@stacksjs/rpx 0.10.0 → 0.11.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/LICENSE.md +21 -0
- package/README.md +12 -12
- package/dist/bin/cli.js +2 -2
- package/dist/chunk-4csm61sj.js +19 -0
- package/dist/chunk-b6654twv.js +24 -0
- package/dist/chunk-pyeywqa0.js +45 -0
- package/dist/chunk-q7w0fwv3.js +1 -0
- package/dist/chunk-s4etpr6b.js +1 -0
- package/dist/chunk-szmp12hh.js +88 -0
- package/dist/config.d.ts +2 -1
- package/dist/dns.d.ts +21 -0
- package/dist/hosts.d.ts +2 -4
- package/dist/https.d.ts +32 -5
- package/dist/index.d.ts +21 -12
- package/dist/logger.d.ts +10 -0
- package/dist/port-manager.d.ts +25 -0
- package/dist/process-manager.d.ts +8 -143
- package/dist/src/index.js +1 -1
- package/dist/start.d.ts +9 -93
- package/dist/types.d.ts +27 -34
- package/dist/utils.d.ts +29 -7
- package/package.json +21 -26
- package/dist/chunk-1j93wxbr.js +0 -45
- package/dist/chunk-1rkjbws7.js +0 -60
- package/dist/chunk-ny83tnrp.js +0 -24
- package/dist/chunk-zxymjc5f.js +0 -45
- /package/dist/{chunk-7am1svx0.js → chunk-4960052z.js} +0 -0
package/dist/chunk-1rkjbws7.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import{G as Kr,H as le,I as ur,M as Ki}from"./chunk-ny83tnrp.js";import{N as Bi,O as Is,P as pn}from"./chunk-7am1svx0.js";var ca=Is((cc,xr)=>{var gr=process||{},sa=gr.argv||[],yr=gr.env||{},As=!(!!yr.NO_COLOR||sa.includes("--no-color"))&&(!!yr.FORCE_COLOR||sa.includes("--color")||gr.platform==="win32"||(gr.stdout||{}).isTTY&&yr.TERM!=="dumb"||!!yr.CI),Bs=(r,S,t=r)=>(e)=>{let a=""+e,y=a.indexOf(S,r.length);return~y?r+bs(a,S,t,y)+S:r+a+S},bs=(r,S,t,e)=>{let a="",y=0;do a+=r.substring(y,e)+t,y=e+S.length,e=r.indexOf(S,y);while(~e);return a+r.substring(y)},oa=(r=As)=>{let S=r?Bs:()=>String;return{isColorSupported:r,reset:S("\x1B[0m","\x1B[0m"),bold:S("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:S("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:S("\x1B[3m","\x1B[23m"),underline:S("\x1B[4m","\x1B[24m"),inverse:S("\x1B[7m","\x1B[27m"),hidden:S("\x1B[8m","\x1B[28m"),strikethrough:S("\x1B[9m","\x1B[29m"),black:S("\x1B[30m","\x1B[39m"),red:S("\x1B[31m","\x1B[39m"),green:S("\x1B[32m","\x1B[39m"),yellow:S("\x1B[33m","\x1B[39m"),blue:S("\x1B[34m","\x1B[39m"),magenta:S("\x1B[35m","\x1B[39m"),cyan:S("\x1B[36m","\x1B[39m"),white:S("\x1B[37m","\x1B[39m"),gray:S("\x1B[90m","\x1B[39m"),bgBlack:S("\x1B[40m","\x1B[49m"),bgRed:S("\x1B[41m","\x1B[49m"),bgGreen:S("\x1B[42m","\x1B[49m"),bgYellow:S("\x1B[43m","\x1B[49m"),bgBlue:S("\x1B[44m","\x1B[49m"),bgMagenta:S("\x1B[45m","\x1B[49m"),bgCyan:S("\x1B[46m","\x1B[49m"),bgWhite:S("\x1B[47m","\x1B[49m"),blackBright:S("\x1B[90m","\x1B[39m"),redBright:S("\x1B[91m","\x1B[39m"),greenBright:S("\x1B[92m","\x1B[39m"),yellowBright:S("\x1B[93m","\x1B[39m"),blueBright:S("\x1B[94m","\x1B[39m"),magentaBright:S("\x1B[95m","\x1B[39m"),cyanBright:S("\x1B[96m","\x1B[39m"),whiteBright:S("\x1B[97m","\x1B[39m"),bgBlackBright:S("\x1B[100m","\x1B[49m"),bgRedBright:S("\x1B[101m","\x1B[49m"),bgGreenBright:S("\x1B[102m","\x1B[49m"),bgYellowBright:S("\x1B[103m","\x1B[49m"),bgBlueBright:S("\x1B[104m","\x1B[49m"),bgMagentaBright:S("\x1B[105m","\x1B[49m"),bgCyanBright:S("\x1B[106m","\x1B[49m"),bgWhiteBright:S("\x1B[107m","\x1B[49m")}};xr.exports=oa();xr.exports.createColors=oa});var ti="0.10.0";import{homedir as Sr}from"node:os";import{join as Tr,resolve as Qa}from"node:path";var{create:La,defineProperty:ai,getOwnPropertyDescriptor:Va,getOwnPropertyNames:Ka,getPrototypeOf:Pa}=Object,Ma=Object.prototype.hasOwnProperty,Oa=(r,S)=>()=>(S||r((S={exports:{}}).exports,S),S.exports),Fa=(r,S,t,e)=>{if(S&&typeof S=="object"||typeof S=="function")for(let a of Ka(S))!Ma.call(r,a)&&a!==t&&ai(r,a,{get:()=>S[a],enumerable:!(e=Va(S,a))||e.enumerable});return r},Ga=(r,S,t)=>(t=r!=null?La(Pa(r)):{},Fa(S||!r||!r.__esModule?ai(t,"default",{value:r,enumerable:!0}):t,r)),qa=Oa((r,S)=>{function t(l){if(typeof l!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(l))}function e(l,p){for(var c="",i=0,v=-1,f=0,B,_=0;_<=l.length;++_){if(_<l.length)B=l.charCodeAt(_);else{if(B===47)break;B=47}if(B===47){if(!(v===_-1||f===1))if(v!==_-1&&f===2){if(c.length<2||i!==2||c.charCodeAt(c.length-1)!==46||c.charCodeAt(c.length-2)!==46){if(c.length>2){var I=c.lastIndexOf("/");if(I!==c.length-1){I===-1?(c="",i=0):(c=c.slice(0,I),i=c.length-1-c.lastIndexOf("/")),v=_,f=0;continue}}else if(c.length===2||c.length===1){c="",i=0,v=_,f=0;continue}}p&&(c.length>0?c+="/..":c="..",i=2)}else c.length>0?c+="/"+l.slice(v+1,_):c=l.slice(v+1,_),i=_-v-1;v=_,f=0}else B===46&&f!==-1?++f:f=-1}return c}function a(l,p){var c=p.dir||p.root,i=p.base||(p.name||"")+(p.ext||"");return c?c===p.root?c+i:c+l+i:i}var y={resolve:function(){for(var l="",p=!1,c,i=arguments.length-1;i>=-1&&!p;i--){var v;i>=0?v=arguments[i]:(c===void 0&&(c=process.cwd()),v=c),t(v),v.length!==0&&(l=v+"/"+l,p=v.charCodeAt(0)===47)}return l=e(l,!p),p?l.length>0?"/"+l:"/":l.length>0?l:"."},normalize:function(l){if(t(l),l.length===0)return".";var p=l.charCodeAt(0)===47,c=l.charCodeAt(l.length-1)===47;return l=e(l,!p),l.length===0&&!p&&(l="."),l.length>0&&c&&(l+="/"),p?"/"+l:l},isAbsolute:function(l){return t(l),l.length>0&&l.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var l,p=0;p<arguments.length;++p){var c=arguments[p];t(c),c.length>0&&(l===void 0?l=c:l+="/"+c)}return l===void 0?".":y.normalize(l)},relative:function(l,p){if(t(l),t(p),l===p||(l=y.resolve(l),p=y.resolve(p),l===p))return"";for(var c=1;c<l.length&&l.charCodeAt(c)===47;++c);for(var i=l.length,v=i-c,f=1;f<p.length&&p.charCodeAt(f)===47;++f);for(var B=p.length,_=B-f,I=v<_?v:_,h=-1,C=0;C<=I;++C){if(C===I){if(_>I){if(p.charCodeAt(f+C)===47)return p.slice(f+C+1);if(C===0)return p.slice(f+C)}else v>I&&(l.charCodeAt(c+C)===47?h=C:C===0&&(h=0));break}var A=l.charCodeAt(c+C),T=p.charCodeAt(f+C);if(A!==T)break;A===47&&(h=C)}var s="";for(C=c+h+1;C<=i;++C)(C===i||l.charCodeAt(C)===47)&&(s.length===0?s+="..":s+="/..");return s.length>0?s+p.slice(f+h):(f+=h,p.charCodeAt(f)===47&&++f,p.slice(f))},_makeLong:function(l){return l},dirname:function(l){if(t(l),l.length===0)return".";for(var p=l.charCodeAt(0),c=p===47,i=-1,v=!0,f=l.length-1;f>=1;--f)if(p=l.charCodeAt(f),p===47){if(!v){i=f;break}}else v=!1;return i===-1?c?"/":".":c&&i===1?"//":l.slice(0,i)},basename:function(l,p){if(p!==void 0&&typeof p!="string")throw new TypeError('"ext" argument must be a string');t(l);var c=0,i=-1,v=!0,f;if(p!==void 0&&p.length>0&&p.length<=l.length){if(p.length===l.length&&p===l)return"";var B=p.length-1,_=-1;for(f=l.length-1;f>=0;--f){var I=l.charCodeAt(f);if(I===47){if(!v){c=f+1;break}}else _===-1&&(v=!1,_=f+1),B>=0&&(I===p.charCodeAt(B)?--B===-1&&(i=f):(B=-1,i=_))}return c===i?i=_:i===-1&&(i=l.length),l.slice(c,i)}else{for(f=l.length-1;f>=0;--f)if(l.charCodeAt(f)===47){if(!v){c=f+1;break}}else i===-1&&(v=!1,i=f+1);return i===-1?"":l.slice(c,i)}},extname:function(l){t(l);for(var p=-1,c=0,i=-1,v=!0,f=0,B=l.length-1;B>=0;--B){var _=l.charCodeAt(B);if(_===47){if(!v){c=B+1;break}continue}i===-1&&(v=!1,i=B+1),_===46?p===-1?p=B:f!==1&&(f=1):p!==-1&&(f=-1)}return p===-1||i===-1||f===0||f===1&&p===i-1&&p===c+1?"":l.slice(p,i)},format:function(l){if(l===null||typeof l!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof l);return a("/",l)},parse:function(l){t(l);var p={root:"",dir:"",base:"",ext:"",name:""};if(l.length===0)return p;var c=l.charCodeAt(0),i=c===47,v;i?(p.root="/",v=1):v=0;for(var f=-1,B=0,_=-1,I=!0,h=l.length-1,C=0;h>=v;--h){if(c=l.charCodeAt(h),c===47){if(!I){B=h+1;break}continue}_===-1&&(I=!1,_=h+1),c===46?f===-1?f=h:C!==1&&(C=1):f!==-1&&(C=-1)}return f===-1||_===-1||C===0||C===1&&f===_-1&&f===B+1?_!==-1&&(B===0&&i?p.base=p.name=l.slice(1,_):p.base=p.name=l.slice(B,_)):(B===0&&i?(p.name=l.slice(1,f),p.base=l.slice(1,_)):(p.name=l.slice(B,f),p.base=l.slice(B,_)),p.ext=l.slice(f,_)),B>0?p.dir=l.slice(0,B-1):i&&(p.dir="/"),p},sep:"/",delimiter:":",win32:null,posix:null};y.posix=y,S.exports=y}),ni=Ga(qa()),Re=ni,Ha=ni,ri=function(r){return r},si=function(){throw new Error("Not implemented")};Re.parse??=si;Ha.parse??=si;var Mt={resolve:Re.resolve.bind(Re),normalize:Re.normalize.bind(Re),isAbsolute:Re.isAbsolute.bind(Re),join:Re.join.bind(Re),relative:Re.relative.bind(Re),toNamespacedPath:ri,dirname:Re.dirname.bind(Re),basename:Re.basename.bind(Re),extname:Re.extname.bind(Re),format:Re.format.bind(Re),parse:Re.parse.bind(Re),sep:"/",delimiter:":",win32:void 0,posix:void 0,_makeLong:ri},ii={sep:"\\",delimiter:";",win32:void 0,...Mt,posix:Mt};Mt.win32=ii.win32=ii;Mt.posix=Mt;var{resolve:ja,normalize:Ds,isAbsolute:Us,join:Ls,relative:Vs,toNamespacedPath:Ks,dirname:Ps,basename:Ms,extname:Os,format:Fs,parse:Gs,sep:qs,delimiter:Hs}=Mt;function rr(r,S){if(Array.isArray(S)&&!Array.isArray(r))return S;if(Array.isArray(S)&&Array.isArray(r))return S.map((e,a)=>{let y=r[a];if(Pt(e)&&Pt(y))return rr(y,e);return e});if(!Pt(S)||!Pt(r))return S;let t={...r};for(let e in S)if(Object.prototype.hasOwnProperty.call(S,e)){let a=S[e],y=t[e];if(a===null||a===void 0)t[e]=a;else if(Pt(a)&&Pt(y))t[e]=rr(y,a);else t[e]=a}return t}function Pt(r){return Boolean(r&&typeof r==="object"&&!Array.isArray(r))}async function oi({name:r,cwd:S,defaultConfig:t,endpoint:e,headers:a={Accept:"application/json","Content-Type":"application/json"}}){if(typeof window==="undefined"){let y=ja(S||"../../../",`${r}.config`);try{let l=await import(y),p=l.default||l;return rr(t,p)}catch(l){return t}}if(!e)return console.warn("An API endpoint is required to load the client config."),t;try{let y=await fetch(e,{method:"GET",headers:a});if(!y.ok)throw new Error(`HTTP error! status: ${y.status}`);let l=await y.json();return rr(t,l)}catch(y){return console.error("Failed to load client config:",y),t}}var __dirname="/home/runner/work/rpx/rpx/src",za={from:"localhost:5173",to:"stacks.localhost",cleanUrls:!1,https:{basePath:"",caCertPath:Tr(Sr(),".stacks","ssl","stacks.localhost.ca.crt"),certPath:Tr(Sr(),".stacks","ssl","stacks.localhost.crt"),keyPath:Tr(Sr(),".stacks","ssl","stacks.localhost.crt.key")},cleanup:{certs:!1,hosts:!1},vitePluginUsage:!1,verbose:!0},jt=await oi({name:"rpx",cwd:Qa(__dirname,".."),defaultConfig:za});import*as ci from"node:fs/promises";function Y(r,S,t){if(t)console.debug(`[rpx:${r}] ${S}`)}function Ws(r){if(Qt(r))return r.proxies.map((S)=>{let t=S.to||"stacks.localhost";return t.startsWith("http")?new URL(t).hostname:t});if(ar(r)){let S=r.to||"stacks.localhost";return[S.startsWith("http")?new URL(S).hostname:S]}return["stacks.localhost"]}function ui(r){return typeof r==="object"&&r!==null&&"certificate"in r&&"privateKey"in r&&typeof r.certificate==="string"&&typeof r.privateKey==="string"}function ir(r){if(!r)return"stacks.localhost";if(Qt(r)&&r.proxies.length>0)return r.proxies[0].to||"stacks.localhost";if(ar(r))return r.to||"stacks.localhost";return"stacks.localhost"}function li(r){return!!(r&&("proxies"in r)&&Array.isArray(r.proxies))}function Qt(r){return"proxies"in r&&Array.isArray(r.proxies)}function ar(r){return"to"in r&&typeof r.to==="string"}function Zs(r){return!!(r&&("to"in r)&&!("proxies"in r))}async function fi(r,S){try{await ci.unlink(r),Y("certificates",`Successfully deleted: ${r}`,S)}catch(t){if(t.code!=="ENOENT")Y("certificates",`Warning: Could not delete ${r}: ${t}`,S)}}import{exec as xn}from"node:child_process";import _t from"node:fs";import ki from"node:os";import Dr from"node:path";import Yt from"node:process";import{promisify as Jn}from"node:util";var et={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},br={silent:{level:-1},fatal:{level:et.fatal},error:{level:et.error},warn:{level:et.warn},log:{level:et.log},info:{level:et.info},success:{level:et.success},fail:{level:et.fail},ready:{level:et.info},start:{level:et.info},box:{level:et.info},debug:{level:et.debug},trace:{level:et.trace},verbose:{level:et.verbose}};function Ir(r){if(r===null||typeof r!=="object")return!1;let S=Object.getPrototypeOf(r);if(S!==null&&S!==Object.prototype&&Object.getPrototypeOf(S)!==null)return!1;if(Symbol.iterator in r)return!1;if(Symbol.toStringTag in r)return Object.prototype.toString.call(r)==="[object Module]";return!0}function Nr(r,S,t=".",e){if(!Ir(S))return Nr(r,{},t,e);let a=Object.assign({},S);for(let y in r){if(y==="__proto__"||y==="constructor")continue;let l=r[y];if(l===null||l===void 0)continue;if(e&&e(a,y,l,t))continue;if(Array.isArray(l)&&Array.isArray(a[y]))a[y]=[...l,...a[y]];else if(Ir(l)&&Ir(a[y]))a[y]=Nr(l,a[y],(t?`${t}.`:"")+y.toString(),e);else a[y]=l}return a}function Ya(r){return(...S)=>S.reduce((t,e)=>Nr(t,e,"",r),{})}var Xa=Ya();function Wa(r){return Object.prototype.toString.call(r)==="[object Object]"}function Za(r){if(!Wa(r))return!1;if(!r.message&&!r.args)return!1;if(r.stack)return!1;return!0}var Ar=!1,hi=[];class Ze{options;_lastLog;_mockFn;constructor(r={}){let S=r.types||br;this.options=Xa({...r,defaults:{...r.defaults},level:Br(r.level,S),reporters:[...r.reporters||[]]},{types:br,throttle:1000,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let t in S){let e={type:t,...this.options.defaults,...S[t]};this[t]=this._wrapLogFn(e),this[t].raw=this._wrapLogFn(e,!0)}if(this.options.mockFn)this.mockTypes();this._lastLog={}}get level(){return this.options.level}set level(r){this.options.level=Br(r,this.options.types,this.options.level)}prompt(r,S){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(r,S)}create(r){let S=new Ze({...this.options,...r});if(this._mockFn)S.mockTypes(this._mockFn);return S}withDefaults(r){return this.create({...this.options,defaults:{...this.options.defaults,...r}})}withTag(r){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+r:r})}addReporter(r){return this.options.reporters.push(r),this}removeReporter(r){if(r){let S=this.options.reporters.indexOf(r);if(S!==-1)return this.options.reporters.splice(S,1)}else this.options.reporters.splice(0);return this}setReporters(r){return this.options.reporters=Array.isArray(r)?r:[r],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let r in this.options.types){if(!console["__"+r])console["__"+r]=console[r];console[r]=this[r].raw}}restoreConsole(){for(let r in this.options.types)if(console["__"+r])console[r]=console["__"+r],delete console["__"+r]}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(r,S){if(!r)return;if(!r.__write)r.__write=r.write;r.write=(t)=>{this[S].raw(String(t).trim())}}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(r){if(!r)return;if(r.__write)r.write=r.__write,delete r.__write}pauseLogs(){Ar=!0}resumeLogs(){Ar=!1;let r=hi.splice(0);for(let S of r)S[0]._logFn(S[1],S[2])}mockTypes(r){let S=r||this.options.mockFn;if(this._mockFn=S,typeof S!=="function")return;for(let t in this.options.types)this[t]=S(t,this.options.types[t])||this[t],this[t].raw=this[t]}_wrapLogFn(r,S){return(...t)=>{if(Ar){hi.push([this,r,t,S]);return}return this._logFn(r,t,S)}}_logFn(r,S,t){if((r.level||0)>this.level)return!1;let e={date:new Date,args:[],...r,level:Br(r.level,this.options.types)};if(!t&&S.length===1&&Za(S[0]))Object.assign(e,S[0]);else e.args=[...S];if(e.message)e.args.unshift(e.message),delete e.message;if(e.additional){if(!Array.isArray(e.additional))e.additional=e.additional.split(`
|
|
2
|
-
`);e.args.push(`
|
|
3
|
-
`+e.additional.join(`
|
|
4
|
-
`)),delete e.additional}e.type=typeof e.type==="string"?e.type.toLowerCase():"log",e.tag=typeof e.tag==="string"?e.tag:"";let a=(l=!1)=>{let p=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&p>0){let c=[...this._lastLog.object.args];if(p>1)c.push(`(repeated ${p} times)`);this._log({...this._lastLog.object,args:c}),this._lastLog.count=1}if(l)this._lastLog.object=e,this._log(e)};clearTimeout(this._lastLog.timeout);let y=this._lastLog.time&&e.date?e.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=e.date,y<this.options.throttle)try{let l=JSON.stringify([e.type,e.tag,e.args]),p=this._lastLog.serialized===l;if(this._lastLog.serialized=l,p){if(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin){this._lastLog.timeout=setTimeout(a,this.options.throttle);return}}}catch{}a(!0)}_log(r){for(let S of this.options.reporters)S.log(r,{options:this.options})}}function Br(r,S={},t=3){if(r===void 0)return t;if(typeof r==="number")return r;if(S[r]&&S[r].level!==void 0)return S[r].level;return t}Ze.prototype.add=Ze.prototype.addReporter;Ze.prototype.remove=Ze.prototype.removeReporter;Ze.prototype.clear=Ze.prototype.removeReporter;Ze.prototype.withScope=Ze.prototype.withTag;Ze.prototype.mock=Ze.prototype.mockTypes;Ze.prototype.pause=Ze.prototype.pauseLogs;Ze.prototype.resume=Ze.prototype.resumeLogs;function pi(r={}){return new Ze(r)}import{formatWithOptions as di}from"node:util";import{sep as $a}from"node:path";function kr(r){let S=process.cwd()+$a;return r.split(`
|
|
5
|
-
`).splice(1).map((e)=>e.trim().replace("file://","").replace(S,""))}function xa(r,S){return(S.__write||S.write).call(S,r)}var wr=(r)=>r?`[${r}]`:"";class nr{formatStack(r,S){let t=" ".repeat((S?.errorLevel||0)+1);return t+kr(r).join(`
|
|
6
|
-
${t}`)}formatError(r,S){let t=r.message??di(S,r),e=r.stack?this.formatStack(r.stack,S):"",a=S?.errorLevel||0,y=a>0?`${" ".repeat(a)}[cause]: `:"",l=r.cause?`
|
|
7
|
-
|
|
8
|
-
`+this.formatError(r.cause,{...S,errorLevel:a+1}):"";return y+t+`
|
|
9
|
-
`+e+l}formatArgs(r,S){let t=r.map((e)=>{if(e&&typeof e.stack==="string")return this.formatError(e,S);return e});return di(S,...t)}formatDate(r,S){return S.date?r.toLocaleTimeString():""}filterAndJoin(r){return r.filter(Boolean).join(" ")}formatLogObj(r,S){let t=this.formatArgs(r.args,S);if(r.type==="box")return`
|
|
10
|
-
`+[wr(r.tag),r.title&&r.title,...t.split(`
|
|
11
|
-
`)].filter(Boolean).map((e)=>" > "+e).join(`
|
|
12
|
-
`)+`
|
|
13
|
-
`;return this.filterAndJoin([wr(r.type),wr(r.tag),t])}log(r,S){let t=this.formatLogObj(r,{columns:S.options.stdout.columns||0,...S.options.formatOptions});return xa(t+`
|
|
14
|
-
`,r.level<2?S.options.stderr||process.stderr:S.options.stdout||process.stdout)}}import Si from"node:process";import*as sr from"node:tty";var{env:At={},argv:vi=[],platform:Ja=""}=typeof process==="undefined"?{}:process,en="NO_COLOR"in At||vi.includes("--no-color"),tn="FORCE_COLOR"in At||vi.includes("--color"),rn=Ja==="win32",mi=At.TERM==="dumb",an=sr&&sr.isatty&&sr.isatty(1)&&At.TERM&&!mi,nn="CI"in At&&(("GITHUB_ACTIONS"in At)||("GITLAB_CI"in At)||("CIRCLECI"in At)),sn=!en&&(tn||rn&&!mi||an||nn);function Ci(r,S,t,e,a=S.slice(0,Math.max(0,r))+e,y=S.slice(Math.max(0,r+t.length)),l=y.indexOf(t)){return a+(l<0?y:Ci(l,y,t,e))}function on(r,S,t,e,a){return r<0?t+S+e:t+Ci(r,S,e,a)+e}function cn(r,S,t=r,e=r.length+1){return(a)=>a||!(a===""||a===void 0)?on((""+a).indexOf(S,e),a,r,S,t):""}function pe(r,S,t){return cn(`\x1B[${r}m`,`\x1B[${S}m`,t)}var yi={reset:pe(0,0),bold:pe(1,22,"\x1B[22m\x1B[1m"),dim:pe(2,22,"\x1B[22m\x1B[2m"),italic:pe(3,23),underline:pe(4,24),inverse:pe(7,27),hidden:pe(8,28),strikethrough:pe(9,29),black:pe(30,39),red:pe(31,39),green:pe(32,39),yellow:pe(33,39),blue:pe(34,39),magenta:pe(35,39),cyan:pe(36,39),white:pe(37,39),gray:pe(90,39),bgBlack:pe(40,49),bgRed:pe(41,49),bgGreen:pe(42,49),bgYellow:pe(43,49),bgBlue:pe(44,49),bgMagenta:pe(45,49),bgCyan:pe(46,49),bgWhite:pe(47,49),blackBright:pe(90,39),redBright:pe(91,39),greenBright:pe(92,39),yellowBright:pe(93,39),blueBright:pe(94,39),magentaBright:pe(95,39),cyanBright:pe(96,39),whiteBright:pe(97,39),bgBlackBright:pe(100,49),bgRedBright:pe(101,49),bgGreenBright:pe(102,49),bgYellowBright:pe(103,49),bgBlueBright:pe(104,49),bgMagentaBright:pe(105,49),bgCyanBright:pe(106,49),bgWhiteBright:pe(107,49)};function un(r=sn){return r?yi:Object.fromEntries(Object.keys(yi).map((S)=>[S,String]))}var it=un();function ln(r,S="reset"){return it[r]||it[S]}var fn=[String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");function kt(r){return r.replace(new RegExp(fn,"g"),"")}var gi={solid:{tl:"┌",tr:"┐",bl:"└",br:"┘",h:"─",v:"│"},double:{tl:"╔",tr:"╗",bl:"╚",br:"╝",h:"═",v:"║"},doubleSingle:{tl:"╓",tr:"╖",bl:"╙",br:"╜",h:"─",v:"║"},doubleSingleRounded:{tl:"╭",tr:"╮",bl:"╰",br:"╯",h:"─",v:"║"},singleThick:{tl:"┏",tr:"┓",bl:"┗",br:"┛",h:"━",v:"┃"},singleDouble:{tl:"╒",tr:"╕",bl:"╘",br:"╛",h:"═",v:"│"},singleDoubleRounded:{tl:"╭",tr:"╮",bl:"╰",br:"╯",h:"═",v:"│"},rounded:{tl:"╭",tr:"╮",bl:"╰",br:"╯",h:"─",v:"│"}},hn={borderColor:"white",borderStyle:"rounded",valign:"center",padding:2,marginLeft:1,marginTop:1,marginBottom:1};function Ei(r,S={}){let t={...S,style:{...hn,...S.style}},e=r.split(`
|
|
15
|
-
`),a=[],y=ln(t.style.borderColor),l={...typeof t.style.borderStyle==="string"?gi[t.style.borderStyle]||gi.solid:t.style.borderStyle};if(y)for(let _ in l)l[_]=y(l[_]);let p=t.style.padding%2===0?t.style.padding:t.style.padding+1,c=e.length+p,i=Math.max(...e.map((_)=>kt(_).length))+p,v=i+p,f=t.style.marginLeft>0?" ".repeat(t.style.marginLeft):"";if(t.style.marginTop>0)a.push("".repeat(t.style.marginTop));if(t.title){let _=y?y(t.title):t.title,I=l.h.repeat(Math.floor((i-kt(t.title).length)/2)),h=l.h.repeat(i-kt(t.title).length-kt(I).length+p);a.push(`${f}${l.tl}${I}${_}${h}${l.tr}`)}else a.push(`${f}${l.tl}${l.h.repeat(v)}${l.tr}`);let B=t.style.valign==="center"?Math.floor((c-e.length)/2):t.style.valign==="top"?c-e.length-p:c-e.length;for(let _=0;_<c;_++)if(_<B||_>=B+e.length)a.push(`${f}${l.v}${" ".repeat(v)}${l.v}`);else{let I=e[_-B],h=" ".repeat(p),C=" ".repeat(i-kt(I).length);a.push(`${f}${l.v}${h}${I}${C}${l.v}`)}if(a.push(`${f}${l.bl}${l.h.repeat(v)}${l.br}`),t.style.marginBottom>0)a.push("".repeat(t.style.marginBottom));return a.join(`
|
|
16
|
-
`)}var cr=Object.create(null),zt=(r)=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(r?cr:globalThis),Bt=new Proxy(cr,{get(r,S){return zt()[S]??cr[S]},has(r,S){let t=zt();return S in t||S in cr},set(r,S,t){let e=zt(!0);return e[S]=t,!0},deleteProperty(r,S){if(!S)return!1;let t=zt(!0);return delete t[S],!0},ownKeys(){let r=zt(!0);return Object.keys(r)}}),dn=typeof process<"u"&&process.env&&"development"||"",yn=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function gn(){if(globalThis.process?.env)for(let r of yn){let S=r[1]||r[0];if(globalThis.process?.env[S])return{name:r[0].toLowerCase(),...r[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}var bi=gn();bi.name;function Rt(r){return r?r!=="false":!1}var vn=globalThis.process?.platform||"",Rr=Rt(Bt.CI)||bi.ci!==!1,Ni=Rt(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),mn=Rt(Bt.DEBUG),_r=dn==="test"||Rt(Bt.TEST);Rt(Bt.MINIMAL);var Cn=/^win/i.test(vn);!Rt(Bt.NO_COLOR)&&(Rt(Bt.FORCE_COLOR)||(Ni||Cn)&&Bt.TERM);var En=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null;Number(En?.split(".")[0]);var Sn=globalThis.process||Object.create(null),Ti={versions:{}};new Proxy(Sn,{get(r,S){if(S==="env")return Bt;if(S in r)return r[S];if(S in Ti)return Ti[S]}});var Tn=globalThis.process?.release?.name==="node",In=!!globalThis.Bun||!!globalThis.process?.versions?.bun,An=!!globalThis.Deno,Bn=!!globalThis.fastly,bn=!!globalThis.Netlify,Nn=!!globalThis.EdgeRuntime,wn=globalThis.navigator?.userAgent==="Cloudflare-Workers",kn=[[bn,"netlify"],[Nn,"edge-light"],[wn,"workerd"],[Bn,"fastly"],[An,"deno"],[In,"bun"],[Tn,"node"]];function Rn(){let r=kn.find((S)=>S[0]);if(r)return{name:r[1]}}var _n=Rn();_n?.name;function Dn({onlyFirst:r=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,r?void 0:"g")}var Un=Dn();function Ln(r){if(typeof r!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return r.replace(Un,"")}function Vn(r){return r===161||r===164||r===167||r===168||r===170||r===173||r===174||r>=176&&r<=180||r>=182&&r<=186||r>=188&&r<=191||r===198||r===208||r===215||r===216||r>=222&&r<=225||r===230||r>=232&&r<=234||r===236||r===237||r===240||r===242||r===243||r>=247&&r<=250||r===252||r===254||r===257||r===273||r===275||r===283||r===294||r===295||r===299||r>=305&&r<=307||r===312||r>=319&&r<=322||r===324||r>=328&&r<=331||r===333||r===338||r===339||r===358||r===359||r===363||r===462||r===464||r===466||r===468||r===470||r===472||r===474||r===476||r===593||r===609||r===708||r===711||r>=713&&r<=715||r===717||r===720||r>=728&&r<=731||r===733||r===735||r>=768&&r<=879||r>=913&&r<=929||r>=931&&r<=937||r>=945&&r<=961||r>=963&&r<=969||r===1025||r>=1040&&r<=1103||r===1105||r===8208||r>=8211&&r<=8214||r===8216||r===8217||r===8220||r===8221||r>=8224&&r<=8226||r>=8228&&r<=8231||r===8240||r===8242||r===8243||r===8245||r===8251||r===8254||r===8308||r===8319||r>=8321&&r<=8324||r===8364||r===8451||r===8453||r===8457||r===8467||r===8470||r===8481||r===8482||r===8486||r===8491||r===8531||r===8532||r>=8539&&r<=8542||r>=8544&&r<=8555||r>=8560&&r<=8569||r===8585||r>=8592&&r<=8601||r===8632||r===8633||r===8658||r===8660||r===8679||r===8704||r===8706||r===8707||r===8711||r===8712||r===8715||r===8719||r===8721||r===8725||r===8730||r>=8733&&r<=8736||r===8739||r===8741||r>=8743&&r<=8748||r===8750||r>=8756&&r<=8759||r===8764||r===8765||r===8776||r===8780||r===8786||r===8800||r===8801||r>=8804&&r<=8807||r===8810||r===8811||r===8814||r===8815||r===8834||r===8835||r===8838||r===8839||r===8853||r===8857||r===8869||r===8895||r===8978||r>=9312&&r<=9449||r>=9451&&r<=9547||r>=9552&&r<=9587||r>=9600&&r<=9615||r>=9618&&r<=9621||r===9632||r===9633||r>=9635&&r<=9641||r===9650||r===9651||r===9654||r===9655||r===9660||r===9661||r===9664||r===9665||r>=9670&&r<=9672||r===9675||r>=9678&&r<=9681||r>=9698&&r<=9701||r===9711||r===9733||r===9734||r===9737||r===9742||r===9743||r===9756||r===9758||r===9792||r===9794||r===9824||r===9825||r>=9827&&r<=9829||r>=9831&&r<=9834||r===9836||r===9837||r===9839||r===9886||r===9887||r===9919||r>=9926&&r<=9933||r>=9935&&r<=9939||r>=9941&&r<=9953||r===9955||r===9960||r===9961||r>=9963&&r<=9969||r===9972||r>=9974&&r<=9977||r===9979||r===9980||r===9982||r===9983||r===10045||r>=10102&&r<=10111||r>=11094&&r<=11097||r>=12872&&r<=12879||r>=57344&&r<=63743||r>=65024&&r<=65039||r===65533||r>=127232&&r<=127242||r>=127248&&r<=127277||r>=127280&&r<=127337||r>=127344&&r<=127373||r===127375||r===127376||r>=127387&&r<=127404||r>=917760&&r<=917999||r>=983040&&r<=1048573||r>=1048576&&r<=1114109}function Kn(r){return r===12288||r>=65281&&r<=65376||r>=65504&&r<=65510}function Pn(r){return r>=4352&&r<=4447||r===8986||r===8987||r===9001||r===9002||r>=9193&&r<=9196||r===9200||r===9203||r===9725||r===9726||r===9748||r===9749||r>=9776&&r<=9783||r>=9800&&r<=9811||r===9855||r>=9866&&r<=9871||r===9875||r===9889||r===9898||r===9899||r===9917||r===9918||r===9924||r===9925||r===9934||r===9940||r===9962||r===9970||r===9971||r===9973||r===9978||r===9981||r===9989||r===9994||r===9995||r===10024||r===10060||r===10062||r>=10067&&r<=10069||r===10071||r>=10133&&r<=10135||r===10160||r===10175||r===11035||r===11036||r===11088||r===11093||r>=11904&&r<=11929||r>=11931&&r<=12019||r>=12032&&r<=12245||r>=12272&&r<=12287||r>=12289&&r<=12350||r>=12353&&r<=12438||r>=12441&&r<=12543||r>=12549&&r<=12591||r>=12593&&r<=12686||r>=12688&&r<=12773||r>=12783&&r<=12830||r>=12832&&r<=12871||r>=12880&&r<=42124||r>=42128&&r<=42182||r>=43360&&r<=43388||r>=44032&&r<=55203||r>=63744&&r<=64255||r>=65040&&r<=65049||r>=65072&&r<=65106||r>=65108&&r<=65126||r>=65128&&r<=65131||r>=94176&&r<=94180||r===94192||r===94193||r>=94208&&r<=100343||r>=100352&&r<=101589||r>=101631&&r<=101640||r>=110576&&r<=110579||r>=110581&&r<=110587||r===110589||r===110590||r>=110592&&r<=110882||r===110898||r>=110928&&r<=110930||r===110933||r>=110948&&r<=110951||r>=110960&&r<=111355||r>=119552&&r<=119638||r>=119648&&r<=119670||r===126980||r===127183||r===127374||r>=127377&&r<=127386||r>=127488&&r<=127490||r>=127504&&r<=127547||r>=127552&&r<=127560||r===127568||r===127569||r>=127584&&r<=127589||r>=127744&&r<=127776||r>=127789&&r<=127797||r>=127799&&r<=127868||r>=127870&&r<=127891||r>=127904&&r<=127946||r>=127951&&r<=127955||r>=127968&&r<=127984||r===127988||r>=127992&&r<=128062||r===128064||r>=128066&&r<=128252||r>=128255&&r<=128317||r>=128331&&r<=128334||r>=128336&&r<=128359||r===128378||r===128405||r===128406||r===128420||r>=128507&&r<=128591||r>=128640&&r<=128709||r===128716||r>=128720&&r<=128722||r>=128725&&r<=128727||r>=128732&&r<=128735||r===128747||r===128748||r>=128756&&r<=128764||r>=128992&&r<=129003||r===129008||r>=129292&&r<=129338||r>=129340&&r<=129349||r>=129351&&r<=129535||r>=129648&&r<=129660||r>=129664&&r<=129673||r>=129679&&r<=129734||r>=129742&&r<=129756||r>=129759&&r<=129769||r>=129776&&r<=129784||r>=131072&&r<=196605||r>=196608&&r<=262141}function Mn(r){if(!Number.isSafeInteger(r))throw new TypeError(`Expected a code point, got \`${typeof r}\`.`)}function On(r,{ambiguousAsWide:S=!1}={}){if(Mn(r),Kn(r)||Pn(r)||S&&Vn(r))return 2;return 1}var Fn=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g},Gn=globalThis.Intl?.Segmenter?new Intl.Segmenter:{segment:(r)=>r.split("")},qn=/^\p{Default_Ignorable_Code_Point}$/u;function Hn(r,S={}){if(typeof r!=="string"||r.length===0)return 0;let{ambiguousIsNarrow:t=!0,countAnsiEscapeCodes:e=!1}=S;if(!e)r=Ln(r);if(r.length===0)return 0;let a=0,y={ambiguousAsWide:!t};for(let{segment:l}of Gn.segment(r)){let p=l.codePointAt(0);if(p<=31||p>=127&&p<=159)continue;if(p>=8203&&p<=8207||p===65279)continue;if(p>=768&&p<=879||p>=6832&&p<=6911||p>=7616&&p<=7679||p>=8400&&p<=8447||p>=65056&&p<=65071)continue;if(p>=55296&&p<=57343)continue;if(p>=65024&&p<=65039)continue;if(qn.test(l))continue;if(Fn().test(l)){a+=2;continue}a+=On(p,y)}return a}function jn(){let{env:r}=Si,{TERM:S,TERM_PROGRAM:t}=r;if(Si.platform!=="win32")return S!=="linux";return Boolean(r.WT_SESSION)||Boolean(r.TERMINUS_SUBLIME)||r.ConEmuTask==="{cmd::Cmder}"||t==="Terminus-Sublime"||t==="vscode"||S==="xterm-256color"||S==="alacritty"||S==="rxvt-unicode"||S==="rxvt-unicode-256color"||r.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Qn={info:"cyan",fail:"red",success:"green",ready:"green",start:"magenta"},zn={0:"red",1:"yellow"},Yn=jn(),yt=(r,S)=>Yn?r:S,Ii={error:yt("✖","×"),fatal:yt("✖","×"),ready:yt("✔","√"),warn:yt("⚠","‼"),info:yt("ℹ","i"),success:yt("✔","√"),debug:yt("⚙","D"),trace:yt("→","→"),fail:yt("✖","×"),start:yt("◐","o"),log:""};function Ai(r){if(typeof Intl!=="object"||!Intl.Segmenter)return kt(r).length;return Hn(r)}class wi extends nr{formatStack(r,S){let t=" ".repeat((S?.errorLevel||0)+1);return`
|
|
17
|
-
${t}`+kr(r).map((e)=>" "+e.replace(/^at +/,(a)=>it.gray(a)).replace(/\((.+)\)/,(a,y)=>`(${it.cyan(y)})`)).join(`
|
|
18
|
-
${t}`)}formatType(r,S,t){let e=Qn[r.type]||zn[r.level]||"gray";if(S)return Wn(e)(it.black(` ${r.type.toUpperCase()} `));let a=typeof Ii[r.type]==="string"?Ii[r.type]:r.icon||r.type;return a?Xn(e)(a):""}formatLogObj(r,S){let[t,...e]=this.formatArgs(r.args,S).split(`
|
|
19
|
-
`);if(r.type==="box")return Ei(or(t+(e.length>0?`
|
|
20
|
-
`+e.join(`
|
|
21
|
-
`):"")),{title:r.title?or(r.title):void 0,style:r.style});let a=this.formatDate(r.date,S),y=a&&it.gray(a),l=r.badge??r.level<2,p=this.formatType(r,l,S),c=r.tag?it.gray(r.tag):"",i,v=this.filterAndJoin([p,or(t)]),f=this.filterAndJoin(S.columns?[c,y]:[c]),B=(S.columns||0)-Ai(v)-Ai(f)-2;if(i=B>0&&(S.columns||0)>=80?v+" ".repeat(B)+f:(f?`${it.gray(`[${f}]`)} `:"")+v,i+=or(e.length>0?`
|
|
22
|
-
`+e.join(`
|
|
23
|
-
`):""),r.type==="trace"){let _=new Error("Trace: "+r.message);i+=this.formatStack(_.stack||"")}return l?`
|
|
24
|
-
`+i+`
|
|
25
|
-
`:i}}function or(r){return r.replace(/`([^`]+)`/gm,(S,t)=>it.cyan(t)).replace(/\s+_([^_]+)_\s+/gm,(S,t)=>` ${it.underline(t)} `)}function Xn(r="white"){return it[r]||it.white}function Wn(r="bgWhite"){return it[`bg${r[0].toUpperCase()}${r.slice(1)}`]||it.bgWhite}function Zn(r={}){let S=$n();if(process.env.CONSOLA_LEVEL)S=Number.parseInt(process.env.CONSOLA_LEVEL)??S;return pi({level:S,defaults:{level:S},stdout:process.stdout,stderr:process.stderr,prompt:(...e)=>import("./chunk-zxymjc5f.js").then((a)=>a.prompt(...e)),reporters:r.reporters||[r.fancy??!(Rr||_r)?new wi:new nr],...r})}function $n(){if(mn)return et.debug;if(_r)return et.warn;return et.info}var ce=Zn();var es=Jn(xn),bt=Yt.platform==="win32"?Dr.join(Yt.env.windir||"C:\\Windows","System32","drivers","etc","hosts"):"/etc/hosts";async function Ri(r){if(Yt.platform==="win32")throw new Error("Administrator privileges required on Windows");try{await es(`sudo ${r}`)}catch(S){throw new Error(`Failed to execute sudo command: ${S.message}`)}}async function _i(r,S){Y("hosts",`Adding hosts: ${r.join(", ")}`,S),Y("hosts",`Using hosts file at: ${bt}`,S);try{let t=await _t.promises.readFile(bt,"utf-8"),e=r.filter((l)=>{let p=`127.0.0.1 ${l}`,c=`::1 ${l}`;return!t.includes(p)&&!t.includes(c)});if(e.length===0){Y("hosts","All hosts already exist in hosts file",S),ce.info("All hosts are already in the hosts file");return}let a=e.map((l)=>`
|
|
26
|
-
# Added by rpx
|
|
27
|
-
127.0.0.1 ${l}
|
|
28
|
-
::1 ${l}`).join(`
|
|
29
|
-
`),y=Dr.join(ki.tmpdir(),"hosts.tmp");await _t.promises.writeFile(y,t+a,"utf8");try{await Ri(`cp "${y}" "${bt}"`),ce.success(`Added new hosts: ${e.join(", ")}`)}catch(l){if(ce.error("Failed to modify hosts file automatically"),ce.warn("Please add these entries to your hosts file manually:"),a.split(`
|
|
30
|
-
`).forEach((p)=>ce.warn(p)),Yt.platform==="win32")ce.warn(`
|
|
31
|
-
On Windows:`),ce.warn("1. Run notepad as administrator"),ce.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");else ce.warn(`
|
|
32
|
-
On Unix systems:`),ce.warn(`sudo nano ${bt}`);throw new Error("Failed to modify hosts file: manual intervention required")}finally{_t.unlinkSync(y)}}catch(t){let e=t;throw ce.error(`Failed to manage hosts file: ${e.message}`),e}}async function Di(r,S){Y("hosts",`Removing hosts: ${r.join(", ")}`,S);try{let e=(await _t.promises.readFile(bt,"utf-8")).split(`
|
|
33
|
-
`),a=e.filter((p,c)=>{if(p.trim()==="# Added by rpx")return e.splice(c+1,2),!1;return!0});while(a[a.length-1]?.trim()==="")a.pop();let y=`${a.join(`
|
|
34
|
-
`)}
|
|
35
|
-
`,l=Dr.join(ki.tmpdir(),"hosts.tmp");await _t.promises.writeFile(l,y,"utf8");try{await Ri(`cp "${l}" "${bt}"`),ce.success("Hosts removed successfully")}catch(p){if(ce.error("Failed to modify hosts file automatically"),ce.warn("Please remove these entries from your hosts file manually:"),r.forEach((c)=>{ce.warn("# Added by rpx"),ce.warn(`127.0.0.1 ${c}`),ce.warn(`::1 ${c}`)}),Yt.platform==="win32")ce.warn(`
|
|
36
|
-
On Windows:`),ce.warn("1. Run notepad as administrator"),ce.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");else ce.warn(`
|
|
37
|
-
On Unix systems:`),ce.warn(`sudo nano ${bt}`);throw new Error("Failed to modify hosts file: manual intervention required")}finally{_t.unlinkSync(l)}}catch(t){let e=t;throw ce.error(`Failed to remove hosts: ${e.message}`),e}}async function Ui(r,S){Y("hosts",`Checking hosts: ${r}`,S);let t=await _t.promises.readFile(bt,"utf-8");return r.map((e)=>{let a=`127.0.0.1 ${e}`,y=`::1 ${e}`;return t.includes(a)||t.includes(y)})}import $t from"node:fs/promises";import{homedir as Ss}from"node:os";import{join as Lt}from"node:path";import Ur from"node:os";import Lr from"node:path";import{resolve as fs}from"path";import hs from"process";import{exec as ds}from"node:child_process";import Li from"node:fs";import ys from"node:path";import gs from"node:process";import{promisify as vs}from"node:util";import Et from"node:fs";import Vi from"node:os";import Ft from"node:path";var de=le((r,S)=>{S.exports={options:{usePureJavaScript:!1}}}),ts=le((r,S)=>{var t={};S.exports=t;var e={};t.encode=function(y,l,p){if(typeof l!=="string")throw new TypeError('"alphabet" must be a string.');if(p!==void 0&&typeof p!=="number")throw new TypeError('"maxline" must be a number.');var c="";if(!(y instanceof Uint8Array))c=a(y,l);else{var i=0,v=l.length,f=l.charAt(0),B=[0];for(i=0;i<y.length;++i){for(var _=0,I=y[i];_<B.length;++_)I+=B[_]<<8,B[_]=I%v,I=I/v|0;while(I>0)B.push(I%v),I=I/v|0}for(i=0;y[i]===0&&i<y.length-1;++i)c+=f;for(i=B.length-1;i>=0;--i)c+=l[B[i]]}if(p){var h=new RegExp(".{1,"+p+"}","g");c=c.match(h).join(`\r
|
|
38
|
-
`)}return c},t.decode=function(y,l){if(typeof y!=="string")throw new TypeError('"input" must be a string.');if(typeof l!=="string")throw new TypeError('"alphabet" must be a string.');var p=e[l];if(!p){p=e[l]=[];for(var c=0;c<l.length;++c)p[l.charCodeAt(c)]=c}y=y.replace(/\s/g,"");var i=l.length,v=l.charAt(0),f=[0];for(var c=0;c<y.length;c++){var B=p[y.charCodeAt(c)];if(B===void 0)return;for(var _=0,I=B;_<f.length;++_)I+=f[_]*i,f[_]=I&255,I>>=8;while(I>0)f.push(I&255),I>>=8}for(var h=0;y[h]===v&&h<y.length-1;++h)f.push(0);if(typeof Buffer!=="undefined")return Buffer.from(f.reverse());return new Uint8Array(f.reverse())};function a(y,l){var p=0,c=l.length,i=l.charAt(0),v=[0];for(p=0;p<y.length();++p){for(var f=0,B=y.at(p);f<v.length;++f)B+=v[f]<<8,v[f]=B%c,B=B/c|0;while(B>0)v.push(B%c),B=B/c|0}var _="";for(p=0;y.at(p)===0&&p<y.length()-1;++p)_+=i;for(p=v.length-1;p>=0;--p)_+=l[v[p]];return _}}),Ee=le((r,S)=>{var t=de(),e=ts(),a=S.exports=t.util=t.util||{};(function(){if(typeof process!=="undefined"&&process.nextTick){if(a.nextTick=process.nextTick,typeof setImmediate==="function")a.setImmediate=setImmediate;else a.setImmediate=a.nextTick;return}if(typeof setImmediate==="function"){a.setImmediate=function(){return setImmediate.apply(void 0,arguments)},a.nextTick=function(n){return setImmediate(n)};return}if(a.setImmediate=function(n){setTimeout(n,0)},typeof window!=="undefined"&&typeof window.postMessage==="function"){let n=function(w){if(w.source===window&&w.data===m){w.stopPropagation();var K=E.slice();E.length=0,K.forEach(function(O){O()})}};var s=n,m="forge.setImmediate",E=[];a.setImmediate=function(w){if(E.push(w),E.length===1)window.postMessage(m,"*")},window.addEventListener("message",n,!0)}if(typeof MutationObserver!=="undefined"){var N=Date.now(),U=!0,g=document.createElement("div"),E=[];new MutationObserver(function(){var w=E.slice();E.length=0,w.forEach(function(K){K()})}).observe(g,{attributes:!0});var o=a.setImmediate;a.setImmediate=function(w){if(Date.now()-N>15)N=Date.now(),o(w);else if(E.push(w),E.length===1)g.setAttribute("a",U=!U)}}a.nextTick=a.setImmediate})(),a.isNodejs=typeof process!=="undefined"&&process.versions&&process.versions.node,a.globalScope=function(){if(a.isNodejs)return global;return typeof self==="undefined"?window:self}(),a.isArray=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"},a.isArrayBuffer=function(s){return typeof ArrayBuffer!=="undefined"&&s instanceof ArrayBuffer},a.isArrayBufferView=function(s){return s&&a.isArrayBuffer(s.buffer)&&s.byteLength!==void 0};function y(s){if(!(s===8||s===16||s===24||s===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+s)}a.ByteBuffer=l;function l(s){if(this.data="",this.read=0,typeof s==="string")this.data=s;else if(a.isArrayBuffer(s)||a.isArrayBufferView(s))if(typeof Buffer!=="undefined"&&s instanceof Buffer)this.data=s.toString("binary");else{var m=new Uint8Array(s);try{this.data=String.fromCharCode.apply(null,m)}catch(N){for(var E=0;E<m.length;++E)this.putByte(m[E])}}else if(s instanceof l||typeof s==="object"&&typeof s.data==="string"&&typeof s.read==="number")this.data=s.data,this.read=s.read;this._constructedStringLength=0}a.ByteStringBuffer=l;var p=4096;a.ByteStringBuffer.prototype._optimizeConstructedString=function(s){if(this._constructedStringLength+=s,this._constructedStringLength>p)this.data.substr(0,1),this._constructedStringLength=0},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(s){return this.putBytes(String.fromCharCode(s))},a.ByteStringBuffer.prototype.fillWithByte=function(s,m){s=String.fromCharCode(s);var E=this.data;while(m>0){if(m&1)E+=s;if(m>>>=1,m>0)s+=s}return this.data=E,this._optimizeConstructedString(m),this},a.ByteStringBuffer.prototype.putBytes=function(s){return this.data+=s,this._optimizeConstructedString(s.length),this},a.ByteStringBuffer.prototype.putString=function(s){return this.putBytes(a.encodeUtf8(s))},a.ByteStringBuffer.prototype.putInt16=function(s){return this.putBytes(String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},a.ByteStringBuffer.prototype.putInt24=function(s){return this.putBytes(String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},a.ByteStringBuffer.prototype.putInt32=function(s){return this.putBytes(String.fromCharCode(s>>24&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},a.ByteStringBuffer.prototype.putInt16Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s>>16&255))},a.ByteStringBuffer.prototype.putInt32Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>24&255))},a.ByteStringBuffer.prototype.putInt=function(s,m){y(m);var E="";do m-=8,E+=String.fromCharCode(s>>m&255);while(m>0);return this.putBytes(E)},a.ByteStringBuffer.prototype.putSignedInt=function(s,m){if(s<0)s+=2<<m-1;return this.putInt(s,m)},a.ByteStringBuffer.prototype.putBuffer=function(s){return this.putBytes(s.getBytes())},a.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},a.ByteStringBuffer.prototype.getInt16=function(){var s=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,s},a.ByteStringBuffer.prototype.getInt24=function(){var s=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,s},a.ByteStringBuffer.prototype.getInt32=function(){var s=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,s},a.ByteStringBuffer.prototype.getInt16Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,s},a.ByteStringBuffer.prototype.getInt24Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,s},a.ByteStringBuffer.prototype.getInt32Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,s},a.ByteStringBuffer.prototype.getInt=function(s){y(s);var m=0;do m=(m<<8)+this.data.charCodeAt(this.read++),s-=8;while(s>0);return m},a.ByteStringBuffer.prototype.getSignedInt=function(s){var m=this.getInt(s),E=2<<s-2;if(m>=E)m-=E<<1;return m},a.ByteStringBuffer.prototype.getBytes=function(s){var m;if(s)s=Math.min(this.length(),s),m=this.data.slice(this.read,this.read+s),this.read+=s;else if(s===0)m="";else m=this.read===0?this.data:this.data.slice(this.read),this.clear();return m},a.ByteStringBuffer.prototype.bytes=function(s){return typeof s==="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},a.ByteStringBuffer.prototype.at=function(s){return this.data.charCodeAt(this.read+s)},a.ByteStringBuffer.prototype.setAt=function(s,m){return this.data=this.data.substr(0,this.read+s)+String.fromCharCode(m)+this.data.substr(this.read+s+1),this},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var s=a.createBuffer(this.data);return s.read=this.read,s},a.ByteStringBuffer.prototype.compact=function(){if(this.read>0)this.data=this.data.slice(this.read),this.read=0;return this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.ByteStringBuffer.prototype.truncate=function(s){var m=Math.max(0,this.length()-s);return this.data=this.data.substr(this.read,m),this.read=0,this},a.ByteStringBuffer.prototype.toHex=function(){var s="";for(var m=this.read;m<this.data.length;++m){var E=this.data.charCodeAt(m);if(E<16)s+="0";s+=E.toString(16)}return s},a.ByteStringBuffer.prototype.toString=function(){return a.decodeUtf8(this.bytes())};function c(s,m){m=m||{},this.read=m.readOffset||0,this.growSize=m.growSize||1024;var E=a.isArrayBuffer(s),N=a.isArrayBufferView(s);if(E||N){if(E)this.data=new DataView(s);else this.data=new DataView(s.buffer,s.byteOffset,s.byteLength);this.write="writeOffset"in m?m.writeOffset:this.data.byteLength;return}if(this.data=new DataView(new ArrayBuffer(0)),this.write=0,s!==null&&s!==void 0)this.putBytes(s);if("writeOffset"in m)this.write=m.writeOffset}a.DataBuffer=c,a.DataBuffer.prototype.length=function(){return this.write-this.read},a.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},a.DataBuffer.prototype.accommodate=function(s,m){if(this.length()>=s)return this;m=Math.max(m||this.growSize,s);var E=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),N=new Uint8Array(this.length()+m);return N.set(E),this.data=new DataView(N.buffer),this},a.DataBuffer.prototype.putByte=function(s){return this.accommodate(1),this.data.setUint8(this.write++,s),this},a.DataBuffer.prototype.fillWithByte=function(s,m){this.accommodate(m);for(var E=0;E<m;++E)this.data.setUint8(s);return this},a.DataBuffer.prototype.putBytes=function(s,m){if(a.isArrayBufferView(s)){var E=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),N=E.byteLength-E.byteOffset;this.accommodate(N);var U=new Uint8Array(this.data.buffer,this.write);return U.set(E),this.write+=N,this}if(a.isArrayBuffer(s)){var E=new Uint8Array(s);this.accommodate(E.byteLength);var U=new Uint8Array(this.data.buffer);return U.set(E,this.write),this.write+=E.byteLength,this}if(s instanceof a.DataBuffer||typeof s==="object"&&typeof s.read==="number"&&typeof s.write==="number"&&a.isArrayBufferView(s.data)){var E=new Uint8Array(s.data.byteLength,s.read,s.length());this.accommodate(E.byteLength);var U=new Uint8Array(s.data.byteLength,this.write);return U.set(E),this.write+=E.byteLength,this}if(s instanceof a.ByteStringBuffer)s=s.data,m="binary";if(m=m||"binary",typeof s==="string"){var g;if(m==="hex")return this.accommodate(Math.ceil(s.length/2)),g=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.hex.decode(s,g,this.write),this;if(m==="base64")return this.accommodate(Math.ceil(s.length/4)*3),g=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.base64.decode(s,g,this.write),this;if(m==="utf8")s=a.encodeUtf8(s),m="binary";if(m==="binary"||m==="raw")return this.accommodate(s.length),g=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.raw.decode(g),this;if(m==="utf16")return this.accommodate(s.length*2),g=new Uint16Array(this.data.buffer,this.write),this.write+=a.text.utf16.encode(g),this;throw new Error("Invalid encoding: "+m)}throw Error("Invalid parameter: "+s)},a.DataBuffer.prototype.putBuffer=function(s){return this.putBytes(s),s.clear(),this},a.DataBuffer.prototype.putString=function(s){return this.putBytes(s,"utf16")},a.DataBuffer.prototype.putInt16=function(s){return this.accommodate(2),this.data.setInt16(this.write,s),this.write+=2,this},a.DataBuffer.prototype.putInt24=function(s){return this.accommodate(3),this.data.setInt16(this.write,s>>8&65535),this.data.setInt8(this.write,s>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(s){return this.accommodate(4),this.data.setInt32(this.write,s),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(s){return this.accommodate(2),this.data.setInt16(this.write,s,!0),this.write+=2,this},a.DataBuffer.prototype.putInt24Le=function(s){return this.accommodate(3),this.data.setInt8(this.write,s>>16&255),this.data.setInt16(this.write,s>>8&65535,!0),this.write+=3,this},a.DataBuffer.prototype.putInt32Le=function(s){return this.accommodate(4),this.data.setInt32(this.write,s,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(s,m){y(m),this.accommodate(m/8);do m-=8,this.data.setInt8(this.write++,s>>m&255);while(m>0);return this},a.DataBuffer.prototype.putSignedInt=function(s,m){if(y(m),this.accommodate(m/8),s<0)s+=2<<m-1;return this.putInt(s,m)},a.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},a.DataBuffer.prototype.getInt16=function(){var s=this.data.getInt16(this.read);return this.read+=2,s},a.DataBuffer.prototype.getInt24=function(){var s=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,s},a.DataBuffer.prototype.getInt32=function(){var s=this.data.getInt32(this.read);return this.read+=4,s},a.DataBuffer.prototype.getInt16Le=function(){var s=this.data.getInt16(this.read,!0);return this.read+=2,s},a.DataBuffer.prototype.getInt24Le=function(){var s=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,s},a.DataBuffer.prototype.getInt32Le=function(){var s=this.data.getInt32(this.read,!0);return this.read+=4,s},a.DataBuffer.prototype.getInt=function(s){y(s);var m=0;do m=(m<<8)+this.data.getInt8(this.read++),s-=8;while(s>0);return m},a.DataBuffer.prototype.getSignedInt=function(s){var m=this.getInt(s),E=2<<s-2;if(m>=E)m-=E<<1;return m},a.DataBuffer.prototype.getBytes=function(s){var m;if(s)s=Math.min(this.length(),s),m=this.data.slice(this.read,this.read+s),this.read+=s;else if(s===0)m="";else m=this.read===0?this.data:this.data.slice(this.read),this.clear();return m},a.DataBuffer.prototype.bytes=function(s){return typeof s==="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},a.DataBuffer.prototype.at=function(s){return this.data.getUint8(this.read+s)},a.DataBuffer.prototype.setAt=function(s,m){return this.data.setUint8(s,m),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.DataBuffer.prototype.compact=function(){if(this.read>0){var s=new Uint8Array(this.data.buffer,this.read),m=new Uint8Array(s.byteLength);m.set(s),this.data=new DataView(m),this.write-=this.read,this.read=0}return this},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(s){return this.write=Math.max(0,this.length()-s),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){var s="";for(var m=this.read;m<this.data.byteLength;++m){var E=this.data.getUint8(m);if(E<16)s+="0";s+=E.toString(16)}return s},a.DataBuffer.prototype.toString=function(s){var m=new Uint8Array(this.data,this.read,this.length());if(s=s||"utf8",s==="binary"||s==="raw")return a.binary.raw.encode(m);if(s==="hex")return a.binary.hex.encode(m);if(s==="base64")return a.binary.base64.encode(m);if(s==="utf8")return a.text.utf8.decode(m);if(s==="utf16")return a.text.utf16.decode(m);throw new Error("Invalid encoding: "+s)},a.createBuffer=function(s,m){if(m=m||"raw",s!==void 0&&m==="utf8")s=a.encodeUtf8(s);return new a.ByteBuffer(s)},a.fillString=function(s,m){var E="";while(m>0){if(m&1)E+=s;if(m>>>=1,m>0)s+=s}return E},a.xorBytes=function(s,m,E){var N="",U="",g="",o=0,n=0;for(;E>0;--E,++o){if(U=s.charCodeAt(o)^m.charCodeAt(o),n>=10)N+=g,g="",n=0;g+=String.fromCharCode(U),++n}return N+=g,N},a.hexToBytes=function(s){var m="",E=0;if(s.length&!0)E=1,m+=String.fromCharCode(parseInt(s[0],16));for(;E<s.length;E+=2)m+=String.fromCharCode(parseInt(s.substr(E,2),16));return m},a.bytesToHex=function(s){return a.createBuffer(s).toHex()},a.int32ToBytes=function(s){return String.fromCharCode(s>>24&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255)};var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,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,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(s,m){var E="",N="",U,g,o,n=0;while(n<s.length){if(U=s.charCodeAt(n++),g=s.charCodeAt(n++),o=s.charCodeAt(n++),E+=i.charAt(U>>2),E+=i.charAt((U&3)<<4|g>>4),isNaN(g))E+="==";else E+=i.charAt((g&15)<<2|o>>6),E+=isNaN(o)?"=":i.charAt(o&63);if(m&&E.length>m)N+=E.substr(0,m)+`\r
|
|
39
|
-
`,E=E.substr(m)}return N+=E,N},a.decode64=function(s){s=s.replace(/[^A-Za-z0-9\+\/\=]/g,"");var m="",E,N,U,g,o=0;while(o<s.length)if(E=v[s.charCodeAt(o++)-43],N=v[s.charCodeAt(o++)-43],U=v[s.charCodeAt(o++)-43],g=v[s.charCodeAt(o++)-43],m+=String.fromCharCode(E<<2|N>>4),U!==64){if(m+=String.fromCharCode((N&15)<<4|U>>2),g!==64)m+=String.fromCharCode((U&3)<<6|g)}return m},a.encodeUtf8=function(s){return unescape(encodeURIComponent(s))},a.decodeUtf8=function(s){return decodeURIComponent(escape(s))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},a.binary.raw.encode=function(s){return String.fromCharCode.apply(null,s)},a.binary.raw.decode=function(s,m,E){var N=m;if(!N)N=new Uint8Array(s.length);E=E||0;var U=E;for(var g=0;g<s.length;++g)N[U++]=s.charCodeAt(g);return m?U-E:N},a.binary.hex.encode=a.bytesToHex,a.binary.hex.decode=function(s,m,E){var N=m;if(!N)N=new Uint8Array(Math.ceil(s.length/2));E=E||0;var U=0,g=E;if(s.length&1)U=1,N[g++]=parseInt(s[0],16);for(;U<s.length;U+=2)N[g++]=parseInt(s.substr(U,2),16);return m?g-E:N},a.binary.base64.encode=function(s,m){var E="",N="",U,g,o,n=0;while(n<s.byteLength){if(U=s[n++],g=s[n++],o=s[n++],E+=i.charAt(U>>2),E+=i.charAt((U&3)<<4|g>>4),isNaN(g))E+="==";else E+=i.charAt((g&15)<<2|o>>6),E+=isNaN(o)?"=":i.charAt(o&63);if(m&&E.length>m)N+=E.substr(0,m)+`\r
|
|
40
|
-
`,E=E.substr(m)}return N+=E,N},a.binary.base64.decode=function(s,m,E){var N=m;if(!N)N=new Uint8Array(Math.ceil(s.length/4)*3);s=s.replace(/[^A-Za-z0-9\+\/\=]/g,""),E=E||0;var U,g,o,n,w=0,K=E;while(w<s.length)if(U=v[s.charCodeAt(w++)-43],g=v[s.charCodeAt(w++)-43],o=v[s.charCodeAt(w++)-43],n=v[s.charCodeAt(w++)-43],N[K++]=U<<2|g>>4,o!==64){if(N[K++]=(g&15)<<4|o>>2,n!==64)N[K++]=(o&3)<<6|n}return m?K-E:N.subarray(0,K)},a.binary.base58.encode=function(s,m){return a.binary.baseN.encode(s,f,m)},a.binary.base58.decode=function(s,m){return a.binary.baseN.decode(s,f,m)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(s,m,E){s=a.encodeUtf8(s);var N=m;if(!N)N=new Uint8Array(s.length);E=E||0;var U=E;for(var g=0;g<s.length;++g)N[U++]=s.charCodeAt(g);return m?U-E:N},a.text.utf8.decode=function(s){return a.decodeUtf8(String.fromCharCode.apply(null,s))},a.text.utf16.encode=function(s,m,E){var N=m;if(!N)N=new Uint8Array(s.length*2);var U=new Uint16Array(N.buffer);E=E||0;var g=E,o=E;for(var n=0;n<s.length;++n)U[o++]=s.charCodeAt(n),g+=2;return m?g-E:N},a.text.utf16.decode=function(s){return String.fromCharCode.apply(null,new Uint16Array(s.buffer))},a.deflate=function(s,m,E){if(m=a.decode64(s.deflate(a.encode64(m)).rval),E){var N=2,U=m.charCodeAt(1);if(U&32)N=6;m=m.substring(N,m.length-4)}return m},a.inflate=function(s,m,E){var N=s.inflate(a.encode64(m)).rval;return N===null?null:a.decode64(N)};var B=function(s,m,E){if(!s)throw new Error("WebStorage not available.");var N;if(E===null)N=s.removeItem(m);else E=a.encode64(JSON.stringify(E)),N=s.setItem(m,E);if(typeof N!=="undefined"&&N.rval!==!0){var U=new Error(N.error.message);throw U.id=N.error.id,U.name=N.error.name,U}},_=function(s,m){if(!s)throw new Error("WebStorage not available.");var E=s.getItem(m);if(s.init)if(E.rval===null){if(E.error){var N=new Error(E.error.message);throw N.id=E.error.id,N.name=E.error.name,N}E=null}else E=E.rval;if(E!==null)E=JSON.parse(a.decode64(E));return E},I=function(s,m,E,N){var U=_(s,m);if(U===null)U={};U[E]=N,B(s,m,U)},h=function(s,m,E){var N=_(s,m);if(N!==null)N=E in N?N[E]:null;return N},C=function(s,m,E){var N=_(s,m);if(N!==null&&E in N){delete N[E];var U=!0;for(var g in N){U=!1;break}if(U)N=null;B(s,m,N)}},A=function(s,m){B(s,m,null)},T=function(s,m,E){var N=null;if(typeof E==="undefined")E=["web","flash"];var U,g=!1,o=null;for(var n in E){U=E[n];try{if(U==="flash"||U==="both"){if(m[0]===null)throw new Error("Flash local storage not available.");N=s.apply(this,m),g=U==="flash"}if(U==="web"||U==="both")m[0]=localStorage,N=s.apply(this,m),g=!0}catch(w){o=w}if(g)break}if(!g)throw o;return N};a.setItem=function(s,m,E,N,U){T(I,arguments,U)},a.getItem=function(s,m,E,N){return T(h,arguments,N)},a.removeItem=function(s,m,E,N){T(C,arguments,N)},a.clearItems=function(s,m,E){T(A,arguments,E)},a.isEmpty=function(s){for(var m in s)if(s.hasOwnProperty(m))return!1;return!0},a.format=function(s){var m=/%./g,E,N,U=0,g=[],o=0;while(E=m.exec(s)){if(N=s.substring(o,m.lastIndex-2),N.length>0)g.push(N);o=m.lastIndex;var n=E[0][1];switch(n){case"s":case"o":if(U<arguments.length)g.push(arguments[U+++1]);else g.push("<?>");break;case"%":g.push("%");break;default:g.push("<%"+n+"?>")}}return g.push(s.substring(o)),g.join("")},a.formatNumber=function(s,m,E,N){var U=s,g=isNaN(m=Math.abs(m))?2:m,o=E===void 0?",":E,n=N===void 0?".":N,w=U<0?"-":"",K=parseInt(U=Math.abs(+U||0).toFixed(g),10)+"",O=K.length>3?K.length%3:0;return w+(O?K.substr(0,O)+n:"")+K.substr(O).replace(/(\d{3})(?=\d)/g,"$1"+n)+(g?o+Math.abs(U-K).toFixed(g).slice(2):"")},a.formatSize=function(s){if(s>=1073741824)s=a.formatNumber(s/1073741824,2,".","")+" GiB";else if(s>=1048576)s=a.formatNumber(s/1048576,2,".","")+" MiB";else if(s>=1024)s=a.formatNumber(s/1024,0)+" KiB";else s=a.formatNumber(s,0)+" bytes";return s},a.bytesFromIP=function(s){if(s.indexOf(".")!==-1)return a.bytesFromIPv4(s);if(s.indexOf(":")!==-1)return a.bytesFromIPv6(s);return null},a.bytesFromIPv4=function(s){if(s=s.split("."),s.length!==4)return null;var m=a.createBuffer();for(var E=0;E<s.length;++E){var N=parseInt(s[E],10);if(isNaN(N))return null;m.putByte(N)}return m.getBytes()},a.bytesFromIPv6=function(s){var m=0;s=s.split(":").filter(function(o){if(o.length===0)++m;return!0});var E=(8-s.length+m)*2,N=a.createBuffer();for(var U=0;U<8;++U){if(!s[U]||s[U].length===0){N.fillWithByte(0,E),E=0;continue}var g=a.hexToBytes(s[U]);if(g.length<2)N.putByte(0);N.putBytes(g)}return N.getBytes()},a.bytesToIP=function(s){if(s.length===4)return a.bytesToIPv4(s);if(s.length===16)return a.bytesToIPv6(s);return null},a.bytesToIPv4=function(s){if(s.length!==4)return null;var m=[];for(var E=0;E<s.length;++E)m.push(s.charCodeAt(E));return m.join(".")},a.bytesToIPv6=function(s){if(s.length!==16)return null;var m=[],E=[],N=0;for(var U=0;U<s.length;U+=2){var g=a.bytesToHex(s[U]+s[U+1]);while(g[0]==="0"&&g!=="0")g=g.substr(1);if(g==="0"){var o=E[E.length-1],n=m.length;if(!o||n!==o.end+1)E.push({start:n,end:n});else if(o.end=n,o.end-o.start>E[N].end-E[N].start)N=E.length-1}m.push(g)}if(E.length>0){var w=E[N];if(w.end-w.start>0){if(m.splice(w.start,w.end-w.start+1,""),w.start===0)m.unshift("");if(w.end===7)m.push("")}}return m.join(":")},a.estimateCores=function(s,m){if(typeof s==="function")m=s,s={};if(s=s||{},"cores"in a&&!s.update)return m(null,a.cores);if(typeof navigator!=="undefined"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,m(null,a.cores);if(typeof Worker==="undefined")return a.cores=1,m(null,a.cores);if(typeof Blob==="undefined")return a.cores=2,m(null,a.cores);var E=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(o){var n=Date.now(),w=n+4;while(Date.now()<w);self.postMessage({st:n,et:w})})}.toString(),")()"],{type:"application/javascript"}));N([],5,16);function N(o,n,w){if(n===0){var K=Math.floor(o.reduce(function(O,V){return O+V},0)/o.length);return a.cores=Math.max(1,K),URL.revokeObjectURL(E),m(null,a.cores)}U(w,function(O,V){o.push(g(w,V)),N(o,n-1,w)})}function U(o,n){var w=[],K=[];for(var O=0;O<o;++O){var V=new Worker(E);V.addEventListener("message",function(F){if(K.push(F.data),K.length===o){for(var H=0;H<o;++H)w[H].terminate();n(null,K)}}),w.push(V)}for(var O=0;O<o;++O)w[O].postMessage(O)}function g(o,n){var w=[];for(var K=0;K<o;++K){var O=n[K],V=w[K]=[];for(var F=0;F<o;++F){if(K===F)continue;var H=n[F];if(O.st>H.st&&O.st<H.et||H.st>O.st&&H.st<O.et)V.push(F)}}return w.reduce(function(j,Q){return Math.max(j,Q.length)},0)}}}),Pr=le((r,S)=>{var t=de();Ee(),S.exports=t.cipher=t.cipher||{},t.cipher.algorithms=t.cipher.algorithms||{},t.cipher.createCipher=function(a,y){var l=a;if(typeof l==="string"){if(l=t.cipher.getAlgorithm(l),l)l=l()}if(!l)throw new Error("Unsupported algorithm: "+a);return new t.cipher.BlockCipher({algorithm:l,key:y,decrypt:!1})},t.cipher.createDecipher=function(a,y){var l=a;if(typeof l==="string"){if(l=t.cipher.getAlgorithm(l),l)l=l()}if(!l)throw new Error("Unsupported algorithm: "+a);return new t.cipher.BlockCipher({algorithm:l,key:y,decrypt:!0})},t.cipher.registerAlgorithm=function(a,y){a=a.toUpperCase(),t.cipher.algorithms[a]=y},t.cipher.getAlgorithm=function(a){if(a=a.toUpperCase(),a in t.cipher.algorithms)return t.cipher.algorithms[a];return null};var e=t.cipher.BlockCipher=function(a){this.algorithm=a.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=a.decrypt,this.algorithm.initialize(a)};e.prototype.start=function(a){a=a||{};var y={};for(var l in a)y[l]=a[l];y.decrypt=this._decrypt,this._finish=!1,this._input=t.util.createBuffer(),this.output=a.output||t.util.createBuffer(),this.mode.start(y)},e.prototype.update=function(a){if(a)this._input.putBuffer(a);while(!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish);this._input.compact()},e.prototype.finish=function(a){if(a&&(this.mode.name==="ECB"||this.mode.name==="CBC"))this.mode.pad=function(l){return a(this.blockSize,l,!1)},this.mode.unpad=function(l){return a(this.blockSize,l,!0)};var y={};if(y.decrypt=this._decrypt,y.overflow=this._input.length()%this.blockSize,!this._decrypt&&this.mode.pad){if(!this.mode.pad(this._input,y))return!1}if(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad){if(!this.mode.unpad(this.output,y))return!1}if(this.mode.afterFinish){if(!this.mode.afterFinish(this.output,y))return!1}return!0}}),Pi=le((r,S)=>{var t=de();Ee(),t.cipher=t.cipher||{};var e=S.exports=t.cipher.modes=t.cipher.modes||{};e.ecb=function(p){p=p||{},this.name="ECB",this.cipher=p.cipher,this.blockSize=p.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(p){},e.ecb.prototype.encrypt=function(p,c,i){if(p.length()<this.blockSize&&!(i&&p.length()>0))return!0;for(var v=0;v<this._ints;++v)this._inBlock[v]=p.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var v=0;v<this._ints;++v)c.putInt32(this._outBlock[v])},e.ecb.prototype.decrypt=function(p,c,i){if(p.length()<this.blockSize&&!(i&&p.length()>0))return!0;for(var v=0;v<this._ints;++v)this._inBlock[v]=p.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var v=0;v<this._ints;++v)c.putInt32(this._outBlock[v])},e.ecb.prototype.pad=function(p,c){var i=p.length()===this.blockSize?this.blockSize:this.blockSize-p.length();return p.fillWithByte(i,i),!0},e.ecb.prototype.unpad=function(p,c){if(c.overflow>0)return!1;var i=p.length(),v=p.at(i-1);if(v>this.blockSize<<2)return!1;return p.truncate(v),!0},e.cbc=function(p){p=p||{},this.name="CBC",this.cipher=p.cipher,this.blockSize=p.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(p){if(p.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if(!("iv"in p))throw new Error("Invalid IV parameter.");else this._iv=a(p.iv,this.blockSize),this._prev=this._iv.slice(0)},e.cbc.prototype.encrypt=function(p,c,i){if(p.length()<this.blockSize&&!(i&&p.length()>0))return!0;for(var v=0;v<this._ints;++v)this._inBlock[v]=this._prev[v]^p.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var v=0;v<this._ints;++v)c.putInt32(this._outBlock[v]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(p,c,i){if(p.length()<this.blockSize&&!(i&&p.length()>0))return!0;for(var v=0;v<this._ints;++v)this._inBlock[v]=p.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var v=0;v<this._ints;++v)c.putInt32(this._prev[v]^this._outBlock[v]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(p,c){var i=p.length()===this.blockSize?this.blockSize:this.blockSize-p.length();return p.fillWithByte(i,i),!0},e.cbc.prototype.unpad=function(p,c){if(c.overflow>0)return!1;var i=p.length(),v=p.at(i-1);if(v>this.blockSize<<2)return!1;return p.truncate(v),!0},e.cfb=function(p){p=p||{},this.name="CFB",this.cipher=p.cipher,this.blockSize=p.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(p){if(!("iv"in p))throw new Error("Invalid IV parameter.");this._iv=a(p.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(p,c,i){var v=p.length();if(v===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&v>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=p.getInt32()^this._outBlock[f],c.putInt32(this._inBlock[f]);return}var B=(this.blockSize-v)%this.blockSize;if(B>0)B=this.blockSize-B;this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=p.getInt32()^this._outBlock[f],this._partialOutput.putInt32(this._partialBlock[f]);if(B>0)p.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(B>0&&!i)return c.putBytes(this._partialOutput.getBytes(B-this._partialBytes)),this._partialBytes=B,!0;c.putBytes(this._partialOutput.getBytes(v-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(p,c,i){var v=p.length();if(v===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&v>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=p.getInt32(),c.putInt32(this._inBlock[f]^this._outBlock[f]);return}var B=(this.blockSize-v)%this.blockSize;if(B>0)B=this.blockSize-B;this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=p.getInt32(),this._partialOutput.putInt32(this._partialBlock[f]^this._outBlock[f]);if(B>0)p.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(B>0&&!i)return c.putBytes(this._partialOutput.getBytes(B-this._partialBytes)),this._partialBytes=B,!0;c.putBytes(this._partialOutput.getBytes(v-this._partialBytes)),this._partialBytes=0},e.ofb=function(p){p=p||{},this.name="OFB",this.cipher=p.cipher,this.blockSize=p.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(p){if(!("iv"in p))throw new Error("Invalid IV parameter.");this._iv=a(p.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(p,c,i){var v=p.length();if(p.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&v>=this.blockSize){for(var f=0;f<this._ints;++f)c.putInt32(p.getInt32()^this._outBlock[f]),this._inBlock[f]=this._outBlock[f];return}var B=(this.blockSize-v)%this.blockSize;if(B>0)B=this.blockSize-B;this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(p.getInt32()^this._outBlock[f]);if(B>0)p.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._outBlock[f];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(B>0&&!i)return c.putBytes(this._partialOutput.getBytes(B-this._partialBytes)),this._partialBytes=B,!0;c.putBytes(this._partialOutput.getBytes(v-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(p){p=p||{},this.name="CTR",this.cipher=p.cipher,this.blockSize=p.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(p){if(!("iv"in p))throw new Error("Invalid IV parameter.");this._iv=a(p.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(p,c,i){var v=p.length();if(v===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&v>=this.blockSize)for(var f=0;f<this._ints;++f)c.putInt32(p.getInt32()^this._outBlock[f]);else{var B=(this.blockSize-v)%this.blockSize;if(B>0)B=this.blockSize-B;this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(p.getInt32()^this._outBlock[f]);if(B>0)p.read-=this.blockSize;if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(B>0&&!i)return c.putBytes(this._partialOutput.getBytes(B-this._partialBytes)),this._partialBytes=B,!0;c.putBytes(this._partialOutput.getBytes(v-this._partialBytes)),this._partialBytes=0}y(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(p){p=p||{},this.name="GCM",this.cipher=p.cipher,this.blockSize=p.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(p){if(!("iv"in p))throw new Error("Invalid IV parameter.");var c=t.util.createBuffer(p.iv);this._cipherLength=0;var i;if("additionalData"in p)i=t.util.createBuffer(p.additionalData);else i=t.util.createBuffer();if("tagLength"in p)this._tagLength=p.tagLength;else this._tagLength=128;if(this._tag=null,p.decrypt){if(this._tag=t.util.createBuffer(p.tag).getBytes(),this._tag.length!==this._tagLength/8)throw new Error("Authentication tag does not match tag length.")}this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var v=c.length();if(v===12)this._j0=[c.getInt32(),c.getInt32(),c.getInt32(),1];else{this._j0=[0,0,0,0];while(c.length()>0)this._j0=this.ghash(this._hashSubkey,this._j0,[c.getInt32(),c.getInt32(),c.getInt32(),c.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(l(v*8)))}this._inBlock=this._j0.slice(0),y(this._inBlock),this._partialBytes=0,i=t.util.createBuffer(i),this._aDataLength=l(i.length()*8);var f=i.length()%this.blockSize;if(f)i.fillWithByte(0,this.blockSize-f);this._s=[0,0,0,0];while(i.length()>0)this._s=this.ghash(this._hashSubkey,this._s,[i.getInt32(),i.getInt32(),i.getInt32(),i.getInt32()])},e.gcm.prototype.encrypt=function(p,c,i){var v=p.length();if(v===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&v>=this.blockSize){for(var f=0;f<this._ints;++f)c.putInt32(this._outBlock[f]^=p.getInt32());this._cipherLength+=this.blockSize}else{var B=(this.blockSize-v)%this.blockSize;if(B>0)B=this.blockSize-B;this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(p.getInt32()^this._outBlock[f]);if(B<=0||i){if(i){var _=v%this.blockSize;this._cipherLength+=_,this._partialOutput.truncate(this.blockSize-_)}else this._cipherLength+=this.blockSize;for(var f=0;f<this._ints;++f)this._outBlock[f]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(B>0&&!i)return p.read-=this.blockSize,c.putBytes(this._partialOutput.getBytes(B-this._partialBytes)),this._partialBytes=B,!0;c.putBytes(this._partialOutput.getBytes(v-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),y(this._inBlock)},e.gcm.prototype.decrypt=function(p,c,i){var v=p.length();if(v<this.blockSize&&!(i&&v>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),y(this._inBlock),this._hashBlock[0]=p.getInt32(),this._hashBlock[1]=p.getInt32(),this._hashBlock[2]=p.getInt32(),this._hashBlock[3]=p.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var f=0;f<this._ints;++f)c.putInt32(this._outBlock[f]^this._hashBlock[f]);if(v<this.blockSize)this._cipherLength+=v%this.blockSize;else this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(p,c){var i=!0;if(c.decrypt&&c.overflow)p.truncate(this.blockSize-c.overflow);this.tag=t.util.createBuffer();var v=this._aDataLength.concat(l(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,v);var f=[];this.cipher.encrypt(this._j0,f);for(var B=0;B<this._ints;++B)this.tag.putInt32(this._s[B]^f[B]);if(this.tag.truncate(this.tag.length()%(this._tagLength/8)),c.decrypt&&this.tag.bytes()!==this._tag)i=!1;return i},e.gcm.prototype.multiply=function(p,c){var i=[0,0,0,0],v=c.slice(0);for(var f=0;f<128;++f){var B=p[f/32|0]&1<<31-f%32;if(B)i[0]^=v[0],i[1]^=v[1],i[2]^=v[2],i[3]^=v[3];this.pow(v,v)}return i},e.gcm.prototype.pow=function(p,c){var i=p[3]&1;for(var v=3;v>0;--v)c[v]=p[v]>>>1|(p[v-1]&1)<<31;if(c[0]=p[0]>>>1,i)c[0]^=this._R},e.gcm.prototype.tableMultiply=function(p){var c=[0,0,0,0];for(var i=0;i<32;++i){var v=i/8|0,f=p[v]>>>(7-i%8)*4&15,B=this._m[i][f];c[0]^=B[0],c[1]^=B[1],c[2]^=B[2],c[3]^=B[3]}return c},e.gcm.prototype.ghash=function(p,c,i){return c[0]^=i[0],c[1]^=i[1],c[2]^=i[2],c[3]^=i[3],this.tableMultiply(c)},e.gcm.prototype.generateHashTable=function(p,c){var i=8/c,v=4*i,f=16*i,B=new Array(f);for(var _=0;_<f;++_){var I=[0,0,0,0],h=_/v|0,C=(v-1-_%v)*c;I[h]=1<<c-1<<C,B[_]=this.generateSubHashTable(this.multiply(I,p),c)}return B},e.gcm.prototype.generateSubHashTable=function(p,c){var i=1<<c,v=i>>>1,f=new Array(i);f[v]=p.slice(0);var B=v>>>1;while(B>0)this.pow(f[2*B],f[B]=[]),B>>=1;B=2;while(B<v){for(var _=1;_<B;++_){var I=f[B],h=f[_];f[B+_]=[I[0]^h[0],I[1]^h[1],I[2]^h[2],I[3]^h[3]]}B*=2}f[0]=[0,0,0,0];for(B=v+1;B<i;++B){var C=f[B^v];f[B]=[p[0]^C[0],p[1]^C[1],p[2]^C[2],p[3]^C[3]]}return f};function a(p,c){if(typeof p==="string")p=t.util.createBuffer(p);if(t.util.isArray(p)&&p.length>4){var i=p;p=t.util.createBuffer();for(var v=0;v<i.length;++v)p.putByte(i[v])}if(p.length()<c)throw new Error("Invalid IV length; got "+p.length()+" bytes and expected "+c+" bytes.");if(!t.util.isArray(p)){var f=[],B=c/4;for(var v=0;v<B;++v)f.push(p.getInt32());p=f}return p}function y(p){p[p.length-1]=p[p.length-1]+1&4294967295}function l(p){return[p/4294967296|0,p&4294967295]}}),Dt=le((r,S)=>{var t=de();Pr(),Pi(),Ee(),S.exports=t.aes=t.aes||{},t.aes.startEncrypting=function(h,C,A,T){var s=I({key:h,output:A,decrypt:!1,mode:T});return s.start(C),s},t.aes.createEncryptionCipher=function(h,C){return I({key:h,output:null,decrypt:!1,mode:C})},t.aes.startDecrypting=function(h,C,A,T){var s=I({key:h,output:A,decrypt:!0,mode:T});return s.start(C),s},t.aes.createDecryptionCipher=function(h,C){return I({key:h,output:null,decrypt:!0,mode:C})},t.aes.Algorithm=function(h,C){if(!a)f();var A=this;A.name=h,A.mode=new C({blockSize:16,cipher:{encrypt:function(T,s){return _(A._w,T,s,!1)},decrypt:function(T,s){return _(A._w,T,s,!0)}}}),A._init=!1},t.aes.Algorithm.prototype.initialize=function(h){if(this._init)return;var C=h.key,A;if(typeof C==="string"&&(C.length===16||C.length===24||C.length===32))C=t.util.createBuffer(C);else if(t.util.isArray(C)&&(C.length===16||C.length===24||C.length===32)){A=C,C=t.util.createBuffer();for(var T=0;T<A.length;++T)C.putByte(A[T])}if(!t.util.isArray(C)){A=C,C=[];var s=A.length();if(s===16||s===24||s===32){s=s>>>2;for(var T=0;T<s;++T)C.push(A.getInt32())}}if(!t.util.isArray(C)||!(C.length===4||C.length===6||C.length===8))throw new Error("Invalid key parameter.");var m=this.mode.name,E=["CFB","OFB","CTR","GCM"].indexOf(m)!==-1;this._w=B(C,h.decrypt&&!E),this._init=!0},t.aes._expandKey=function(h,C){if(!a)f();return B(h,C)},t.aes._updateBlock=_,e("AES-ECB",t.cipher.modes.ecb),e("AES-CBC",t.cipher.modes.cbc),e("AES-CFB",t.cipher.modes.cfb),e("AES-OFB",t.cipher.modes.ofb),e("AES-CTR",t.cipher.modes.ctr),e("AES-GCM",t.cipher.modes.gcm);function e(h,C){var A=function(){return new t.aes.Algorithm(h,C)};t.cipher.registerAlgorithm(h,A)}var a=!1,y=4,l,p,c,i,v;function f(){a=!0,c=[0,1,2,4,8,16,32,64,128,27,54];var h=new Array(256);for(var C=0;C<128;++C)h[C]=C<<1,h[C+128]=C+128<<1^283;l=new Array(256),p=new Array(256),i=new Array(4),v=new Array(4);for(var C=0;C<4;++C)i[C]=new Array(256),v[C]=new Array(256);var A=0,T=0,s,m,E,N,U,g,o;for(var C=0;C<256;++C){N=T^T<<1^T<<2^T<<3^T<<4,N=N>>8^N&255^99,l[A]=N,p[N]=A,U=h[N],s=h[A],m=h[s],E=h[m],g=U<<24^N<<16^N<<8^(N^U),o=(s^m^E)<<24^(A^E)<<16^(A^m^E)<<8^(A^s^E);for(var n=0;n<4;++n)i[n][A]=g,v[n][N]=o,g=g<<24|g>>>8,o=o<<24|o>>>8;if(A===0)A=T=1;else A=s^h[h[h[s^E]]],T^=h[h[T]]}}function B(h,C){var A=h.slice(0),T,s=1,m=A.length,E=m+6+1,N=y*E;for(var U=m;U<N;++U){if(T=A[U-1],U%m===0)T=l[T>>>16&255]<<24^l[T>>>8&255]<<16^l[T&255]<<8^l[T>>>24]^c[s]<<24,s++;else if(m>6&&U%m===4)T=l[T>>>24]<<24^l[T>>>16&255]<<16^l[T>>>8&255]<<8^l[T&255];A[U]=A[U-m]^T}if(C){var g,o=v[0],n=v[1],w=v[2],K=v[3],O=A.slice(0);N=A.length;for(var U=0,V=N-y;U<N;U+=y,V-=y)if(U===0||U===N-y)O[U]=A[V],O[U+1]=A[V+3],O[U+2]=A[V+2],O[U+3]=A[V+1];else for(var F=0;F<y;++F)g=A[V+F],O[U+(3&-F)]=o[l[g>>>24]]^n[l[g>>>16&255]]^w[l[g>>>8&255]]^K[l[g&255]];A=O}return A}function _(h,C,A,T){var s=h.length/4-1,m,E,N,U,g;if(T)m=v[0],E=v[1],N=v[2],U=v[3],g=p;else m=i[0],E=i[1],N=i[2],U=i[3],g=l;var o,n,w,K,O,V,F;o=C[0]^h[0],n=C[T?3:1]^h[1],w=C[2]^h[2],K=C[T?1:3]^h[3];var H=3;for(var j=1;j<s;++j)O=m[o>>>24]^E[n>>>16&255]^N[w>>>8&255]^U[K&255]^h[++H],V=m[n>>>24]^E[w>>>16&255]^N[K>>>8&255]^U[o&255]^h[++H],F=m[w>>>24]^E[K>>>16&255]^N[o>>>8&255]^U[n&255]^h[++H],K=m[K>>>24]^E[o>>>16&255]^N[n>>>8&255]^U[w&255]^h[++H],o=O,n=V,w=F;A[0]=g[o>>>24]<<24^g[n>>>16&255]<<16^g[w>>>8&255]<<8^g[K&255]^h[++H],A[T?3:1]=g[n>>>24]<<24^g[w>>>16&255]<<16^g[K>>>8&255]<<8^g[o&255]^h[++H],A[2]=g[w>>>24]<<24^g[K>>>16&255]<<16^g[o>>>8&255]<<8^g[n&255]^h[++H],A[T?1:3]=g[K>>>24]<<24^g[o>>>16&255]<<16^g[n>>>8&255]<<8^g[w&255]^h[++H]}function I(h){h=h||{};var C=(h.mode||"CBC").toUpperCase(),A="AES-"+C,T;if(h.decrypt)T=t.cipher.createDecipher(A,h.key);else T=t.cipher.createCipher(A,h.key);var s=T.start;return T.start=function(m,E){var N=null;if(E instanceof t.util.ByteBuffer)N=E,E={};E=E||{},E.output=N,E.iv=m,s.call(T,E)},T}}),Ut=le((r,S)=>{var t=de();t.pki=t.pki||{};var e=S.exports=t.pki.oids=t.oids=t.oids||{};function a(l,p){e[l]=p,e[p]=l}function y(l,p){e[l]=p}a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.3.101.112","EdDSA25519"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("1.3.14.3.2.29","sha1WithRSASignature"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("2.16.840.1.101.3.4.2.4","sha224"),a("2.16.840.1.101.3.4.2.5","sha512-224"),a("2.16.840.1.101.3.4.2.6","sha512-256"),a("1.2.840.113549.2.2","md2"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.4","surname"),a("2.5.4.5","serialNumber"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.9","streetAddress"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.12","title"),a("2.5.4.13","description"),a("2.5.4.15","businessCategory"),a("2.5.4.17","postalCode"),a("2.5.4.42","givenName"),a("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),a("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),y("2.5.29.1","authorityKeyIdentifier"),y("2.5.29.2","keyAttributes"),y("2.5.29.3","certificatePolicies"),y("2.5.29.4","keyUsageRestriction"),y("2.5.29.5","policyMapping"),y("2.5.29.6","subtreesConstraint"),y("2.5.29.7","subjectAltName"),y("2.5.29.8","issuerAltName"),y("2.5.29.9","subjectDirectoryAttributes"),y("2.5.29.10","basicConstraints"),y("2.5.29.11","nameConstraints"),y("2.5.29.12","policyConstraints"),y("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),y("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),y("2.5.29.20","cRLNumber"),y("2.5.29.21","cRLReason"),y("2.5.29.22","expirationDate"),y("2.5.29.23","instructionCode"),y("2.5.29.24","invalidityDate"),y("2.5.29.25","cRLDistributionPoints"),y("2.5.29.26","issuingDistributionPoint"),y("2.5.29.27","deltaCRLIndicator"),y("2.5.29.28","issuingDistributionPoint"),y("2.5.29.29","certificateIssuer"),y("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),y("2.5.29.33","policyMappings"),y("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),y("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),y("2.5.29.46","freshestCRL"),y("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping")}),gt=le((r,S)=>{var t=de();Ee(),Ut();var e=S.exports=t.asn1=t.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.create=function(c,i,v,f,B){if(t.util.isArray(f)){var _=[];for(var I=0;I<f.length;++I)if(f[I]!==void 0)_.push(f[I]);f=_}var h={tagClass:c,type:i,constructed:v,composed:v||t.util.isArray(f),value:f};if(B&&"bitStringContents"in B)h.bitStringContents=B.bitStringContents,h.original=e.copy(h);return h},e.copy=function(c,i){var v;if(t.util.isArray(c)){v=[];for(var f=0;f<c.length;++f)v.push(e.copy(c[f],i));return v}if(typeof c==="string")return c;if(v={tagClass:c.tagClass,type:c.type,constructed:c.constructed,composed:c.composed,value:e.copy(c.value,i)},i&&!i.excludeBitStringContents)v.bitStringContents=c.bitStringContents;return v},e.equals=function(c,i,v){if(t.util.isArray(c)){if(!t.util.isArray(i))return!1;if(c.length!==i.length)return!1;for(var f=0;f<c.length;++f)if(!e.equals(c[f],i[f]))return!1;return!0}if(typeof c!==typeof i)return!1;if(typeof c==="string")return c===i;var B=c.tagClass===i.tagClass&&c.type===i.type&&c.constructed===i.constructed&&c.composed===i.composed&&e.equals(c.value,i.value);if(v&&v.includeBitStringContents)B=B&&c.bitStringContents===i.bitStringContents;return B},e.getBerValueLength=function(c){var i=c.getByte();if(i===128)return;var v,f=i&128;if(!f)v=i;else v=c.getInt((i&127)<<3);return v};function a(c,i,v){if(v>i){var f=new Error("Too few bytes to parse DER.");throw f.available=c.length(),f.remaining=i,f.requested=v,f}}var y=function(c,i){var v=c.getByte();if(i--,v===128)return;var f,B=v&128;if(!B)f=v;else{var _=v&127;a(c,i,_),f=c.getInt(_<<3)}if(f<0)throw new Error("Negative length: "+f);return f};e.fromDer=function(c,i){if(i===void 0)i={strict:!0,parseAllBytes:!0,decodeBitStrings:!0};if(typeof i==="boolean")i={strict:i,parseAllBytes:!0,decodeBitStrings:!0};if(!("strict"in i))i.strict=!0;if(!("parseAllBytes"in i))i.parseAllBytes=!0;if(!("decodeBitStrings"in i))i.decodeBitStrings=!0;if(typeof c==="string")c=t.util.createBuffer(c);var v=c.length(),f=l(c,c.length(),0,i);if(i.parseAllBytes&&c.length()!==0){var B=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw B.byteCount=v,B.remaining=c.length(),B}return f};function l(c,i,v,f){var B;a(c,i,2);var _=c.getByte();i--;var I=_&192,h=_&31;B=c.length();var C=y(c,i);if(i-=B-c.length(),C!==void 0&&C>i){if(f.strict){var A=new Error("Too few bytes to read ASN.1 value.");throw A.available=c.length(),A.remaining=i,A.requested=C,A}C=i}var T,s,m=(_&32)===32;if(m)if(T=[],C===void 0)for(;;){if(a(c,i,2),c.bytes(2)===String.fromCharCode(0,0)){c.getBytes(2),i-=2;break}B=c.length(),T.push(l(c,i,v+1,f)),i-=B-c.length()}else while(C>0)B=c.length(),T.push(l(c,C,v+1,f)),i-=B-c.length(),C-=B-c.length();if(T===void 0&&I===e.Class.UNIVERSAL&&h===e.Type.BITSTRING)s=c.bytes(C);if(T===void 0&&f.decodeBitStrings&&I===e.Class.UNIVERSAL&&h===e.Type.BITSTRING&&C>1){var E=c.read,N=i,U=0;if(h===e.Type.BITSTRING)a(c,i,1),U=c.getByte(),i--;if(U===0)try{B=c.length();var g={strict:!0,decodeBitStrings:!0},o=l(c,i,v+1,g),n=B-c.length();if(i-=n,h==e.Type.BITSTRING)n++;var w=o.tagClass;if(n===C&&(w===e.Class.UNIVERSAL||w===e.Class.CONTEXT_SPECIFIC))T=[o]}catch(O){}if(T===void 0)c.read=E,i=N}if(T===void 0){if(C===void 0){if(f.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");C=i}if(h===e.Type.BMPSTRING){T="";for(;C>0;C-=2)a(c,i,2),T+=String.fromCharCode(c.getInt16()),i-=2}else T=c.getBytes(C),i-=C}var K=s===void 0?null:{bitStringContents:s};return e.create(I,h,m,T,K)}e.toDer=function(c){var i=t.util.createBuffer(),v=c.tagClass|c.type,f=t.util.createBuffer(),B=!1;if("bitStringContents"in c){if(B=!0,c.original)B=e.equals(c,c.original)}if(B)f.putBytes(c.bitStringContents);else if(c.composed){if(c.constructed)v|=32;else f.putByte(0);for(var _=0;_<c.value.length;++_)if(c.value[_]!==void 0)f.putBuffer(e.toDer(c.value[_]))}else if(c.type===e.Type.BMPSTRING)for(var _=0;_<c.value.length;++_)f.putInt16(c.value.charCodeAt(_));else if(c.type===e.Type.INTEGER&&c.value.length>1&&(c.value.charCodeAt(0)===0&&(c.value.charCodeAt(1)&128)===0||c.value.charCodeAt(0)===255&&(c.value.charCodeAt(1)&128)===128))f.putBytes(c.value.substr(1));else f.putBytes(c.value);if(i.putByte(v),f.length()<=127)i.putByte(f.length()&127);else{var I=f.length(),h="";do h+=String.fromCharCode(I&255),I=I>>>8;while(I>0);i.putByte(h.length|128);for(var _=h.length-1;_>=0;--_)i.putByte(h.charCodeAt(_))}return i.putBuffer(f),i},e.oidToDer=function(c){var i=c.split("."),v=t.util.createBuffer();v.putByte(40*parseInt(i[0],10)+parseInt(i[1],10));var f,B,_,I;for(var h=2;h<i.length;++h){f=!0,B=[],_=parseInt(i[h],10);do{if(I=_&127,_=_>>>7,!f)I|=128;B.push(I),f=!1}while(_>0);for(var C=B.length-1;C>=0;--C)v.putByte(B[C])}return v},e.derToOid=function(c){var i;if(typeof c==="string")c=t.util.createBuffer(c);var v=c.getByte();i=Math.floor(v/40)+"."+v%40;var f=0;while(c.length()>0)if(v=c.getByte(),f=f<<7,v&128)f+=v&127;else i+="."+(f+v),f=0;return i},e.utcTimeToDate=function(c){var i=new Date,v=parseInt(c.substr(0,2),10);v=v>=50?1900+v:2000+v;var f=parseInt(c.substr(2,2),10)-1,B=parseInt(c.substr(4,2),10),_=parseInt(c.substr(6,2),10),I=parseInt(c.substr(8,2),10),h=0;if(c.length>11){var C=c.charAt(10),A=10;if(C!=="+"&&C!=="-")h=parseInt(c.substr(10,2),10),A+=2}if(i.setUTCFullYear(v,f,B),i.setUTCHours(_,I,h,0),A){if(C=c.charAt(A),C==="+"||C==="-"){var T=parseInt(c.substr(A+1,2),10),s=parseInt(c.substr(A+4,2),10),m=T*60+s;if(m*=60000,C==="+")i.setTime(+i-m);else i.setTime(+i+m)}}return i},e.generalizedTimeToDate=function(c){var i=new Date,v=parseInt(c.substr(0,4),10),f=parseInt(c.substr(4,2),10)-1,B=parseInt(c.substr(6,2),10),_=parseInt(c.substr(8,2),10),I=parseInt(c.substr(10,2),10),h=parseInt(c.substr(12,2),10),C=0,A=0,T=!1;if(c.charAt(c.length-1)==="Z")T=!0;var s=c.length-5,m=c.charAt(s);if(m==="+"||m==="-"){var E=parseInt(c.substr(s+1,2),10),N=parseInt(c.substr(s+4,2),10);if(A=E*60+N,A*=60000,m==="+")A*=-1;T=!0}if(c.charAt(14)===".")C=parseFloat(c.substr(14),10)*1000;if(T)i.setUTCFullYear(v,f,B),i.setUTCHours(_,I,h,C),i.setTime(+i+A);else i.setFullYear(v,f,B),i.setHours(_,I,h,C);return i},e.dateToUtcTime=function(c){if(typeof c==="string")return c;var i="",v=[];v.push((""+c.getUTCFullYear()).substr(2)),v.push(""+(c.getUTCMonth()+1)),v.push(""+c.getUTCDate()),v.push(""+c.getUTCHours()),v.push(""+c.getUTCMinutes()),v.push(""+c.getUTCSeconds());for(var f=0;f<v.length;++f){if(v[f].length<2)i+="0";i+=v[f]}return i+="Z",i},e.dateToGeneralizedTime=function(c){if(typeof c==="string")return c;var i="",v=[];v.push(""+c.getUTCFullYear()),v.push(""+(c.getUTCMonth()+1)),v.push(""+c.getUTCDate()),v.push(""+c.getUTCHours()),v.push(""+c.getUTCMinutes()),v.push(""+c.getUTCSeconds());for(var f=0;f<v.length;++f){if(v[f].length<2)i+="0";i+=v[f]}return i+="Z",i},e.integerToDer=function(c){var i=t.util.createBuffer();if(c>=-128&&c<128)return i.putSignedInt(c,8);if(c>=-32768&&c<32768)return i.putSignedInt(c,16);if(c>=-8388608&&c<8388608)return i.putSignedInt(c,24);if(c>=-2147483648&&c<2147483648)return i.putSignedInt(c,32);var v=new Error("Integer too large; max is 32-bits.");throw v.integer=c,v},e.derToInteger=function(c){if(typeof c==="string")c=t.util.createBuffer(c);var i=c.length()*8;if(i>32)throw new Error("Integer too large; max is 32-bits.");return c.getSignedInt(i)},e.validate=function(c,i,v,f){var B=!1;if((c.tagClass===i.tagClass||typeof i.tagClass==="undefined")&&(c.type===i.type||typeof i.type==="undefined")){if(c.constructed===i.constructed||typeof i.constructed==="undefined"){if(B=!0,i.value&&t.util.isArray(i.value)){var _=0;for(var I=0;B&&I<i.value.length;++I){if(B=i.value[I].optional||!1,c.value[_]){if(B=e.validate(c.value[_],i.value[I],v,f),B)++_;else if(i.value[I].optional)B=!0}if(!B&&f)f.push("["+i.name+'] Tag class "'+i.tagClass+'", type "'+i.type+'" expected value length "'+i.value.length+'", got "'+c.value.length+'"')}}if(B&&v){if(i.capture)v[i.capture]=c.value;if(i.captureAsn1)v[i.captureAsn1]=c;if(i.captureBitStringContents&&"bitStringContents"in c)v[i.captureBitStringContents]=c.bitStringContents;if(i.captureBitStringValue&&"bitStringContents"in c){var h;if(c.bitStringContents.length<2)v[i.captureBitStringValue]="";else{var C=c.bitStringContents.charCodeAt(0);if(C!==0)throw new Error("captureBitStringValue only supported for zero unused bits");v[i.captureBitStringValue]=c.bitStringContents.slice(1)}}}}else if(f)f.push("["+i.name+'] Expected constructed "'+i.constructed+'", got "'+c.constructed+'"')}else if(f){if(c.tagClass!==i.tagClass)f.push("["+i.name+'] Expected tag class "'+i.tagClass+'", got "'+c.tagClass+'"');if(c.type!==i.type)f.push("["+i.name+'] Expected type "'+i.type+'", got "'+c.type+'"')}return B};var p=/[^\\u0000-\\u00ff]/;e.prettyPrint=function(c,i,v){var f="";if(i=i||0,v=v||2,i>0)f+=`
|
|
41
|
-
`;var B="";for(var _=0;_<i*v;++_)B+=" ";switch(f+=B+"Tag: ",c.tagClass){case e.Class.UNIVERSAL:f+="Universal:";break;case e.Class.APPLICATION:f+="Application:";break;case e.Class.CONTEXT_SPECIFIC:f+="Context-Specific:";break;case e.Class.PRIVATE:f+="Private:";break}if(c.tagClass===e.Class.UNIVERSAL)switch(f+=c.type,c.type){case e.Type.NONE:f+=" (None)";break;case e.Type.BOOLEAN:f+=" (Boolean)";break;case e.Type.INTEGER:f+=" (Integer)";break;case e.Type.BITSTRING:f+=" (Bit string)";break;case e.Type.OCTETSTRING:f+=" (Octet string)";break;case e.Type.NULL:f+=" (Null)";break;case e.Type.OID:f+=" (Object Identifier)";break;case e.Type.ODESC:f+=" (Object Descriptor)";break;case e.Type.EXTERNAL:f+=" (External or Instance of)";break;case e.Type.REAL:f+=" (Real)";break;case e.Type.ENUMERATED:f+=" (Enumerated)";break;case e.Type.EMBEDDED:f+=" (Embedded PDV)";break;case e.Type.UTF8:f+=" (UTF8)";break;case e.Type.ROID:f+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:f+=" (Sequence)";break;case e.Type.SET:f+=" (Set)";break;case e.Type.PRINTABLESTRING:f+=" (Printable String)";break;case e.Type.IA5String:f+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:f+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:f+=" (Generalized time)";break;case e.Type.BMPSTRING:f+=" (BMP String)";break}else f+=c.type;if(f+=`
|
|
42
|
-
`,f+=B+"Constructed: "+c.constructed+`
|
|
43
|
-
`,c.composed){var I=0,h="";for(var _=0;_<c.value.length;++_)if(c.value[_]!==void 0){if(I+=1,h+=e.prettyPrint(c.value[_],i+1,v),_+1<c.value.length)h+=","}f+=B+"Sub values: "+I+h}else{if(f+=B+"Value: ",c.type===e.Type.OID){var C=e.derToOid(c.value);if(f+=C,t.pki&&t.pki.oids){if(C in t.pki.oids)f+=" ("+t.pki.oids[C]+") "}}if(c.type===e.Type.INTEGER)try{f+=e.derToInteger(c.value)}catch(T){f+="0x"+t.util.bytesToHex(c.value)}else if(c.type===e.Type.BITSTRING){if(c.value.length>1)f+="0x"+t.util.bytesToHex(c.value.slice(1));else f+="(none)";if(c.value.length>0){var A=c.value.charCodeAt(0);if(A==1)f+=" (1 unused bit shown)";else if(A>1)f+=" ("+A+" unused bits shown)"}}else if(c.type===e.Type.OCTETSTRING){if(!p.test(c.value))f+="("+c.value+") ";f+="0x"+t.util.bytesToHex(c.value)}else if(c.type===e.Type.UTF8)try{f+=t.util.decodeUtf8(c.value)}catch(T){if(T.message==="URI malformed")f+="0x"+t.util.bytesToHex(c.value)+" (malformed UTF8)";else throw T}else if(c.type===e.Type.PRINTABLESTRING||c.type===e.Type.IA5String)f+=c.value;else if(p.test(c.value))f+="0x"+t.util.bytesToHex(c.value);else if(c.value.length===0)f+="[null]";else f+=c.value}return f}}),St=le((r,S)=>{var t=de();S.exports=t.md=t.md||{},t.md.algorithms=t.md.algorithms||{}}),Wt=le((r,S)=>{var t=de();St(),Ee();var e=S.exports=t.hmac=t.hmac||{};e.create=function(){var a=null,y=null,l=null,p=null,c={};return c.start=function(i,v){if(i!==null)if(typeof i==="string")if(i=i.toLowerCase(),i in t.md.algorithms)y=t.md.algorithms[i].create();else throw new Error('Unknown hash algorithm "'+i+'"');else y=i;if(v===null)v=a;else{if(typeof v==="string")v=t.util.createBuffer(v);else if(t.util.isArray(v)){var f=v;v=t.util.createBuffer();for(var B=0;B<f.length;++B)v.putByte(f[B])}var _=v.length();if(_>y.blockLength)y.start(),y.update(v.bytes()),v=y.digest();l=t.util.createBuffer(),p=t.util.createBuffer(),_=v.length();for(var B=0;B<_;++B){var f=v.at(B);l.putByte(54^f),p.putByte(92^f)}if(_<y.blockLength){var f=y.blockLength-_;for(var B=0;B<f;++B)l.putByte(54),p.putByte(92)}a=v,l=l.bytes(),p=p.bytes()}y.start(),y.update(l)},c.update=function(i){y.update(i)},c.getMac=function(){var i=y.digest().bytes();return y.start(),y.update(p),y.update(i),y.digest()},c.digest=c.getMac,c}}),Mr=le((r,S)=>{var t=de();St(),Ee();var e=S.exports=t.md5=t.md5||{};t.md.md5=t.md.algorithms.md5=e,e.create=function(){if(!c)i();var f=null,B=t.util.createBuffer(),_=new Array(16),I={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return I.start=function(){I.messageLength=0,I.fullMessageLength=I.messageLength64=[];var h=I.messageLengthSize/4;for(var C=0;C<h;++C)I.fullMessageLength.push(0);return B=t.util.createBuffer(),f={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},I},I.start(),I.update=function(h,C){if(C==="utf8")h=t.util.encodeUtf8(h);var A=h.length;I.messageLength+=A,A=[A/4294967296>>>0,A>>>0];for(var T=I.fullMessageLength.length-1;T>=0;--T)I.fullMessageLength[T]+=A[1],A[1]=A[0]+(I.fullMessageLength[T]/4294967296>>>0),I.fullMessageLength[T]=I.fullMessageLength[T]>>>0,A[0]=A[1]/4294967296>>>0;if(B.putBytes(h),v(f,_,B),B.read>2048||B.length()===0)B.compact();return I},I.digest=function(){var h=t.util.createBuffer();h.putBytes(B.bytes());var C=I.fullMessageLength[I.fullMessageLength.length-1]+I.messageLengthSize,A=C&I.blockLength-1;h.putBytes(a.substr(0,I.blockLength-A));var T,s=0;for(var m=I.fullMessageLength.length-1;m>=0;--m)T=I.fullMessageLength[m]*8+s,s=T/4294967296>>>0,h.putInt32Le(T>>>0);var E={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3};v(E,_,h);var N=t.util.createBuffer();return N.putInt32Le(E.h0),N.putInt32Le(E.h1),N.putInt32Le(E.h2),N.putInt32Le(E.h3),N},I};var a=null,y=null,l=null,p=null,c=!1;function i(){a=String.fromCharCode(128),a+=t.util.fillString(String.fromCharCode(0),64),y=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],l=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],p=new Array(64);for(var f=0;f<64;++f)p[f]=Math.floor(Math.abs(Math.sin(f+1))*4294967296);c=!0}function v(f,B,_){var I,h,C,A,T,s,m,E,N=_.length();while(N>=64){h=f.h0,C=f.h1,A=f.h2,T=f.h3;for(E=0;E<16;++E)B[E]=_.getInt32Le(),s=T^C&(A^T),I=h+s+p[E]+B[E],m=l[E],h=T,T=A,A=C,C+=I<<m|I>>>32-m;for(;E<32;++E)s=A^T&(C^A),I=h+s+p[E]+B[y[E]],m=l[E],h=T,T=A,A=C,C+=I<<m|I>>>32-m;for(;E<48;++E)s=C^A^T,I=h+s+p[E]+B[y[E]],m=l[E],h=T,T=A,A=C,C+=I<<m|I>>>32-m;for(;E<64;++E)s=A^(C|~T),I=h+s+p[E]+B[y[E]],m=l[E],h=T,T=A,A=C,C+=I<<m|I>>>32-m;f.h0=f.h0+h|0,f.h1=f.h1+C|0,f.h2=f.h2+A|0,f.h3=f.h3+T|0,N-=64}}}),Gt=le((r,S)=>{var t=de();Ee();var e=S.exports=t.pem=t.pem||{};e.encode=function(l,p){p=p||{};var c="-----BEGIN "+l.type+`-----\r
|
|
44
|
-
`,i;if(l.procType)i={name:"Proc-Type",values:[String(l.procType.version),l.procType.type]},c+=a(i);if(l.contentDomain)i={name:"Content-Domain",values:[l.contentDomain]},c+=a(i);if(l.dekInfo){if(i={name:"DEK-Info",values:[l.dekInfo.algorithm]},l.dekInfo.parameters)i.values.push(l.dekInfo.parameters);c+=a(i)}if(l.headers)for(var v=0;v<l.headers.length;++v)c+=a(l.headers[v]);if(l.procType)c+=`\r
|
|
45
|
-
`;return c+=t.util.encode64(l.body,p.maxline||64)+`\r
|
|
46
|
-
`,c+="-----END "+l.type+`-----\r
|
|
47
|
-
`,c},e.decode=function(l){var p=[],c=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,i=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,v=/\r?\n/,f;while(!0){if(f=c.exec(l),!f)break;var B=f[1];if(B==="NEW CERTIFICATE REQUEST")B="CERTIFICATE REQUEST";var _={type:B,procType:null,contentDomain:null,dekInfo:null,headers:[],body:t.util.decode64(f[3])};if(p.push(_),!f[2])continue;var I=f[2].split(v),h=0;while(f&&h<I.length){var C=I[h].replace(/\s+$/,"");for(var A=h+1;A<I.length;++A){var T=I[A];if(!/\s/.test(T[0]))break;C+=T,h=A}if(f=C.match(i),f){var s={name:f[1],values:[]},m=f[2].split(",");for(var E=0;E<m.length;++E)s.values.push(y(m[E]));if(!_.procType){if(s.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');else if(s.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');_.procType={version:m[0],type:m[1]}}else if(!_.contentDomain&&s.name==="Content-Domain")_.contentDomain=m[0]||"";else if(!_.dekInfo&&s.name==="DEK-Info"){if(s.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');_.dekInfo={algorithm:m[0],parameters:m[1]||null}}else _.headers.push(s)}++h}if(_.procType==="ENCRYPTED"&&!_.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}if(p.length===0)throw new Error("Invalid PEM formatted message.");return p};function a(l){var p=l.name+": ",c=[],i=function(I,h){return" "+h};for(var v=0;v<l.values.length;++v)c.push(l.values[v].replace(/^(\S+\r\n)/,i));p+=c.join(",")+`\r
|
|
48
|
-
`;var f=0,B=-1;for(var v=0;v<p.length;++v,++f)if(f>65&&B!==-1){var _=p[B];if(_===",")++B,p=p.substr(0,B)+`\r
|
|
49
|
-
`+p.substr(B);else p=p.substr(0,B)+`\r
|
|
50
|
-
`+_+p.substr(B+1);f=v-B-1,B=-1,++v}else if(p[v]===" "||p[v]==="\t"||p[v]===",")B=v;return p}function y(l){return l.replace(/^\s+/,"")}}),lr=le((r,S)=>{var t=de();Pr(),Pi(),Ee(),S.exports=t.des=t.des||{},t.des.startEncrypting=function(h,C,A,T){var s=I({key:h,output:A,decrypt:!1,mode:T||(C===null?"ECB":"CBC")});return s.start(C),s},t.des.createEncryptionCipher=function(h,C){return I({key:h,output:null,decrypt:!1,mode:C})},t.des.startDecrypting=function(h,C,A,T){var s=I({key:h,output:A,decrypt:!0,mode:T||(C===null?"ECB":"CBC")});return s.start(C),s},t.des.createDecryptionCipher=function(h,C){return I({key:h,output:null,decrypt:!0,mode:C})},t.des.Algorithm=function(h,C){var A=this;A.name=h,A.mode=new C({blockSize:8,cipher:{encrypt:function(T,s){return _(A._keys,T,s,!1)},decrypt:function(T,s){return _(A._keys,T,s,!0)}}}),A._init=!1},t.des.Algorithm.prototype.initialize=function(h){if(this._init)return;var C=t.util.createBuffer(h.key);if(this.name.indexOf("3DES")===0){if(C.length()!==24)throw new Error("Invalid Triple-DES key size: "+C.length()*8)}this._keys=B(C),this._init=!0},e("DES-ECB",t.cipher.modes.ecb),e("DES-CBC",t.cipher.modes.cbc),e("DES-CFB",t.cipher.modes.cfb),e("DES-OFB",t.cipher.modes.ofb),e("DES-CTR",t.cipher.modes.ctr),e("3DES-ECB",t.cipher.modes.ecb),e("3DES-CBC",t.cipher.modes.cbc),e("3DES-CFB",t.cipher.modes.cfb),e("3DES-OFB",t.cipher.modes.ofb),e("3DES-CTR",t.cipher.modes.ctr);function e(h,C){var A=function(){return new t.des.Algorithm(h,C)};t.cipher.registerAlgorithm(h,A)}var a=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],y=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],l=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],p=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],i=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],v=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function B(h){var C=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],A=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],T=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],m=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],E=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],N=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],U=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],g=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],o=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],n=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],w=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],K=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],O=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],V=h.length()>8?3:1,F=[],H=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],j=0,Q;for(var Z=0;Z<V;Z++){var J=h.getInt32(),te=h.getInt32();Q=(J>>>4^te)&252645135,te^=Q,J^=Q<<4,Q=(te>>>-16^J)&65535,J^=Q,te^=Q<<-16,Q=(J>>>2^te)&858993459,te^=Q,J^=Q<<2,Q=(te>>>-16^J)&65535,J^=Q,te^=Q<<-16,Q=(J>>>1^te)&1431655765,te^=Q,J^=Q<<1,Q=(te>>>8^J)&16711935,J^=Q,te^=Q<<8,Q=(J>>>1^te)&1431655765,te^=Q,J^=Q<<1,Q=J<<8|te>>>20&240,J=te<<24|te<<8&16711680|te>>>8&65280|te>>>24&240,te=Q;for(var se=0;se<H.length;++se){if(H[se])J=J<<2|J>>>26,te=te<<2|te>>>26;else J=J<<1|J>>>27,te=te<<1|te>>>27;J&=-15,te&=-15;var fe=C[J>>>28]|A[J>>>24&15]|T[J>>>20&15]|s[J>>>16&15]|m[J>>>12&15]|E[J>>>8&15]|N[J>>>4&15],me=U[te>>>28]|g[te>>>24&15]|o[te>>>20&15]|n[te>>>16&15]|w[te>>>12&15]|K[te>>>8&15]|O[te>>>4&15];Q=(me>>>16^fe)&65535,F[j++]=fe^Q,F[j++]=me^Q<<16}}return F}function _(h,C,A,T){var s=h.length===32?3:9,m;if(s===3)m=T?[30,-2,-2]:[0,32,2];else m=T?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var E,N=C[0],U=C[1];E=(N>>>4^U)&252645135,U^=E,N^=E<<4,E=(N>>>16^U)&65535,U^=E,N^=E<<16,E=(U>>>2^N)&858993459,N^=E,U^=E<<2,E=(U>>>8^N)&16711935,N^=E,U^=E<<8,E=(N>>>1^U)&1431655765,U^=E,N^=E<<1,N=N<<1|N>>>31,U=U<<1|U>>>31;for(var g=0;g<s;g+=3){var o=m[g+1],n=m[g+2];for(var w=m[g];w!=o;w+=n){var K=U^h[w],O=(U>>>4|U<<28)^h[w+1];E=N,N=U,U=E^(y[K>>>24&63]|p[K>>>16&63]|i[K>>>8&63]|f[K&63]|a[O>>>24&63]|l[O>>>16&63]|c[O>>>8&63]|v[O&63])}E=N,N=U,U=E}N=N>>>1|N<<31,U=U>>>1|U<<31,E=(N>>>1^U)&1431655765,U^=E,N^=E<<1,E=(U>>>8^N)&16711935,N^=E,U^=E<<8,E=(U>>>2^N)&858993459,N^=E,U^=E<<2,E=(N>>>16^U)&65535,U^=E,N^=E<<16,E=(N>>>4^U)&252645135,U^=E,N^=E<<4,A[0]=N,A[1]=U}function I(h){h=h||{};var C=(h.mode||"CBC").toUpperCase(),A="DES-"+C,T;if(h.decrypt)T=t.cipher.createDecipher(A,h.key);else T=t.cipher.createCipher(A,h.key);var s=T.start;return T.start=function(m,E){var N=null;if(E instanceof t.util.ByteBuffer)N=E,E={};E=E||{},E.output=N,E.iv=m,s.call(T,E)},T}}),Or=le((r,S)=>{var t=de();Wt(),St(),Ee();var e=t.pkcs5=t.pkcs5||{},a;if(t.util.isNodejs&&!t.options.usePureJavaScript)a=ur("crypto");S.exports=t.pbkdf2=e.pbkdf2=function(y,l,p,c,i,v){if(typeof i==="function")v=i,i=null;if(t.util.isNodejs&&!t.options.usePureJavaScript&&a.pbkdf2&&(i===null||typeof i!=="object")&&(a.pbkdf2Sync.length>4||(!i||i==="sha1"))){if(typeof i!=="string")i="sha1";if(y=Buffer.from(y,"binary"),l=Buffer.from(l,"binary"),!v){if(a.pbkdf2Sync.length===4)return a.pbkdf2Sync(y,l,p,c).toString("binary");return a.pbkdf2Sync(y,l,p,c,i).toString("binary")}if(a.pbkdf2Sync.length===4)return a.pbkdf2(y,l,p,c,function(g,o){if(g)return v(g);v(null,o.toString("binary"))});return a.pbkdf2(y,l,p,c,i,function(g,o){if(g)return v(g);v(null,o.toString("binary"))})}if(typeof i==="undefined"||i===null)i="sha1";if(typeof i==="string"){if(!(i in t.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=t.md[i].create()}var f=i.digestLength;if(c>4294967295*f){var B=new Error("Derived key is too long.");if(v)return v(B);throw B}var _=Math.ceil(c/f),I=c-(_-1)*f,h=t.hmac.create();h.start(i,y);var C="",A,T,s;if(!v){for(var m=1;m<=_;++m){h.start(null,null),h.update(l),h.update(t.util.int32ToBytes(m)),A=s=h.digest().getBytes();for(var E=2;E<=p;++E)h.start(null,null),h.update(s),T=h.digest().getBytes(),A=t.util.xorBytes(A,T,f),s=T;C+=m<_?A:A.substr(0,I)}return C}var m=1,E;function N(){if(m>_)return v(null,C);h.start(null,null),h.update(l),h.update(t.util.int32ToBytes(m)),A=s=h.digest().getBytes(),E=2,U()}function U(){if(E<=p)return h.start(null,null),h.update(s),T=h.digest().getBytes(),A=t.util.xorBytes(A,T,f),s=T,++E,t.util.setImmediate(U);C+=m<_?A:A.substr(0,I),++m,N()}N()}}),Mi=le((r,S)=>{var t=de();St(),Ee();var e=S.exports=t.sha256=t.sha256||{};t.md.sha256=t.md.algorithms.sha256=e,e.create=function(){if(!y)p();var i=null,v=t.util.createBuffer(),f=new Array(64),B={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return B.start=function(){B.messageLength=0,B.fullMessageLength=B.messageLength64=[];var _=B.messageLengthSize/4;for(var I=0;I<_;++I)B.fullMessageLength.push(0);return v=t.util.createBuffer(),i={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},B},B.start(),B.update=function(_,I){if(I==="utf8")_=t.util.encodeUtf8(_);var h=_.length;B.messageLength+=h,h=[h/4294967296>>>0,h>>>0];for(var C=B.fullMessageLength.length-1;C>=0;--C)B.fullMessageLength[C]+=h[1],h[1]=h[0]+(B.fullMessageLength[C]/4294967296>>>0),B.fullMessageLength[C]=B.fullMessageLength[C]>>>0,h[0]=h[1]/4294967296>>>0;if(v.putBytes(_),c(i,f,v),v.read>2048||v.length()===0)v.compact();return B},B.digest=function(){var _=t.util.createBuffer();_.putBytes(v.bytes());var I=B.fullMessageLength[B.fullMessageLength.length-1]+B.messageLengthSize,h=I&B.blockLength-1;_.putBytes(a.substr(0,B.blockLength-h));var C,A,T=B.fullMessageLength[0]*8;for(var s=0;s<B.fullMessageLength.length-1;++s)C=B.fullMessageLength[s+1]*8,A=C/4294967296>>>0,T+=A,_.putInt32(T>>>0),T=C>>>0;_.putInt32(T);var m={h0:i.h0,h1:i.h1,h2:i.h2,h3:i.h3,h4:i.h4,h5:i.h5,h6:i.h6,h7:i.h7};c(m,f,_);var E=t.util.createBuffer();return E.putInt32(m.h0),E.putInt32(m.h1),E.putInt32(m.h2),E.putInt32(m.h3),E.putInt32(m.h4),E.putInt32(m.h5),E.putInt32(m.h6),E.putInt32(m.h7),E},B};var a=null,y=!1,l=null;function p(){a=String.fromCharCode(128),a+=t.util.fillString(String.fromCharCode(0),64),l=[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],y=!0}function c(i,v,f){var B,_,I,h,C,A,T,s,m,E,N,U,g,o,n,w=f.length();while(w>=64){for(T=0;T<16;++T)v[T]=f.getInt32();for(;T<64;++T)B=v[T-2],B=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,_=v[T-15],_=(_>>>7|_<<25)^(_>>>18|_<<14)^_>>>3,v[T]=B+v[T-7]+_+v[T-16]|0;s=i.h0,m=i.h1,E=i.h2,N=i.h3,U=i.h4,g=i.h5,o=i.h6,n=i.h7;for(T=0;T<64;++T)h=(U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7),C=o^U&(g^o),I=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),A=s&m|E&(s^m),B=n+h+C+l[T]+v[T],_=I+A,n=o,o=g,g=U,U=N+B>>>0,N=E,E=m,m=s,s=B+_>>>0;i.h0=i.h0+s|0,i.h1=i.h1+m|0,i.h2=i.h2+E|0,i.h3=i.h3+N|0,i.h4=i.h4+U|0,i.h5=i.h5+g|0,i.h6=i.h6+o|0,i.h7=i.h7+n|0,w-=64}}}),Oi=le((r,S)=>{var t=de();Ee();var e=null;if(t.util.isNodejs&&!t.options.usePureJavaScript&&!process.versions["node-webkit"])e=ur("crypto");var a=S.exports=t.prng=t.prng||{};a.create=function(y){var l={plugin:y,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},p=y.md,c=new Array(32);for(var i=0;i<32;++i)c[i]=p.create();l.pools=c,l.pool=0,l.generate=function(I,h){if(!h)return l.generateSync(I);var C=l.plugin.cipher,A=l.plugin.increment,T=l.plugin.formatKey,s=l.plugin.formatSeed,m=t.util.createBuffer();l.key=null,E();function E(N){if(N)return h(N);if(m.length()>=I)return h(null,m.getBytes(I));if(l.generated>1048575)l.key=null;if(l.key===null)return t.util.nextTick(function(){v(E)});var U=C(l.key,l.seed);l.generated+=U.length,m.putBytes(U),l.key=T(C(l.key,A(l.seed))),l.seed=s(C(l.key,l.seed)),t.util.setImmediate(E)}},l.generateSync=function(I){var h=l.plugin.cipher,C=l.plugin.increment,A=l.plugin.formatKey,T=l.plugin.formatSeed;l.key=null;var s=t.util.createBuffer();while(s.length()<I){if(l.generated>1048575)l.key=null;if(l.key===null)f();var m=h(l.key,l.seed);l.generated+=m.length,s.putBytes(m),l.key=A(h(l.key,C(l.seed))),l.seed=T(h(l.key,l.seed))}return s.getBytes(I)};function v(I){if(l.pools[0].messageLength>=32)return B(),I();var h=32-l.pools[0].messageLength<<5;l.seedFile(h,function(C,A){if(C)return I(C);l.collect(A),B(),I()})}function f(){if(l.pools[0].messageLength>=32)return B();var I=32-l.pools[0].messageLength<<5;l.collect(l.seedFileSync(I)),B()}function B(){l.reseeds=l.reseeds===4294967295?0:l.reseeds+1;var I=l.plugin.md.create();I.update(l.keyBytes);var h=1;for(var C=0;C<32;++C){if(l.reseeds%h===0)I.update(l.pools[C].digest().getBytes()),l.pools[C].start();h=h<<1}l.keyBytes=I.digest().getBytes(),I.start(),I.update(l.keyBytes);var A=I.digest().getBytes();l.key=l.plugin.formatKey(l.keyBytes),l.seed=l.plugin.formatSeed(A),l.generated=0}function _(I){var h=null,C=t.util.globalScope,A=C.crypto||C.msCrypto;if(A&&A.getRandomValues)h=function(n){return A.getRandomValues(n)};var T=t.util.createBuffer();if(h)while(T.length()<I){var s=Math.max(1,Math.min(I-T.length(),65536)/4),m=new Uint32Array(Math.floor(s));try{h(m);for(var E=0;E<m.length;++E)T.putInt32(m[E])}catch(n){if(!(typeof QuotaExceededError!=="undefined"&&n instanceof QuotaExceededError))throw n}}if(T.length()<I){var N,U,g,o=Math.floor(Math.random()*65536);while(T.length()<I){U=16807*(o&65535),N=16807*(o>>16),U+=(N&32767)<<16,U+=N>>15,U=(U&2147483647)+(U>>31),o=U&4294967295;for(var E=0;E<3;++E)g=o>>>(E<<3),g^=Math.floor(Math.random()*256),T.putByte(g&255)}}return T.getBytes(I)}if(e)l.seedFile=function(I,h){e.randomBytes(I,function(C,A){if(C)return h(C);h(null,A.toString())})},l.seedFileSync=function(I){return e.randomBytes(I).toString()};else l.seedFile=function(I,h){try{h(null,_(I))}catch(C){h(C)}},l.seedFileSync=_;return l.collect=function(I){var h=I.length;for(var C=0;C<h;++C)l.pools[l.pool].update(I.substr(C,1)),l.pool=l.pool===31?0:l.pool+1},l.collectInt=function(I,h){var C="";for(var A=0;A<h;A+=8)C+=String.fromCharCode(I>>A&255);l.collect(C)},l.registerWorker=function(I){if(I===self)l.seedFile=function(C,A){function T(s){var m=s.data;if(m.forge&&m.forge.prng)self.removeEventListener("message",T),A(m.forge.prng.err,m.forge.prng.bytes)}self.addEventListener("message",T),self.postMessage({forge:{prng:{needed:C}}})};else{var h=function(C){var A=C.data;if(A.forge&&A.forge.prng)l.seedFile(A.forge.prng.needed,function(T,s){I.postMessage({forge:{prng:{err:T,bytes:s}}})})};I.addEventListener("message",h)}},l}}),ht=le((r,S)=>{var t=de();Dt(),Mi(),Oi(),Ee(),function(){if(t.random&&t.random.getBytes){S.exports=t.random;return}(function(e){var a={},y=new Array(4),l=t.util.createBuffer();a.formatKey=function(I){var h=t.util.createBuffer(I);return I=new Array(4),I[0]=h.getInt32(),I[1]=h.getInt32(),I[2]=h.getInt32(),I[3]=h.getInt32(),t.aes._expandKey(I,!1)},a.formatSeed=function(I){var h=t.util.createBuffer(I);return I=new Array(4),I[0]=h.getInt32(),I[1]=h.getInt32(),I[2]=h.getInt32(),I[3]=h.getInt32(),I},a.cipher=function(I,h){return t.aes._updateBlock(I,h,y,!1),l.putInt32(y[0]),l.putInt32(y[1]),l.putInt32(y[2]),l.putInt32(y[3]),l.getBytes()},a.increment=function(I){return++I[3],I},a.md=t.md.sha256;function p(){var I=t.prng.create(a);return I.getBytes=function(h,C){return I.generate(h,C)},I.getBytesSync=function(h){return I.generate(h)},I}var c=p(),i=null,v=t.util.globalScope,f=v.crypto||v.msCrypto;if(f&&f.getRandomValues)i=function(I){return f.getRandomValues(I)};if(t.options.usePureJavaScript||!t.util.isNodejs&&!i){if(typeof window==="undefined"||window.document===void 0);if(c.collectInt(+new Date,32),typeof navigator!=="undefined"){var B="";for(var _ in navigator)try{if(typeof navigator[_]=="string")B+=navigator[_]}catch(I){}c.collect(B),B=null}if(e)e().mousemove(function(I){c.collectInt(I.clientX,16),c.collectInt(I.clientY,16)}),e().keypress(function(I){c.collectInt(I.charCode,8)})}if(!t.random)t.random=c;else for(var _ in c)t.random[_]=c[_];t.random.createInstance=p,S.exports=t.random})(typeof jQuery!=="undefined"?jQuery:null)}()}),Fi=le((r,S)=>{var t=de();Ee();var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],a=[1,2,3,5],y=function(c,i){return c<<i&65535|(c&65535)>>16-i},l=function(c,i){return(c&65535)>>i|c<<16-i&65535};S.exports=t.rc2=t.rc2||{},t.rc2.expandKey=function(c,i){if(typeof c==="string")c=t.util.createBuffer(c);i=i||128;var v=c,f=c.length(),B=i,_=Math.ceil(B/8),I=255>>(B&7),h;for(h=f;h<128;h++)v.putByte(e[v.at(h-1)+v.at(h-f)&255]);v.setAt(128-_,e[v.at(128-_)&I]);for(h=127-_;h>=0;h--)v.setAt(h,e[v.at(h+1)^v.at(h+_)]);return v};var p=function(c,i,v){var f=!1,B=null,_=null,I=null,h,C,A,T,s=[];c=t.rc2.expandKey(c,i);for(A=0;A<64;A++)s.push(c.getInt16Le());if(v)h=function(N){for(A=0;A<4;A++)N[A]+=s[T]+(N[(A+3)%4]&N[(A+2)%4])+(~N[(A+3)%4]&N[(A+1)%4]),N[A]=y(N[A],a[A]),T++},C=function(N){for(A=0;A<4;A++)N[A]+=s[N[(A+3)%4]&63]};else h=function(N){for(A=3;A>=0;A--)N[A]=l(N[A],a[A]),N[A]-=s[T]+(N[(A+3)%4]&N[(A+2)%4])+(~N[(A+3)%4]&N[(A+1)%4]),T--},C=function(N){for(A=3;A>=0;A--)N[A]-=s[N[(A+3)%4]&63]};var m=function(N){var U=[];for(A=0;A<4;A++){var g=B.getInt16Le();if(I!==null)if(v)g^=I.getInt16Le();else I.putInt16Le(g);U.push(g&65535)}T=v?0:63;for(var o=0;o<N.length;o++)for(var n=0;n<N[o][0];n++)N[o][1](U);for(A=0;A<4;A++){if(I!==null)if(v)I.putInt16Le(U[A]);else U[A]^=I.getInt16Le();_.putInt16Le(U[A])}},E=null;return E={start:function(N,U){if(N){if(typeof N==="string")N=t.util.createBuffer(N)}f=!1,B=t.util.createBuffer(),_=U||new t.util.createBuffer,I=N,E.output=_},update:function(N){if(!f)B.putBuffer(N);while(B.length()>=8)m([[5,h],[1,C],[6,h],[1,C],[5,h]])},finish:function(N){var U=!0;if(v)if(N)U=N(8,B,!v);else{var g=B.length()===8?8:8-B.length();B.fillWithByte(g,g)}if(U)f=!0,E.update();if(!v){if(U=B.length()===0,U)if(N)U=N(8,_,!v);else{var o=_.length(),n=_.at(o-1);if(n>o)U=!1;else _.truncate(n)}}return U}},E};t.rc2.startEncrypting=function(c,i,v){var f=t.rc2.createEncryptionCipher(c,128);return f.start(i,v),f},t.rc2.createEncryptionCipher=function(c,i){return p(c,i,!0)},t.rc2.startDecrypting=function(c,i,v){var f=t.rc2.createDecryptionCipher(c,128);return f.start(i,v),f},t.rc2.createDecryptionCipher=function(c,i){return p(c,i,!1)}}),fr=le((r,S)=>{var t=de();S.exports=t.jsbn=t.jsbn||{};var e,a=244837814094590,y=(a&16777215)==15715070;function l(b,R,P){if(this.data=[],b!=null)if(typeof b=="number")this.fromNumber(b,R,P);else if(R==null&&typeof b!="string")this.fromString(b,256);else this.fromString(b,R)}t.jsbn.BigInteger=l;function p(){return new l(null)}function c(b,R,P,q,X,$){while(--$>=0){var ne=R*this.data[b++]+P.data[q]+X;X=Math.floor(ne/67108864),P.data[q++]=ne&67108863}return X}function i(b,R,P,q,X,$){var ne=R&32767,re=R>>15;while(--$>=0){var Se=this.data[b]&32767,We=this.data[b++]>>15,ot=re*Se+We*ne;Se=ne*Se+((ot&32767)<<15)+P.data[q]+(X&1073741823),X=(Se>>>30)+(ot>>>15)+re*We+(X>>>30),P.data[q++]=Se&1073741823}return X}function v(b,R,P,q,X,$){var ne=R&16383,re=R>>14;while(--$>=0){var Se=this.data[b]&16383,We=this.data[b++]>>14,ot=re*Se+We*ne;Se=ne*Se+((ot&16383)<<14)+P.data[q]+X,X=(Se>>28)+(ot>>14)+re*We,P.data[q++]=Se&268435455}return X}if(typeof navigator==="undefined")l.prototype.am=v,e=28;else if(y&&navigator.appName=="Microsoft Internet Explorer")l.prototype.am=i,e=30;else if(y&&navigator.appName!="Netscape")l.prototype.am=c,e=26;else l.prototype.am=v,e=28;l.prototype.DB=e,l.prototype.DM=(1<<e)-1,l.prototype.DV=1<<e;var f=52;l.prototype.FV=Math.pow(2,f),l.prototype.F1=f-e,l.prototype.F2=2*e-f;var B="0123456789abcdefghijklmnopqrstuvwxyz",_=new Array,I,h;I=48;for(h=0;h<=9;++h)_[I++]=h;I=97;for(h=10;h<36;++h)_[I++]=h;I=65;for(h=10;h<36;++h)_[I++]=h;function C(b){return B.charAt(b)}function A(b,R){var P=_[b.charCodeAt(R)];return P==null?-1:P}function T(b){for(var R=this.t-1;R>=0;--R)b.data[R]=this.data[R];b.t=this.t,b.s=this.s}function s(b){if(this.t=1,this.s=b<0?-1:0,b>0)this.data[0]=b;else if(b<-1)this.data[0]=b+this.DV;else this.t=0}function m(b){var R=p();return R.fromInt(b),R}function E(b,R){var P;if(R==16)P=4;else if(R==8)P=3;else if(R==256)P=8;else if(R==2)P=1;else if(R==32)P=5;else if(R==4)P=2;else{this.fromRadix(b,R);return}this.t=0,this.s=0;var q=b.length,X=!1,$=0;while(--q>=0){var ne=P==8?b[q]&255:A(b,q);if(ne<0){if(b.charAt(q)=="-")X=!0;continue}if(X=!1,$==0)this.data[this.t++]=ne;else if($+P>this.DB)this.data[this.t-1]|=(ne&(1<<this.DB-$)-1)<<$,this.data[this.t++]=ne>>this.DB-$;else this.data[this.t-1]|=ne<<$;if($+=P,$>=this.DB)$-=this.DB}if(P==8&&(b[0]&128)!=0){if(this.s=-1,$>0)this.data[this.t-1]|=(1<<this.DB-$)-1<<$}if(this.clamp(),X)l.ZERO.subTo(this,this)}function N(){var b=this.s&this.DM;while(this.t>0&&this.data[this.t-1]==b)--this.t}function U(b){if(this.s<0)return"-"+this.negate().toString(b);var R;if(b==16)R=4;else if(b==8)R=3;else if(b==2)R=1;else if(b==32)R=5;else if(b==4)R=2;else return this.toRadix(b);var P=(1<<R)-1,q,X=!1,$="",ne=this.t,re=this.DB-ne*this.DB%R;if(ne-- >0){if(re<this.DB&&(q=this.data[ne]>>re)>0)X=!0,$=C(q);while(ne>=0){if(re<R)q=(this.data[ne]&(1<<re)-1)<<R-re,q|=this.data[--ne]>>(re+=this.DB-R);else if(q=this.data[ne]>>(re-=R)&P,re<=0)re+=this.DB,--ne;if(q>0)X=!0;if(X)$+=C(q)}}return X?$:"0"}function g(){var b=p();return l.ZERO.subTo(this,b),b}function o(){return this.s<0?this.negate():this}function n(b){var R=this.s-b.s;if(R!=0)return R;var P=this.t;if(R=P-b.t,R!=0)return this.s<0?-R:R;while(--P>=0)if((R=this.data[P]-b.data[P])!=0)return R;return 0}function w(b){var R=1,P;if((P=b>>>16)!=0)b=P,R+=16;if((P=b>>8)!=0)b=P,R+=8;if((P=b>>4)!=0)b=P,R+=4;if((P=b>>2)!=0)b=P,R+=2;if((P=b>>1)!=0)b=P,R+=1;return R}function K(){if(this.t<=0)return 0;return this.DB*(this.t-1)+w(this.data[this.t-1]^this.s&this.DM)}function O(b,R){var P;for(P=this.t-1;P>=0;--P)R.data[P+b]=this.data[P];for(P=b-1;P>=0;--P)R.data[P]=0;R.t=this.t+b,R.s=this.s}function V(b,R){for(var P=b;P<this.t;++P)R.data[P-b]=this.data[P];R.t=Math.max(this.t-b,0),R.s=this.s}function F(b,R){var P=b%this.DB,q=this.DB-P,X=(1<<q)-1,$=Math.floor(b/this.DB),ne=this.s<<P&this.DM,re;for(re=this.t-1;re>=0;--re)R.data[re+$+1]=this.data[re]>>q|ne,ne=(this.data[re]&X)<<P;for(re=$-1;re>=0;--re)R.data[re]=0;R.data[$]=ne,R.t=this.t+$+1,R.s=this.s,R.clamp()}function H(b,R){R.s=this.s;var P=Math.floor(b/this.DB);if(P>=this.t){R.t=0;return}var q=b%this.DB,X=this.DB-q,$=(1<<q)-1;R.data[0]=this.data[P]>>q;for(var ne=P+1;ne<this.t;++ne)R.data[ne-P-1]|=(this.data[ne]&$)<<X,R.data[ne-P]=this.data[ne]>>q;if(q>0)R.data[this.t-P-1]|=(this.s&$)<<X;R.t=this.t-P,R.clamp()}function j(b,R){var P=0,q=0,X=Math.min(b.t,this.t);while(P<X)q+=this.data[P]-b.data[P],R.data[P++]=q&this.DM,q>>=this.DB;if(b.t<this.t){q-=b.s;while(P<this.t)q+=this.data[P],R.data[P++]=q&this.DM,q>>=this.DB;q+=this.s}else{q+=this.s;while(P<b.t)q-=b.data[P],R.data[P++]=q&this.DM,q>>=this.DB;q-=b.s}if(R.s=q<0?-1:0,q<-1)R.data[P++]=this.DV+q;else if(q>0)R.data[P++]=q;R.t=P,R.clamp()}function Q(b,R){var P=this.abs(),q=b.abs(),X=P.t;R.t=X+q.t;while(--X>=0)R.data[X]=0;for(X=0;X<q.t;++X)R.data[X+P.t]=P.am(0,q.data[X],R,X,0,P.t);if(R.s=0,R.clamp(),this.s!=b.s)l.ZERO.subTo(R,R)}function Z(b){var R=this.abs(),P=b.t=2*R.t;while(--P>=0)b.data[P]=0;for(P=0;P<R.t-1;++P){var q=R.am(P,R.data[P],b,2*P,0,1);if((b.data[P+R.t]+=R.am(P+1,2*R.data[P],b,2*P+1,q,R.t-P-1))>=R.DV)b.data[P+R.t]-=R.DV,b.data[P+R.t+1]=1}if(b.t>0)b.data[b.t-1]+=R.am(P,R.data[P],b,2*P,0,1);b.s=0,b.clamp()}function J(b,R,P){var q=b.abs();if(q.t<=0)return;var X=this.abs();if(X.t<q.t){if(R!=null)R.fromInt(0);if(P!=null)this.copyTo(P);return}if(P==null)P=p();var $=p(),ne=this.s,re=b.s,Se=this.DB-w(q.data[q.t-1]);if(Se>0)q.lShiftTo(Se,$),X.lShiftTo(Se,P);else q.copyTo($),X.copyTo(P);var We=$.t,ot=$.data[We-1];if(ot==0)return;var st=ot*(1<<this.F1)+(We>1?$.data[We-2]>>this.F2:0),Ct=this.FV/st,er=(1<<this.F1)/st,lt=1<<this.F2,ft=P.t,tr=ft-We,It=R==null?p():R;if($.dlShiftTo(tr,It),P.compareTo(It)>=0)P.data[P.t++]=1,P.subTo(It,P);l.ONE.dlShiftTo(We,It),It.subTo($,$);while($.t<We)$.data[$.t++]=0;while(--tr>=0){var Er=P.data[--ft]==ot?this.DM:Math.floor(P.data[ft]*Ct+(P.data[ft-1]+lt)*er);if((P.data[ft]+=$.am(0,Er,P,tr,0,We))<Er){$.dlShiftTo(tr,It),P.subTo(It,P);while(P.data[ft]<--Er)P.subTo(It,P)}}if(R!=null){if(P.drShiftTo(We,R),ne!=re)l.ZERO.subTo(R,R)}if(P.t=We,P.clamp(),Se>0)P.rShiftTo(Se,P);if(ne<0)l.ZERO.subTo(P,P)}function te(b){var R=p();if(this.abs().divRemTo(b,null,R),this.s<0&&R.compareTo(l.ZERO)>0)b.subTo(R,R);return R}function se(b){this.m=b}function fe(b){if(b.s<0||b.compareTo(this.m)>=0)return b.mod(this.m);else return b}function me(b){return b}function Ae(b){b.divRemTo(this.m,null,b)}function x(b,R,P){b.multiplyTo(R,P),this.reduce(P)}function Ce(b,R){b.squareTo(R),this.reduce(R)}se.prototype.convert=fe,se.prototype.revert=me,se.prototype.reduce=Ae,se.prototype.mulTo=x,se.prototype.sqrTo=Ce;function ee(){if(this.t<1)return 0;var b=this.data[0];if((b&1)==0)return 0;var R=b&3;return R=R*(2-(b&15)*R)&15,R=R*(2-(b&255)*R)&255,R=R*(2-((b&65535)*R&65535))&65535,R=R*(2-b*R%this.DV)%this.DV,R>0?this.DV-R:-R}function Be(b){this.m=b,this.mp=b.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<b.DB-15)-1,this.mt2=2*b.t}function ye(b){var R=p();if(b.abs().dlShiftTo(this.m.t,R),R.divRemTo(this.m,null,R),b.s<0&&R.compareTo(l.ZERO)>0)this.m.subTo(R,R);return R}function d(b){var R=p();return b.copyTo(R),this.reduce(R),R}function L(b){while(b.t<=this.mt2)b.data[b.t++]=0;for(var R=0;R<this.m.t;++R){var P=b.data[R]&32767,q=P*this.mpl+((P*this.mph+(b.data[R]>>15)*this.mpl&this.um)<<15)&b.DM;P=R+this.m.t,b.data[P]+=this.m.am(0,q,b,R,0,this.m.t);while(b.data[P]>=b.DV)b.data[P]-=b.DV,b.data[++P]++}if(b.clamp(),b.drShiftTo(this.m.t,b),b.compareTo(this.m)>=0)b.subTo(this.m,b)}function D(b,R){b.squareTo(R),this.reduce(R)}function u(b,R,P){b.multiplyTo(R,P),this.reduce(P)}Be.prototype.convert=ye,Be.prototype.revert=d,Be.prototype.reduce=L,Be.prototype.mulTo=u,Be.prototype.sqrTo=D;function k(){return(this.t>0?this.data[0]&1:this.s)==0}function G(b,R){if(b>4294967295||b<1)return l.ONE;var P=p(),q=p(),X=R.convert(this),$=w(b)-1;X.copyTo(P);while(--$>=0)if(R.sqrTo(P,q),(b&1<<$)>0)R.mulTo(q,X,P);else{var ne=P;P=q,q=ne}return R.revert(P)}function M(b,R){var P;if(b<256||R.isEven())P=new se(R);else P=new Be(R);return this.exp(b,P)}l.prototype.copyTo=T,l.prototype.fromInt=s,l.prototype.fromString=E,l.prototype.clamp=N,l.prototype.dlShiftTo=O,l.prototype.drShiftTo=V,l.prototype.lShiftTo=F,l.prototype.rShiftTo=H,l.prototype.subTo=j,l.prototype.multiplyTo=Q,l.prototype.squareTo=Z,l.prototype.divRemTo=J,l.prototype.invDigit=ee,l.prototype.isEven=k,l.prototype.exp=G,l.prototype.toString=U,l.prototype.negate=g,l.prototype.abs=o,l.prototype.compareTo=n,l.prototype.bitLength=K,l.prototype.mod=te,l.prototype.modPowInt=M,l.ZERO=m(0),l.ONE=m(1);function W(){var b=p();return this.copyTo(b),b}function ie(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;else if(this.t==0)return-1}else if(this.t==1)return this.data[0];else if(this.t==0)return 0;return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function oe(){return this.t==0?this.s:this.data[0]<<24>>24}function z(){return this.t==0?this.s:this.data[0]<<16>>16}function ae(b){return Math.floor(Math.LN2*this.DB/Math.log(b))}function ue(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this.data[0]<=0)return 0;else return 1}function ve(b){if(b==null)b=10;if(this.signum()==0||b<2||b>36)return"0";var R=this.chunkSize(b),P=Math.pow(b,R),q=m(P),X=p(),$=p(),ne="";this.divRemTo(q,X,$);while(X.signum()>0)ne=(P+$.intValue()).toString(b).substr(1)+ne,X.divRemTo(q,X,$);return $.intValue().toString(b)+ne}function he(b,R){if(this.fromInt(0),R==null)R=10;var P=this.chunkSize(R),q=Math.pow(R,P),X=!1,$=0,ne=0;for(var re=0;re<b.length;++re){var Se=A(b,re);if(Se<0){if(b.charAt(re)=="-"&&this.signum()==0)X=!0;continue}if(ne=R*ne+Se,++$>=P)this.dMultiply(q),this.dAddOffset(ne,0),$=0,ne=0}if($>0)this.dMultiply(Math.pow(R,$)),this.dAddOffset(ne,0);if(X)l.ZERO.subTo(this,this)}function be(b,R,P){if(typeof R=="number")if(b<2)this.fromInt(1);else{if(this.fromNumber(b,P),!this.testBit(b-1))this.bitwiseTo(l.ONE.shiftLeft(b-1),Le,this);if(this.isEven())this.dAddOffset(1,0);while(!this.isProbablePrime(R))if(this.dAddOffset(2,0),this.bitLength()>b)this.subTo(l.ONE.shiftLeft(b-1),this)}else{var q=new Array,X=b&7;if(q.length=(b>>3)+1,R.nextBytes(q),X>0)q[0]&=(1<<X)-1;else q[0]=0;this.fromString(q,256)}}function _e(){var b=this.t,R=new Array;R[0]=this.s;var P=this.DB-b*this.DB%8,q,X=0;if(b-- >0){if(P<this.DB&&(q=this.data[b]>>P)!=(this.s&this.DM)>>P)R[X++]=q|this.s<<this.DB-P;while(b>=0){if(P<8)q=(this.data[b]&(1<<P)-1)<<8-P,q|=this.data[--b]>>(P+=this.DB-8);else if(q=this.data[b]>>(P-=8)&255,P<=0)P+=this.DB,--b;if((q&128)!=0)q|=-256;if(X==0&&(this.s&128)!=(q&128))++X;if(X>0||q!=this.s)R[X++]=q}}return R}function ke(b){return this.compareTo(b)==0}function Ne(b){return this.compareTo(b)<0?this:b}function Te(b){return this.compareTo(b)>0?this:b}function Ie(b,R,P){var q,X,$=Math.min(b.t,this.t);for(q=0;q<$;++q)P.data[q]=R(this.data[q],b.data[q]);if(b.t<this.t){X=b.s&this.DM;for(q=$;q<this.t;++q)P.data[q]=R(this.data[q],X);P.t=this.t}else{X=this.s&this.DM;for(q=$;q<b.t;++q)P.data[q]=R(X,b.data[q]);P.t=b.t}P.s=R(this.s,b.s),P.clamp()}function Ue(b,R){return b&R}function Je(b){var R=p();return this.bitwiseTo(b,Ue,R),R}function Le(b,R){return b|R}function tt(b){var R=p();return this.bitwiseTo(b,Le,R),R}function rt(b,R){return b^R}function at(b){var R=p();return this.bitwiseTo(b,rt,R),R}function nt(b,R){return b&~R}function ct(b){var R=p();return this.bitwiseTo(b,nt,R),R}function dt(){var b=p();for(var R=0;R<this.t;++R)b.data[R]=this.DM&~this.data[R];return b.t=this.t,b.s=~this.s,b}function mt(b){var R=p();if(b<0)this.rShiftTo(-b,R);else this.lShiftTo(b,R);return R}function Tt(b){var R=p();if(b<0)this.lShiftTo(-b,R);else this.rShiftTo(b,R);return R}function wt(b){if(b==0)return-1;var R=0;if((b&65535)==0)b>>=16,R+=16;if((b&255)==0)b>>=8,R+=8;if((b&15)==0)b>>=4,R+=4;if((b&3)==0)b>>=2,R+=2;if((b&1)==0)++R;return R}function Vt(){for(var b=0;b<this.t;++b)if(this.data[b]!=0)return b*this.DB+wt(this.data[b]);if(this.s<0)return this.t*this.DB;return-1}function Ht(b){var R=0;while(b!=0)b&=b-1,++R;return R}function Jt(){var b=0,R=this.s&this.DM;for(var P=0;P<this.t;++P)b+=Ht(this.data[P]^R);return b}function Ve(b){var R=Math.floor(b/this.DB);if(R>=this.t)return this.s!=0;return(this.data[R]&1<<b%this.DB)!=0}function Ke(b,R){var P=l.ONE.shiftLeft(b);return this.bitwiseTo(P,R,P),P}function Pe(b){return this.changeBit(b,Le)}function Me(b){return this.changeBit(b,nt)}function Oe(b){return this.changeBit(b,rt)}function Fe(b,R){var P=0,q=0,X=Math.min(b.t,this.t);while(P<X)q+=this.data[P]+b.data[P],R.data[P++]=q&this.DM,q>>=this.DB;if(b.t<this.t){q+=b.s;while(P<this.t)q+=this.data[P],R.data[P++]=q&this.DM,q>>=this.DB;q+=this.s}else{q+=this.s;while(P<b.t)q+=b.data[P],R.data[P++]=q&this.DM,q>>=this.DB;q+=b.s}if(R.s=q<0?-1:0,q>0)R.data[P++]=q;else if(q<-1)R.data[P++]=this.DV+q;R.t=P,R.clamp()}function Ge(b){var R=p();return this.addTo(b,R),R}function qe(b){var R=p();return this.subTo(b,R),R}function He(b){var R=p();return this.multiplyTo(b,R),R}function je(b){var R=p();return this.divRemTo(b,R,null),R}function Qe(b){var R=p();return this.divRemTo(b,null,R),R}function ze(b){var R=p(),P=p();return this.divRemTo(b,R,P),new Array(R,P)}function Ye(b){this.data[this.t]=this.am(0,b-1,this,0,0,this.t),++this.t,this.clamp()}function Xe(b,R){if(b==0)return;while(this.t<=R)this.data[this.t++]=0;this.data[R]+=b;while(this.data[R]>=this.DV){if(this.data[R]-=this.DV,++R>=this.t)this.data[this.t++]=0;++this.data[R]}}function we(){}function De(b){return b}function ya(b,R,P){b.multiplyTo(R,P)}function ga(b,R){b.squareTo(R)}we.prototype.convert=De,we.prototype.revert=De,we.prototype.mulTo=ya,we.prototype.sqrTo=ga;function va(b){return this.exp(b,new we)}function ma(b,R,P){var q=Math.min(this.t+b.t,R);P.s=0,P.t=q;while(q>0)P.data[--q]=0;var X;for(X=P.t-this.t;q<X;++q)P.data[q+this.t]=this.am(0,b.data[q],P,q,0,this.t);for(X=Math.min(b.t,R);q<X;++q)this.am(0,b.data[q],P,q,0,R-q);P.clamp()}function Ca(b,R,P){--R;var q=P.t=this.t+b.t-R;P.s=0;while(--q>=0)P.data[q]=0;for(q=Math.max(R-this.t,0);q<b.t;++q)P.data[this.t+q-R]=this.am(R-q,b.data[q],P,0,0,this.t+q-R);P.clamp(),P.drShiftTo(1,P)}function Kt(b){this.r2=p(),this.q3=p(),l.ONE.dlShiftTo(2*b.t,this.r2),this.mu=this.r2.divide(b),this.m=b}function Ea(b){if(b.s<0||b.t>2*this.m.t)return b.mod(this.m);else if(b.compareTo(this.m)<0)return b;else{var R=p();return b.copyTo(R),this.reduce(R),R}}function Sa(b){return b}function Ta(b){if(b.drShiftTo(this.m.t-1,this.r2),b.t>this.m.t+1)b.t=this.m.t+1,b.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(b.compareTo(this.r2)<0)b.dAddOffset(1,this.m.t+1);b.subTo(this.r2,b);while(b.compareTo(this.m)>=0)b.subTo(this.m,b)}function Ia(b,R){b.squareTo(R),this.reduce(R)}function Aa(b,R,P){b.multiplyTo(R,P),this.reduce(P)}Kt.prototype.convert=Ea,Kt.prototype.revert=Sa,Kt.prototype.reduce=Ta,Kt.prototype.mulTo=Aa,Kt.prototype.sqrTo=Ia;function Ba(b,R){var P=b.bitLength(),q,X=m(1),$;if(P<=0)return X;else if(P<18)q=1;else if(P<48)q=3;else if(P<144)q=4;else if(P<768)q=5;else q=6;if(P<8)$=new se(R);else if(R.isEven())$=new Kt(R);else $=new Be(R);var ne=new Array,re=3,Se=q-1,We=(1<<q)-1;if(ne[1]=$.convert(this),q>1){var ot=p();$.sqrTo(ne[1],ot);while(re<=We)ne[re]=p(),$.mulTo(ot,ne[re-2],ne[re]),re+=2}var st=b.t-1,Ct,er=!0,lt=p(),ft;P=w(b.data[st])-1;while(st>=0){if(P>=Se)Ct=b.data[st]>>P-Se&We;else if(Ct=(b.data[st]&(1<<P+1)-1)<<Se-P,st>0)Ct|=b.data[st-1]>>this.DB+P-Se;re=q;while((Ct&1)==0)Ct>>=1,--re;if((P-=re)<0)P+=this.DB,--st;if(er)ne[Ct].copyTo(X),er=!1;else{while(re>1)$.sqrTo(X,lt),$.sqrTo(lt,X),re-=2;if(re>0)$.sqrTo(X,lt);else ft=X,X=lt,lt=ft;$.mulTo(lt,ne[Ct],X)}while(st>=0&&(b.data[st]&1<<P)==0)if($.sqrTo(X,lt),ft=X,X=lt,lt=ft,--P<0)P=this.DB-1,--st}return $.revert(X)}function ba(b){var R=this.s<0?this.negate():this.clone(),P=b.s<0?b.negate():b.clone();if(R.compareTo(P)<0){var q=R;R=P,P=q}var X=R.getLowestSetBit(),$=P.getLowestSetBit();if($<0)return R;if(X<$)$=X;if($>0)R.rShiftTo($,R),P.rShiftTo($,P);while(R.signum()>0){if((X=R.getLowestSetBit())>0)R.rShiftTo(X,R);if((X=P.getLowestSetBit())>0)P.rShiftTo(X,P);if(R.compareTo(P)>=0)R.subTo(P,R),R.rShiftTo(1,R);else P.subTo(R,P),P.rShiftTo(1,P)}if($>0)P.lShiftTo($,P);return P}function Na(b){if(b<=0)return 0;var R=this.DV%b,P=this.s<0?b-1:0;if(this.t>0)if(R==0)P=this.data[0]%b;else for(var q=this.t-1;q>=0;--q)P=(R*P+this.data[q])%b;return P}function wa(b){var R=b.isEven();if(this.isEven()&&R||b.signum()==0)return l.ZERO;var P=b.clone(),q=this.clone(),X=m(1),$=m(0),ne=m(0),re=m(1);while(P.signum()!=0){while(P.isEven()){if(P.rShiftTo(1,P),R){if(!X.isEven()||!$.isEven())X.addTo(this,X),$.subTo(b,$);X.rShiftTo(1,X)}else if(!$.isEven())$.subTo(b,$);$.rShiftTo(1,$)}while(q.isEven()){if(q.rShiftTo(1,q),R){if(!ne.isEven()||!re.isEven())ne.addTo(this,ne),re.subTo(b,re);ne.rShiftTo(1,ne)}else if(!re.isEven())re.subTo(b,re);re.rShiftTo(1,re)}if(P.compareTo(q)>=0){if(P.subTo(q,P),R)X.subTo(ne,X);$.subTo(re,$)}else{if(q.subTo(P,q),R)ne.subTo(X,ne);re.subTo($,re)}}if(q.compareTo(l.ONE)!=0)return l.ZERO;if(re.compareTo(b)>=0)return re.subtract(b);if(re.signum()<0)re.addTo(b,re);else return re;if(re.signum()<0)return re.add(b);else return re}var ut=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ka=67108864/ut[ut.length-1];function Ra(b){var R,P=this.abs();if(P.t==1&&P.data[0]<=ut[ut.length-1]){for(R=0;R<ut.length;++R)if(P.data[0]==ut[R])return!0;return!1}if(P.isEven())return!1;R=1;while(R<ut.length){var q=ut[R],X=R+1;while(X<ut.length&&q<ka)q*=ut[X++];q=P.modInt(q);while(R<X)if(q%ut[R++]==0)return!1}return P.millerRabin(b)}function _a(b){var R=this.subtract(l.ONE),P=R.getLowestSetBit();if(P<=0)return!1;var q=R.shiftRight(P),X=Da(),$;for(var ne=0;ne<b;++ne){do $=new l(this.bitLength(),X);while($.compareTo(l.ONE)<=0||$.compareTo(R)>=0);var re=$.modPow(q,this);if(re.compareTo(l.ONE)!=0&&re.compareTo(R)!=0){var Se=1;while(Se++<P&&re.compareTo(R)!=0)if(re=re.modPowInt(2,this),re.compareTo(l.ONE)==0)return!1;if(re.compareTo(R)!=0)return!1}}return!0}function Da(){return{nextBytes:function(b){for(var R=0;R<b.length;++R)b[R]=Math.floor(Math.random()*256)}}}l.prototype.chunkSize=ae,l.prototype.toRadix=ve,l.prototype.fromRadix=he,l.prototype.fromNumber=be,l.prototype.bitwiseTo=Ie,l.prototype.changeBit=Ke,l.prototype.addTo=Fe,l.prototype.dMultiply=Ye,l.prototype.dAddOffset=Xe,l.prototype.multiplyLowerTo=ma,l.prototype.multiplyUpperTo=Ca,l.prototype.modInt=Na,l.prototype.millerRabin=_a,l.prototype.clone=W,l.prototype.intValue=ie,l.prototype.byteValue=oe,l.prototype.shortValue=z,l.prototype.signum=ue,l.prototype.toByteArray=_e,l.prototype.equals=ke,l.prototype.min=Ne,l.prototype.max=Te,l.prototype.and=Je,l.prototype.or=tt,l.prototype.xor=at,l.prototype.andNot=ct,l.prototype.not=dt,l.prototype.shiftLeft=mt,l.prototype.shiftRight=Tt,l.prototype.getLowestSetBit=Vt,l.prototype.bitCount=Jt,l.prototype.testBit=Ve,l.prototype.setBit=Pe,l.prototype.clearBit=Me,l.prototype.flipBit=Oe,l.prototype.add=Ge,l.prototype.subtract=qe,l.prototype.multiply=He,l.prototype.divide=je,l.prototype.remainder=Qe,l.prototype.divideAndRemainder=ze,l.prototype.modPow=Ba,l.prototype.modInverse=wa,l.prototype.pow=va,l.prototype.gcd=ba,l.prototype.isProbablePrime=Ra}),Zt=le((r,S)=>{var t=de();St(),Ee();var e=S.exports=t.sha1=t.sha1||{};t.md.sha1=t.md.algorithms.sha1=e,e.create=function(){if(!y)l();var c=null,i=t.util.createBuffer(),v=new Array(80),f={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return f.start=function(){f.messageLength=0,f.fullMessageLength=f.messageLength64=[];var B=f.messageLengthSize/4;for(var _=0;_<B;++_)f.fullMessageLength.push(0);return i=t.util.createBuffer(),c={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},f},f.start(),f.update=function(B,_){if(_==="utf8")B=t.util.encodeUtf8(B);var I=B.length;f.messageLength+=I,I=[I/4294967296>>>0,I>>>0];for(var h=f.fullMessageLength.length-1;h>=0;--h)f.fullMessageLength[h]+=I[1],I[1]=I[0]+(f.fullMessageLength[h]/4294967296>>>0),f.fullMessageLength[h]=f.fullMessageLength[h]>>>0,I[0]=I[1]/4294967296>>>0;if(i.putBytes(B),p(c,v,i),i.read>2048||i.length()===0)i.compact();return f},f.digest=function(){var B=t.util.createBuffer();B.putBytes(i.bytes());var _=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize,I=_&f.blockLength-1;B.putBytes(a.substr(0,f.blockLength-I));var h,C,A=f.fullMessageLength[0]*8;for(var T=0;T<f.fullMessageLength.length-1;++T)h=f.fullMessageLength[T+1]*8,C=h/4294967296>>>0,A+=C,B.putInt32(A>>>0),A=h>>>0;B.putInt32(A);var s={h0:c.h0,h1:c.h1,h2:c.h2,h3:c.h3,h4:c.h4};p(s,v,B);var m=t.util.createBuffer();return m.putInt32(s.h0),m.putInt32(s.h1),m.putInt32(s.h2),m.putInt32(s.h3),m.putInt32(s.h4),m},f};var a=null,y=!1;function l(){a=String.fromCharCode(128),a+=t.util.fillString(String.fromCharCode(0),64),y=!0}function p(c,i,v){var f,B,_,I,h,C,A,T,s=v.length();while(s>=64){B=c.h0,_=c.h1,I=c.h2,h=c.h3,C=c.h4;for(T=0;T<16;++T)f=v.getInt32(),i[T]=f,A=h^_&(I^h),f=(B<<5|B>>>27)+A+C+1518500249+f,C=h,h=I,I=(_<<30|_>>>2)>>>0,_=B,B=f;for(;T<20;++T)f=i[T-3]^i[T-8]^i[T-14]^i[T-16],f=f<<1|f>>>31,i[T]=f,A=h^_&(I^h),f=(B<<5|B>>>27)+A+C+1518500249+f,C=h,h=I,I=(_<<30|_>>>2)>>>0,_=B,B=f;for(;T<32;++T)f=i[T-3]^i[T-8]^i[T-14]^i[T-16],f=f<<1|f>>>31,i[T]=f,A=_^I^h,f=(B<<5|B>>>27)+A+C+1859775393+f,C=h,h=I,I=(_<<30|_>>>2)>>>0,_=B,B=f;for(;T<40;++T)f=i[T-6]^i[T-16]^i[T-28]^i[T-32],f=f<<2|f>>>30,i[T]=f,A=_^I^h,f=(B<<5|B>>>27)+A+C+1859775393+f,C=h,h=I,I=(_<<30|_>>>2)>>>0,_=B,B=f;for(;T<60;++T)f=i[T-6]^i[T-16]^i[T-28]^i[T-32],f=f<<2|f>>>30,i[T]=f,A=_&I|h&(_^I),f=(B<<5|B>>>27)+A+C+2400959708+f,C=h,h=I,I=(_<<30|_>>>2)>>>0,_=B,B=f;for(;T<80;++T)f=i[T-6]^i[T-16]^i[T-28]^i[T-32],f=f<<2|f>>>30,i[T]=f,A=_^I^h,f=(B<<5|B>>>27)+A+C+3395469782+f,C=h,h=I,I=(_<<30|_>>>2)>>>0,_=B,B=f;c.h0=c.h0+B|0,c.h1=c.h1+_|0,c.h2=c.h2+I|0,c.h3=c.h3+h|0,c.h4=c.h4+C|0,s-=64}}}),Gi=le((r,S)=>{var t=de();Ee(),ht(),Zt();var e=S.exports=t.pkcs1=t.pkcs1||{};e.encode_rsa_oaep=function(y,l,p){var c,i,v,f;if(typeof p==="string")c=p,i=arguments[3]||void 0,v=arguments[4]||void 0;else if(p){if(c=p.label||void 0,i=p.seed||void 0,v=p.md||void 0,p.mgf1&&p.mgf1.md)f=p.mgf1.md}if(!v)v=t.md.sha1.create();else v.start();if(!f)f=v;var B=Math.ceil(y.n.bitLength()/8),_=B-2*v.digestLength-2;if(l.length>_){var I=new Error("RSAES-OAEP input message length is too long.");throw I.length=l.length,I.maxLength=_,I}if(!c)c="";v.update(c,"raw");var h=v.digest(),C="",A=_-l.length;for(var T=0;T<A;T++)C+="\x00";var s=h.getBytes()+C+"\x01"+l;if(!i)i=t.random.getBytes(v.digestLength);else if(i.length!==v.digestLength){var I=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw I.seedLength=i.length,I.digestLength=v.digestLength,I}var m=a(i,B-v.digestLength-1,f),E=t.util.xorBytes(s,m,s.length),N=a(E,v.digestLength,f),U=t.util.xorBytes(i,N,i.length);return"\x00"+U+E},e.decode_rsa_oaep=function(y,l,p){var c,i,v;if(typeof p==="string")c=p,i=arguments[3]||void 0;else if(p){if(c=p.label||void 0,i=p.md||void 0,p.mgf1&&p.mgf1.md)v=p.mgf1.md}var f=Math.ceil(y.n.bitLength()/8);if(l.length!==f){var E=new Error("RSAES-OAEP encoded message length is invalid.");throw E.length=l.length,E.expectedLength=f,E}if(i===void 0)i=t.md.sha1.create();else i.start();if(!v)v=i;if(f<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");if(!c)c="";i.update(c,"raw");var B=i.digest().getBytes(),_=l.charAt(0),I=l.substring(1,i.digestLength+1),h=l.substring(1+i.digestLength),C=a(h,i.digestLength,v),A=t.util.xorBytes(I,C,I.length),T=a(A,f-i.digestLength-1,v),s=t.util.xorBytes(h,T,h.length),m=s.substring(0,i.digestLength),E=_!=="\x00";for(var N=0;N<i.digestLength;++N)E|=B.charAt(N)!==m.charAt(N);var U=1,g=i.digestLength;for(var o=i.digestLength;o<s.length;o++){var n=s.charCodeAt(o),w=n&1^1,K=U?65534:0;E|=n&K,U=U&w,g+=U}if(E||s.charCodeAt(g)!==1)throw new Error("Invalid RSAES-OAEP padding.");return s.substring(g+1)};function a(y,l,p){if(!p)p=t.md.sha1.create();var c="",i=Math.ceil(l/p.digestLength);for(var v=0;v<i;++v){var f=String.fromCharCode(v>>24&255,v>>16&255,v>>8&255,v&255);p.start(),p.update(y+f),c+=p.digest().getBytes()}return c.substring(0,l)}}),qi=le((r,S)=>{var t=de();Ee(),fr(),ht(),function(){if(t.prime){S.exports=t.prime;return}var e=S.exports=t.prime=t.prime||{},a=t.jsbn.BigInteger,y=[6,4,2,4,2,4,6,2],l=new a(null);l.fromInt(30);var p=function(I,h){return I|h};e.generateProbablePrime=function(I,h,C){if(typeof h==="function")C=h,h={};h=h||{};var A=h.algorithm||"PRIMEINC";if(typeof A==="string")A={name:A};A.options=A.options||{};var T=h.prng||t.random,s={nextBytes:function(m){var E=T.getBytesSync(m.length);for(var N=0;N<m.length;++N)m[N]=E.charCodeAt(N)}};if(A.name==="PRIMEINC")return c(I,s,A.options,C);throw new Error("Invalid prime generation algorithm: "+A.name)};function c(I,h,C,A){if("workers"in C)return f(I,h,C,A);return i(I,h,C,A)}function i(I,h,C,A){var T=B(I,h),s=0,m=_(T.bitLength());if("millerRabinTests"in C)m=C.millerRabinTests;var E=10;if("maxBlockTime"in C)E=C.maxBlockTime;v(T,I,h,s,m,E,A)}function v(I,h,C,A,T,s,m){var E=+new Date;do{if(I.bitLength()>h)I=B(h,C);if(I.isProbablePrime(T))return m(null,I);I.dAddOffset(y[A++%8],0)}while(s<0||+new Date-E<s);t.util.setImmediate(function(){v(I,h,C,A,T,s,m)})}function f(I,h,C,A){if(typeof Worker==="undefined")return i(I,h,C,A);var T=B(I,h),s=C.workers,m=C.workLoad||100,E=m*30/8,N=C.workerScript||"forge/prime.worker.js";if(s===-1)return t.util.estimateCores(function(g,o){if(g)o=2;s=o-1,U()});U();function U(){s=Math.max(1,s);var g=[];for(var o=0;o<s;++o)g[o]=new Worker(N);var n=s;for(var o=0;o<s;++o)g[o].addEventListener("message",K);var w=!1;function K(O){if(w)return;--n;var V=O.data;if(V.found){for(var F=0;F<g.length;++F)g[F].terminate();return w=!0,A(null,new a(V.prime,16))}if(T.bitLength()>I)T=B(I,h);var H=T.toString(16);O.target.postMessage({hex:H,workLoad:m}),T.dAddOffset(E,0)}}}function B(I,h){var C=new a(I,h),A=I-1;if(!C.testBit(A))C.bitwiseTo(a.ONE.shiftLeft(A),p,C);return C.dAddOffset(31-C.mod(l).byteValue(),0),C}function _(I){if(I<=100)return 27;if(I<=150)return 18;if(I<=200)return 15;if(I<=250)return 12;if(I<=300)return 9;if(I<=350)return 8;if(I<=400)return 7;if(I<=500)return 6;if(I<=600)return 5;if(I<=800)return 4;if(I<=1250)return 3;return 2}}()}),hr=le((r,S)=>{var t=de();if(gt(),fr(),Ut(),Gi(),qi(),ht(),Ee(),typeof e==="undefined")e=t.jsbn.BigInteger;var e,a=t.util.isNodejs?ur("crypto"):null,y=t.asn1,l=t.util;t.pki=t.pki||{},S.exports=t.pki.rsa=t.rsa=t.rsa||{};var p=t.pki,c=[6,4,2,4,2,4,6,2],i={name:"PrivateKeyInfo",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:y.Class.UNIVERSAL,type:y.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:y.Class.UNIVERSAL,type:y.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},v={name:"RSAPrivateKey",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},B=t.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:y.Class.UNIVERSAL,type:y.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:y.Class.UNIVERSAL,type:y.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},_={name:"DigestInfo",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:y.Class.UNIVERSAL,type:y.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:y.Class.UNIVERSAL,type:y.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:y.Class.UNIVERSAL,type:y.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},I=function(o){var n;if(o.algorithm in p.oids)n=p.oids[o.algorithm];else{var w=new Error("Unknown message digest algorithm.");throw w.algorithm=o.algorithm,w}var K=y.oidToDer(n).getBytes(),O=y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[]),V=y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[]);V.value.push(y.create(y.Class.UNIVERSAL,y.Type.OID,!1,K)),V.value.push(y.create(y.Class.UNIVERSAL,y.Type.NULL,!1,""));var F=y.create(y.Class.UNIVERSAL,y.Type.OCTETSTRING,!1,o.digest().getBytes());return O.value.push(V),O.value.push(F),y.toDer(O).getBytes()},h=function(o,n,w){if(w)return o.modPow(n.e,n.n);if(!n.p||!n.q)return o.modPow(n.d,n.n);if(!n.dP)n.dP=n.d.mod(n.p.subtract(e.ONE));if(!n.dQ)n.dQ=n.d.mod(n.q.subtract(e.ONE));if(!n.qInv)n.qInv=n.q.modInverse(n.p);var K;do K=new e(t.util.bytesToHex(t.random.getBytes(n.n.bitLength()/8)),16);while(K.compareTo(n.n)>=0||!K.gcd(n.n).equals(e.ONE));o=o.multiply(K.modPow(n.e,n.n)).mod(n.n);var O=o.mod(n.p).modPow(n.dP,n.p),V=o.mod(n.q).modPow(n.dQ,n.q);while(O.compareTo(V)<0)O=O.add(n.p);var F=O.subtract(V).multiply(n.qInv).mod(n.p).multiply(n.q).add(V);return F=F.multiply(K.modInverse(n.n)).mod(n.n),F};p.rsa.encrypt=function(o,n,w){var K=w,O,V=Math.ceil(n.n.bitLength()/8);if(w!==!1&&w!==!0)K=w===2,O=C(o,n,w);else O=t.util.createBuffer(),O.putBytes(o);var F=new e(O.toHex(),16),H=h(F,n,K),j=H.toString(16),Q=t.util.createBuffer(),Z=V-Math.ceil(j.length/2);while(Z>0)Q.putByte(0),--Z;return Q.putBytes(t.util.hexToBytes(j)),Q.getBytes()},p.rsa.decrypt=function(o,n,w,K){var O=Math.ceil(n.n.bitLength()/8);if(o.length!==O){var V=new Error("Encrypted message length is invalid.");throw V.length=o.length,V.expected=O,V}var F=new e(t.util.createBuffer(o).toHex(),16);if(F.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");var H=h(F,n,w),j=H.toString(16),Q=t.util.createBuffer(),Z=O-Math.ceil(j.length/2);while(Z>0)Q.putByte(0),--Z;if(Q.putBytes(t.util.hexToBytes(j)),K!==!1)return A(Q.getBytes(),n,w);return Q.getBytes()},p.rsa.createKeyPairGenerationState=function(o,n,w){if(typeof o==="string")o=parseInt(o,10);o=o||2048,w=w||{};var K=w.prng||t.random,O={nextBytes:function(H){var j=K.getBytesSync(H.length);for(var Q=0;Q<H.length;++Q)H[Q]=j.charCodeAt(Q)}},V=w.algorithm||"PRIMEINC",F;if(V==="PRIMEINC")F={algorithm:V,state:0,bits:o,rng:O,eInt:n||65537,e:new e(null),p:null,q:null,qBits:o>>1,pBits:o-(o>>1),pqState:0,num:null,keys:null},F.e.fromInt(F.eInt);else throw new Error("Invalid key generation algorithm: "+V);return F},p.rsa.stepKeyPairGenerationState=function(o,n){if(!("algorithm"in o))o.algorithm="PRIMEINC";var w=new e(null);w.fromInt(30);var K=0,O=function(J,te){return J|te},V=+new Date,F,H=0;while(o.keys===null&&(n<=0||H<n)){if(o.state===0){var j=o.p===null?o.pBits:o.qBits,Q=j-1;if(o.pqState===0){if(o.num=new e(j,o.rng),!o.num.testBit(Q))o.num.bitwiseTo(e.ONE.shiftLeft(Q),O,o.num);o.num.dAddOffset(31-o.num.mod(w).byteValue(),0),K=0,++o.pqState}else if(o.pqState===1)if(o.num.bitLength()>j)o.pqState=0;else if(o.num.isProbablePrime(m(o.num.bitLength())))++o.pqState;else o.num.dAddOffset(c[K++%8],0);else if(o.pqState===2)o.pqState=o.num.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)===0?3:0;else if(o.pqState===3){if(o.pqState=0,o.p===null)o.p=o.num;else o.q=o.num;if(o.p!==null&&o.q!==null)++o.state;o.num=null}}else if(o.state===1){if(o.p.compareTo(o.q)<0)o.num=o.p,o.p=o.q,o.q=o.num;++o.state}else if(o.state===2)o.p1=o.p.subtract(e.ONE),o.q1=o.q.subtract(e.ONE),o.phi=o.p1.multiply(o.q1),++o.state;else if(o.state===3)if(o.phi.gcd(o.e).compareTo(e.ONE)===0)++o.state;else o.p=null,o.q=null,o.state=0;else if(o.state===4)if(o.n=o.p.multiply(o.q),o.n.bitLength()===o.bits)++o.state;else o.q=null,o.state=0;else if(o.state===5){var Z=o.e.modInverse(o.phi);o.keys={privateKey:p.rsa.setPrivateKey(o.n,o.e,Z,o.p,o.q,Z.mod(o.p1),Z.mod(o.q1),o.q.modInverse(o.p)),publicKey:p.rsa.setPublicKey(o.n,o.e)}}F=+new Date,H+=F-V,V=F}return o.keys!==null},p.rsa.generateKeyPair=function(o,n,w,K){if(arguments.length===1){if(typeof o==="object")w=o,o=void 0;else if(typeof o==="function")K=o,o=void 0}else if(arguments.length===2)if(typeof o==="number"){if(typeof n==="function")K=n,n=void 0;else if(typeof n!=="number")w=n,n=void 0}else w=o,K=n,o=void 0,n=void 0;else if(arguments.length===3)if(typeof n==="number"){if(typeof w==="function")K=w,w=void 0}else K=w,w=n,n=void 0;if(w=w||{},o===void 0)o=w.bits||2048;if(n===void 0)n=w.e||65537;if(!t.options.usePureJavaScript&&!w.prng&&o>=256&&o<=16384&&(n===65537||n===3)){if(K){if(E("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:o,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(H,j,Q){if(H)return K(H);K(null,{privateKey:p.privateKeyFromPem(Q),publicKey:p.publicKeyFromPem(j)})});if(N("generateKey")&&N("exportKey"))return l.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:o,publicExponent:g(n),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(H){return l.globalScope.crypto.subtle.exportKey("pkcs8",H.privateKey)}).then(void 0,function(H){K(H)}).then(function(H){if(H){var j=p.privateKeyFromAsn1(y.fromDer(t.util.createBuffer(H)));K(null,{privateKey:j,publicKey:p.setRsaPublicKey(j.n,j.e)})}});if(U("generateKey")&&U("exportKey")){var O=l.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:o,publicExponent:g(n),hash:{name:"SHA-256"}},!0,["sign","verify"]);O.oncomplete=function(H){var j=H.target.result,Q=l.globalScope.msCrypto.subtle.exportKey("pkcs8",j.privateKey);Q.oncomplete=function(Z){var J=Z.target.result,te=p.privateKeyFromAsn1(y.fromDer(t.util.createBuffer(J)));K(null,{privateKey:te,publicKey:p.setRsaPublicKey(te.n,te.e)})},Q.onerror=function(Z){K(Z)}},O.onerror=function(H){K(H)};return}}else if(E("generateKeyPairSync")){var V=a.generateKeyPairSync("rsa",{modulusLength:o,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:p.privateKeyFromPem(V.privateKey),publicKey:p.publicKeyFromPem(V.publicKey)}}}var F=p.rsa.createKeyPairGenerationState(o,n,w);if(!K)return p.rsa.stepKeyPairGenerationState(F,0),F.keys;T(F,w,K)},p.setRsaPublicKey=p.rsa.setPublicKey=function(o,n){var w={n:o,e:n};return w.encrypt=function(K,O,V){if(typeof O==="string")O=O.toUpperCase();else if(O===void 0)O="RSAES-PKCS1-V1_5";if(O==="RSAES-PKCS1-V1_5")O={encode:function(H,j,Q){return C(H,j,2).getBytes()}};else if(O==="RSA-OAEP"||O==="RSAES-OAEP")O={encode:function(H,j){return t.pkcs1.encode_rsa_oaep(j,H,V)}};else if(["RAW","NONE","NULL",null].indexOf(O)!==-1)O={encode:function(H){return H}};else if(typeof O==="string")throw new Error('Unsupported encryption scheme: "'+O+'".');var F=O.encode(K,w,!0);return p.rsa.encrypt(F,w,!0)},w.verify=function(K,O,V,F){if(typeof V==="string")V=V.toUpperCase();else if(V===void 0)V="RSASSA-PKCS1-V1_5";if(F===void 0)F={_parseAllDigestBytes:!0};if(!("_parseAllDigestBytes"in F))F._parseAllDigestBytes=!0;if(V==="RSASSA-PKCS1-V1_5")V={verify:function(j,Q){Q=A(Q,w,!0);var Z=y.fromDer(Q,{parseAllBytes:F._parseAllDigestBytes}),J={},te=[];if(!y.validate(Z,_,J,te)){var se=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw se.errors=te,se}var fe=y.derToOid(J.algorithmIdentifier);if(!(fe===t.oids.md2||fe===t.oids.md5||fe===t.oids.sha1||fe===t.oids.sha224||fe===t.oids.sha256||fe===t.oids.sha384||fe===t.oids.sha512||fe===t.oids["sha512-224"]||fe===t.oids["sha512-256"])){var se=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw se.oid=fe,se}if(fe===t.oids.md2||fe===t.oids.md5){if(!("parameters"in J))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.")}return j===J.digest}};else if(V==="NONE"||V==="NULL"||V===null)V={verify:function(j,Q){return Q=A(Q,w,!0),j===Q}};var H=p.rsa.decrypt(O,w,!0,!1);return V.verify(K,H,w.n.bitLength())},w},p.setRsaPrivateKey=p.rsa.setPrivateKey=function(o,n,w,K,O,V,F,H){var j={n:o,e:n,d:w,p:K,q:O,dP:V,dQ:F,qInv:H};return j.decrypt=function(Q,Z,J){if(typeof Z==="string")Z=Z.toUpperCase();else if(Z===void 0)Z="RSAES-PKCS1-V1_5";var te=p.rsa.decrypt(Q,j,!1,!1);if(Z==="RSAES-PKCS1-V1_5")Z={decode:A};else if(Z==="RSA-OAEP"||Z==="RSAES-OAEP")Z={decode:function(se,fe){return t.pkcs1.decode_rsa_oaep(fe,se,J)}};else if(["RAW","NONE","NULL",null].indexOf(Z)!==-1)Z={decode:function(se){return se}};else throw new Error('Unsupported encryption scheme: "'+Z+'".');return Z.decode(te,j,!1)},j.sign=function(Q,Z){var J=!1;if(typeof Z==="string")Z=Z.toUpperCase();if(Z===void 0||Z==="RSASSA-PKCS1-V1_5")Z={encode:I},J=1;else if(Z==="NONE"||Z==="NULL"||Z===null)Z={encode:function(){return Q}},J=1;var te=Z.encode(Q,j.n.bitLength());return p.rsa.encrypt(te,j,J)},j},p.wrapRsaPrivateKey=function(o){return y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,y.integerToDer(0).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OID,!1,y.oidToDer(p.oids.rsaEncryption).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.NULL,!1,"")]),y.create(y.Class.UNIVERSAL,y.Type.OCTETSTRING,!1,y.toDer(o).getBytes())])},p.privateKeyFromAsn1=function(o){var n={},w=[];if(y.validate(o,i,n,w))o=y.fromDer(t.util.createBuffer(n.privateKey));if(n={},w=[],!y.validate(o,v,n,w)){var K=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw K.errors=w,K}var O,V,F,H,j,Q,Z,J;return O=t.util.createBuffer(n.privateKeyModulus).toHex(),V=t.util.createBuffer(n.privateKeyPublicExponent).toHex(),F=t.util.createBuffer(n.privateKeyPrivateExponent).toHex(),H=t.util.createBuffer(n.privateKeyPrime1).toHex(),j=t.util.createBuffer(n.privateKeyPrime2).toHex(),Q=t.util.createBuffer(n.privateKeyExponent1).toHex(),Z=t.util.createBuffer(n.privateKeyExponent2).toHex(),J=t.util.createBuffer(n.privateKeyCoefficient).toHex(),p.setRsaPrivateKey(new e(O,16),new e(V,16),new e(F,16),new e(H,16),new e(j,16),new e(Q,16),new e(Z,16),new e(J,16))},p.privateKeyToAsn1=p.privateKeyToRSAPrivateKey=function(o){return y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,y.integerToDer(0).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.n)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.e)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.d)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.p)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.q)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.dP)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.dQ)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.qInv))])},p.publicKeyFromAsn1=function(o){var n={},w=[];if(y.validate(o,B,n,w)){var K=y.derToOid(n.publicKeyOid);if(K!==p.oids.rsaEncryption){var O=new Error("Cannot read public key. Unknown OID.");throw O.oid=K,O}o=n.rsaPublicKey}if(w=[],!y.validate(o,f,n,w)){var O=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw O.errors=w,O}var V=t.util.createBuffer(n.publicKeyModulus).toHex(),F=t.util.createBuffer(n.publicKeyExponent).toHex();return p.setRsaPublicKey(new e(V,16),new e(F,16))},p.publicKeyToAsn1=p.publicKeyToSubjectPublicKeyInfo=function(o){return y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OID,!1,y.oidToDer(p.oids.rsaEncryption).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.NULL,!1,"")]),y.create(y.Class.UNIVERSAL,y.Type.BITSTRING,!1,[p.publicKeyToRSAPublicKey(o)])])},p.publicKeyToRSAPublicKey=function(o){return y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.n)),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,s(o.e))])};function C(o,n,w){var K=t.util.createBuffer(),O=Math.ceil(n.n.bitLength()/8);if(o.length>O-11){var V=new Error("Message is too long for PKCS#1 v1.5 padding.");throw V.length=o.length,V.max=O-11,V}K.putByte(0),K.putByte(w);var F=O-3-o.length,H;if(w===0||w===1){H=w===0?0:255;for(var j=0;j<F;++j)K.putByte(H)}else while(F>0){var Q=0,Z=t.random.getBytes(F);for(var j=0;j<F;++j)if(H=Z.charCodeAt(j),H===0)++Q;else K.putByte(H);F=Q}return K.putByte(0),K.putBytes(o),K}function A(o,n,w,K){var O=Math.ceil(n.n.bitLength()/8),V=t.util.createBuffer(o),F=V.getByte(),H=V.getByte();if(F!==0||w&&H!==0&&H!==1||!w&&H!=2||w&&H===0&&typeof K==="undefined")throw new Error("Encryption block is invalid.");var j=0;if(H===0){j=O-3-K;for(var Q=0;Q<j;++Q)if(V.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(H===1){j=0;while(V.length()>1){if(V.getByte()!==255){--V.read;break}++j}}else if(H===2){j=0;while(V.length()>1){if(V.getByte()===0){--V.read;break}++j}}var Z=V.getByte();if(Z!==0||j!==O-3-V.length())throw new Error("Encryption block is invalid.");return V.getBytes()}function T(o,n,w){if(typeof n==="function")w=n,n={};n=n||{};var K={algorithm:{name:n.algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};if("prng"in n)K.prng=n.prng;O();function O(){V(o.pBits,function(H,j){if(H)return w(H);if(o.p=j,o.q!==null)return F(H,o.q);V(o.qBits,F)})}function V(H,j){t.prime.generateProbablePrime(H,K,j)}function F(H,j){if(H)return w(H);if(o.q=j,o.p.compareTo(o.q)<0){var Q=o.p;o.p=o.q,o.q=Q}if(o.p.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)!==0){o.p=null,O();return}if(o.q.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)!==0){o.q=null,V(o.qBits,F);return}if(o.p1=o.p.subtract(e.ONE),o.q1=o.q.subtract(e.ONE),o.phi=o.p1.multiply(o.q1),o.phi.gcd(o.e).compareTo(e.ONE)!==0){o.p=o.q=null,O();return}if(o.n=o.p.multiply(o.q),o.n.bitLength()!==o.bits){o.q=null,V(o.qBits,F);return}var Z=o.e.modInverse(o.phi);o.keys={privateKey:p.rsa.setPrivateKey(o.n,o.e,Z,o.p,o.q,Z.mod(o.p1),Z.mod(o.q1),o.q.modInverse(o.p)),publicKey:p.rsa.setPublicKey(o.n,o.e)},w(null,o.keys)}}function s(o){var n=o.toString(16);if(n[0]>="8")n="00"+n;var w=t.util.hexToBytes(n);if(w.length>1&&(w.charCodeAt(0)===0&&(w.charCodeAt(1)&128)===0||w.charCodeAt(0)===255&&(w.charCodeAt(1)&128)===128))return w.substr(1);return w}function m(o){if(o<=100)return 27;if(o<=150)return 18;if(o<=200)return 15;if(o<=250)return 12;if(o<=300)return 9;if(o<=350)return 8;if(o<=400)return 7;if(o<=500)return 6;if(o<=600)return 5;if(o<=800)return 4;if(o<=1250)return 3;return 2}function E(o){return t.util.isNodejs&&typeof a[o]==="function"}function N(o){return typeof l.globalScope!=="undefined"&&typeof l.globalScope.crypto==="object"&&typeof l.globalScope.crypto.subtle==="object"&&typeof l.globalScope.crypto.subtle[o]==="function"}function U(o){return typeof l.globalScope!=="undefined"&&typeof l.globalScope.msCrypto==="object"&&typeof l.globalScope.msCrypto.subtle==="object"&&typeof l.globalScope.msCrypto.subtle[o]==="function"}function g(o){var n=t.util.hexToBytes(o.toString(16)),w=new Uint8Array(n.length);for(var K=0;K<n.length;++K)w[K]=n.charCodeAt(K);return w}}),Hi=le((r,S)=>{var t=de();if(Dt(),gt(),lr(),St(),Ut(),Or(),Gt(),ht(),Fi(),hr(),Ee(),typeof e==="undefined")e=t.jsbn.BigInteger;var e,a=t.asn1,y=t.pki=t.pki||{};S.exports=y.pbe=t.pbe=t.pbe||{};var l=y.oids,p={name:"EncryptedPrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},i={name:"pkcs-12PbeParams",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"iterations"}]};y.encryptPrivateKeyInfo=function(I,h,C){C=C||{},C.saltSize=C.saltSize||8,C.count=C.count||2048,C.algorithm=C.algorithm||"aes128",C.prfAlgorithm=C.prfAlgorithm||"sha1";var A=t.random.getBytesSync(C.saltSize),T=C.count,s=a.integerToDer(T),m,E,N;if(C.algorithm.indexOf("aes")===0||C.algorithm==="des"){var U,g,o;switch(C.algorithm){case"aes128":m=16,U=16,g=l["aes128-CBC"],o=t.aes.createEncryptionCipher;break;case"aes192":m=24,U=16,g=l["aes192-CBC"],o=t.aes.createEncryptionCipher;break;case"aes256":m=32,U=16,g=l["aes256-CBC"],o=t.aes.createEncryptionCipher;break;case"des":m=8,U=8,g=l.desCBC,o=t.des.createEncryptionCipher;break;default:var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=C.algorithm,n}var w="hmacWith"+C.prfAlgorithm.toUpperCase(),K=B(w),O=t.pkcs5.pbkdf2(h,A,T,m,K),V=t.random.getBytesSync(U),F=o(O);F.start(V),F.update(a.toDer(I)),F.finish(),N=F.output.getBytes();var H=_(A,s,m,w);E=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(l.pkcs5PBES2).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(l.pkcs5PBKDF2).getBytes()),H]),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(g).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,V)])])])}else if(C.algorithm==="3des"){m=24;var j=new t.util.ByteBuffer(A),O=y.pbe.generatePkcs12Key(h,j,1,T,m),V=y.pbe.generatePkcs12Key(h,j,2,T,m),F=t.des.createEncryptionCipher(O);F.start(V),F.update(a.toDer(I)),F.finish(),N=F.output.getBytes(),E=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(l["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,A),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,s.getBytes())])])}else{var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=C.algorithm,n}var Q=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[E,a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,N)]);return Q},y.decryptPrivateKeyInfo=function(I,h){var C=null,A={},T=[];if(!a.validate(I,p,A,T)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=T,s}var m=a.derToOid(A.encryptionOid),E=y.pbe.getCipher(m,A.encryptionParams,h),N=t.util.createBuffer(A.encryptedData);if(E.update(N),E.finish())C=a.fromDer(E.output);return C},y.encryptedPrivateKeyToPem=function(I,h){var C={type:"ENCRYPTED PRIVATE KEY",body:a.toDer(I).getBytes()};return t.pem.encode(C,{maxline:h})},y.encryptedPrivateKeyFromPem=function(I){var h=t.pem.decode(I)[0];if(h.type!=="ENCRYPTED PRIVATE KEY"){var C=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw C.headerType=h.type,C}if(h.procType&&h.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return a.fromDer(h.body)},y.encryptRsaPrivateKey=function(I,h,C){if(C=C||{},!C.legacy){var A=y.wrapRsaPrivateKey(y.privateKeyToAsn1(I));return A=y.encryptPrivateKeyInfo(A,h,C),y.encryptedPrivateKeyToPem(A)}var T,s,m,E;switch(C.algorithm){case"aes128":T="AES-128-CBC",m=16,s=t.random.getBytesSync(16),E=t.aes.createEncryptionCipher;break;case"aes192":T="AES-192-CBC",m=24,s=t.random.getBytesSync(16),E=t.aes.createEncryptionCipher;break;case"aes256":T="AES-256-CBC",m=32,s=t.random.getBytesSync(16),E=t.aes.createEncryptionCipher;break;case"3des":T="DES-EDE3-CBC",m=24,s=t.random.getBytesSync(8),E=t.des.createEncryptionCipher;break;case"des":T="DES-CBC",m=8,s=t.random.getBytesSync(8),E=t.des.createEncryptionCipher;break;default:var N=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+C.algorithm+'".');throw N.algorithm=C.algorithm,N}var U=t.pbe.opensslDeriveBytes(h,s.substr(0,8),m),g=E(U);g.start(s),g.update(a.toDer(y.privateKeyToAsn1(I))),g.finish();var o={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:T,parameters:t.util.bytesToHex(s).toUpperCase()},body:g.output.getBytes()};return t.pem.encode(o)},y.decryptRsaPrivateKey=function(I,h){var C=null,A=t.pem.decode(I)[0];if(A.type!=="ENCRYPTED PRIVATE KEY"&&A.type!=="PRIVATE KEY"&&A.type!=="RSA PRIVATE KEY"){var T=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw T.headerType=T,T}if(A.procType&&A.procType.type==="ENCRYPTED"){var s,m;switch(A.dekInfo.algorithm){case"DES-CBC":s=8,m=t.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,m=t.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,m=t.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,m=t.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,m=t.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,m=function(o){return t.rc2.createDecryptionCipher(o,40)};break;case"RC2-64-CBC":s=8,m=function(o){return t.rc2.createDecryptionCipher(o,64)};break;case"RC2-128-CBC":s=16,m=function(o){return t.rc2.createDecryptionCipher(o,128)};break;default:var T=new Error('Could not decrypt private key; unsupported encryption algorithm "'+A.dekInfo.algorithm+'".');throw T.algorithm=A.dekInfo.algorithm,T}var E=t.util.hexToBytes(A.dekInfo.parameters),N=t.pbe.opensslDeriveBytes(h,E.substr(0,8),s),U=m(N);if(U.start(E),U.update(t.util.createBuffer(A.body)),U.finish())C=U.output.getBytes();else return C}else C=A.body;if(A.type==="ENCRYPTED PRIVATE KEY")C=y.decryptPrivateKeyInfo(a.fromDer(C),h);else C=a.fromDer(C);if(C!==null)C=y.privateKeyFromAsn1(C);return C},y.pbe.generatePkcs12Key=function(I,h,C,A,T,s){var m,E;if(typeof s==="undefined"||s===null){if(!("sha1"in t.md))throw new Error('"sha1" hash algorithm unavailable.');s=t.md.sha1.create()}var{digestLength:N,blockLength:U}=s,g=new t.util.ByteBuffer,o=new t.util.ByteBuffer;if(I!==null&&I!==void 0){for(E=0;E<I.length;E++)o.putInt16(I.charCodeAt(E));o.putInt16(0)}var n=o.length(),w=h.length(),K=new t.util.ByteBuffer;K.fillWithByte(C,U);var O=U*Math.ceil(w/U),V=new t.util.ByteBuffer;for(E=0;E<O;E++)V.putByte(h.at(E%w));var F=U*Math.ceil(n/U),H=new t.util.ByteBuffer;for(E=0;E<F;E++)H.putByte(o.at(E%n));var j=V;j.putBuffer(H);var Q=Math.ceil(T/N);for(var Z=1;Z<=Q;Z++){var J=new t.util.ByteBuffer;J.putBytes(K.bytes()),J.putBytes(j.bytes());for(var te=0;te<A;te++)s.start(),s.update(J.getBytes()),J=s.digest();var se=new t.util.ByteBuffer;for(E=0;E<U;E++)se.putByte(J.at(E%N));var fe=Math.ceil(w/U)+Math.ceil(n/U),me=new t.util.ByteBuffer;for(m=0;m<fe;m++){var Ae=new t.util.ByteBuffer(j.getBytes(U)),x=511;for(E=se.length()-1;E>=0;E--)x=x>>8,x+=se.at(E)+Ae.at(E),Ae.setAt(E,x&255);me.putBuffer(Ae)}j=me,g.putBuffer(J)}return g.truncate(g.length()-T),g},y.pbe.getCipher=function(I,h,C){switch(I){case y.oids.pkcs5PBES2:return y.pbe.getCipherForPBES2(I,h,C);case y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case y.oids["pbewithSHAAnd40BitRC2-CBC"]:return y.pbe.getCipherForPKCS12PBE(I,h,C);default:var A=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw A.oid=I,A.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],A}},y.pbe.getCipherForPBES2=function(I,h,C){var A={},T=[];if(!a.validate(h,c,A,T)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=T,s}if(I=a.derToOid(A.kdfOid),I!==y.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=I,s.supportedOids=["pkcs5PBKDF2"],s}if(I=a.derToOid(A.encOid),I!==y.oids["aes128-CBC"]&&I!==y.oids["aes192-CBC"]&&I!==y.oids["aes256-CBC"]&&I!==y.oids["des-EDE3-CBC"]&&I!==y.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=I,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var m=A.kdfSalt,E=t.util.createBuffer(A.kdfIterationCount);E=E.getInt(E.length()<<3);var N,U;switch(y.oids[I]){case"aes128-CBC":N=16,U=t.aes.createDecryptionCipher;break;case"aes192-CBC":N=24,U=t.aes.createDecryptionCipher;break;case"aes256-CBC":N=32,U=t.aes.createDecryptionCipher;break;case"des-EDE3-CBC":N=24,U=t.des.createDecryptionCipher;break;case"desCBC":N=8,U=t.des.createDecryptionCipher;break}var g=f(A.prfOid),o=t.pkcs5.pbkdf2(C,m,E,N,g),n=A.encIv,w=U(o);return w.start(n),w},y.pbe.getCipherForPKCS12PBE=function(I,h,C){var A={},T=[];if(!a.validate(h,i,A,T)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=T,s}var m=t.util.createBuffer(A.salt),E=t.util.createBuffer(A.iterations);E=E.getInt(E.length()<<3);var N,U,g;switch(I){case y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:N=24,U=8,g=t.des.startDecrypting;break;case y.oids["pbewithSHAAnd40BitRC2-CBC"]:N=5,U=8,g=function(O,V){var F=t.rc2.createDecryptionCipher(O,40);return F.start(V,null),F};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=I,s}var o=f(A.prfOid),n=y.pbe.generatePkcs12Key(C,m,1,E,N,o);o.start();var w=y.pbe.generatePkcs12Key(C,m,2,E,U,o);return g(n,w)},y.pbe.opensslDeriveBytes=function(I,h,C,A){if(typeof A==="undefined"||A===null){if(!("md5"in t.md))throw new Error('"md5" hash algorithm unavailable.');A=t.md.md5.create()}if(h===null)h="";var T=[v(A,I+h)];for(var s=16,m=1;s<C;++m,s+=16)T.push(v(A,T[m-1]+I+h));return T.join("").substr(0,C)};function v(I,h){return I.start().update(h).digest().getBytes()}function f(I){var h;if(!I)h="hmacWithSHA1";else if(h=y.oids[a.derToOid(I)],!h){var C=new Error("Unsupported PRF OID.");throw C.oid=I,C.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],C}return B(h)}function B(I){var h=t.md;switch(I){case"hmacWithSHA224":h=t.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":I=I.substr(8).toLowerCase();break;default:var C=new Error("Unsupported PRF algorithm.");throw C.algorithm=I,C.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],C}if(!h||!(I in h))throw new Error("Unknown hash algorithm: "+I);return h[I].create()}function _(I,h,C,A){var T=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,I),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,h.getBytes())]);if(A!=="hmacWithSHA1")T.value.push(a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,t.util.hexToBytes(C.toString(16))),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(y.oids[A]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]));return T}}),ji=le((r,S)=>{var t=de();gt(),Ee();var e=t.asn1,a=S.exports=t.pkcs7asn1=t.pkcs7asn1||{};t.pkcs7=t.pkcs7||{},t.pkcs7.asn1=a;var y={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=y;var l={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(l)},a.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(l)};var p={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},y,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[p]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}}),Qi=le((r,S)=>{var t=de();Ee(),t.mgf=t.mgf||{};var e=S.exports=t.mgf.mgf1=t.mgf1=t.mgf1||{};e.create=function(a){var y={generate:function(l,p){var c=new t.util.ByteBuffer,i=Math.ceil(p/a.digestLength);for(var v=0;v<i;v++){var f=new t.util.ByteBuffer;f.putInt32(v),a.start(),a.update(l+f.getBytes()),c.putBuffer(a.digest())}return c.truncate(c.length()-p),c.getBytes()}};return y}}),rs=le((r,S)=>{var t=de();Qi(),S.exports=t.mgf=t.mgf||{},t.mgf.mgf1=t.mgf1}),Fr=le((r,S)=>{var t=de();ht(),Ee();var e=S.exports=t.pss=t.pss||{};e.create=function(a){if(arguments.length===3)a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]};var{md:y,mgf:l}=a,p=y.digestLength,c=a.salt||null;if(typeof c==="string")c=t.util.createBuffer(c);var i;if("saltLength"in a)i=a.saltLength;else if(c!==null)i=c.length();else throw new Error("Salt length not specified or specific salt not given.");if(c!==null&&c.length()!==i)throw new Error("Given salt length does not match length of given salt.");var v=a.prng||t.random,f={};return f.encode=function(B,_){var I,h=_-1,C=Math.ceil(h/8),A=B.digest().getBytes();if(C<p+i+2)throw new Error("Message is too long to encrypt.");var T;if(c===null)T=v.getBytesSync(i);else T=c.bytes();var s=new t.util.ByteBuffer;s.fillWithByte(0,8),s.putBytes(A),s.putBytes(T),y.start(),y.update(s.getBytes());var m=y.digest().getBytes(),E=new t.util.ByteBuffer;E.fillWithByte(0,C-i-p-2),E.putByte(1),E.putBytes(T);var N=E.getBytes(),U=C-p-1,g=l.generate(m,U),o="";for(I=0;I<U;I++)o+=String.fromCharCode(N.charCodeAt(I)^g.charCodeAt(I));var n=65280>>8*C-h&255;return o=String.fromCharCode(o.charCodeAt(0)&~n)+o.substr(1),o+m+String.fromCharCode(188)},f.verify=function(B,_,I){var h,C=I-1,A=Math.ceil(C/8);if(_=_.substr(-A),A<p+i+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(_.charCodeAt(A-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var T=A-p-1,s=_.substr(0,T),m=_.substr(T,p),E=65280>>8*A-C&255;if((s.charCodeAt(0)&E)!==0)throw new Error("Bits beyond keysize not zero as expected.");var N=l.generate(m,T),U="";for(h=0;h<T;h++)U+=String.fromCharCode(s.charCodeAt(h)^N.charCodeAt(h));U=String.fromCharCode(U.charCodeAt(0)&~E)+U.substr(1);var g=A-p-i-2;for(h=0;h<g;h++)if(U.charCodeAt(h)!==0)throw new Error("Leftmost octets not zero as expected");if(U.charCodeAt(g)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var o=U.substr(-i),n=new t.util.ByteBuffer;n.fillWithByte(0,8),n.putBytes(B),n.putBytes(o),y.start(),y.update(n.getBytes());var w=y.digest().getBytes();return m===w},f}}),Gr=le((r,S)=>{var t=de();Dt(),gt(),lr(),St(),rs(),Ut(),Gt(),Fr(),hr(),Ee();var e=t.asn1,a=S.exports=t.pki=t.pki||{},y=a.oids,l={};l.CN=y.commonName,l.commonName="CN",l.C=y.countryName,l.countryName="C",l.L=y.localityName,l.localityName="L",l.ST=y.stateOrProvinceName,l.stateOrProvinceName="ST",l.O=y.organizationName,l.organizationName="O",l.OU=y.organizationalUnitName,l.organizationalUnitName="OU",l.E=y.emailAddress,l.emailAddress="E";var p=t.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},p,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},i={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},v={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},p,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[v,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};a.RDNAttributesAsArray=function(g,o){var n=[],w,K,O;for(var V=0;V<g.value.length;++V){w=g.value[V];for(var F=0;F<w.value.length;++F){if(O={},K=w.value[F],O.type=e.derToOid(K.value[0].value),O.value=K.value[1].value,O.valueTagClass=K.value[1].type,O.type in y){if(O.name=y[O.type],O.name in l)O.shortName=l[O.name]}if(o)o.update(O.type),o.update(O.value);n.push(O)}}return n},a.CRIAttributesAsArray=function(g){var o=[];for(var n=0;n<g.length;++n){var w=g[n],K=e.derToOid(w.value[0].value),O=w.value[1].value;for(var V=0;V<O.length;++V){var F={};if(F.type=K,F.value=O[V].value,F.valueTagClass=O[V].type,F.type in y){if(F.name=y[F.type],F.name in l)F.shortName=l[F.name]}if(F.type===y.extensionRequest){F.extensions=[];for(var H=0;H<F.value.length;++H)F.extensions.push(a.certificateExtensionFromAsn1(F.value[H]))}o.push(F)}}return o};function B(g,o){if(typeof o==="string")o={shortName:o};var n=null,w;for(var K=0;n===null&&K<g.attributes.length;++K)if(w=g.attributes[K],o.type&&o.type===w.type)n=w;else if(o.name&&o.name===w.name)n=w;else if(o.shortName&&o.shortName===w.shortName)n=w;return n}var _=function(g,o,n){var w={};if(g!==y["RSASSA-PSS"])return w;if(n)w={hash:{algorithmOid:y.sha1},mgf:{algorithmOid:y.mgf1,hash:{algorithmOid:y.sha1}},saltLength:20};var K={},O=[];if(!e.validate(o,i,K,O)){var V=new Error("Cannot read RSASSA-PSS parameter block.");throw V.errors=O,V}if(K.hashOid!==void 0)w.hash=w.hash||{},w.hash.algorithmOid=e.derToOid(K.hashOid);if(K.maskGenOid!==void 0)w.mgf=w.mgf||{},w.mgf.algorithmOid=e.derToOid(K.maskGenOid),w.mgf.hash=w.mgf.hash||{},w.mgf.hash.algorithmOid=e.derToOid(K.maskGenHashOid);if(K.saltLength!==void 0)w.saltLength=K.saltLength.charCodeAt(0);return w},I=function(g){switch(y[g.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return t.md.sha1.create();case"md5WithRSAEncryption":return t.md.md5.create();case"sha256WithRSAEncryption":return t.md.sha256.create();case"sha384WithRSAEncryption":return t.md.sha384.create();case"sha512WithRSAEncryption":return t.md.sha512.create();case"RSASSA-PSS":return t.md.sha256.create();default:var o=new Error("Could not compute "+g.type+" digest. Unknown signature OID.");throw o.signatureOid=g.signatureOid,o}},h=function(g){var o=g.certificate,n;switch(o.signatureOid){case y.sha1WithRSAEncryption:case y.sha1WithRSASignature:break;case y["RSASSA-PSS"]:var w,K;if(w=y[o.signatureParameters.mgf.hash.algorithmOid],w===void 0||t.md[w]===void 0){var O=new Error("Unsupported MGF hash function.");throw O.oid=o.signatureParameters.mgf.hash.algorithmOid,O.name=w,O}if(K=y[o.signatureParameters.mgf.algorithmOid],K===void 0||t.mgf[K]===void 0){var O=new Error("Unsupported MGF function.");throw O.oid=o.signatureParameters.mgf.algorithmOid,O.name=K,O}if(K=t.mgf[K].create(t.md[w].create()),w=y[o.signatureParameters.hash.algorithmOid],w===void 0||t.md[w]===void 0){var O=new Error("Unsupported RSASSA-PSS hash function.");throw O.oid=o.signatureParameters.hash.algorithmOid,O.name=w,O}n=t.pss.create(t.md[w].create(),K,o.signatureParameters.saltLength);break}return o.publicKey.verify(g.md.digest().getBytes(),g.signature,n)};a.certificateFromPem=function(g,o,n){var w=t.pem.decode(g)[0];if(w.type!=="CERTIFICATE"&&w.type!=="X509 CERTIFICATE"&&w.type!=="TRUSTED CERTIFICATE"){var K=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw K.headerType=w.type,K}if(w.procType&&w.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var O=e.fromDer(w.body,n);return a.certificateFromAsn1(O,o)},a.certificateToPem=function(g,o){var n={type:"CERTIFICATE",body:e.toDer(a.certificateToAsn1(g)).getBytes()};return t.pem.encode(n,{maxline:o})},a.publicKeyFromPem=function(g){var o=t.pem.decode(g)[0];if(o.type!=="PUBLIC KEY"&&o.type!=="RSA PUBLIC KEY"){var n=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw n.headerType=o.type,n}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var w=e.fromDer(o.body);return a.publicKeyFromAsn1(w)},a.publicKeyToPem=function(g,o){var n={type:"PUBLIC KEY",body:e.toDer(a.publicKeyToAsn1(g)).getBytes()};return t.pem.encode(n,{maxline:o})},a.publicKeyToRSAPublicKeyPem=function(g,o){var n={type:"RSA PUBLIC KEY",body:e.toDer(a.publicKeyToRSAPublicKey(g)).getBytes()};return t.pem.encode(n,{maxline:o})},a.getPublicKeyFingerprint=function(g,o){o=o||{};var n=o.md||t.md.sha1.create(),w=o.type||"RSAPublicKey",K;switch(w){case"RSAPublicKey":K=e.toDer(a.publicKeyToRSAPublicKey(g)).getBytes();break;case"SubjectPublicKeyInfo":K=e.toDer(a.publicKeyToAsn1(g)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+o.type+'".')}n.start(),n.update(K);var O=n.digest();if(o.encoding==="hex"){var V=O.toHex();if(o.delimiter)return V.match(/.{2}/g).join(o.delimiter);return V}else if(o.encoding==="binary")return O.getBytes();else if(o.encoding)throw new Error('Unknown encoding "'+o.encoding+'".');return O},a.certificationRequestFromPem=function(g,o,n){var w=t.pem.decode(g)[0];if(w.type!=="CERTIFICATE REQUEST"){var K=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw K.headerType=w.type,K}if(w.procType&&w.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var O=e.fromDer(w.body,n);return a.certificationRequestFromAsn1(O,o)},a.certificationRequestToPem=function(g,o){var n={type:"CERTIFICATE REQUEST",body:e.toDer(a.certificationRequestToAsn1(g)).getBytes()};return t.pem.encode(n,{maxline:o})},a.createCertificate=function(){var g={};return g.version=2,g.serialNumber="00",g.signatureOid=null,g.signature=null,g.siginfo={},g.siginfo.algorithmOid=null,g.validity={},g.validity.notBefore=new Date,g.validity.notAfter=new Date,g.issuer={},g.issuer.getField=function(o){return B(g.issuer,o)},g.issuer.addField=function(o){A([o]),g.issuer.attributes.push(o)},g.issuer.attributes=[],g.issuer.hash=null,g.subject={},g.subject.getField=function(o){return B(g.subject,o)},g.subject.addField=function(o){A([o]),g.subject.attributes.push(o)},g.subject.attributes=[],g.subject.hash=null,g.extensions=[],g.publicKey=null,g.md=null,g.setSubject=function(o,n){if(A(o),g.subject.attributes=o,delete g.subject.uniqueId,n)g.subject.uniqueId=n;g.subject.hash=null},g.setIssuer=function(o,n){if(A(o),g.issuer.attributes=o,delete g.issuer.uniqueId,n)g.issuer.uniqueId=n;g.issuer.hash=null},g.setExtensions=function(o){for(var n=0;n<o.length;++n)T(o[n],{cert:g});g.extensions=o},g.getExtension=function(o){if(typeof o==="string")o={name:o};var n=null,w;for(var K=0;n===null&&K<g.extensions.length;++K)if(w=g.extensions[K],o.id&&w.id===o.id)n=w;else if(o.name&&w.name===o.name)n=w;return n},g.sign=function(o,n){g.md=n||t.md.sha1.create();var w=y[g.md.algorithm+"WithRSAEncryption"];if(!w){var K=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw K.algorithm=g.md.algorithm,K}g.signatureOid=g.siginfo.algorithmOid=w,g.tbsCertificate=a.getTBSCertificate(g);var O=e.toDer(g.tbsCertificate);g.md.update(O.getBytes()),g.signature=o.sign(g.md)},g.verify=function(o){var n=!1;if(!g.issued(o)){var w=o.issuer,K=g.subject,O=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw O.expectedIssuer=K.attributes,O.actualIssuer=w.attributes,O}var V=o.md;if(V===null){V=I({signatureOid:o.signatureOid,type:"certificate"});var F=o.tbsCertificate||a.getTBSCertificate(o),H=e.toDer(F);V.update(H.getBytes())}if(V!==null)n=h({certificate:g,md:V,signature:o.signature});return n},g.isIssuer=function(o){var n=!1,w=g.issuer,K=o.subject;if(w.hash&&K.hash)n=w.hash===K.hash;else if(w.attributes.length===K.attributes.length){n=!0;var O,V;for(var F=0;n&&F<w.attributes.length;++F)if(O=w.attributes[F],V=K.attributes[F],O.type!==V.type||O.value!==V.value)n=!1}return n},g.issued=function(o){return o.isIssuer(g)},g.generateSubjectKeyIdentifier=function(){return a.getPublicKeyFingerprint(g.publicKey,{type:"RSAPublicKey"})},g.verifySubjectKeyIdentifier=function(){var o=y.subjectKeyIdentifier;for(var n=0;n<g.extensions.length;++n){var w=g.extensions[n];if(w.id===o){var K=g.generateSubjectKeyIdentifier().getBytes();return t.util.hexToBytes(w.subjectKeyIdentifier)===K}}return!1},g},a.certificateFromAsn1=function(g,o){var n={},w=[];if(!e.validate(g,c,n,w)){var K=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw K.errors=w,K}var O=e.derToOid(n.publicKeyOid);if(O!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var V=a.createCertificate();V.version=n.certVersion?n.certVersion.charCodeAt(0):0;var F=t.util.createBuffer(n.certSerialNumber);V.serialNumber=F.toHex(),V.signatureOid=t.asn1.derToOid(n.certSignatureOid),V.signatureParameters=_(V.signatureOid,n.certSignatureParams,!0),V.siginfo.algorithmOid=t.asn1.derToOid(n.certinfoSignatureOid),V.siginfo.parameters=_(V.siginfo.algorithmOid,n.certinfoSignatureParams,!1),V.signature=n.certSignature;var H=[];if(n.certValidity1UTCTime!==void 0)H.push(e.utcTimeToDate(n.certValidity1UTCTime));if(n.certValidity2GeneralizedTime!==void 0)H.push(e.generalizedTimeToDate(n.certValidity2GeneralizedTime));if(n.certValidity3UTCTime!==void 0)H.push(e.utcTimeToDate(n.certValidity3UTCTime));if(n.certValidity4GeneralizedTime!==void 0)H.push(e.generalizedTimeToDate(n.certValidity4GeneralizedTime));if(H.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(H.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(V.validity.notBefore=H[0],V.validity.notAfter=H[1],V.tbsCertificate=n.tbsCertificate,o){V.md=I({signatureOid:V.signatureOid,type:"certificate"});var j=e.toDer(V.tbsCertificate);V.md.update(j.getBytes())}var Q=t.md.sha1.create(),Z=e.toDer(n.certIssuer);if(Q.update(Z.getBytes()),V.issuer.getField=function(se){return B(V.issuer,se)},V.issuer.addField=function(se){A([se]),V.issuer.attributes.push(se)},V.issuer.attributes=a.RDNAttributesAsArray(n.certIssuer),n.certIssuerUniqueId)V.issuer.uniqueId=n.certIssuerUniqueId;V.issuer.hash=Q.digest().toHex();var J=t.md.sha1.create(),te=e.toDer(n.certSubject);if(J.update(te.getBytes()),V.subject.getField=function(se){return B(V.subject,se)},V.subject.addField=function(se){A([se]),V.subject.attributes.push(se)},V.subject.attributes=a.RDNAttributesAsArray(n.certSubject),n.certSubjectUniqueId)V.subject.uniqueId=n.certSubjectUniqueId;if(V.subject.hash=J.digest().toHex(),n.certExtensions)V.extensions=a.certificateExtensionsFromAsn1(n.certExtensions);else V.extensions=[];return V.publicKey=a.publicKeyFromAsn1(n.subjectPublicKeyInfo),V},a.certificateExtensionsFromAsn1=function(g){var o=[];for(var n=0;n<g.value.length;++n){var w=g.value[n];for(var K=0;K<w.value.length;++K)o.push(a.certificateExtensionFromAsn1(w.value[K]))}return o},a.certificateExtensionFromAsn1=function(g){var o={};if(o.id=e.derToOid(g.value[0].value),o.critical=!1,g.value[1].type===e.Type.BOOLEAN)o.critical=g.value[1].value.charCodeAt(0)!==0,o.value=g.value[2].value;else o.value=g.value[1].value;if(o.id in y){if(o.name=y[o.id],o.name==="keyUsage"){var n=e.fromDer(o.value),w=0,K=0;if(n.value.length>1)w=n.value.charCodeAt(1),K=n.value.length>2?n.value.charCodeAt(2):0;o.digitalSignature=(w&128)===128,o.nonRepudiation=(w&64)===64,o.keyEncipherment=(w&32)===32,o.dataEncipherment=(w&16)===16,o.keyAgreement=(w&8)===8,o.keyCertSign=(w&4)===4,o.cRLSign=(w&2)===2,o.encipherOnly=(w&1)===1,o.decipherOnly=(K&128)===128}else if(o.name==="basicConstraints"){var n=e.fromDer(o.value);if(n.value.length>0&&n.value[0].type===e.Type.BOOLEAN)o.cA=n.value[0].value.charCodeAt(0)!==0;else o.cA=!1;var O=null;if(n.value.length>0&&n.value[0].type===e.Type.INTEGER)O=n.value[0].value;else if(n.value.length>1)O=n.value[1].value;if(O!==null)o.pathLenConstraint=e.derToInteger(O)}else if(o.name==="extKeyUsage"){var n=e.fromDer(o.value);for(var V=0;V<n.value.length;++V){var F=e.derToOid(n.value[V].value);if(F in y)o[y[F]]=!0;else o[F]=!0}}else if(o.name==="nsCertType"){var n=e.fromDer(o.value),w=0;if(n.value.length>1)w=n.value.charCodeAt(1);o.client=(w&128)===128,o.server=(w&64)===64,o.email=(w&32)===32,o.objsign=(w&16)===16,o.reserved=(w&8)===8,o.sslCA=(w&4)===4,o.emailCA=(w&2)===2,o.objCA=(w&1)===1}else if(o.name==="subjectAltName"||o.name==="issuerAltName"){o.altNames=[];var H,n=e.fromDer(o.value);for(var j=0;j<n.value.length;++j){H=n.value[j];var Q={type:H.type,value:H.value};switch(o.altNames.push(Q),H.type){case 1:case 2:case 6:break;case 7:Q.ip=t.util.bytesToIP(H.value);break;case 8:Q.oid=e.derToOid(H.value);break;default:}}}else if(o.name==="subjectKeyIdentifier"){var n=e.fromDer(o.value);o.subjectKeyIdentifier=t.util.bytesToHex(n.value)}}return o},a.certificationRequestFromAsn1=function(g,o){var n={},w=[];if(!e.validate(g,f,n,w)){var K=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw K.errors=w,K}var O=e.derToOid(n.publicKeyOid);if(O!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var V=a.createCertificationRequest();if(V.version=n.csrVersion?n.csrVersion.charCodeAt(0):0,V.signatureOid=t.asn1.derToOid(n.csrSignatureOid),V.signatureParameters=_(V.signatureOid,n.csrSignatureParams,!0),V.siginfo.algorithmOid=t.asn1.derToOid(n.csrSignatureOid),V.siginfo.parameters=_(V.siginfo.algorithmOid,n.csrSignatureParams,!1),V.signature=n.csrSignature,V.certificationRequestInfo=n.certificationRequestInfo,o){V.md=I({signatureOid:V.signatureOid,type:"certification request"});var F=e.toDer(V.certificationRequestInfo);V.md.update(F.getBytes())}var H=t.md.sha1.create();return V.subject.getField=function(j){return B(V.subject,j)},V.subject.addField=function(j){A([j]),V.subject.attributes.push(j)},V.subject.attributes=a.RDNAttributesAsArray(n.certificationRequestInfoSubject,H),V.subject.hash=H.digest().toHex(),V.publicKey=a.publicKeyFromAsn1(n.subjectPublicKeyInfo),V.getAttribute=function(j){return B(V,j)},V.addAttribute=function(j){A([j]),V.attributes.push(j)},V.attributes=a.CRIAttributesAsArray(n.certificationRequestInfoAttributes||[]),V},a.createCertificationRequest=function(){var g={};return g.version=0,g.signatureOid=null,g.signature=null,g.siginfo={},g.siginfo.algorithmOid=null,g.subject={},g.subject.getField=function(o){return B(g.subject,o)},g.subject.addField=function(o){A([o]),g.subject.attributes.push(o)},g.subject.attributes=[],g.subject.hash=null,g.publicKey=null,g.attributes=[],g.getAttribute=function(o){return B(g,o)},g.addAttribute=function(o){A([o]),g.attributes.push(o)},g.md=null,g.setSubject=function(o){A(o),g.subject.attributes=o,g.subject.hash=null},g.setAttributes=function(o){A(o),g.attributes=o},g.sign=function(o,n){g.md=n||t.md.sha1.create();var w=y[g.md.algorithm+"WithRSAEncryption"];if(!w){var K=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw K.algorithm=g.md.algorithm,K}g.signatureOid=g.siginfo.algorithmOid=w,g.certificationRequestInfo=a.getCertificationRequestInfo(g);var O=e.toDer(g.certificationRequestInfo);g.md.update(O.getBytes()),g.signature=o.sign(g.md)},g.verify=function(){var o=!1,n=g.md;if(n===null){n=I({signatureOid:g.signatureOid,type:"certification request"});var w=g.certificationRequestInfo||a.getCertificationRequestInfo(g),K=e.toDer(w);n.update(K.getBytes())}if(n!==null)o=h({certificate:g,md:n,signature:g.signature});return o},g};function C(g){var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),n,w,K=g.attributes;for(var O=0;O<K.length;++O){n=K[O];var V=n.value,F=e.Type.PRINTABLESTRING;if("valueTagClass"in n){if(F=n.valueTagClass,F===e.Type.UTF8)V=t.util.encodeUtf8(V)}w=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.type).getBytes()),e.create(e.Class.UNIVERSAL,F,!1,V)])]),o.value.push(w)}return o}function A(g){var o;for(var n=0;n<g.length;++n){if(o=g[n],typeof o.name==="undefined"){if(o.type&&o.type in a.oids)o.name=a.oids[o.type];else if(o.shortName&&o.shortName in l)o.name=a.oids[l[o.shortName]]}if(typeof o.type==="undefined")if(o.name&&o.name in a.oids)o.type=a.oids[o.name];else{var w=new Error("Attribute type not specified.");throw w.attribute=o,w}if(typeof o.shortName==="undefined"){if(o.name&&o.name in l)o.shortName=l[o.name]}if(o.type===y.extensionRequest){if(o.valueConstructed=!0,o.valueTagClass=e.Type.SEQUENCE,!o.value&&o.extensions){o.value=[];for(var K=0;K<o.extensions.length;++K)o.value.push(a.certificateExtensionToAsn1(T(o.extensions[K])))}}if(typeof o.value==="undefined"){var w=new Error("Attribute value not specified.");throw w.attribute=o,w}}}function T(g,o){if(o=o||{},typeof g.name==="undefined"){if(g.id&&g.id in a.oids)g.name=a.oids[g.id]}if(typeof g.id==="undefined")if(g.name&&g.name in a.oids)g.id=a.oids[g.name];else{var n=new Error("Extension ID not specified.");throw n.extension=g,n}if(typeof g.value!=="undefined")return g;if(g.name==="keyUsage"){var w=0,K=0,O=0;if(g.digitalSignature)K|=128,w=7;if(g.nonRepudiation)K|=64,w=6;if(g.keyEncipherment)K|=32,w=5;if(g.dataEncipherment)K|=16,w=4;if(g.keyAgreement)K|=8,w=3;if(g.keyCertSign)K|=4,w=2;if(g.cRLSign)K|=2,w=1;if(g.encipherOnly)K|=1,w=0;if(g.decipherOnly)O|=128,w=7;var V=String.fromCharCode(w);if(O!==0)V+=String.fromCharCode(K)+String.fromCharCode(O);else if(K!==0)V+=String.fromCharCode(K);g.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,V)}else if(g.name==="basicConstraints"){if(g.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),g.cA)g.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,String.fromCharCode(255)));if("pathLenConstraint"in g)g.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(g.pathLenConstraint).getBytes()))}else if(g.name==="extKeyUsage"){g.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var F=g.value.value;for(var H in g){if(g[H]!==!0)continue;if(H in y)F.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(y[H]).getBytes()));else if(H.indexOf(".")!==-1)F.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(H).getBytes()))}}else if(g.name==="nsCertType"){var w=0,K=0;if(g.client)K|=128,w=7;if(g.server)K|=64,w=6;if(g.email)K|=32,w=5;if(g.objsign)K|=16,w=4;if(g.reserved)K|=8,w=3;if(g.sslCA)K|=4,w=2;if(g.emailCA)K|=2,w=1;if(g.objCA)K|=1,w=0;var V=String.fromCharCode(w);if(K!==0)V+=String.fromCharCode(K);g.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,V)}else if(g.name==="subjectAltName"||g.name==="issuerAltName"){g.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var j;for(var Q=0;Q<g.altNames.length;++Q){j=g.altNames[Q];var V=j.value;if(j.type===7&&j.ip){if(V=t.util.bytesFromIP(j.ip),V===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=g,n}}else if(j.type===8)if(j.oid)V=e.oidToDer(e.oidToDer(j.oid));else V=e.oidToDer(V);g.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,j.type,!1,V))}}else if(g.name==="nsComment"&&o.cert){if(!/^[\x00-\x7F]*$/.test(g.comment)||g.comment.length<1||g.comment.length>128)throw new Error('Invalid "nsComment" content.');g.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,g.comment)}else if(g.name==="subjectKeyIdentifier"&&o.cert){var Z=o.cert.generateSubjectKeyIdentifier();g.subjectKeyIdentifier=Z.toHex(),g.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Z.getBytes())}else if(g.name==="authorityKeyIdentifier"&&o.cert){g.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var F=g.value.value;if(g.keyIdentifier){var J=g.keyIdentifier===!0?o.cert.generateSubjectKeyIdentifier().getBytes():g.keyIdentifier;F.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,J))}if(g.authorityCertIssuer){var te=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[C(g.authorityCertIssuer===!0?o.cert.issuer:g.authorityCertIssuer)])];F.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,te))}if(g.serialNumber){var se=t.util.hexToBytes(g.serialNumber===!0?o.cert.serialNumber:g.serialNumber);F.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,se))}}else if(g.name==="cRLDistributionPoints"){g.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var F=g.value.value,fe=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),me=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),j;for(var Q=0;Q<g.altNames.length;++Q){j=g.altNames[Q];var V=j.value;if(j.type===7&&j.ip){if(V=t.util.bytesFromIP(j.ip),V===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=g,n}}else if(j.type===8)if(j.oid)V=e.oidToDer(e.oidToDer(j.oid));else V=e.oidToDer(V);me.value.push(e.create(e.Class.CONTEXT_SPECIFIC,j.type,!1,V))}fe.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[me])),F.push(fe)}if(typeof g.value==="undefined"){var n=new Error("Extension value not specified.");throw n.extension=g,n}return g}function s(g,o){switch(g){case y["RSASSA-PSS"]:var n=[];if(o.hash.algorithmOid!==void 0)n.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]));if(o.mgf.algorithmOid!==void 0)n.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])]));if(o.saltLength!==void 0)n.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(o.saltLength).getBytes())]));return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n);default:return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}}function m(g){var o=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(g.attributes.length===0)return o;var n=g.attributes;for(var w=0;w<n.length;++w){var K=n[w],O=K.value,V=e.Type.UTF8;if("valueTagClass"in K)V=K.valueTagClass;if(V===e.Type.UTF8)O=t.util.encodeUtf8(O);var F=!1;if("valueConstructed"in K)F=K.valueConstructed;var H=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(K.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,V,F,O)])]);o.value.push(H)}return o}var E=new Date("1950-01-01T00:00:00Z"),N=new Date("2050-01-01T00:00:00Z");function U(g){if(g>=E&&g<N)return e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(g));else return e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(g))}a.getTBSCertificate=function(g){var o=U(g.validity.notBefore),n=U(g.validity.notAfter),w=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(g.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(g.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g.siginfo.algorithmOid).getBytes()),s(g.siginfo.algorithmOid,g.siginfo.parameters)]),C(g.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,n]),C(g.subject),a.publicKeyToAsn1(g.publicKey)]);if(g.issuer.uniqueId)w.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,String.fromCharCode(0)+g.issuer.uniqueId)]));if(g.subject.uniqueId)w.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,String.fromCharCode(0)+g.subject.uniqueId)]));if(g.extensions.length>0)w.value.push(a.certificateExtensionsToAsn1(g.extensions));return w},a.getCertificationRequestInfo=function(g){var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(g.version).getBytes()),C(g.subject),a.publicKeyToAsn1(g.publicKey),m(g)]);return o},a.distinguishedNameToAsn1=function(g){return C(g)},a.certificateToAsn1=function(g){var o=g.tbsCertificate||a.getTBSCertificate(g);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g.signatureOid).getBytes()),s(g.signatureOid,g.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,String.fromCharCode(0)+g.signature)])},a.certificateExtensionsToAsn1=function(g){var o=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);o.value.push(n);for(var w=0;w<g.length;++w)n.value.push(a.certificateExtensionToAsn1(g[w]));return o},a.certificateExtensionToAsn1=function(g){var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);if(o.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g.id).getBytes())),g.critical)o.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,String.fromCharCode(255)));var n=g.value;if(typeof g.value!=="string")n=e.toDer(n).getBytes();return o.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n)),o},a.certificationRequestToAsn1=function(g){var o=g.certificationRequestInfo||a.getCertificationRequestInfo(g);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(g.signatureOid).getBytes()),s(g.signatureOid,g.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,String.fromCharCode(0)+g.signature)])},a.createCaStore=function(g){var o={certs:{}};o.getIssuer=function(V){var F=n(V.issuer);return F},o.addCertificate=function(V){if(typeof V==="string")V=t.pki.certificateFromPem(V);if(w(V.subject),!o.hasCertificate(V))if(V.subject.hash in o.certs){var F=o.certs[V.subject.hash];if(!t.util.isArray(F))F=[F];F.push(V),o.certs[V.subject.hash]=F}else o.certs[V.subject.hash]=V},o.hasCertificate=function(V){if(typeof V==="string")V=t.pki.certificateFromPem(V);var F=n(V.subject);if(!F)return!1;if(!t.util.isArray(F))F=[F];var H=e.toDer(a.certificateToAsn1(V)).getBytes();for(var j=0;j<F.length;++j){var Q=e.toDer(a.certificateToAsn1(F[j])).getBytes();if(H===Q)return!0}return!1},o.listAllCertificates=function(){var V=[];for(var F in o.certs)if(o.certs.hasOwnProperty(F)){var H=o.certs[F];if(!t.util.isArray(H))V.push(H);else for(var j=0;j<H.length;++j)V.push(H[j])}return V},o.removeCertificate=function(V){var F;if(typeof V==="string")V=t.pki.certificateFromPem(V);if(w(V.subject),!o.hasCertificate(V))return null;var H=n(V.subject);if(!t.util.isArray(H))return F=o.certs[V.subject.hash],delete o.certs[V.subject.hash],F;var j=e.toDer(a.certificateToAsn1(V)).getBytes();for(var Q=0;Q<H.length;++Q){var Z=e.toDer(a.certificateToAsn1(H[Q])).getBytes();if(j===Z)F=H[Q],H.splice(Q,1)}if(H.length===0)delete o.certs[V.subject.hash];return F};function n(V){return w(V),o.certs[V.hash]||null}function w(V){if(!V.hash){var F=t.md.sha1.create();V.attributes=a.RDNAttributesAsArray(C(V),F),V.hash=F.digest().toHex()}}if(g)for(var K=0;K<g.length;++K){var O=g[K];o.addCertificate(O)}return o},a.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},a.verifyCertificateChain=function(g,o,n){if(typeof n==="function")n={verify:n};n=n||{},o=o.slice(0);var w=o.slice(0),K=n.validityCheckDate;if(typeof K==="undefined")K=new Date;var O=!0,V=null,F=0;do{var H=o.shift(),j=null,Q=!1;if(K){if(K<H.validity.notBefore||K>H.validity.notAfter)V={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:H.validity.notBefore,notAfter:H.validity.notAfter,now:K}}if(V===null){if(j=o[0]||g.getIssuer(H),j===null){if(H.isIssuer(H))Q=!0,j=H}if(j){var Z=j;if(!t.util.isArray(Z))Z=[Z];var J=!1;while(!J&&Z.length>0){j=Z.shift();try{J=j.verify(H)}catch(Be){}}if(!J)V={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate}}if(V===null&&(!j||Q)&&!g.hasCertificate(H))V={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca}}if(V===null&&j&&!H.isIssuer(j))V={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate};if(V===null){var te={keyUsage:!0,basicConstraints:!0};for(var se=0;V===null&&se<H.extensions.length;++se){var fe=H.extensions[se];if(fe.critical&&!(fe.name in te))V={message:"Certificate has an unsupported critical extension.",error:a.certificateError.unsupported_certificate}}}if(V===null&&(!O||o.length===0&&(!j||Q))){var me=H.getExtension("basicConstraints"),Ae=H.getExtension("keyUsage");if(Ae!==null){if(!Ae.keyCertSign||me===null)V={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:a.certificateError.bad_certificate}}if(V===null&&me!==null&&!me.cA)V={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:a.certificateError.bad_certificate};if(V===null&&Ae!==null&&"pathLenConstraint"in me){var x=F-1;if(x>me.pathLenConstraint)V={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate}}}var Ce=V===null?!0:V.error,ee=n.verify?n.verify(Ce,F,w):Ce;if(ee===!0)V=null;else{if(Ce===!0)V={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate};if(ee||ee===0){if(typeof ee==="object"&&!t.util.isArray(ee)){if(ee.message)V.message=ee.message;if(ee.error)V.error=ee.error}else if(typeof ee==="string")V.error=ee}throw V}O=!1,++F}while(o.length>0);return!0}}),zi=le((r,S)=>{var t=de();gt(),Wt(),Ut(),ji(),Hi(),ht(),hr(),Zt(),Ee(),Gr();var{asn1:e,pki:a}=t,y=S.exports=t.pkcs12=t.pkcs12||{},l={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},p={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},l,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},c={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},i={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},v={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function f(A,T,s,m){var E=[];for(var N=0;N<A.length;N++)for(var U=0;U<A[N].safeBags.length;U++){var g=A[N].safeBags[U];if(m!==void 0&&g.type!==m)continue;if(T===null){E.push(g);continue}if(g.attributes[T]!==void 0&&g.attributes[T].indexOf(s)>=0)E.push(g)}return E}y.pkcs12FromAsn1=function(A,T,s){if(typeof T==="string")s=T,T=!0;else if(T===void 0)T=!0;var m={},E=[];if(!e.validate(A,p,m,E)){var N=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw N.errors=N,N}var U={version:m.version.charCodeAt(0),safeContents:[],getBags:function(j){var Q={},Z;if("localKeyId"in j)Z=j.localKeyId;else if("localKeyIdHex"in j)Z=t.util.hexToBytes(j.localKeyIdHex);if(Z===void 0&&!("friendlyName"in j)&&"bagType"in j)Q[j.bagType]=f(U.safeContents,null,null,j.bagType);if(Z!==void 0)Q.localKeyId=f(U.safeContents,"localKeyId",Z,j.bagType);if("friendlyName"in j)Q.friendlyName=f(U.safeContents,"friendlyName",j.friendlyName,j.bagType);return Q},getBagsByFriendlyName:function(j,Q){return f(U.safeContents,"friendlyName",j,Q)},getBagsByLocalKeyId:function(j,Q){return f(U.safeContents,"localKeyId",j,Q)}};if(m.version.charCodeAt(0)!==3){var N=new Error("PKCS#12 PFX of version other than 3 not supported.");throw N.version=m.version.charCodeAt(0),N}if(e.derToOid(m.contentType)!==a.oids.data){var N=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw N.oid=e.derToOid(m.contentType),N}var g=m.content.value[0];if(g.tagClass!==e.Class.UNIVERSAL||g.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(g=B(g),m.mac){var o=null,n=0,w=e.derToOid(m.macAlgorithm);switch(w){case a.oids.sha1:o=t.md.sha1.create(),n=20;break;case a.oids.sha256:o=t.md.sha256.create(),n=32;break;case a.oids.sha384:o=t.md.sha384.create(),n=48;break;case a.oids.sha512:o=t.md.sha512.create(),n=64;break;case a.oids.md5:o=t.md.md5.create(),n=16;break}if(o===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+w);var K=new t.util.ByteBuffer(m.macSalt),O="macIterations"in m?parseInt(t.util.bytesToHex(m.macIterations),16):1,V=y.generateKey(s,K,3,O,n,o),F=t.hmac.create();F.start(o,V),F.update(g.value);var H=F.getMac();if(H.getBytes()!==m.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return _(U,g.value,T,s),U};function B(A){if(A.composed||A.constructed){var T=t.util.createBuffer();for(var s=0;s<A.value.length;++s)T.putBytes(A.value[s].value);A.composed=A.constructed=!1,A.value=T.getBytes()}return A}function _(A,T,s,m){if(T=e.fromDer(T,s),T.tagClass!==e.Class.UNIVERSAL||T.type!==e.Type.SEQUENCE||T.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var E=0;E<T.value.length;E++){var N=T.value[E],U={},g=[];if(!e.validate(N,l,U,g)){var o=new Error("Cannot read ContentInfo.");throw o.errors=g,o}var n={encrypted:!1},w=null,K=U.content.value[0];switch(e.derToOid(U.contentType)){case a.oids.data:if(K.tagClass!==e.Class.UNIVERSAL||K.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");w=B(K).value;break;case a.oids.encryptedData:w=I(K,m),n.encrypted=!0;break;default:var o=new Error("Unsupported PKCS#12 contentType.");throw o.contentType=e.derToOid(U.contentType),o}n.safeBags=h(w,s,m),A.safeContents.push(n)}}function I(A,T){var s={},m=[];if(!e.validate(A,t.pkcs7.asn1.encryptedDataValidator,s,m)){var E=new Error("Cannot read EncryptedContentInfo.");throw E.errors=m,E}var N=e.derToOid(s.contentType);if(N!==a.oids.data){var E=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw E.oid=N,E}N=e.derToOid(s.encAlgorithm);var U=a.pbe.getCipher(N,s.encParameter,T),g=B(s.encryptedContentAsn1),o=t.util.createBuffer(g.value);if(U.update(o),!U.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return U.output.getBytes()}function h(A,T,s){if(!T&&A.length===0)return[];if(A=e.fromDer(A,T),A.tagClass!==e.Class.UNIVERSAL||A.type!==e.Type.SEQUENCE||A.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");var m=[];for(var E=0;E<A.value.length;E++){var N=A.value[E],U={},g=[];if(!e.validate(N,c,U,g)){var o=new Error("Cannot read SafeBag.");throw o.errors=g,o}var n={type:e.derToOid(U.bagId),attributes:C(U.bagAttributes)};m.push(n);var w,K,O=U.bagValue.value[0];switch(n.type){case a.oids.pkcs8ShroudedKeyBag:if(O=a.decryptPrivateKeyInfo(O,s),O===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case a.oids.keyBag:try{n.key=a.privateKeyFromAsn1(O)}catch(F){n.key=null,n.asn1=O}continue;case a.oids.certBag:w=v,K=function(){if(e.derToOid(U.certId)!==a.oids.x509Certificate){var F=new Error("Unsupported certificate type, only X.509 supported.");throw F.oid=e.derToOid(U.certId),F}var H=e.fromDer(U.cert,T);try{n.cert=a.certificateFromAsn1(H,!0)}catch(j){n.cert=null,n.asn1=H}};break;default:var o=new Error("Unsupported PKCS#12 SafeBag type.");throw o.oid=n.type,o}if(w!==void 0&&!e.validate(O,w,U,g)){var o=new Error("Cannot read PKCS#12 "+w.name);throw o.errors=g,o}K()}return m}function C(A){var T={};if(A!==void 0)for(var s=0;s<A.length;++s){var m={},E=[];if(!e.validate(A[s],i,m,E)){var N=new Error("Cannot read PKCS#12 BagAttribute.");throw N.errors=E,N}var U=e.derToOid(m.oid);if(a.oids[U]===void 0)continue;T[a.oids[U]]=[];for(var g=0;g<m.values.length;++g)T[a.oids[U]].push(m.values[g].value)}return T}y.toPkcs12Asn1=function(A,T,s,m){if(m=m||{},m.saltSize=m.saltSize||8,m.count=m.count||2048,m.algorithm=m.algorithm||m.encAlgorithm||"aes128",!("useMac"in m))m.useMac=!0;if(!("localKeyId"in m))m.localKeyId=null;if(!("generateLocalKeyId"in m))m.generateLocalKeyId=!0;var E=m.localKeyId,N;if(E!==null)E=t.util.hexToBytes(E);else if(m.generateLocalKeyId)if(T){var U=t.util.isArray(T)?T[0]:T;if(typeof U==="string")U=a.certificateFromPem(U);var g=t.md.sha1.create();g.update(e.toDer(a.certificateToAsn1(U)).getBytes()),E=g.digest().getBytes()}else E=t.random.getBytes(20);var o=[];if(E!==null)o.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,E)])]));if("friendlyName"in m)o.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,m.friendlyName)])]));if(o.length>0)N=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,o);var n=[],w=[];if(T!==null)if(t.util.isArray(T))w=T;else w=[T];var K=[];for(var O=0;O<w.length;++O){if(T=w[O],typeof T==="string")T=a.certificateFromPem(T);var V=O===0?N:void 0,F=a.certificateToAsn1(T),H=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(F).getBytes())])])]),V]);K.push(H)}if(K.length>0){var j=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,K),Q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(j).getBytes())])]);n.push(Q)}var Z=null;if(A!==null){var J=a.wrapRsaPrivateKey(a.privateKeyToAsn1(A));if(s===null)Z=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[J]),N]);else Z=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(J,s,m)]),N]);var te=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[Z]),se=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(te).getBytes())])]);n.push(se)}var fe=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n),me;if(m.useMac){var g=t.md.sha1.create(),Ae=new t.util.ByteBuffer(t.random.getBytes(m.saltSize)),x=m.count,A=y.generateKey(s,Ae,3,x,20),Ce=t.hmac.create();Ce.start(g,A),Ce.update(e.toDer(fe).getBytes());var ee=Ce.getMac();me=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ee.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Ae.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(x).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(fe).getBytes())])]),me])},y.generateKey=t.pbe.generatePkcs12Key}),Yi=le((r,S)=>{var t=de();gt(),Ut(),Hi(),Gt(),Or(),zi(),Fr(),hr(),Ee(),Gr();var e=t.asn1,a=S.exports=t.pki=t.pki||{};a.pemToDer=function(y){var l=t.pem.decode(y)[0];if(l.procType&&l.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return t.util.createBuffer(l.body)},a.privateKeyFromPem=function(y){var l=t.pem.decode(y)[0];if(l.type!=="PRIVATE KEY"&&l.type!=="RSA PRIVATE KEY"){var p=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw p.headerType=l.type,p}if(l.procType&&l.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var c=e.fromDer(l.body);return a.privateKeyFromAsn1(c)},a.privateKeyToPem=function(y,l){var p={type:"RSA PRIVATE KEY",body:e.toDer(a.privateKeyToAsn1(y)).getBytes()};return t.pem.encode(p,{maxline:l})},a.privateKeyInfoToPem=function(y,l){var p={type:"PRIVATE KEY",body:e.toDer(y).getBytes()};return t.pem.encode(p,{maxline:l})}}),Xi=le((r,S)=>{var t=de();gt(),Wt(),Mr(),Gt(),Yi(),ht(),Zt(),Ee();var e=function(d,L,D,u){var k=t.util.createBuffer(),G=d.length>>1,M=G+(d.length&1),W=d.substr(0,M),ie=d.substr(G,M),oe=t.util.createBuffer(),z=t.hmac.create();D=L+D;var ae=Math.ceil(u/16),ue=Math.ceil(u/20);z.start("MD5",W);var ve=t.util.createBuffer();oe.putBytes(D);for(var he=0;he<ae;++he)z.start(null,null),z.update(oe.getBytes()),oe.putBuffer(z.digest()),z.start(null,null),z.update(oe.bytes()+D),ve.putBuffer(z.digest());z.start("SHA1",ie);var be=t.util.createBuffer();oe.clear(),oe.putBytes(D);for(var he=0;he<ue;++he)z.start(null,null),z.update(oe.getBytes()),oe.putBuffer(z.digest()),z.start(null,null),z.update(oe.bytes()+D),be.putBuffer(z.digest());return k.putBytes(t.util.xorBytes(ve.getBytes(),be.getBytes(),u)),k},a=function(d,L,D){var u=t.hmac.create();u.start("SHA1",d);var k=t.util.createBuffer();return k.putInt32(L[0]),k.putInt32(L[1]),k.putByte(D.type),k.putByte(D.version.major),k.putByte(D.version.minor),k.putInt16(D.length),k.putBytes(D.fragment.bytes()),u.update(k.getBytes()),u.digest().getBytes()},y=function(d,L,D){var u=!1;try{var k=d.deflate(L.fragment.getBytes());L.fragment=t.util.createBuffer(k),L.length=k.length,u=!0}catch(G){}return u},l=function(d,L,D){var u=!1;try{var k=d.inflate(L.fragment.getBytes());L.fragment=t.util.createBuffer(k),L.length=k.length,u=!0}catch(G){}return u},p=function(d,L){var D=0;switch(L){case 1:D=d.getByte();break;case 2:D=d.getInt16();break;case 3:D=d.getInt24();break;case 4:D=d.getInt32();break}return t.util.createBuffer(d.getBytes(D))},c=function(d,L,D){d.putInt(D.length(),L<<3),d.putBuffer(D)},i={};i.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},i.SupportedVersions=[i.Versions.TLS_1_1,i.Versions.TLS_1_0],i.Version=i.SupportedVersions[0],i.MaxFragment=15360,i.ConnectionEnd={server:0,client:1},i.PRFAlgorithm={tls_prf_sha256:0},i.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},i.CipherType={stream:0,block:1,aead:2},i.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},i.CompressionMethod={none:0,deflate:1},i.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},i.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},i.Alert={},i.Alert.Level={warning:1,fatal:2},i.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},i.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},i.CipherSuites={},i.getCipherSuite=function(d){var L=null;for(var D in i.CipherSuites){var u=i.CipherSuites[D];if(u.id[0]===d.charCodeAt(0)&&u.id[1]===d.charCodeAt(1)){L=u;break}}return L},i.handleUnexpected=function(d,L){var D=!d.open&&d.entity===i.ConnectionEnd.client;if(!D)d.error(d,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}})},i.handleHelloRequest=function(d,L,D){if(!d.handshaking&&d.handshakes>0)i.queue(d,i.createAlert(d,{level:i.Alert.Level.warning,description:i.Alert.Description.no_renegotiation})),i.flush(d);d.process()},i.parseHelloMessage=function(d,L,D){var u=null,k=d.entity===i.ConnectionEnd.client;if(D<38)d.error(d,{message:k?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});else{var G=L.fragment,M=G.length();if(u={version:{major:G.getByte(),minor:G.getByte()},random:t.util.createBuffer(G.getBytes(32)),session_id:p(G,1),extensions:[]},k)u.cipher_suite=G.getBytes(2),u.compression_method=G.getByte();else u.cipher_suites=p(G,2),u.compression_methods=p(G,1);if(M=D-(M-G.length()),M>0){var W=p(G,2);while(W.length()>0)u.extensions.push({type:[W.getByte(),W.getByte()],data:p(W,2)});if(!k)for(var ie=0;ie<u.extensions.length;++ie){var oe=u.extensions[ie];if(oe.type[0]===0&&oe.type[1]===0){var z=p(oe.data,2);while(z.length()>0){var ae=z.getByte();if(ae!==0)break;d.session.extensions.server_name.serverNameList.push(p(z,2).getBytes())}}}}if(d.session.version){if(u.version.major!==d.session.version.major||u.version.minor!==d.session.version.minor)return d.error(d,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}})}if(k)d.session.cipherSuite=i.getCipherSuite(u.cipher_suite);else{var ue=t.util.createBuffer(u.cipher_suites.bytes());while(ue.length()>0)if(d.session.cipherSuite=i.getCipherSuite(ue.getBytes(2)),d.session.cipherSuite!==null)break}if(d.session.cipherSuite===null)return d.error(d,{message:"No cipher suites in common.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure},cipherSuite:t.util.bytesToHex(u.cipher_suite)});if(k)d.session.compressionMethod=u.compression_method;else d.session.compressionMethod=i.CompressionMethod.none}return u},i.createSecurityParameters=function(d,L){var D=d.entity===i.ConnectionEnd.client,u=L.random.bytes(),k=D?d.session.sp.client_random:u,G=D?u:i.createRandom().getBytes();d.session.sp={entity:d.entity,prf_algorithm:i.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:d.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:k,server_random:G}},i.handleServerHello=function(d,L,D){var u=i.parseHelloMessage(d,L,D);if(d.fail)return;if(u.version.minor<=d.version.minor)d.version.minor=u.version.minor;else return d.error(d,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}});d.session.version=d.version;var k=u.session_id.bytes();if(k.length>0&&k===d.session.id)d.expect=h,d.session.resuming=!0,d.session.sp.server_random=u.random.bytes();else d.expect=f,d.session.resuming=!1,i.createSecurityParameters(d,u);d.session.id=k,d.process()},i.handleClientHello=function(d,L,D){var u=i.parseHelloMessage(d,L,D);if(d.fail)return;var k=u.session_id.bytes(),G=null;if(d.sessionCache){if(G=d.sessionCache.getSession(k),G===null)k="";else if(G.version.major!==u.version.major||G.version.minor>u.version.minor)G=null,k=""}if(k.length===0)k=t.random.getBytes(32);if(d.session.id=k,d.session.clientHelloVersion=u.version,d.session.sp={},G)d.version=d.session.version=G.version,d.session.sp=G.sp;else{var M;for(var W=1;W<i.SupportedVersions.length;++W)if(M=i.SupportedVersions[W],M.minor<=u.version.minor)break;d.version={major:M.major,minor:M.minor},d.session.version=d.version}if(G!==null)d.expect=U,d.session.resuming=!0,d.session.sp.client_random=u.random.bytes();else d.expect=d.verifyClient!==!1?m:E,d.session.resuming=!1,i.createSecurityParameters(d,u);if(d.open=!0,i.queue(d,i.createRecord(d,{type:i.ContentType.handshake,data:i.createServerHello(d)})),d.session.resuming)i.queue(d,i.createRecord(d,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),d.state.pending=i.createConnectionState(d),d.state.current.write=d.state.pending.write,i.queue(d,i.createRecord(d,{type:i.ContentType.handshake,data:i.createFinished(d)}));else if(i.queue(d,i.createRecord(d,{type:i.ContentType.handshake,data:i.createCertificate(d)})),!d.fail){if(i.queue(d,i.createRecord(d,{type:i.ContentType.handshake,data:i.createServerKeyExchange(d)})),d.verifyClient!==!1)i.queue(d,i.createRecord(d,{type:i.ContentType.handshake,data:i.createCertificateRequest(d)}));i.queue(d,i.createRecord(d,{type:i.ContentType.handshake,data:i.createServerHelloDone(d)}))}i.flush(d),d.process()},i.handleCertificate=function(d,L,D){if(D<3)return d.error(d,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var u=L.fragment,k={certificate_list:p(u,3)},G,M,W=[];try{while(k.certificate_list.length()>0)G=p(k.certificate_list,3),M=t.asn1.fromDer(G),G=t.pki.certificateFromAsn1(M,!0),W.push(G)}catch(oe){return d.error(d,{message:"Could not parse certificate list.",cause:oe,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var ie=d.entity===i.ConnectionEnd.client;if((ie||d.verifyClient===!0)&&W.length===0)d.error(d,{message:ie?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});else if(W.length===0)d.expect=ie?B:E;else{if(ie)d.session.serverCertificate=W[0];else d.session.clientCertificate=W[0];if(i.verifyCertificateChain(d,W))d.expect=ie?B:E}d.process()},i.handleServerKeyExchange=function(d,L,D){if(D>0)return d.error(d,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});d.expect=_,d.process()},i.handleClientKeyExchange=function(d,L,D){if(D<48)return d.error(d,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});var u=L.fragment,k={enc_pre_master_secret:p(u,2).getBytes()},G=null;if(d.getPrivateKey)try{G=d.getPrivateKey(d,d.session.serverCertificate),G=t.pki.privateKeyFromPem(G)}catch(ie){d.error(d,{message:"Could not get private key.",cause:ie,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}if(G===null)return d.error(d,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}});try{var M=d.session.sp;M.pre_master_secret=G.decrypt(k.enc_pre_master_secret);var W=d.session.clientHelloVersion;if(W.major!==M.pre_master_secret.charCodeAt(0)||W.minor!==M.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(ie){M.pre_master_secret=t.random.getBytes(48)}if(d.expect=U,d.session.clientCertificate!==null)d.expect=N;d.process()},i.handleCertificateRequest=function(d,L,D){if(D<3)return d.error(d,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var u=L.fragment,k={certificate_types:p(u,1),certificate_authorities:p(u,2)};d.session.certificateRequest=k,d.expect=I,d.process()},i.handleCertificateVerify=function(d,L,D){if(D<2)return d.error(d,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var u=L.fragment;u.read-=4;var k=u.bytes();u.read+=4;var G={signature:p(u,2).getBytes()},M=t.util.createBuffer();M.putBuffer(d.session.md5.digest()),M.putBuffer(d.session.sha1.digest()),M=M.getBytes();try{var W=d.session.clientCertificate;if(!W.publicKey.verify(M,G.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");d.session.md5.update(k),d.session.sha1.update(k)}catch(ie){return d.error(d,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure}})}d.expect=U,d.process()},i.handleServerHelloDone=function(d,L,D){if(D>0)return d.error(d,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.record_overflow}});if(d.serverCertificate===null){var u={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.insufficient_security}},k=0,G=d.verify(d,u.alert.description,k,[]);if(G!==!0){if(G||G===0){if(typeof G==="object"&&!t.util.isArray(G)){if(G.message)u.message=G.message;if(G.alert)u.alert.description=G.alert}else if(typeof G==="number")u.alert.description=G}return d.error(d,u)}}if(d.session.certificateRequest!==null)L=i.createRecord(d,{type:i.ContentType.handshake,data:i.createCertificate(d)}),i.queue(d,L);L=i.createRecord(d,{type:i.ContentType.handshake,data:i.createClientKeyExchange(d)}),i.queue(d,L),d.expect=T;var M=function(W,ie){if(W.session.certificateRequest!==null&&W.session.clientCertificate!==null)i.queue(W,i.createRecord(W,{type:i.ContentType.handshake,data:i.createCertificateVerify(W,ie)}));i.queue(W,i.createRecord(W,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),W.state.pending=i.createConnectionState(W),W.state.current.write=W.state.pending.write,i.queue(W,i.createRecord(W,{type:i.ContentType.handshake,data:i.createFinished(W)})),W.expect=h,i.flush(W),W.process()};if(d.session.certificateRequest===null||d.session.clientCertificate===null)return M(d,null);i.getClientSignature(d,M)},i.handleChangeCipherSpec=function(d,L){if(L.fragment.getByte()!==1)return d.error(d,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var D=d.entity===i.ConnectionEnd.client;if(d.session.resuming&&D||!d.session.resuming&&!D)d.state.pending=i.createConnectionState(d);if(d.state.current.read=d.state.pending.read,!d.session.resuming&&D||d.session.resuming&&!D)d.state.pending=null;d.expect=D?C:g,d.process()},i.handleFinished=function(d,L,D){var u=L.fragment;u.read-=4;var k=u.bytes();u.read+=4;var G=L.fragment.getBytes();u=t.util.createBuffer(),u.putBuffer(d.session.md5.digest()),u.putBuffer(d.session.sha1.digest());var M=d.entity===i.ConnectionEnd.client,W=M?"server finished":"client finished",ie=d.session.sp,oe=12,z=e;if(u=z(ie.master_secret,W,u.getBytes(),oe),u.getBytes()!==G)return d.error(d,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decrypt_error}});if(d.session.md5.update(k),d.session.sha1.update(k),d.session.resuming&&M||!d.session.resuming&&!M)i.queue(d,i.createRecord(d,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),d.state.current.write=d.state.pending.write,d.state.pending=null,i.queue(d,i.createRecord(d,{type:i.ContentType.handshake,data:i.createFinished(d)}));d.expect=M?A:o,d.handshaking=!1,++d.handshakes,d.peerCertificate=M?d.session.serverCertificate:d.session.clientCertificate,i.flush(d),d.isConnected=!0,d.connected(d),d.process()},i.handleAlert=function(d,L){var D=L.fragment,u={level:D.getByte(),description:D.getByte()},k;switch(u.description){case i.Alert.Description.close_notify:k="Connection closed.";break;case i.Alert.Description.unexpected_message:k="Unexpected message.";break;case i.Alert.Description.bad_record_mac:k="Bad record MAC.";break;case i.Alert.Description.decryption_failed:k="Decryption failed.";break;case i.Alert.Description.record_overflow:k="Record overflow.";break;case i.Alert.Description.decompression_failure:k="Decompression failed.";break;case i.Alert.Description.handshake_failure:k="Handshake failure.";break;case i.Alert.Description.bad_certificate:k="Bad certificate.";break;case i.Alert.Description.unsupported_certificate:k="Unsupported certificate.";break;case i.Alert.Description.certificate_revoked:k="Certificate revoked.";break;case i.Alert.Description.certificate_expired:k="Certificate expired.";break;case i.Alert.Description.certificate_unknown:k="Certificate unknown.";break;case i.Alert.Description.illegal_parameter:k="Illegal parameter.";break;case i.Alert.Description.unknown_ca:k="Unknown certificate authority.";break;case i.Alert.Description.access_denied:k="Access denied.";break;case i.Alert.Description.decode_error:k="Decode error.";break;case i.Alert.Description.decrypt_error:k="Decrypt error.";break;case i.Alert.Description.export_restriction:k="Export restriction.";break;case i.Alert.Description.protocol_version:k="Unsupported protocol version.";break;case i.Alert.Description.insufficient_security:k="Insufficient security.";break;case i.Alert.Description.internal_error:k="Internal error.";break;case i.Alert.Description.user_canceled:k="User canceled.";break;case i.Alert.Description.no_renegotiation:k="Renegotiation not supported.";break;default:k="Unknown error.";break}if(u.description===i.Alert.Description.close_notify)return d.close();d.error(d,{message:k,send:!1,origin:d.entity===i.ConnectionEnd.client?"server":"client",alert:u}),d.process()},i.handleHandshake=function(d,L){var D=L.fragment,u=D.getByte(),k=D.getInt24();if(k>D.length())return d.fragmented=L,L.fragment=t.util.createBuffer(),D.read-=4,d.process();d.fragmented=null,D.read-=4;var G=D.bytes(k+4);if(D.read+=4,u in me[d.entity][d.expect]){if(d.entity===i.ConnectionEnd.server&&!d.open&&!d.fail)d.handshaking=!0,d.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:t.md.md5.create(),sha1:t.md.sha1.create()};if(u!==i.HandshakeType.hello_request&&u!==i.HandshakeType.certificate_verify&&u!==i.HandshakeType.finished)d.session.md5.update(G),d.session.sha1.update(G);me[d.entity][d.expect][u](d,L,k)}else i.handleUnexpected(d,L)},i.handleApplicationData=function(d,L){d.data.putBuffer(L.fragment),d.dataReady(d),d.process()},i.handleHeartbeat=function(d,L){var D=L.fragment,u=D.getByte(),k=D.getInt16(),G=D.getBytes(k);if(u===i.HeartbeatMessageType.heartbeat_request){if(d.handshaking||k>G.length)return d.process();i.queue(d,i.createRecord(d,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_response,G)})),i.flush(d)}else if(u===i.HeartbeatMessageType.heartbeat_response){if(G!==d.expectedHeartbeatPayload)return d.process();if(d.heartbeatReceived)d.heartbeatReceived(d,t.util.createBuffer(G))}d.process()};var v=0,f=1,B=2,_=3,I=4,h=5,C=6,A=7,T=8,s=0,m=1,E=2,N=3,U=4,g=5,o=6,n=i.handleUnexpected,w=i.handleChangeCipherSpec,K=i.handleAlert,O=i.handleHandshake,V=i.handleApplicationData,F=i.handleHeartbeat,H=[];H[i.ConnectionEnd.client]=[[n,K,O,n,F],[n,K,O,n,F],[n,K,O,n,F],[n,K,O,n,F],[n,K,O,n,F],[w,K,n,n,F],[n,K,O,n,F],[n,K,O,V,F],[n,K,O,n,F]],H[i.ConnectionEnd.server]=[[n,K,O,n,F],[n,K,O,n,F],[n,K,O,n,F],[n,K,O,n,F],[w,K,n,n,F],[n,K,O,n,F],[n,K,O,V,F],[n,K,O,n,F]];var{handleHelloRequest:j,handleServerHello:Q,handleCertificate:Z,handleServerKeyExchange:J,handleCertificateRequest:te,handleServerHelloDone:se,handleFinished:fe}=i,me=[];me[i.ConnectionEnd.client]=[[n,n,Q,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[j,n,n,n,n,n,n,n,n,n,n,Z,J,te,se,n,n,n,n,n,n],[j,n,n,n,n,n,n,n,n,n,n,n,J,te,se,n,n,n,n,n,n],[j,n,n,n,n,n,n,n,n,n,n,n,n,te,se,n,n,n,n,n,n],[j,n,n,n,n,n,n,n,n,n,n,n,n,n,se,n,n,n,n,n,n],[j,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[j,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,fe],[j,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[j,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]];var{handleClientHello:Ae,handleClientKeyExchange:x,handleCertificateVerify:Ce}=i;me[i.ConnectionEnd.server]=[[n,Ae,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,Z,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,x,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,Ce,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,fe],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]],i.generateKeys=function(d,L){var D=e,u=L.client_random+L.server_random;if(!d.session.resuming)L.master_secret=D(L.pre_master_secret,"master secret",u,48).bytes(),L.pre_master_secret=null;u=L.server_random+L.client_random;var k=2*L.mac_key_length+2*L.enc_key_length,G=d.version.major===i.Versions.TLS_1_0.major&&d.version.minor===i.Versions.TLS_1_0.minor;if(G)k+=2*L.fixed_iv_length;var M=D(L.master_secret,"key expansion",u,k),W={client_write_MAC_key:M.getBytes(L.mac_key_length),server_write_MAC_key:M.getBytes(L.mac_key_length),client_write_key:M.getBytes(L.enc_key_length),server_write_key:M.getBytes(L.enc_key_length)};if(G)W.client_write_IV=M.getBytes(L.fixed_iv_length),W.server_write_IV=M.getBytes(L.fixed_iv_length);return W},i.createConnectionState=function(d){var L=d.entity===i.ConnectionEnd.client,D=function(){var G={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(M){return!0},compressionState:null,compressFunction:function(M){return!0},updateSequenceNumber:function(){if(G.sequenceNumber[1]===4294967295)G.sequenceNumber[1]=0,++G.sequenceNumber[0];else++G.sequenceNumber[1]}};return G},u={read:D(),write:D()};if(u.read.update=function(G,M){if(!u.read.cipherFunction(M,u.read))G.error(G,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_record_mac}});else if(!u.read.compressFunction(G,M,u.read))G.error(G,{message:"Could not decompress record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decompression_failure}});return!G.fail},u.write.update=function(G,M){if(!u.write.compressFunction(G,M,u.write))G.error(G,{message:"Could not compress record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}});else if(!u.write.cipherFunction(M,u.write))G.error(G,{message:"Could not encrypt record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}});return!G.fail},d.session){var k=d.session.sp;switch(d.session.cipherSuite.initSecurityParameters(k),k.keys=i.generateKeys(d,k),u.read.macKey=L?k.keys.server_write_MAC_key:k.keys.client_write_MAC_key,u.write.macKey=L?k.keys.client_write_MAC_key:k.keys.server_write_MAC_key,d.session.cipherSuite.initConnectionState(u,d,k),k.compression_algorithm){case i.CompressionMethod.none:break;case i.CompressionMethod.deflate:u.read.compressFunction=l,u.write.compressFunction=y;break;default:throw new Error("Unsupported compression algorithm.")}}return u},i.createRandom=function(){var d=new Date,L=+d+d.getTimezoneOffset()*60000,D=t.util.createBuffer();return D.putInt32(L),D.putBytes(t.random.getBytes(28)),D},i.createRecord=function(d,L){if(!L.data)return null;var D={type:L.type,version:{major:d.version.major,minor:d.version.minor},length:L.data.length(),fragment:L.data};return D},i.createAlert=function(d,L){var D=t.util.createBuffer();return D.putByte(L.level),D.putByte(L.description),i.createRecord(d,{type:i.ContentType.alert,data:D})},i.createClientHello=function(d){d.session.clientHelloVersion={major:d.version.major,minor:d.version.minor};var L=t.util.createBuffer();for(var D=0;D<d.cipherSuites.length;++D){var u=d.cipherSuites[D];L.putByte(u.id[0]),L.putByte(u.id[1])}var k=L.length(),G=t.util.createBuffer();G.putByte(i.CompressionMethod.none);var M=G.length(),W=t.util.createBuffer();if(d.virtualHost){var ie=t.util.createBuffer();ie.putByte(0),ie.putByte(0);var oe=t.util.createBuffer();oe.putByte(0),c(oe,2,t.util.createBuffer(d.virtualHost));var z=t.util.createBuffer();c(z,2,oe),c(ie,2,z),W.putBuffer(ie)}var ae=W.length();if(ae>0)ae+=2;var ue=d.session.id,ve=ue.length+1+2+4+28+2+k+1+M+ae,he=t.util.createBuffer();if(he.putByte(i.HandshakeType.client_hello),he.putInt24(ve),he.putByte(d.version.major),he.putByte(d.version.minor),he.putBytes(d.session.sp.client_random),c(he,1,t.util.createBuffer(ue)),c(he,2,L),c(he,1,G),ae>0)c(he,2,W);return he},i.createServerHello=function(d){var L=d.session.id,D=L.length+1+2+4+28+2+1,u=t.util.createBuffer();return u.putByte(i.HandshakeType.server_hello),u.putInt24(D),u.putByte(d.version.major),u.putByte(d.version.minor),u.putBytes(d.session.sp.server_random),c(u,1,t.util.createBuffer(L)),u.putByte(d.session.cipherSuite.id[0]),u.putByte(d.session.cipherSuite.id[1]),u.putByte(d.session.compressionMethod),u},i.createCertificate=function(d){var L=d.entity===i.ConnectionEnd.client,D=null;if(d.getCertificate){var u;if(L)u=d.session.certificateRequest;else u=d.session.extensions.server_name.serverNameList;D=d.getCertificate(d,u)}var k=t.util.createBuffer();if(D!==null)try{if(!t.util.isArray(D))D=[D];var G=null;for(var M=0;M<D.length;++M){var W=t.pem.decode(D[M])[0];if(W.type!=="CERTIFICATE"&&W.type!=="X509 CERTIFICATE"&&W.type!=="TRUSTED CERTIFICATE"){var ie=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw ie.headerType=W.type,ie}if(W.procType&&W.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var oe=t.util.createBuffer(W.body);if(G===null)G=t.asn1.fromDer(oe.bytes(),!1);var z=t.util.createBuffer();c(z,3,oe),k.putBuffer(z)}if(D=t.pki.certificateFromAsn1(G),L)d.session.clientCertificate=D;else d.session.serverCertificate=D}catch(ve){return d.error(d,{message:"Could not send certificate list.",cause:ve,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var ae=3+k.length(),ue=t.util.createBuffer();return ue.putByte(i.HandshakeType.certificate),ue.putInt24(ae),c(ue,3,k),ue},i.createClientKeyExchange=function(d){var L=t.util.createBuffer();L.putByte(d.session.clientHelloVersion.major),L.putByte(d.session.clientHelloVersion.minor),L.putBytes(t.random.getBytes(46));var D=d.session.sp;D.pre_master_secret=L.getBytes();var u=d.session.serverCertificate.publicKey;L=u.encrypt(D.pre_master_secret);var k=L.length+2,G=t.util.createBuffer();return G.putByte(i.HandshakeType.client_key_exchange),G.putInt24(k),G.putInt16(L.length),G.putBytes(L),G},i.createServerKeyExchange=function(d){var L=0,D=t.util.createBuffer();if(L>0)D.putByte(i.HandshakeType.server_key_exchange),D.putInt24(L);return D},i.getClientSignature=function(d,L){var D=t.util.createBuffer();D.putBuffer(d.session.md5.digest()),D.putBuffer(d.session.sha1.digest()),D=D.getBytes(),d.getSignature=d.getSignature||function(u,k,G){var M=null;if(u.getPrivateKey)try{M=u.getPrivateKey(u,u.session.clientCertificate),M=t.pki.privateKeyFromPem(M)}catch(W){u.error(u,{message:"Could not get private key.",cause:W,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}if(M===null)u.error(u,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}});else k=M.sign(k,null);G(u,k)},d.getSignature(d,D,L)},i.createCertificateVerify=function(d,L){var D=L.length+2,u=t.util.createBuffer();return u.putByte(i.HandshakeType.certificate_verify),u.putInt24(D),u.putInt16(L.length),u.putBytes(L),u},i.createCertificateRequest=function(d){var L=t.util.createBuffer();L.putByte(1);var D=t.util.createBuffer();for(var u in d.caStore.certs){var k=d.caStore.certs[u],G=t.pki.distinguishedNameToAsn1(k.subject),M=t.asn1.toDer(G);D.putInt16(M.length()),D.putBuffer(M)}var W=1+L.length()+2+D.length(),ie=t.util.createBuffer();return ie.putByte(i.HandshakeType.certificate_request),ie.putInt24(W),c(ie,1,L),c(ie,2,D),ie},i.createServerHelloDone=function(d){var L=t.util.createBuffer();return L.putByte(i.HandshakeType.server_hello_done),L.putInt24(0),L},i.createChangeCipherSpec=function(){var d=t.util.createBuffer();return d.putByte(1),d},i.createFinished=function(d){var L=t.util.createBuffer();L.putBuffer(d.session.md5.digest()),L.putBuffer(d.session.sha1.digest());var D=d.entity===i.ConnectionEnd.client,u=d.session.sp,k=12,G=e,M=D?"client finished":"server finished";L=G(u.master_secret,M,L.getBytes(),k);var W=t.util.createBuffer();return W.putByte(i.HandshakeType.finished),W.putInt24(L.length()),W.putBuffer(L),W},i.createHeartbeat=function(d,L,D){if(typeof D==="undefined")D=L.length;var u=t.util.createBuffer();u.putByte(d),u.putInt16(D),u.putBytes(L);var k=u.length(),G=Math.max(16,k-D-3);return u.putBytes(t.random.getBytes(G)),u},i.queue=function(d,L){if(!L)return;if(L.fragment.length()===0){if(L.type===i.ContentType.handshake||L.type===i.ContentType.alert||L.type===i.ContentType.change_cipher_spec)return}if(L.type===i.ContentType.handshake){var D=L.fragment.bytes();d.session.md5.update(D),d.session.sha1.update(D),D=null}var u;if(L.fragment.length()<=i.MaxFragment)u=[L];else{u=[];var k=L.fragment.bytes();while(k.length>i.MaxFragment)u.push(i.createRecord(d,{type:L.type,data:t.util.createBuffer(k.slice(0,i.MaxFragment))})),k=k.slice(i.MaxFragment);if(k.length>0)u.push(i.createRecord(d,{type:L.type,data:t.util.createBuffer(k)}))}for(var G=0;G<u.length&&!d.fail;++G){var M=u[G],W=d.state.current.write;if(W.update(d,M))d.records.push(M)}},i.flush=function(d){for(var L=0;L<d.records.length;++L){var D=d.records[L];d.tlsData.putByte(D.type),d.tlsData.putByte(D.version.major),d.tlsData.putByte(D.version.minor),d.tlsData.putInt16(D.fragment.length()),d.tlsData.putBuffer(d.records[L].fragment)}return d.records=[],d.tlsDataReady(d)};var ee=function(d){switch(d){case!0:return!0;case t.pki.certificateError.bad_certificate:return i.Alert.Description.bad_certificate;case t.pki.certificateError.unsupported_certificate:return i.Alert.Description.unsupported_certificate;case t.pki.certificateError.certificate_revoked:return i.Alert.Description.certificate_revoked;case t.pki.certificateError.certificate_expired:return i.Alert.Description.certificate_expired;case t.pki.certificateError.certificate_unknown:return i.Alert.Description.certificate_unknown;case t.pki.certificateError.unknown_ca:return i.Alert.Description.unknown_ca;default:return i.Alert.Description.bad_certificate}},Be=function(d){switch(d){case!0:return!0;case i.Alert.Description.bad_certificate:return t.pki.certificateError.bad_certificate;case i.Alert.Description.unsupported_certificate:return t.pki.certificateError.unsupported_certificate;case i.Alert.Description.certificate_revoked:return t.pki.certificateError.certificate_revoked;case i.Alert.Description.certificate_expired:return t.pki.certificateError.certificate_expired;case i.Alert.Description.certificate_unknown:return t.pki.certificateError.certificate_unknown;case i.Alert.Description.unknown_ca:return t.pki.certificateError.unknown_ca;default:return t.pki.certificateError.bad_certificate}};i.verifyCertificateChain=function(d,L){try{var D={};for(var u in d.verifyOptions)D[u]=d.verifyOptions[u];D.verify=function(G,M,W){var ie=ee(G),oe=d.verify(d,G,M,W);if(oe!==!0){if(typeof oe==="object"&&!t.util.isArray(oe)){var z=new Error("The application rejected the certificate.");if(z.send=!0,z.alert={level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate},oe.message)z.message=oe.message;if(oe.alert)z.alert.description=oe.alert;throw z}if(oe!==G)oe=Be(oe)}return oe},t.pki.verifyCertificateChain(d.caStore,L,D)}catch(G){var k=G;if(typeof k!=="object"||t.util.isArray(k))k={send:!0,alert:{level:i.Alert.Level.fatal,description:ee(G)}};if(!("send"in k))k.send=!0;if(!("alert"in k))k.alert={level:i.Alert.Level.fatal,description:ee(k.error)};d.error(d,k)}return!d.fail},i.createSessionCache=function(d,L){var D=null;if(d&&d.getSession&&d.setSession&&d.order)D=d;else{D={},D.cache=d||{},D.capacity=Math.max(L||100,1),D.order=[];for(var u in d)if(D.order.length<=L)D.order.push(u);else delete d[u];D.getSession=function(k){var G=null,M=null;if(k)M=t.util.bytesToHex(k);else if(D.order.length>0)M=D.order[0];if(M!==null&&M in D.cache){G=D.cache[M],delete D.cache[M];for(var W in D.order)if(D.order[W]===M){D.order.splice(W,1);break}}return G},D.setSession=function(k,G){if(D.order.length===D.capacity){var M=D.order.shift();delete D.cache[M]}var M=t.util.bytesToHex(k);D.order.push(M),D.cache[M]=G}}return D},i.createConnection=function(d){var L=null;if(d.caStore)if(t.util.isArray(d.caStore))L=t.pki.createCaStore(d.caStore);else L=d.caStore;else L=t.pki.createCaStore();var D=d.cipherSuites||null;if(D===null){D=[];for(var u in i.CipherSuites)D.push(i.CipherSuites[u])}var k=d.server?i.ConnectionEnd.server:i.ConnectionEnd.client,G=d.sessionCache?i.createSessionCache(d.sessionCache):null,M={version:{major:i.Version.major,minor:i.Version.minor},entity:k,sessionId:d.sessionId,caStore:L,sessionCache:G,cipherSuites:D,connected:d.connected,virtualHost:d.virtualHost||null,verifyClient:d.verifyClient||!1,verify:d.verify||function(z,ae,ue,ve){return ae},verifyOptions:d.verifyOptions||{},getCertificate:d.getCertificate||null,getPrivateKey:d.getPrivateKey||null,getSignature:d.getSignature||null,input:t.util.createBuffer(),tlsData:t.util.createBuffer(),data:t.util.createBuffer(),tlsDataReady:d.tlsDataReady,dataReady:d.dataReady,heartbeatReceived:d.heartbeatReceived,closed:d.closed,error:function(z,ae){if(ae.origin=ae.origin||(z.entity===i.ConnectionEnd.client?"client":"server"),ae.send)i.queue(z,i.createAlert(z,ae.alert)),i.flush(z);var ue=ae.fatal!==!1;if(ue)z.fail=!0;if(d.error(z,ae),ue)z.close(!1)},deflate:d.deflate||null,inflate:d.inflate||null};M.reset=function(z){M.version={major:i.Version.major,minor:i.Version.minor},M.record=null,M.session=null,M.peerCertificate=null,M.state={pending:null,current:null},M.expect=M.entity===i.ConnectionEnd.client?v:s,M.fragmented=null,M.records=[],M.open=!1,M.handshakes=0,M.handshaking=!1,M.isConnected=!1,M.fail=!(z||typeof z==="undefined"),M.input.clear(),M.tlsData.clear(),M.data.clear(),M.state.current=i.createConnectionState(M)},M.reset();var W=function(z,ae){var ue=ae.type-i.ContentType.change_cipher_spec,ve=H[z.entity][z.expect];if(ue in ve)ve[ue](z,ae);else i.handleUnexpected(z,ae)},ie=function(z){var ae=0,ue=z.input,ve=ue.length();if(ve<5)ae=5-ve;else{z.record={type:ue.getByte(),version:{major:ue.getByte(),minor:ue.getByte()},length:ue.getInt16(),fragment:t.util.createBuffer(),ready:!1};var he=z.record.version.major===z.version.major;if(he&&z.session&&z.session.version)he=z.record.version.minor===z.version.minor;if(!he)z.error(z,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}})}return ae},oe=function(z){var ae=0,ue=z.input,ve=ue.length();if(ve<z.record.length)ae=z.record.length-ve;else{z.record.fragment.putBytes(ue.getBytes(z.record.length)),ue.compact();var he=z.state.current.read;if(he.update(z,z.record)){if(z.fragmented!==null)if(z.fragmented.type===z.record.type)z.fragmented.fragment.putBuffer(z.record.fragment),z.record=z.fragmented;else z.error(z,{message:"Invalid fragmented record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}});z.record.ready=!0}}return ae};return M.handshake=function(z){if(M.entity!==i.ConnectionEnd.client)M.error(M,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(M.handshaking)M.error(M,{message:"Handshake already in progress.",fatal:!1});else{if(M.fail&&!M.open&&M.handshakes===0)M.fail=!1;M.handshaking=!0,z=z||"";var ae=null;if(z.length>0){if(M.sessionCache)ae=M.sessionCache.getSession(z);if(ae===null)z=""}if(z.length===0&&M.sessionCache){if(ae=M.sessionCache.getSession(),ae!==null)z=ae.id}if(M.session={id:z,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:t.md.md5.create(),sha1:t.md.sha1.create()},ae)M.version=ae.version,M.session.sp=ae.sp;M.session.sp.client_random=i.createRandom().getBytes(),M.open=!0,i.queue(M,i.createRecord(M,{type:i.ContentType.handshake,data:i.createClientHello(M)})),i.flush(M)}},M.process=function(z){var ae=0;if(z)M.input.putBytes(z);if(!M.fail){if(M.record!==null&&M.record.ready&&M.record.fragment.isEmpty())M.record=null;if(M.record===null)ae=ie(M);if(!M.fail&&M.record!==null&&!M.record.ready)ae=oe(M);if(!M.fail&&M.record!==null&&M.record.ready)W(M,M.record)}return ae},M.prepare=function(z){return i.queue(M,i.createRecord(M,{type:i.ContentType.application_data,data:t.util.createBuffer(z)})),i.flush(M)},M.prepareHeartbeatRequest=function(z,ae){if(z instanceof t.util.ByteBuffer)z=z.bytes();if(typeof ae==="undefined")ae=z.length;return M.expectedHeartbeatPayload=z,i.queue(M,i.createRecord(M,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_request,z,ae)})),i.flush(M)},M.close=function(z){if(!M.fail&&M.sessionCache&&M.session){var ae={id:M.session.id,version:M.session.version,sp:M.session.sp};ae.sp.keys=null,M.sessionCache.setSession(ae.id,ae)}if(M.open){if(M.open=!1,M.input.clear(),M.isConnected||M.handshaking)M.isConnected=M.handshaking=!1,i.queue(M,i.createAlert(M,{level:i.Alert.Level.warning,description:i.Alert.Description.close_notify})),i.flush(M);M.closed(M)}M.reset(z)},M},S.exports=t.tls=t.tls||{};for(ye in i)if(typeof i[ye]!=="function")t.tls[ye]=i[ye];var ye;t.tls.prf_tls1=e,t.tls.hmac_sha1=a,t.tls.createSessionCache=i.createSessionCache,t.tls.createConnection=i.createConnection}),is=le((r,S)=>{var t=de();Dt(),Xi();var e=S.exports=t.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(v){v.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,v.cipher_type=e.CipherType.block,v.enc_key_length=16,v.block_length=16,v.fixed_iv_length=16,v.record_iv_length=16,v.mac_algorithm=e.MACAlgorithm.hmac_sha1,v.mac_length=20,v.mac_key_length=20},initConnectionState:a},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(v){v.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,v.cipher_type=e.CipherType.block,v.enc_key_length=32,v.block_length=16,v.fixed_iv_length=16,v.record_iv_length=16,v.mac_algorithm=e.MACAlgorithm.hmac_sha1,v.mac_length=20,v.mac_key_length=20},initConnectionState:a};function a(v,f,B){var _=f.entity===t.tls.ConnectionEnd.client;v.read.cipherState={init:!1,cipher:t.cipher.createDecipher("AES-CBC",_?B.keys.server_write_key:B.keys.client_write_key),iv:_?B.keys.server_write_IV:B.keys.client_write_IV},v.write.cipherState={init:!1,cipher:t.cipher.createCipher("AES-CBC",_?B.keys.client_write_key:B.keys.server_write_key),iv:_?B.keys.client_write_IV:B.keys.server_write_IV},v.read.cipherFunction=c,v.write.cipherFunction=y,v.read.macLength=v.write.macLength=B.mac_length,v.read.macFunction=v.write.macFunction=e.hmac_sha1}function y(v,f){var B=!1,_=f.macFunction(f.macKey,f.sequenceNumber,v);v.fragment.putBytes(_),f.updateSequenceNumber();var I;if(v.version.minor===e.Versions.TLS_1_0.minor)I=f.cipherState.init?null:f.cipherState.iv;else I=t.random.getBytesSync(16);f.cipherState.init=!0;var h=f.cipherState.cipher;if(h.start({iv:I}),v.version.minor>=e.Versions.TLS_1_1.minor)h.output.putBytes(I);if(h.update(v.fragment),h.finish(l))v.fragment=h.output,v.length=v.fragment.length(),B=!0;return B}function l(v,f,B){if(!B){var _=v-f.length()%v;f.fillWithByte(_-1,_)}return!0}function p(v,f,B){var _=!0;if(B){var I=f.length(),h=f.last();for(var C=I-1-h;C<I-1;++C)_=_&&f.at(C)==h;if(_)f.truncate(h+1)}return _}function c(v,f){var B=!1,_;if(v.version.minor===e.Versions.TLS_1_0.minor)_=f.cipherState.init?null:f.cipherState.iv;else _=v.fragment.getBytes(16);f.cipherState.init=!0;var I=f.cipherState.cipher;I.start({iv:_}),I.update(v.fragment),B=I.finish(p);var h=f.macLength,C=t.random.getBytesSync(h),A=I.output.length();if(A>=h)v.fragment=I.output.getBytes(A-h),C=I.output.getBytes(h);else v.fragment=I.output.getBytes();v.fragment=t.util.createBuffer(v.fragment),v.length=v.fragment.length();var T=f.macFunction(f.macKey,f.sequenceNumber,v);return f.updateSequenceNumber(),B=i(f.macKey,C,T)&&B,B}function i(v,f,B){var _=t.hmac.create();return _.start("SHA1",v),_.update(f),f=_.digest().getBytes(),_.start(null,null),_.update(B),B=_.digest().getBytes(),f===B}}),Wi=le((r,S)=>{var t=de();St(),Ee();var e=S.exports=t.sha512=t.sha512||{};t.md.sha512=t.md.algorithms.sha512=e;var a=t.sha384=t.sha512.sha384=t.sha512.sha384||{};a.create=function(){return e.create("SHA-384")},t.md.sha384=t.md.algorithms.sha384=a,t.sha512.sha256=t.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},t.md["sha512/256"]=t.md.algorithms["sha512/256"]=t.sha512.sha256,t.sha512.sha224=t.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},t.md["sha512/224"]=t.md.algorithms["sha512/224"]=t.sha512.sha224,e.create=function(f){if(!l)i();if(typeof f==="undefined")f="SHA-512";if(!(f in c))throw new Error("Invalid SHA-512 algorithm: "+f);var B=c[f],_=null,I=t.util.createBuffer(),h=new Array(80);for(var C=0;C<80;++C)h[C]=new Array(2);var A=64;switch(f){case"SHA-384":A=48;break;case"SHA-512/256":A=32;break;case"SHA-512/224":A=28;break}var T={algorithm:f.replace("-","").toLowerCase(),blockLength:128,digestLength:A,messageLength:0,fullMessageLength:null,messageLengthSize:16};return T.start=function(){T.messageLength=0,T.fullMessageLength=T.messageLength128=[];var s=T.messageLengthSize/4;for(var m=0;m<s;++m)T.fullMessageLength.push(0);I=t.util.createBuffer(),_=new Array(B.length);for(var m=0;m<B.length;++m)_[m]=B[m].slice(0);return T},T.start(),T.update=function(s,m){if(m==="utf8")s=t.util.encodeUtf8(s);var E=s.length;T.messageLength+=E,E=[E/4294967296>>>0,E>>>0];for(var N=T.fullMessageLength.length-1;N>=0;--N)T.fullMessageLength[N]+=E[1],E[1]=E[0]+(T.fullMessageLength[N]/4294967296>>>0),T.fullMessageLength[N]=T.fullMessageLength[N]>>>0,E[0]=E[1]/4294967296>>>0;if(I.putBytes(s),v(_,h,I),I.read>2048||I.length()===0)I.compact();return T},T.digest=function(){var s=t.util.createBuffer();s.putBytes(I.bytes());var m=T.fullMessageLength[T.fullMessageLength.length-1]+T.messageLengthSize,E=m&T.blockLength-1;s.putBytes(y.substr(0,T.blockLength-E));var N,U,g=T.fullMessageLength[0]*8;for(var o=0;o<T.fullMessageLength.length-1;++o)N=T.fullMessageLength[o+1]*8,U=N/4294967296>>>0,g+=U,s.putInt32(g>>>0),g=N>>>0;s.putInt32(g);var n=new Array(_.length);for(var o=0;o<_.length;++o)n[o]=_[o].slice(0);v(n,h,s);var w=t.util.createBuffer(),K;if(f==="SHA-512")K=n.length;else if(f==="SHA-384")K=n.length-2;else K=n.length-4;for(var o=0;o<K;++o)if(w.putInt32(n[o][0]),o!==K-1||f!=="SHA-512/224")w.putInt32(n[o][1]);return w},T};var y=null,l=!1,p=null,c=null;function i(){y=String.fromCharCode(128),y+=t.util.fillString(String.fromCharCode(0),128),p=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],c={},c["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],l=!0}function v(f,B,_){var I,h,C,A,T,s,m,E,N,U,g,o,n,w,K,O,V,F,H,j,Q,Z,J,te,se,fe,me,Ae,x,Ce,ee,Be,ye,d,L,D=_.length();while(D>=128){for(x=0;x<16;++x)B[x][0]=_.getInt32()>>>0,B[x][1]=_.getInt32()>>>0;for(;x<80;++x)Be=B[x-2],Ce=Be[0],ee=Be[1],I=((Ce>>>19|ee<<13)^(ee>>>29|Ce<<3)^Ce>>>6)>>>0,h=((Ce<<13|ee>>>19)^(ee<<3|Ce>>>29)^(Ce<<26|ee>>>6))>>>0,d=B[x-15],Ce=d[0],ee=d[1],C=((Ce>>>1|ee<<31)^(Ce>>>8|ee<<24)^Ce>>>7)>>>0,A=((Ce<<31|ee>>>1)^(Ce<<24|ee>>>8)^(Ce<<25|ee>>>7))>>>0,ye=B[x-7],L=B[x-16],ee=h+ye[1]+A+L[1],B[x][0]=I+ye[0]+C+L[0]+(ee/4294967296>>>0)>>>0,B[x][1]=ee>>>0;n=f[0][0],w=f[0][1],K=f[1][0],O=f[1][1],V=f[2][0],F=f[2][1],H=f[3][0],j=f[3][1],Q=f[4][0],Z=f[4][1],J=f[5][0],te=f[5][1],se=f[6][0],fe=f[6][1],me=f[7][0],Ae=f[7][1];for(x=0;x<80;++x)m=((Q>>>14|Z<<18)^(Q>>>18|Z<<14)^(Z>>>9|Q<<23))>>>0,E=((Q<<18|Z>>>14)^(Q<<14|Z>>>18)^(Z<<23|Q>>>9))>>>0,N=(se^Q&(J^se))>>>0,U=(fe^Z&(te^fe))>>>0,T=((n>>>28|w<<4)^(w>>>2|n<<30)^(w>>>7|n<<25))>>>0,s=((n<<4|w>>>28)^(w<<30|n>>>2)^(w<<25|n>>>7))>>>0,g=(n&K|V&(n^K))>>>0,o=(w&O|F&(w^O))>>>0,ee=Ae+E+U+p[x][1]+B[x][1],I=me+m+N+p[x][0]+B[x][0]+(ee/4294967296>>>0)>>>0,h=ee>>>0,ee=s+o,C=T+g+(ee/4294967296>>>0)>>>0,A=ee>>>0,me=se,Ae=fe,se=J,fe=te,J=Q,te=Z,ee=j+h,Q=H+I+(ee/4294967296>>>0)>>>0,Z=ee>>>0,H=V,j=F,V=K,F=O,K=n,O=w,ee=h+A,n=I+C+(ee/4294967296>>>0)>>>0,w=ee>>>0;ee=f[0][1]+w,f[0][0]=f[0][0]+n+(ee/4294967296>>>0)>>>0,f[0][1]=ee>>>0,ee=f[1][1]+O,f[1][0]=f[1][0]+K+(ee/4294967296>>>0)>>>0,f[1][1]=ee>>>0,ee=f[2][1]+F,f[2][0]=f[2][0]+V+(ee/4294967296>>>0)>>>0,f[2][1]=ee>>>0,ee=f[3][1]+j,f[3][0]=f[3][0]+H+(ee/4294967296>>>0)>>>0,f[3][1]=ee>>>0,ee=f[4][1]+Z,f[4][0]=f[4][0]+Q+(ee/4294967296>>>0)>>>0,f[4][1]=ee>>>0,ee=f[5][1]+te,f[5][0]=f[5][0]+J+(ee/4294967296>>>0)>>>0,f[5][1]=ee>>>0,ee=f[6][1]+fe,f[6][0]=f[6][0]+se+(ee/4294967296>>>0)>>>0,f[6][1]=ee>>>0,ee=f[7][1]+Ae,f[7][0]=f[7][0]+me+(ee/4294967296>>>0)>>>0,f[7][1]=ee>>>0,D-=128}}}),as=le((r)=>{var S=de();gt();var t=S.asn1;r.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},r.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}}),ns=le((r,S)=>{var t=de();fr(),ht(),Wi(),Ee();var e=as(),a=e.publicKeyValidator,y=e.privateKeyValidator;if(typeof l==="undefined")l=t.jsbn.BigInteger;var l,p=t.util.ByteBuffer,c=typeof Buffer==="undefined"?Uint8Array:Buffer;t.pki=t.pki||{},S.exports=t.pki.ed25519=t.ed25519=t.ed25519||{};var i=t.ed25519;i.constants={},i.constants.PUBLIC_KEY_BYTE_LENGTH=32,i.constants.PRIVATE_KEY_BYTE_LENGTH=64,i.constants.SEED_BYTE_LENGTH=32,i.constants.SIGN_BYTE_LENGTH=64,i.constants.HASH_BYTE_LENGTH=64,i.generateKeyPair=function(d){d=d||{};var L=d.seed;if(L===void 0)L=t.random.getBytesSync(i.constants.SEED_BYTE_LENGTH);else if(typeof L==="string"){if(L.length!==i.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+i.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(L instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');L=v({message:L,encoding:"binary"});var D=new c(i.constants.PUBLIC_KEY_BYTE_LENGTH),u=new c(i.constants.PRIVATE_KEY_BYTE_LENGTH);for(var k=0;k<32;++k)u[k]=L[k];return m(D,u),{publicKey:D,privateKey:u}},i.privateKeyFromAsn1=function(d){var L={},D=[],u=t.asn1.validate(d,y,L,D);if(!u){var k=new Error("Invalid Key.");throw k.errors=D,k}var G=t.asn1.derToOid(L.privateKeyOid),M=t.oids.EdDSA25519;if(G!==M)throw new Error('Invalid OID "'+G+'"; OID must be "'+M+'".');var W=L.privateKey,ie=v({message:t.asn1.fromDer(W).value,encoding:"binary"});return{privateKeyBytes:ie}},i.publicKeyFromAsn1=function(d){var L={},D=[],u=t.asn1.validate(d,a,L,D);if(!u){var k=new Error("Invalid Key.");throw k.errors=D,k}var G=t.asn1.derToOid(L.publicKeyOid),M=t.oids.EdDSA25519;if(G!==M)throw new Error('Invalid OID "'+G+'"; OID must be "'+M+'".');var W=L.ed25519PublicKey;if(W.length!==i.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return v({message:W,encoding:"binary"})},i.publicKeyFromPrivateKey=function(d){d=d||{};var L=v({message:d.privateKey,encoding:"binary"});if(L.length!==i.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+i.constants.PRIVATE_KEY_BYTE_LENGTH);var D=new c(i.constants.PUBLIC_KEY_BYTE_LENGTH);for(var u=0;u<D.length;++u)D[u]=L[32+u];return D},i.sign=function(d){d=d||{};var L=v(d),D=v({message:d.privateKey,encoding:"binary"});if(D.length===i.constants.SEED_BYTE_LENGTH){var u=i.generateKeyPair({seed:D});D=u.privateKey}else if(D.length!==i.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+i.constants.SEED_BYTE_LENGTH+" or "+i.constants.PRIVATE_KEY_BYTE_LENGTH);var k=new c(i.constants.SIGN_BYTE_LENGTH+L.length);E(k,L,L.length,D);var G=new c(i.constants.SIGN_BYTE_LENGTH);for(var M=0;M<G.length;++M)G[M]=k[M];return G},i.verify=function(d){d=d||{};var L=v(d);if(d.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var D=v({message:d.signature,encoding:"binary"});if(D.length!==i.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+i.constants.SIGN_BYTE_LENGTH);var u=v({message:d.publicKey,encoding:"binary"});if(u.length!==i.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+i.constants.PUBLIC_KEY_BYTE_LENGTH);var k=new c(i.constants.SIGN_BYTE_LENGTH+L.length),G=new c(i.constants.SIGN_BYTE_LENGTH+L.length),M;for(M=0;M<i.constants.SIGN_BYTE_LENGTH;++M)k[M]=D[M];for(M=0;M<L.length;++M)k[M+i.constants.SIGN_BYTE_LENGTH]=L[M];return N(G,k,k.length,u)>=0};function v(d){var L=d.message;if(L instanceof Uint8Array||L instanceof c)return L;var D=d.encoding;if(L===void 0)if(d.md)L=d.md.digest().getBytes(),D="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof L==="string"&&!D)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof L==="string"){if(typeof Buffer!=="undefined")return Buffer.from(L,D);L=new p(L,D)}else if(!(L instanceof p))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');var u=new c(L.length());for(var k=0;k<u.length;++k)u[k]=L.at(k);return u}var f=x(),B=x([1]),_=x([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),I=x([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=x([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),C=x([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),A=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),T=x([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function s(d,L){var D=t.md.sha512.create(),u=new p(d);D.update(u.getBytes(L),"binary");var k=D.digest().getBytes();if(typeof Buffer!=="undefined")return Buffer.from(k,"binary");var G=new c(i.constants.HASH_BYTE_LENGTH);for(var M=0;M<64;++M)G[M]=k.charCodeAt(M);return G}function m(d,L){var D=[x(),x(),x(),x()],u,k=s(L,32);k[0]&=248,k[31]&=127,k[31]|=64,te(D,k),w(d,D);for(u=0;u<32;++u)L[u+32]=d[u];return 0}function E(d,L,D,u){var k,G,M=new Float64Array(64),W=[x(),x(),x(),x()],ie=s(u,32);ie[0]&=248,ie[31]&=127,ie[31]|=64;var oe=D+64;for(k=0;k<D;++k)d[64+k]=L[k];for(k=0;k<32;++k)d[32+k]=ie[32+k];var z=s(d.subarray(32),D+32);g(z),te(W,z),w(d,W);for(k=32;k<64;++k)d[k]=u[k];var ae=s(d,D+64);g(ae);for(k=32;k<64;++k)M[k]=0;for(k=0;k<32;++k)M[k]=z[k];for(k=0;k<32;++k)for(G=0;G<32;G++)M[k+G]+=ae[k]*ie[G];return U(d.subarray(32),M),oe}function N(d,L,D,u){var k,G,M=new c(32),W=[x(),x(),x(),x()],ie=[x(),x(),x(),x()];if(G=-1,D<64)return-1;if(O(ie,u))return-1;for(k=0;k<D;++k)d[k]=L[k];for(k=0;k<32;++k)d[k+32]=u[k];var oe=s(d,D);if(g(oe),J(W,ie,oe),te(ie,L.subarray(32)),o(W,ie),w(M,W),D-=64,j(L,0,M,0)){for(k=0;k<D;++k)d[k]=0;return-1}for(k=0;k<D;++k)d[k]=L[k+64];return G=D,G}function U(d,L){var D,u,k,G;for(u=63;u>=32;--u){D=0;for(k=u-32,G=u-12;k<G;++k)L[k]+=D-16*L[u]*A[k-(u-32)],D=L[k]+128>>8,L[k]-=D*256;L[k]+=D,L[u]=0}D=0;for(k=0;k<32;++k)L[k]+=D-(L[31]>>4)*A[k],D=L[k]>>8,L[k]&=255;for(k=0;k<32;++k)L[k]-=D*A[k];for(u=0;u<32;++u)L[u+1]+=L[u]>>8,d[u]=L[u]&255}function g(d){var L=new Float64Array(64);for(var D=0;D<64;++D)L[D]=d[D],d[D]=0;U(d,L)}function o(d,L){var D=x(),u=x(),k=x(),G=x(),M=x(),W=x(),ie=x(),oe=x(),z=x();ee(D,d[1],d[0]),ee(z,L[1],L[0]),ye(D,D,z),Ce(u,d[0],d[1]),Ce(z,L[0],L[1]),ye(u,u,z),ye(k,d[3],L[3]),ye(k,k,I),ye(G,d[2],L[2]),Ce(G,G,G),ee(M,u,D),ee(W,G,k),Ce(ie,G,k),Ce(oe,u,D),ye(d[0],M,W),ye(d[1],oe,ie),ye(d[2],ie,W),ye(d[3],M,oe)}function n(d,L,D){for(var u=0;u<4;++u)Ae(d[u],L[u],D)}function w(d,L){var D=x(),u=x(),k=x();fe(k,L[2]),ye(D,L[0],k),ye(u,L[1],k),K(d,u),d[31]^=Z(D)<<7}function K(d,L){var D,u,k,G=x(),M=x();for(D=0;D<16;++D)M[D]=L[D];me(M),me(M),me(M);for(u=0;u<2;++u){G[0]=M[0]-65517;for(D=1;D<15;++D)G[D]=M[D]-65535-(G[D-1]>>16&1),G[D-1]&=65535;G[15]=M[15]-32767-(G[14]>>16&1),k=G[15]>>16&1,G[14]&=65535,Ae(M,G,1-k)}for(D=0;D<16;D++)d[2*D]=M[D]&255,d[2*D+1]=M[D]>>8}function O(d,L){var D=x(),u=x(),k=x(),G=x(),M=x(),W=x(),ie=x();if(se(d[2],B),V(d[1],L),Be(k,d[1]),ye(G,k,_),ee(k,k,d[2]),Ce(G,d[2],G),Be(M,G),Be(W,M),ye(ie,W,M),ye(D,ie,k),ye(D,D,G),F(D,D),ye(D,D,k),ye(D,D,G),ye(D,D,G),ye(d[0],D,G),Be(u,d[0]),ye(u,u,G),H(u,k))ye(d[0],d[0],T);if(Be(u,d[0]),ye(u,u,G),H(u,k))return-1;if(Z(d[0])===L[31]>>7)ee(d[0],f,d[0]);return ye(d[3],d[0],d[1]),0}function V(d,L){var D;for(D=0;D<16;++D)d[D]=L[2*D]+(L[2*D+1]<<8);d[15]&=32767}function F(d,L){var D=x(),u;for(u=0;u<16;++u)D[u]=L[u];for(u=250;u>=0;--u)if(Be(D,D),u!==1)ye(D,D,L);for(u=0;u<16;++u)d[u]=D[u]}function H(d,L){var D=new c(32),u=new c(32);return K(D,d),K(u,L),j(D,0,u,0)}function j(d,L,D,u){return Q(d,L,D,u,32)}function Q(d,L,D,u,k){var G,M=0;for(G=0;G<k;++G)M|=d[L+G]^D[u+G];return(1&M-1>>>8)-1}function Z(d){var L=new c(32);return K(L,d),L[0]&1}function J(d,L,D){var u,k;se(d[0],f),se(d[1],B),se(d[2],B),se(d[3],f);for(k=255;k>=0;--k)u=D[k/8|0]>>(k&7)&1,n(d,L,u),o(L,d),o(d,d),n(d,L,u)}function te(d,L){var D=[x(),x(),x(),x()];se(D[0],h),se(D[1],C),se(D[2],B),ye(D[3],h,C),J(d,D,L)}function se(d,L){var D;for(D=0;D<16;D++)d[D]=L[D]|0}function fe(d,L){var D=x(),u;for(u=0;u<16;++u)D[u]=L[u];for(u=253;u>=0;--u)if(Be(D,D),u!==2&&u!==4)ye(D,D,L);for(u=0;u<16;++u)d[u]=D[u]}function me(d){var L,D,u=1;for(L=0;L<16;++L)D=d[L]+u+65535,u=Math.floor(D/65536),d[L]=D-u*65536;d[0]+=u-1+37*(u-1)}function Ae(d,L,D){var u,k=~(D-1);for(var G=0;G<16;++G)u=k&(d[G]^L[G]),d[G]^=u,L[G]^=u}function x(d){var L,D=new Float64Array(16);if(d)for(L=0;L<d.length;++L)D[L]=d[L];return D}function Ce(d,L,D){for(var u=0;u<16;++u)d[u]=L[u]+D[u]}function ee(d,L,D){for(var u=0;u<16;++u)d[u]=L[u]-D[u]}function Be(d,L){ye(d,L,L)}function ye(d,L,D){var u,k,G=0,M=0,W=0,ie=0,oe=0,z=0,ae=0,ue=0,ve=0,he=0,be=0,_e=0,ke=0,Ne=0,Te=0,Ie=0,Ue=0,Je=0,Le=0,tt=0,rt=0,at=0,nt=0,ct=0,dt=0,mt=0,Tt=0,wt=0,Vt=0,Ht=0,Jt=0,Ve=D[0],Ke=D[1],Pe=D[2],Me=D[3],Oe=D[4],Fe=D[5],Ge=D[6],qe=D[7],He=D[8],je=D[9],Qe=D[10],ze=D[11],Ye=D[12],Xe=D[13],we=D[14],De=D[15];u=L[0],G+=u*Ve,M+=u*Ke,W+=u*Pe,ie+=u*Me,oe+=u*Oe,z+=u*Fe,ae+=u*Ge,ue+=u*qe,ve+=u*He,he+=u*je,be+=u*Qe,_e+=u*ze,ke+=u*Ye,Ne+=u*Xe,Te+=u*we,Ie+=u*De,u=L[1],M+=u*Ve,W+=u*Ke,ie+=u*Pe,oe+=u*Me,z+=u*Oe,ae+=u*Fe,ue+=u*Ge,ve+=u*qe,he+=u*He,be+=u*je,_e+=u*Qe,ke+=u*ze,Ne+=u*Ye,Te+=u*Xe,Ie+=u*we,Ue+=u*De,u=L[2],W+=u*Ve,ie+=u*Ke,oe+=u*Pe,z+=u*Me,ae+=u*Oe,ue+=u*Fe,ve+=u*Ge,he+=u*qe,be+=u*He,_e+=u*je,ke+=u*Qe,Ne+=u*ze,Te+=u*Ye,Ie+=u*Xe,Ue+=u*we,Je+=u*De,u=L[3],ie+=u*Ve,oe+=u*Ke,z+=u*Pe,ae+=u*Me,ue+=u*Oe,ve+=u*Fe,he+=u*Ge,be+=u*qe,_e+=u*He,ke+=u*je,Ne+=u*Qe,Te+=u*ze,Ie+=u*Ye,Ue+=u*Xe,Je+=u*we,Le+=u*De,u=L[4],oe+=u*Ve,z+=u*Ke,ae+=u*Pe,ue+=u*Me,ve+=u*Oe,he+=u*Fe,be+=u*Ge,_e+=u*qe,ke+=u*He,Ne+=u*je,Te+=u*Qe,Ie+=u*ze,Ue+=u*Ye,Je+=u*Xe,Le+=u*we,tt+=u*De,u=L[5],z+=u*Ve,ae+=u*Ke,ue+=u*Pe,ve+=u*Me,he+=u*Oe,be+=u*Fe,_e+=u*Ge,ke+=u*qe,Ne+=u*He,Te+=u*je,Ie+=u*Qe,Ue+=u*ze,Je+=u*Ye,Le+=u*Xe,tt+=u*we,rt+=u*De,u=L[6],ae+=u*Ve,ue+=u*Ke,ve+=u*Pe,he+=u*Me,be+=u*Oe,_e+=u*Fe,ke+=u*Ge,Ne+=u*qe,Te+=u*He,Ie+=u*je,Ue+=u*Qe,Je+=u*ze,Le+=u*Ye,tt+=u*Xe,rt+=u*we,at+=u*De,u=L[7],ue+=u*Ve,ve+=u*Ke,he+=u*Pe,be+=u*Me,_e+=u*Oe,ke+=u*Fe,Ne+=u*Ge,Te+=u*qe,Ie+=u*He,Ue+=u*je,Je+=u*Qe,Le+=u*ze,tt+=u*Ye,rt+=u*Xe,at+=u*we,nt+=u*De,u=L[8],ve+=u*Ve,he+=u*Ke,be+=u*Pe,_e+=u*Me,ke+=u*Oe,Ne+=u*Fe,Te+=u*Ge,Ie+=u*qe,Ue+=u*He,Je+=u*je,Le+=u*Qe,tt+=u*ze,rt+=u*Ye,at+=u*Xe,nt+=u*we,ct+=u*De,u=L[9],he+=u*Ve,be+=u*Ke,_e+=u*Pe,ke+=u*Me,Ne+=u*Oe,Te+=u*Fe,Ie+=u*Ge,Ue+=u*qe,Je+=u*He,Le+=u*je,tt+=u*Qe,rt+=u*ze,at+=u*Ye,nt+=u*Xe,ct+=u*we,dt+=u*De,u=L[10],be+=u*Ve,_e+=u*Ke,ke+=u*Pe,Ne+=u*Me,Te+=u*Oe,Ie+=u*Fe,Ue+=u*Ge,Je+=u*qe,Le+=u*He,tt+=u*je,rt+=u*Qe,at+=u*ze,nt+=u*Ye,ct+=u*Xe,dt+=u*we,mt+=u*De,u=L[11],_e+=u*Ve,ke+=u*Ke,Ne+=u*Pe,Te+=u*Me,Ie+=u*Oe,Ue+=u*Fe,Je+=u*Ge,Le+=u*qe,tt+=u*He,rt+=u*je,at+=u*Qe,nt+=u*ze,ct+=u*Ye,dt+=u*Xe,mt+=u*we,Tt+=u*De,u=L[12],ke+=u*Ve,Ne+=u*Ke,Te+=u*Pe,Ie+=u*Me,Ue+=u*Oe,Je+=u*Fe,Le+=u*Ge,tt+=u*qe,rt+=u*He,at+=u*je,nt+=u*Qe,ct+=u*ze,dt+=u*Ye,mt+=u*Xe,Tt+=u*we,wt+=u*De,u=L[13],Ne+=u*Ve,Te+=u*Ke,Ie+=u*Pe,Ue+=u*Me,Je+=u*Oe,Le+=u*Fe,tt+=u*Ge,rt+=u*qe,at+=u*He,nt+=u*je,ct+=u*Qe,dt+=u*ze,mt+=u*Ye,Tt+=u*Xe,wt+=u*we,Vt+=u*De,u=L[14],Te+=u*Ve,Ie+=u*Ke,Ue+=u*Pe,Je+=u*Me,Le+=u*Oe,tt+=u*Fe,rt+=u*Ge,at+=u*qe,nt+=u*He,ct+=u*je,dt+=u*Qe,mt+=u*ze,Tt+=u*Ye,wt+=u*Xe,Vt+=u*we,Ht+=u*De,u=L[15],Ie+=u*Ve,Ue+=u*Ke,Je+=u*Pe,Le+=u*Me,tt+=u*Oe,rt+=u*Fe,at+=u*Ge,nt+=u*qe,ct+=u*He,dt+=u*je,mt+=u*Qe,Tt+=u*ze,wt+=u*Ye,Vt+=u*Xe,Ht+=u*we,Jt+=u*De,G+=38*Ue,M+=38*Je,W+=38*Le,ie+=38*tt,oe+=38*rt,z+=38*at,ae+=38*nt,ue+=38*ct,ve+=38*dt,he+=38*mt,be+=38*Tt,_e+=38*wt,ke+=38*Vt,Ne+=38*Ht,Te+=38*Jt,k=1,u=G+k+65535,k=Math.floor(u/65536),G=u-k*65536,u=M+k+65535,k=Math.floor(u/65536),M=u-k*65536,u=W+k+65535,k=Math.floor(u/65536),W=u-k*65536,u=ie+k+65535,k=Math.floor(u/65536),ie=u-k*65536,u=oe+k+65535,k=Math.floor(u/65536),oe=u-k*65536,u=z+k+65535,k=Math.floor(u/65536),z=u-k*65536,u=ae+k+65535,k=Math.floor(u/65536),ae=u-k*65536,u=ue+k+65535,k=Math.floor(u/65536),ue=u-k*65536,u=ve+k+65535,k=Math.floor(u/65536),ve=u-k*65536,u=he+k+65535,k=Math.floor(u/65536),he=u-k*65536,u=be+k+65535,k=Math.floor(u/65536),be=u-k*65536,u=_e+k+65535,k=Math.floor(u/65536),_e=u-k*65536,u=ke+k+65535,k=Math.floor(u/65536),ke=u-k*65536,u=Ne+k+65535,k=Math.floor(u/65536),Ne=u-k*65536,u=Te+k+65535,k=Math.floor(u/65536),Te=u-k*65536,u=Ie+k+65535,k=Math.floor(u/65536),Ie=u-k*65536,G+=k-1+37*(k-1),k=1,u=G+k+65535,k=Math.floor(u/65536),G=u-k*65536,u=M+k+65535,k=Math.floor(u/65536),M=u-k*65536,u=W+k+65535,k=Math.floor(u/65536),W=u-k*65536,u=ie+k+65535,k=Math.floor(u/65536),ie=u-k*65536,u=oe+k+65535,k=Math.floor(u/65536),oe=u-k*65536,u=z+k+65535,k=Math.floor(u/65536),z=u-k*65536,u=ae+k+65535,k=Math.floor(u/65536),ae=u-k*65536,u=ue+k+65535,k=Math.floor(u/65536),ue=u-k*65536,u=ve+k+65535,k=Math.floor(u/65536),ve=u-k*65536,u=he+k+65535,k=Math.floor(u/65536),he=u-k*65536,u=be+k+65535,k=Math.floor(u/65536),be=u-k*65536,u=_e+k+65535,k=Math.floor(u/65536),_e=u-k*65536,u=ke+k+65535,k=Math.floor(u/65536),ke=u-k*65536,u=Ne+k+65535,k=Math.floor(u/65536),Ne=u-k*65536,u=Te+k+65535,k=Math.floor(u/65536),Te=u-k*65536,u=Ie+k+65535,k=Math.floor(u/65536),Ie=u-k*65536,G+=k-1+37*(k-1),d[0]=G,d[1]=M,d[2]=W,d[3]=ie,d[4]=oe,d[5]=z,d[6]=ae,d[7]=ue,d[8]=ve,d[9]=he,d[10]=be,d[11]=_e,d[12]=ke,d[13]=Ne,d[14]=Te,d[15]=Ie}}),ss=le((r,S)=>{var t=de();Ee(),ht(),fr(),S.exports=t.kem=t.kem||{};var e=t.jsbn.BigInteger;t.kem.rsa={},t.kem.rsa.create=function(y,l){l=l||{};var p=l.prng||t.random,c={};return c.encrypt=function(i,v){var f=Math.ceil(i.n.bitLength()/8),B;do B=new e(t.util.bytesToHex(p.getBytesSync(f)),16).mod(i.n);while(B.compareTo(e.ONE)<=0);B=t.util.hexToBytes(B.toString(16));var _=f-B.length;if(_>0)B=t.util.fillString(String.fromCharCode(0),_)+B;var I=i.encrypt(B,"NONE"),h=y.generate(B,v);return{encapsulation:I,key:h}},c.decrypt=function(i,v,f){var B=i.decrypt(v,"NONE");return y.generate(B,f)},c},t.kem.kdf1=function(y,l){a(this,y,0,l||y.digestLength)},t.kem.kdf2=function(y,l){a(this,y,1,l||y.digestLength)};function a(y,l,p,c){y.generate=function(i,v){var f=new t.util.ByteBuffer,B=Math.ceil(v/c)+p,_=new t.util.ByteBuffer;for(var I=p;I<B;++I){_.putInt32(I),l.start(),l.update(i+_.getBytes());var h=l.digest();f.putBytes(h.getBytes(c))}return f.truncate(f.length()-v),f.getBytes()}}}),os=le((r,S)=>{var t=de();Ee(),S.exports=t.log=t.log||{},t.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},a=[],y=null;t.log.LEVEL_LOCKED=2,t.log.NO_LEVEL_CHECK=4,t.log.INTERPOLATE=8;for(c=0;c<t.log.levels.length;++c)l=t.log.levels[c],e[l]={index:c,name:l.toUpperCase()};var l,c;t.log.logMessage=function(I){var h=e[I.level].index;for(var C=0;C<a.length;++C){var A=a[C];if(A.flags&t.log.NO_LEVEL_CHECK)A.f(I);else{var T=e[A.level].index;if(h<=T)A.f(A,I)}}},t.log.prepareStandard=function(I){if(!("standard"in I))I.standard=e[I.level].name+" ["+I.category+"] "+I.message},t.log.prepareFull=function(I){if(!("full"in I)){var h=[I.message];h=h.concat([]),I.full=t.util.format.apply(this,h)}},t.log.prepareStandardFull=function(I){if(!("standardFull"in I))t.log.prepareStandard(I),I.standardFull=I.standard},p=["error","warning","info","debug","verbose"];for(c=0;c<p.length;++c)(function(I){t.log[I]=function(h,C){var A=Array.prototype.slice.call(arguments).slice(2),T={timestamp:new Date,level:I,category:h,message:C,arguments:A};t.log.logMessage(T)}})(p[c]);var p,c;if(t.log.makeLogger=function(I){var h={flags:0,f:I};return t.log.setLevel(h,"none"),h},t.log.setLevel=function(I,h){var C=!1;if(I&&!(I.flags&t.log.LEVEL_LOCKED))for(var A=0;A<t.log.levels.length;++A){var T=t.log.levels[A];if(h==T){I.level=h,C=!0;break}}return C},t.log.lock=function(I,h){if(typeof h==="undefined"||h)I.flags|=t.log.LEVEL_LOCKED;else I.flags&=~t.log.LEVEL_LOCKED},t.log.addLogger=function(I){a.push(I)},typeof console!=="undefined"&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)v={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},f=function(I,h){t.log.prepareStandard(h);var C=v[h.level],A=[h.standard];A=A.concat(h.arguments.slice()),C.apply(console,A)},i=t.log.makeLogger(f);else f=function(I,h){t.log.prepareStandardFull(h),console.log(h.standardFull)},i=t.log.makeLogger(f);t.log.setLevel(i,"debug"),t.log.addLogger(i),y=i}else console={log:function(){}};var i,v,f;if(y!==null&&typeof window!=="undefined"&&window.location){if(B=new URL(window.location.href).searchParams,B.has("console.level"))t.log.setLevel(y,B.get("console.level").slice(-1)[0]);if(B.has("console.lock")){if(_=B.get("console.lock").slice(-1)[0],_=="true")t.log.lock(y)}}var B,_;t.log.consoleLogger=y}),cs=le((r,S)=>{S.exports=St(),Mr(),Zt(),Mi(),Wi()}),us=le((r,S)=>{var t=de();Dt(),gt(),lr(),Ut(),Gt(),ji(),ht(),Ee(),Gr();var e=t.asn1,a=S.exports=t.pkcs7=t.pkcs7||{};a.messageFromPem=function(h){var C=t.pem.decode(h)[0];if(C.type!=="PKCS7"){var A=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw A.headerType=C.type,A}if(C.procType&&C.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var T=e.fromDer(C.body);return a.messageFromAsn1(T)},a.messageToPem=function(h,C){var A={type:"PKCS7",body:e.toDer(h.toAsn1()).getBytes()};return t.pem.encode(A,{maxline:C})},a.messageFromAsn1=function(h){var C={},A=[];if(!e.validate(h,a.asn1.contentInfoValidator,C,A)){var T=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw T.errors=A,T}var s=e.derToOid(C.contentType),m;switch(s){case t.pki.oids.envelopedData:m=a.createEnvelopedData();break;case t.pki.oids.encryptedData:m=a.createEncryptedData();break;case t.pki.oids.signedData:m=a.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return m.fromAsn1(C.content.value[0]),m},a.createSignedData=function(){var h=null;return h={type:t.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(T){if(_(h,T,a.asn1.signedDataValidator),h.certificates=[],h.crls=[],h.digestAlgorithmIdentifiers=[],h.contentInfo=null,h.signerInfos=[],h.rawCapture.certificates){var s=h.rawCapture.certificates.value;for(var m=0;m<s.length;++m)h.certificates.push(t.pki.certificateFromAsn1(s[m]))}},toAsn1:function(){if(!h.contentInfo)h.sign();var T=[];for(var s=0;s<h.certificates.length;++s)T.push(t.pki.certificateToAsn1(h.certificates[s]));var m=[],E=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(h.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,h.digestAlgorithmIdentifiers),h.contentInfo])]);if(T.length>0)E.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,T));if(m.length>0)E.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,m));return E.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,h.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.type).getBytes()),E])},addSigner:function(T){var{issuer:s,serialNumber:m}=T;if(T.certificate){var E=T.certificate;if(typeof E==="string")E=t.pki.certificateFromPem(E);s=E.issuer.attributes,m=E.serialNumber}var N=T.key;if(!N)throw new Error("Could not add PKCS#7 signer; no private key specified.");if(typeof N==="string")N=t.pki.privateKeyFromPem(N);var U=T.digestAlgorithm||t.pki.oids.sha1;switch(U){case t.pki.oids.sha1:case t.pki.oids.sha256:case t.pki.oids.sha384:case t.pki.oids.sha512:case t.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+U)}var g=T.authenticatedAttributes||[];if(g.length>0){var o=!1,n=!1;for(var w=0;w<g.length;++w){var K=g[w];if(!o&&K.type===t.pki.oids.contentType){if(o=!0,n)break;continue}if(!n&&K.type===t.pki.oids.messageDigest){if(n=!0,o)break;continue}}if(!o||!n)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}h.signers.push({key:N,version:1,issuer:s,serialNumber:m,digestAlgorithm:U,signatureAlgorithm:t.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:g,unauthenticatedAttributes:[]})},sign:function(T){if(T=T||{},typeof h.content!=="object"||h.contentInfo===null){if(h.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes())]),"content"in h){var s;if(h.content instanceof t.util.ByteBuffer)s=h.content.bytes();else if(typeof h.content==="string")s=t.util.encodeUtf8(h.content);if(T.detached)h.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s);else h.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s)]))}}if(h.signers.length===0)return;var m=C();A(m)},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(T){if(typeof T==="string")T=t.pki.certificateFromPem(T);h.certificates.push(T)},addCertificateRevokationList:function(T){throw new Error("PKCS#7 CRL support not yet implemented.")}},h;function C(){var T={};for(var s=0;s<h.signers.length;++s){var m=h.signers[s],E=m.digestAlgorithm;if(!(E in T))T[E]=t.md[t.pki.oids[E]].create();if(m.authenticatedAttributes.length===0)m.md=T[E];else m.md=t.md[t.pki.oids[E]].create()}h.digestAlgorithmIdentifiers=[];for(var E in T)h.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(E).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return T}function A(T){var s;if(h.detachedContent)s=h.detachedContent;else s=h.contentInfo.value[1],s=s.value[0];if(!s)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var m=e.derToOid(h.contentInfo.value[0].value),E=e.toDer(s);E.getByte(),e.getBerValueLength(E),E=E.getBytes();for(var N in T)T[N].start().update(E);var U=new Date;for(var g=0;g<h.signers.length;++g){var o=h.signers[g];if(o.authenticatedAttributes.length===0){if(m!==t.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{o.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);var n=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]);for(var w=0;w<o.authenticatedAttributes.length;++w){var K=o.authenticatedAttributes[w];if(K.type===t.pki.oids.messageDigest)K.value=T[o.digestAlgorithm].digest();else if(K.type===t.pki.oids.signingTime){if(!K.value)K.value=U}n.value.push(f(K)),o.authenticatedAttributesAsn1.value.push(f(K))}E=e.toDer(n).getBytes(),o.md.start().update(E)}o.signature=o.key.sign(o.md,"RSASSA-PKCS1-V1_5")}h.signerInfos=v(h.signers)}},a.createEncryptedData=function(){var h=null;return h={type:t.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(C){_(h,C,a.asn1.encryptedDataValidator)},decrypt:function(C){if(C!==void 0)h.encryptedContent.key=C;I(h)}},h},a.createEnvelopedData=function(){var h=null;return h={type:t.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(C){var A=_(h,C,a.asn1.envelopedDataValidator);h.recipients=p(A.recipientInfos.value)},toAsn1:function(){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(h.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,c(h.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,B(h.encryptedContent))])])])},findRecipient:function(C){var A=C.issuer.attributes;for(var T=0;T<h.recipients.length;++T){var s=h.recipients[T],m=s.issuer;if(s.serialNumber!==C.serialNumber)continue;if(m.length!==A.length)continue;var E=!0;for(var N=0;N<A.length;++N)if(m[N].type!==A[N].type||m[N].value!==A[N].value){E=!1;break}if(E)return s}return null},decrypt:function(C,A){if(h.encryptedContent.key===void 0&&C!==void 0&&A!==void 0)switch(C.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:case t.pki.oids.desCBC:var T=A.decrypt(C.encryptedContent.content);h.encryptedContent.key=t.util.createBuffer(T);break;default:throw new Error("Unsupported asymmetric cipher, OID "+C.encryptedContent.algorithm)}I(h)},addRecipient:function(C){h.recipients.push({version:0,issuer:C.issuer.attributes,serialNumber:C.serialNumber,encryptedContent:{algorithm:t.pki.oids.rsaEncryption,key:C.publicKey}})},encrypt:function(C,A){if(h.encryptedContent.content===void 0){A=A||h.encryptedContent.algorithm,C=C||h.encryptedContent.key;var T,s,m;switch(A){case t.pki.oids["aes128-CBC"]:T=16,s=16,m=t.aes.createEncryptionCipher;break;case t.pki.oids["aes192-CBC"]:T=24,s=16,m=t.aes.createEncryptionCipher;break;case t.pki.oids["aes256-CBC"]:T=32,s=16,m=t.aes.createEncryptionCipher;break;case t.pki.oids["des-EDE3-CBC"]:T=24,s=8,m=t.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+A)}if(C===void 0)C=t.util.createBuffer(t.random.getBytes(T));else if(C.length()!=T)throw new Error("Symmetric key has wrong length; got "+C.length()+" bytes, expected "+T+".");h.encryptedContent.algorithm=A,h.encryptedContent.key=C,h.encryptedContent.parameter=t.util.createBuffer(t.random.getBytes(s));var E=m(C);if(E.start(h.encryptedContent.parameter.copy()),E.update(h.content),!E.finish())throw new Error("Symmetric encryption failed.");h.encryptedContent.content=E.output}for(var N=0;N<h.recipients.length;++N){var U=h.recipients[N];if(U.encryptedContent.content!==void 0)continue;switch(U.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:U.encryptedContent.content=U.encryptedContent.key.encrypt(h.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+U.encryptedContent.algorithm)}}}},h};function y(h){var C={},A=[];if(!e.validate(h,a.asn1.recipientInfoValidator,C,A)){var T=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw T.errors=A,T}return{version:C.version.charCodeAt(0),issuer:t.pki.RDNAttributesAsArray(C.issuer),serialNumber:t.util.createBuffer(C.serial).toHex(),encryptedContent:{algorithm:e.derToOid(C.encAlgorithm),parameter:C.encParameter?C.encParameter.value:void 0,content:C.encKey}}}function l(h){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(h.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:h.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(h.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h.encryptedContent.content)])}function p(h){var C=[];for(var A=0;A<h.length;++A)C.push(y(h[A]));return C}function c(h){var C=[];for(var A=0;A<h.length;++A)C.push(l(h[A]));return C}function i(h){var C=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(h.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:h.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(h.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(h.authenticatedAttributesAsn1)C.value.push(h.authenticatedAttributesAsn1);if(C.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),C.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h.signature)),h.unauthenticatedAttributes.length>0){var A=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]);for(var T=0;T<h.unauthenticatedAttributes.length;++T){var s=h.unauthenticatedAttributes[T];A.values.push(f(s))}C.value.push(A)}return C}function v(h){var C=[];for(var A=0;A<h.length;++A)C.push(i(h[A]));return C}function f(h){var C;if(h.type===t.pki.oids.contentType)C=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.value).getBytes());else if(h.type===t.pki.oids.messageDigest)C=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h.value.bytes());else if(h.type===t.pki.oids.signingTime){var A=new Date("1950-01-01T00:00:00Z"),T=new Date("2050-01-01T00:00:00Z"),s=h.value;if(typeof s==="string"){var m=Date.parse(s);if(!isNaN(m))s=new Date(m);else if(s.length===13)s=e.utcTimeToDate(s);else s=e.generalizedTimeToDate(s)}if(s>=A&&s<T)C=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(s));else C=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(s))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[C])])}function B(h){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(h.algorithm).getBytes()),!h.parameter?void 0:e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h.parameter.getBytes())]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h.content.getBytes())])]}function _(h,C,A){var T={},s=[];if(!e.validate(C,A,T,s)){var m=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw m.errors=m,m}var E=e.derToOid(T.contentType);if(E!==t.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(T.encryptedContent){var N="";if(t.util.isArray(T.encryptedContent))for(var U=0;U<T.encryptedContent.length;++U){if(T.encryptedContent[U].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");N+=T.encryptedContent[U].value}else N=T.encryptedContent;h.encryptedContent={algorithm:e.derToOid(T.encAlgorithm),parameter:t.util.createBuffer(T.encParameter.value),content:t.util.createBuffer(N)}}if(T.content){var N="";if(t.util.isArray(T.content))for(var U=0;U<T.content.length;++U){if(T.content[U].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");N+=T.content[U].value}else N=T.content;h.content=t.util.createBuffer(N)}return h.version=T.version.charCodeAt(0),h.rawCapture=T,T}function I(h){if(h.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(h.content===void 0){var C;switch(h.encryptedContent.algorithm){case t.pki.oids["aes128-CBC"]:case t.pki.oids["aes192-CBC"]:case t.pki.oids["aes256-CBC"]:C=t.aes.createDecryptionCipher(h.encryptedContent.key);break;case t.pki.oids.desCBC:case t.pki.oids["des-EDE3-CBC"]:C=t.des.createDecryptionCipher(h.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+h.encryptedContent.algorithm)}if(C.start(h.encryptedContent.parameter),C.update(h.encryptedContent.content),!C.finish())throw new Error("Symmetric decryption failed.");h.content=C.output}}}),ls=le((r,S)=>{var t=de();Dt(),Wt(),Mr(),Zt(),Ee();var e=S.exports=t.ssh=t.ssh||{};e.privateKeyToPutty=function(p,c,i){i=i||"",c=c||"";var v="ssh-rsa",f=c===""?"none":"aes256-cbc",B="PuTTY-User-Key-File-2: "+v+`\r
|
|
51
|
-
`;B+="Encryption: "+f+`\r
|
|
52
|
-
`,B+="Comment: "+i+`\r
|
|
53
|
-
`;var _=t.util.createBuffer();y(_,v),a(_,p.e),a(_,p.n);var I=t.util.encode64(_.bytes(),64),h=Math.floor(I.length/66)+1;B+="Public-Lines: "+h+`\r
|
|
54
|
-
`,B+=I;var C=t.util.createBuffer();a(C,p.d),a(C,p.p),a(C,p.q),a(C,p.qInv);var A;if(!c)A=t.util.encode64(C.bytes(),64);else{var T=C.length()+16-1;T-=T%16;var s=l(C.bytes());s.truncate(s.length()-T+C.length()),C.putBuffer(s);var m=t.util.createBuffer();m.putBuffer(l("\x00\x00\x00\x00",c)),m.putBuffer(l("\x00\x00\x00\x01",c));var E=t.aes.createEncryptionCipher(m.truncate(8),"CBC");E.start(t.util.createBuffer().fillWithByte(0,16)),E.update(C.copy()),E.finish();var N=E.output;N.truncate(16),A=t.util.encode64(N.bytes(),64)}h=Math.floor(A.length/66)+1,B+=`\r
|
|
55
|
-
Private-Lines: `+h+`\r
|
|
56
|
-
`,B+=A;var U=l("putty-private-key-file-mac-key",c),g=t.util.createBuffer();y(g,v),y(g,f),y(g,i),g.putInt32(_.length()),g.putBuffer(_),g.putInt32(C.length()),g.putBuffer(C);var o=t.hmac.create();return o.start("sha1",U),o.update(g.bytes()),B+=`\r
|
|
57
|
-
Private-MAC: `+o.digest().toHex()+`\r
|
|
58
|
-
`,B},e.publicKeyToOpenSSH=function(p,c){var i="ssh-rsa";c=c||"";var v=t.util.createBuffer();return y(v,i),a(v,p.e),a(v,p.n),i+" "+t.util.encode64(v.bytes())+" "+c},e.privateKeyToOpenSSH=function(p,c){if(!c)return t.pki.privateKeyToPem(p);return t.pki.encryptRsaPrivateKey(p,c,{legacy:!0,algorithm:"aes128"})},e.getPublicKeyFingerprint=function(p,c){c=c||{};var i=c.md||t.md.md5.create(),v="ssh-rsa",f=t.util.createBuffer();y(f,v),a(f,p.e),a(f,p.n),i.start(),i.update(f.getBytes());var B=i.digest();if(c.encoding==="hex"){var _=B.toHex();if(c.delimiter)return _.match(/.{2}/g).join(c.delimiter);return _}else if(c.encoding==="binary")return B.getBytes();else if(c.encoding)throw new Error('Unknown encoding "'+c.encoding+'".');return B};function a(p,c){var i=c.toString(16);if(i[0]>="8")i="00"+i;var v=t.util.hexToBytes(i);p.putInt32(v.length),p.putBytes(v)}function y(p,c){p.putInt32(c.length),p.putString(c)}function l(){var p=t.md.sha1.create(),c=arguments.length;for(var i=0;i<c;++i)p.update(arguments[i]);return p.digest()}}),Zi=le((r,S)=>{S.exports=de(),Dt(),is(),gt(),Pr(),lr(),ns(),Wt(),ss(),os(),cs(),Qi(),Or(),Gt(),Gi(),zi(),us(),Yi(),qi(),Oi(),Fr(),ht(),Fi(),ls(),Xi(),Ee()});function Vr(r,S){if(Array.isArray(S)&&!Array.isArray(r))return S;if(Array.isArray(S)&&Array.isArray(r))return S.map((e,a)=>{let y=r[a];if(Ot(e)&&Ot(y))return Vr(y,e);return e});if(!Ot(S)||!Ot(r))return S;let t={...r};for(let e in S)if(Object.prototype.hasOwnProperty.call(S,e)){let a=S[e],y=t[e];if(a===null||a===void 0)t[e]=a;else if(Ot(a)&&Ot(y))t[e]=Vr(y,a);else t[e]=a}return t}function Ot(r){return Boolean(r&&typeof r==="object"&&!Array.isArray(r))}async function ps({name:r,cwd:S,defaultConfig:t}){let e=fs(S||hs.cwd(),`${r}.config`);try{let a=await import(e),y=a.default||a;return Vr(t,y)}catch(a){return t}}var $i={altNameIPs:["127.0.0.1"],altNameURIs:["localhost"],organizationName:"Local Development",countryName:"US",stateName:"California",localityName:"Playa Vista",commonName:"stacks.localhost",validityDays:825,hostCertCN:"stacks.localhost",domain:"stacks.localhost",rootCA:{certificate:"",privateKey:""},basePath:"",caCertPath:Lr.join(Ur.homedir(),".stacks","ssl","stacks.localhost.ca.crt"),certPath:Lr.join(Ur.homedir(),".stacks","ssl","stacks.localhost.crt"),keyPath:Lr.join(Ur.homedir(),".stacks","ssl","stacks.localhost.crt.key"),verbose:!1},xe=await ps({name:"tls",defaultConfig:$i}),Ao=Kr(Zi(),1);function xi(r){let S=Number.parseInt(r[0],16);if(S<8)return r;return S-=8,S.toString()+r.substring(1)}function Ji(r,S){let t=[];function e(a){try{let y=Li.readdirSync(a);for(let l of y){let p=ys.join(a,l);if(Li.lstatSync(p).isDirectory())e(p);else if(l===S)t.push(a)}}catch(y){console.warn(`Error reading directory ${a}: ${y}`)}}return e(r),t}function ge(r,S,t){if(t||xe.verbose)console.debug(`[tlsx:${r}] ${S}`)}var ms=vs(ds);async function Xt(r,S={}){try{let{stdout:t,stderr:e}=await ms(r,{cwd:S.cwd||gs.cwd(),timeout:S.timeout||30000});return{stdout:t.trim(),stderr:e.trim()}}catch(t){let e=new Error(`Failed to execute command: ${r}
|
|
59
|
-
Error: ${t.message}`);throw e.stack=t.stack,e}}function ea(r){if(r.domain)return r.domain;if(r.domains?.length)return r.domains[0];throw new Error("Either domain or domains must be specified")}var $e=Kr(Zi(),1);function Cs(r){let S=[],t=new Set;if(r.domain)t.add(r.domain);if(r.domains?.length)r.domains.forEach((e)=>t.add(e));for(let e of t)S.push({type:2,value:e});if(r.altNameIPs?.length)for(let e of r.altNameIPs)S.push({type:7,value:e});if(r.altNameURIs?.length)for(let e of r.altNameURIs)S.push({type:6,value:e});if(r.subjectAltNames?.length)S.push(...r.subjectAltNames);return ge("cert",`Generated ${S.length} Subject Alternative Names`,r.verbose),S}function qr(r){ge("cert","Generating random serial number",r);let S=xi($e.default.util.bytesToHex($e.default.random.getBytesSync(20)));return ge("cert",`Generated serial number: ${S}`,r),S}function Hr(r){let S=r.notBeforeDays??2,t=r.validityDays??(r.validityYears?r.validityYears*365:180);ge("cert","Calculating certificate validity dates",r.verbose);let e=new Date(Date.now()-86400*S*1000),a=new Date(e.getTime()+t*24*60*60*1000);return e.setUTCHours(0,0,0,0),a.setUTCHours(23,59,59,999),ge("cert",`Validity period: ${e.toISOString()} to ${a.toISOString()}`,r.verbose),{notBefore:e,notAfter:a}}function Es(r){let S=[];S.push({name:"basicConstraints",cA:r.isCA??!1,critical:!0,...r.basicConstraints||{}});let t=Cs(r);if(t.length>0)S.push({name:"subjectAltName",altNames:t});if(r.keyUsage)S.push({name:"keyUsage",critical:!0,...r.keyUsage});if(r.extKeyUsage)S.push({name:"extKeyUsage",...r.extKeyUsage});return S}async function jr(r={}){ge("ca","Creating new Root CA Certificate",r.verbose);let S=r.keySize||2048;ge("ca",`Generating ${S}-bit RSA key pair`,r.verbose);let{privateKey:t,publicKey:e}=$e.pki.rsa.generateKeyPair(S),a=[{shortName:"C",value:r.countryName||xe.countryName},{shortName:"ST",value:r.stateName||xe.stateName},{shortName:"L",value:r.localityName||xe.localityName},{shortName:"O",value:r.organization||"Local Development CA"},{shortName:"OU",value:r.organizationalUnit||"Certificate Authority"},{shortName:"CN",value:r.commonName||"Local Development Root CA"},...r.extraAttributes||[]],{notBefore:y,notAfter:l}=Hr({validityYears:r.validityYears||100,verbose:r.verbose}),p=$e.pki.createCertificate();return p.publicKey=e,p.serialNumber=qr(r.verbose),p.validity.notBefore=y,p.validity.notAfter=l,p.setSubject(a),p.setIssuer(a),p.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),p.sign(t,$e.default.md.sha256.create()),{certificate:$e.pki.certificateToPem(p),privateKey:$e.pki.privateKeyToPem(t),notBefore:y,notAfter:l}}async function Qr(r){if(ge("cert","Generating new certificate",r.verbose),ge("cert",`Options: ${JSON.stringify(r)}`,r.verbose),!r.domain&&!r.domains?.length)throw new Error("Either domain or domains must be specified");if(!r.rootCA?.certificate||!r.rootCA?.privateKey)throw new Error("Root CA certificate and private key are required");let S=$e.pki.certificateFromPem(r.rootCA.certificate),t=$e.pki.privateKeyFromPem(r.rootCA.privateKey);ge("cert","Generating 2048-bit RSA key pair for host certificate",r.verbose);let e=2048,{privateKey:a,publicKey:y}=$e.pki.rsa.generateKeyPair(e),l=r.commonName||ea(r),p=r.certificateAttributes||[{shortName:"C",value:r.countryName||xe.countryName},{shortName:"ST",value:r.stateName||xe.stateName},{shortName:"L",value:r.localityName||xe.localityName},{shortName:"O",value:r.organizationName||xe.organizationName},{shortName:"CN",value:l}],{notBefore:c,notAfter:i}=Hr({validityDays:r.validityDays,verbose:r.verbose}),v=$e.pki.createCertificate();return v.publicKey=y,v.serialNumber=qr(r.verbose),v.validity.notBefore=c,v.validity.notAfter=i,v.setSubject(p),v.setIssuer(S.subject.attributes),v.setExtensions(Es(r)),v.sign(t,$e.default.md.sha256.create()),{certificate:$e.pki.certificateToPem(v),privateKey:$e.pki.privateKeyToPem(a),notBefore:c,notAfter:i}}async function zr(r,S,t){ge("trust",`Adding certificate to system trust store with options: ${JSON.stringify(t)}`,t?.verbose),ge("trust","Storing certificate and private key",t?.verbose);let e=ta(r,t);ge("trust","Storing CA certificate",t?.verbose);let a=ra(S,t),y=Vi.platform();ge("trust",`Detected platform: ${y}`,t?.verbose);let l="TC, C, C";if(y==="darwin")ge("trust","Adding certificate to macOS keychain",t?.verbose),await Xt(`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${a}`);else if(y==="win32")ge("trust","Adding certificate to Windows certificate store",t?.verbose),await Xt(`certutil -f -v -addstore -enterprise Root ${a}`);else if(y==="linux"){ge("trust","Adding certificate to Linux certificate store",t?.verbose);let p=Vi.homedir(),c="cert9.db";ge("trust",`Searching for certificate databases in ${p}`,t?.verbose);let i=Ji(p,c);for(let v of i){ge("trust",`Processing certificate database in ${v}`,t?.verbose);try{ge("trust",`Attempting to delete existing cert for ${xe.commonName}`,t?.verbose),await Xt(`certutil -d sql:${v} -D -n ${xe.commonName}`)}catch(f){ge("trust",`Warning: Error deleting existing cert: ${f}`,t?.verbose),console.warn(`Error deleting existing cert: ${f}`)}ge("trust",`Adding new certificate to ${v}`,t?.verbose),await Xt(`certutil -d sql:${v} -A -t ${l} -n ${xe.commonName} -i ${a}`),Ki.info(`Cert added to ${v}`)}}else throw ge("trust",`Error: Unsupported platform ${y}`,t?.verbose),new Error(`Unsupported platform: ${y}`);return ge("trust","Certificate successfully added to system trust store",t?.verbose),e}function ta(r,S){ge("storage",`Storing certificate and private key with options: ${JSON.stringify(S)}`,S?.verbose);let t=Ft.join(S?.basePath||xe.basePath,S?.certPath||xe.certPath),e=Ft.join(S?.basePath||xe.basePath,S?.keyPath||xe.keyPath);ge("storage",`Certificate path: ${t}`,S?.verbose),ge("storage",`Private key path: ${e}`,S?.verbose);let a=Ft.dirname(t);if(!Et.existsSync(a))ge("storage",`Creating certificate directory: ${a}`,S?.verbose),Et.mkdirSync(a,{recursive:!0});ge("storage","Writing certificate file",S?.verbose),Et.writeFileSync(t,r.certificate);let y=Ft.dirname(e);if(!Et.existsSync(y))ge("storage",`Creating private key directory: ${y}`,S?.verbose),Et.mkdirSync(y,{recursive:!0});return ge("storage","Writing private key file",S?.verbose),Et.writeFileSync(e,r.privateKey),ge("storage","Certificate and private key stored successfully",S?.verbose),t}function ra(r,S){ge("storage","Storing CA certificate",S?.verbose);let t=Ft.join(S?.basePath||xe.basePath,S?.caCertPath||xe.caCertPath);ge("storage",`CA certificate path: ${t}`,S?.verbose);let e=Ft.dirname(t);if(!Et.existsSync(e))ge("storage",`Creating CA certificate directory: ${e}`,S?.verbose),Et.mkdirSync(e,{recursive:!0});return ge("storage","Writing CA certificate file",S?.verbose),Et.writeFileSync(t,r),ge("storage","CA certificate stored successfully",S?.verbose),t}var qo=$e.tls,Ho=$e.pki,jo=$e.default;var Yr=null;function Jo(r,S){let t=li(r)?r.proxies[0].to||"stacks.localhost":r.to||"stacks.localhost";if(typeof r.https==="object"&&typeof S.https==="object"){if(r.https.caCertPath&&r.https.certPath&&r.https.keyPath){let a=Nt({...r,to:t,https:S.https}),y=r.https.altNameIPs?.filter((p)=>p!==void 0)||a.altNameIPs,l=r.https.altNameURIs?.filter((p)=>p!==void 0)||a.altNameURIs;return{...a,caCertPath:r.https.caCertPath||a.caCertPath,certPath:r.https.certPath||a.certPath,keyPath:r.https.keyPath||a.keyPath,basePath:r.https.basePath||a.basePath,commonName:r.https.commonName||a.commonName,organizationName:r.https.organizationName||a.organizationName,countryName:r.https.countryName||a.countryName,stateName:r.https.stateName||a.stateName,localityName:r.https.localityName||a.localityName,validityDays:r.https.validityDays||a.validityDays,altNameIPs:y,altNameURIs:l,verbose:r.verbose||a.verbose}}}return Nt({...r,to:t})}function ia(r){let S=new Set;S.add(r);let t=r.split(".");if(t.length>=2)S.add(`*.${t.slice(1).join(".")}`);return Array.from(S)}function Xr(r){let S=ir(r),t="";if(typeof r?.https==="object")return t=r.https.basePath||"",{caCertPath:r.https.caCertPath||Lt(t,`${S}.ca.crt`),certPath:r.https.certPath||Lt(t,`${S}.crt`),keyPath:r.https.keyPath||Lt(t,`${S}.key`)};let e=t||Lt(Ss(),".stacks","ssl"),a=S.replace(/\*/g,"wildcard");return{caCertPath:Lt(e,`${a}.ca.crt`),certPath:Lt(e,`${a}.crt`),keyPath:Lt(e,`${a}.key`)}}function aa(r){let S=new Set;if(Qt(r))r.proxies.forEach((t)=>{let e=t.to||"stacks.localhost";ia(e).forEach((a)=>S.add(a))});else if(ar(r)){let t=r.to||"stacks.localhost";ia(t).forEach((e)=>S.add(e))}else S.add("stacks.localhost");return S.add("localhost"),S.add("*.localhost"),S}async function Wr(r){Y("ssl","Loading SSL configuration",r.verbose);let S={...jt,...r};if(r.https=Nt(S),!r.https?.keyPath&&!r.https?.certPath)return Y("ssl","No SSL configuration provided",r.verbose),null;if(r.https?.keyPath&&!r.https?.certPath||!r.https?.keyPath&&r.https?.certPath){let t=!r.https?.keyPath?"keyPath":"certPath";throw Y("ssl",`Invalid SSL configuration - missing ${t}`,r.verbose),new Error(`SSL Configuration requires both keyPath and certPath. Missing: ${t}`)}try{if(!r.https?.keyPath||!r.https?.certPath)return null;try{Y("ssl","Reading SSL certificate files",r.verbose);let t=await $t.readFile(r.https?.keyPath,"utf8"),e=await $t.readFile(r.https?.certPath,"utf8");return Y("ssl","SSL configuration loaded successfully",r.verbose),{key:t,cert:e}}catch(t){return Y("ssl",`Failed to read certificates: ${t}`,r.verbose),null}}catch(t){throw Y("ssl",`SSL configuration error: ${t}`,r.verbose),t}}async function Zr(r){if(Yr){Y("ssl","Using cached SSL configuration",r.verbose);return}let S=Qt(r)?r.proxies.map((l)=>l.to):[r.to];Y("ssl",`Generating certificate for domains: ${S.join(", ")}`,r.verbose);let t=Nt(r,r.verbose);ce.info("Generating Root CA certificate...");let e=await jr(t),a=Nt(r,r.verbose);ce.info(`Generating host certificate for: ${S.join(", ")}`);let y=await Qr({...a,rootCA:{certificate:e.certificate,privateKey:e.privateKey}});await zr(y,e.certificate,a),Yr={key:y.privateKey,cert:y.certificate,ca:e.certificate},ce.success(`Certificate generated successfully for ${S.length} domain${S.length>1?"s":""}`),Y("ssl",`Certificate includes domains: ${S.join(", ")}`,r.verbose)}function ec(){return Yr}async function $r(r){let S=ir(r),t=Xr(r);try{Y("ssl",`Checking certificates for ${S} at paths:`,r?.verbose),Y("ssl",`CA: ${t.caCertPath}`,r?.verbose),Y("ssl",`Cert: ${t.certPath}`,r?.verbose),Y("ssl",`Key: ${t.keyPath}`,r?.verbose);let e=await $t.readFile(t.keyPath,"utf8"),a=await $t.readFile(t.certPath,"utf8"),y;if(t.caCertPath)try{y=await $t.readFile(t.caCertPath,"utf8")}catch(l){Y("ssl",`Failed to read CA cert: ${l}`,r?.verbose)}return{key:e,cert:a,ca:y}}catch(e){return Y("ssl",`Failed to read certificates: ${e}`,r?.verbose),null}}function Nt(r,S){let t=ir(r);Y("ssl",`Primary domain: ${t}`,S);let e=Xr(r);if(typeof r.https==="object"){let a={domain:t,hostCertCN:t,basePath:r.https.basePath||"",caCertPath:r.https.caCertPath||e.caCertPath,certPath:r.https.certPath||e.certPath,keyPath:r.https.keyPath||e.keyPath,altNameIPs:["127.0.0.1","::1"],altNameURIs:[],commonName:r.https.commonName||t,organizationName:r.https.organizationName||"Local Development",countryName:r.https.countryName||"US",stateName:r.https.stateName||"California",localityName:r.https.localityName||"Playa Vista",validityDays:r.https.validityDays||825,verbose:S||!1,subjectAltNames:Array.from(aa(r)).map((y)=>({type:2,value:y}))};if(ui(r.https.rootCA))a.rootCA=r.https.rootCA;return a}return{domain:t,hostCertCN:t,basePath:"",...e,altNameIPs:["127.0.0.1","::1"],altNameURIs:[],commonName:t,organizationName:"Local Development",countryName:"US",stateName:"California",localityName:"Playa Vista",validityDays:825,verbose:S||!1,subjectAltNames:Array.from(aa(r)).map((a)=>({type:2,value:a}))}}async function na(r,S){let t=Xr({to:r,verbose:S}),e=[t.caCertPath,t.certPath,t.keyPath];Y("certificates","Attempting to clean up relating certificates",S),await Promise.all(e.map((a)=>fi(a,S)))}import{spawn as Ts}from"node:child_process";import pr from"node:process";class dr{processes=new Map;isShuttingDown=!1;async startProcess(r,S,t){if(this.processes.has(r)){Y("start",`Process ${r} is already running`,t);return}let[e,...a]=S.command.split(" "),y=S.cwd||pr.cwd();Y("start",`Starting process ${r}:`,t),Y("start",` Command: ${e} ${a.join(" ")}`,t),Y("start",` Working directory: ${y}`,t),Y("start",` Environment variables: ${JSON.stringify(S.env)}`,t);let l=Ts(e,a,{cwd:y,env:{...pr.env,...S.env},shell:!0,stdio:"inherit"});return this.processes.set(r,{command:S.command,cwd:y,process:l,env:S.env}),new Promise((p,c)=>{if(l.on("error",(i)=>{if(!this.isShuttingDown)Y("start",`Process ${r} failed to start: ${i}`,t),this.processes.delete(r),c(i),pr.emit("SIGINT")}),l.on("exit",(i)=>{if(!this.isShuttingDown&&i!==null&&i!==0)Y("start",`Process ${r} exited with code ${i}`,t),this.processes.delete(r),c(new Error(`Process ${r} exited with code ${i}`)),pr.emit("SIGINT")}),t)l.stdout?.on("data",(i)=>{Y("process",`[${r}] ${i.toString().trim()}`,!0)}),l.stderr?.on("data",(i)=>{Y("process",`[${r}] ERR: ${i.toString().trim()}`,!0)});setTimeout(()=>{if(!this.isShuttingDown&&l.killed)this.processes.delete(r),c(new Error(`Process ${r} was killed during startup`));else Y("start",`Process ${r} started successfully`,t),p()},1000)})}async stopProcess(r,S){let t=this.processes.get(r);if(!t?.process){Y("start",`No process found for ${r}`,S);return}return Y("start",`Stopping process ${r}`,S),new Promise((e)=>{if(!t.process){e();return}t.process.once("exit",()=>{this.processes.delete(r),Y("start",`Process ${r} stopped`,S),e()});try{t.process.kill("SIGTERM"),setTimeout(()=>{if(t.process){Y("start",`Force killing process ${r}`,S);try{t.process.kill("SIGKILL")}catch(a){}}},3000)}catch(a){Y("start",`Error stopping process ${r}: ${a}`,S),this.processes.delete(r),e()}})}async stopAll(r){if(this.isShuttingDown){Y("start","Already shutting down, skipping duplicate stopAll call",r);return}this.isShuttingDown=!0,Y("start","Stopping all processes",r);let S=Array.from(this.processes.keys()).map((t)=>this.stopProcess(t,r).catch((e)=>{ce.error(`Failed to stop process ${t}:`,e)}));await Promise.allSettled(S),this.processes.clear(),this.isShuttingDown=!1}isRunning(r){let S=this.processes.get(r);return!!S?.process&&!S.process.killed}}var sc=new dr;import*as qt from"node:http";import*as la from"node:http2";import*as fa from"node:https";import*as Cr from"node:net";import pt from"node:process";var vt=Bi(ca(),1);var vr=new dr,ha=new Set,Jr=!1;async function xt(r){if(Jr){Y("cleanup","Cleanup already in progress, skipping",r?.verbose);return}Jr=!0,Y("cleanup","Starting cleanup process",r?.verbose);try{await vr.stopAll(r?.verbose),ce.info("Shutting down proxy servers...");let S=[],t=Array.from(ha).map((e)=>new Promise((a)=>{e.close(()=>{Y("cleanup","Server closed successfully",r?.verbose),a()})}));if(S.push(...t),r?.hosts&&r.domains?.length){Y("cleanup","Cleaning up hosts file entries",r?.verbose);let e=r.domains.filter((a)=>!a.includes("localhost"));if(e.length>0)ce.info("Cleaning up hosts file entries..."),S.push(Di(e,r?.verbose).then(()=>{Y("cleanup",`Removed hosts entries for ${e.join(", ")}`,r?.verbose)}).catch((a)=>{Y("cleanup",`Failed to remove hosts entries: ${a}`,r?.verbose),ce.warn(`Failed to clean up hosts file entries for ${e.join(", ")}:`,a)}))}if(r?.certs&&r.domains?.length){Y("cleanup","Cleaning up SSL certificates",r?.verbose),ce.info("Cleaning up SSL certificates...");let e=r.domains.map(async(a)=>{try{await na(a,r?.verbose),Y("cleanup",`Removed certificates for ${a}`,r?.verbose)}catch(y){Y("cleanup",`Failed to remove certificates for ${a}: ${y}`,r?.verbose),ce.warn(`Failed to clean up certificates for ${a}:`,y)}});S.push(...e)}await Promise.allSettled(S),Y("cleanup","All cleanup tasks completed successfully",r?.verbose),ce.success("All cleanup tasks completed successfully")}catch(S){Y("cleanup",`Error during cleanup: ${S}`,r?.verbose),ce.error("Error during cleanup:",S)}finally{Jr=!1,pt.exit(0)}}var ua=!1;function pa(){if(ua){pt.exit(1);return}ua=!0,xt().catch(()=>pt.exit(1))}pt.on("SIGINT",pa);pt.on("SIGTERM",pa);pt.on("uncaughtException",(r)=>{Y("process",`Uncaught exception: ${r}`,!0),ce.error("Uncaught exception:",r),xt()});function ei(r,S,t){return Y("port",`Checking if port ${r} is in use on ${S}`,t),new Promise((e)=>{let a=Cr.createServer();a.once("error",(y)=>{if(y.code==="EADDRINUSE")Y("port",`Port ${r} is in use`,t),e(!0)}),a.once("listening",()=>{Y("port",`Port ${r} is available`,t),a.close(),e(!1)}),a.listen(r,S)})}async function Ns(r,S,t){Y("port",`Finding available port starting from ${r}`,t);let e=r;while(await ei(e,S,t))Y("port",`Port ${e} is in use, trying ${e+1}`,t),e++;return Y("port",`Found available port: ${e}`,t),e}async function mr(r,S,t,e=5){Y("connection",`Testing connection to ${r}:${S} (retries left: ${e})`,t);let a=()=>new Promise((y,l)=>{let p=Cr.connect({host:r,port:S,timeout:2000});p.once("connect",()=>{Y("connection",`Successfully connected to ${r}:${S}`,t),p.end(),y()}),p.once("timeout",()=>{Y("connection",`Connection to ${r}:${S} timed out`,t),p.destroy(),l(new Error("Connection timed out"))}),p.once("error",(c)=>{Y("connection",`Failed to connect to ${r}:${S}: ${c}`,t),p.destroy(),l(c)})});try{await a()}catch(y){if(e>0)return Y("connection",`Retrying connection in 2 seconds... (${e} retries left)`,t),await new Promise((l)=>setTimeout(l,2000)),mr(r,S,t,e-1);throw new Error(`Failed to connect to ${r}:${S} after multiple attempts: ${y.message}`)}}async function da(r){Y("server",`Starting server with options: ${JSON.stringify(r)}`,r.verbose);let S=new URL((r.from?.startsWith("http")?r.from:`http://${r.from}`)||"localhost:5173"),t=new URL((r.to?.startsWith("http")?r.to:`http://${r.to}`)||"stacks.localhost"),e=Number.parseInt(S.port)||(S.protocol.includes("https:")?443:80),a=[t.hostname];if(!t.hostname.includes("localhost")&&!t.hostname.includes("127.0.0.1")){Y("hosts",`Checking if hosts file entry exists for: ${t.hostname}`,r?.verbose);try{if(!(await Ui(a,r.verbose))[0]){ce.info(`Adding ${t.hostname} to hosts file...`),ce.info("This may require sudo/administrator privileges");try{await _i(a,r.verbose)}catch(p){if(ce.error("Failed to add hosts entry:",p.message),ce.warn("You can manually add this entry to your hosts file:"),ce.warn(`127.0.0.1 ${t.hostname}`),ce.warn(`::1 ${t.hostname}`),pt.platform==="win32")ce.warn("On Windows:"),ce.warn("1. Run notepad as administrator"),ce.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");else ce.warn("On Unix systems:"),ce.warn("sudo nano /etc/hosts")}}else Y("hosts",`Host entry already exists for ${t.hostname}`,r.verbose)}catch(l){ce.error("Failed to check hosts file:",l.message)}}try{await mr(S.hostname,e,r.verbose)}catch(l){Y("server",`Connection test failed: ${l}`,r.verbose),ce.error(l.message),pt.exit(1)}let y=r._cachedSSLConfig||null;if(r.https)try{if(r.https===!0)r.https=Nt({...r,to:t.hostname});try{Y("ssl",`Attempting to load SSL configuration for ${t.hostname}`,r.verbose),y=await Wr({...r,to:t.hostname,https:r.https})}catch(l){Y("ssl",`Failed to load certificates, will generate new ones: ${l}`,r.verbose)}if(!y){if(Y("ssl",`Generating new certificates for ${t.hostname}`,r.verbose),await Zr({...r,from:S.toString(),to:t.hostname,https:r.https}),y=await Wr({...r,to:t.hostname,https:r.https}),!y)throw new Error(`Failed to load SSL configuration after generating certificates for ${t.hostname}`)}}catch(l){throw Y("server",`SSL setup failed: ${l}`,r.verbose),l}Y("server",`Setting up reverse proxy with SSL config for ${t.hostname}`,r.verbose),await ks({...r,from:r.from||"localhost:5173",to:t.hostname,fromPort:e,sourceUrl:{hostname:S.hostname,host:S.host},ssl:y})}async function ws(r,S,t,e,a,y,l,p,c,i){Y("proxy",`Creating proxy server ${r} -> ${S} with cleanUrls: ${i}`,c);function v(C){let A={};for(let[T,s]of Object.entries(C))if(!T.startsWith(":"))A[T]=s;return A}let f=(C,A)=>{Y("request",`Incoming request: ${C.method} ${C.url}`,c);let T=C.url||"/",s=C.method||"GET";if(C instanceof la.Http2ServerRequest){let N=C.headers;s=N[":method"]||s,T=N[":path"]||T}if(i){if(!T.match(/\.[a-z0-9]+$/i))if(T.endsWith("/"))T=`${T}index.html`;else T=`${T}.html`}let m={hostname:y.hostname,port:t,path:T,method:s,headers:v(C.headers)};Y("request",`Proxy request options: ${JSON.stringify(m)}`,c);let E=qt.request(m,(N)=>{if(Y("response",`Proxy response received with status ${N.statusCode}`,c),i&&N.statusCode===404){let g=[];if(T.endsWith(".html"))g.push(T.slice(0,-5));else if(!T.match(/\.[a-z0-9]+$/i))g.push(`${T}.html`);if(!T.endsWith("/"))g.push(`${T}/index.html`);if(g.length>0){Y("cleanUrls",`Trying alternative paths: ${g.join(", ")}`,c);let o=(n)=>{if(n.length===0){A.writeHead(N.statusCode||404,N.headers),N.pipe(A);return}let w=n[0],K={...m,path:w},O=qt.request(K,(V)=>{if(V.statusCode===200)Y("cleanUrls",`Found matching path: ${w}`,c),A.writeHead(V.statusCode,V.headers),V.pipe(A);else o(n.slice(1))});O.on("error",()=>o(n.slice(1))),O.end()};o(g);return}}let U={...N.headers,"Strict-Transport-Security":"max-age=31536000; includeSubDomains; preload","X-Content-Type-Options":"nosniff"};A.writeHead(N.statusCode||500,U),N.pipe(A)});E.on("error",(N)=>{Y("request",`Proxy request failed: ${N}`,c),ce.error("Proxy request failed:",N),A.writeHead(502),A.end(`Proxy Error: ${N.message}`)}),C.pipe(E)},B=l?{key:l.key,cert:l.cert,ca:l.ca,minVersion:"TLSv1.2",maxVersion:"TLSv1.3",requestCert:!1,rejectUnauthorized:!1,ciphers:["TLS_AES_128_GCM_SHA256","TLS_AES_256_GCM_SHA384","TLS_CHACHA20_POLY1305_SHA256","ECDHE-ECDSA-AES128-GCM-SHA256","ECDHE-RSA-AES128-GCM-SHA256","ECDHE-ECDSA-AES256-GCM-SHA384","ECDHE-RSA-AES256-GCM-SHA384"].join(":")}:void 0;Y("server",`Creating server with SSL config: ${!!l}`,c);let _;if(l&&B)_=fa.createServer(B,f),_.on("error",(C)=>{Y("server",`HTTPS server error: ${C}`,c)}),_.on("secureConnection",(C)=>{Y("tls",`TLS Connection established: ${JSON.stringify({protocol:C.getProtocol?.(),cipher:C.getCipher?.(),authorized:C.authorized,authError:C.authorizationError})}`,c)});else _=qt.createServer(f);let I=new Set;function h(C){return I.add(C),new Promise((A,T)=>{C.listen(e,a,()=>{if(Y("server",`Server listening on port ${e}`,c),!p){if(console.log(""),console.log(` ${vt.default.green(vt.default.bold("rpx"))} ${vt.default.green(`v${ti}`)}`),console.log(""),console.log(` ${vt.default.green("➜")} ${vt.default.dim(r)} ${vt.default.dim("➜")} ${l?"https":"http"}://${S}`),e!==(l?443:80))console.log(` ${vt.default.green("➜")} Listening on port ${e}`);if(l)console.log(` ${vt.default.green("➜")} SSL enabled with:`),console.log(" - TLS 1.2/1.3"),console.log(" - Modern cipher suite"),console.log(" - HTTP/2 enabled"),console.log(" - HSTS enabled");if(i)console.log(` ${vt.default.green("➜")} Clean URLs enabled`)}A()}),C.on("error",(s)=>{Y("server",`Server error: ${s}`,c),T(s)})})}return h(_)}async function ks(r){Y("setup",`Setting up reverse proxy: ${JSON.stringify(r)}`,r.verbose);let{from:S,to:t,fromPort:e,sourceUrl:a,ssl:y,verbose:l,cleanup:p,vitePluginUsage:c,portManager:i}=r,v=80,f=443,B="0.0.0.0";try{if(y&&!i?.usedPorts.has(v))if(!await ei(v,B,l))Y("setup","Starting HTTP redirect server",l),Rs(l),i?.usedPorts.add(v);else Y("setup","Port 80 is in use, skipping HTTP redirect",l),ce.warn("Port 80 is in use, HTTP to HTTPS redirect will not be available");let _=y?f:v,I;if(i)I=await i.getNextAvailablePort(_);else I=await ei(_,B,l)?await Ns(y?8443:8080,B,l):_;if(I!==_)ce.warn(`Port ${_} is in use. Using port ${I} instead.`),ce.info(`You can use 'sudo lsof -i :${_}' (Unix) or 'netstat -ano | findstr :${_}' (Windows) to check what's using the port.`);await ws(S,t,e,I,B,a,y,c,l)}catch(_){Y("setup",`Setup failed: ${_}`,l),ce.error(`Failed to setup reverse proxy: ${_.message}`),xt({domains:[t],hosts:typeof p==="boolean"?p:p?.hosts,certs:typeof p==="boolean"?p:p?.certs,verbose:l})}}function Rs(r){Y("redirect","Starting HTTP redirect server",r);let S=qt.createServer((t,e)=>{let a=t.headers.host||"";Y("redirect",`Redirecting request from ${a}${t.url} to HTTPS`,r),e.writeHead(301,{Location:`https://${a}${t.url}`}),e.end()}).listen(80);ha.add(S),Y("redirect","HTTP redirect server started",r)}function vc(r){let S={...jt,...r};Y("proxy",`Starting proxy with options: ${JSON.stringify(S)}`,S?.verbose);let t={from:S.from,to:S.to,cleanUrls:S.cleanUrls,https:Nt(S),cleanup:S.cleanup,vitePluginUsage:S.vitePluginUsage,verbose:S.verbose};console.log("serverOptions",t),da(t).catch((e)=>{Y("proxy",`Failed to start proxy: ${e}`,S.verbose),ce.error(`Failed to start proxy: ${e.message}`),xt({domains:[S.to],hosts:typeof S.cleanup==="boolean"?S.cleanup:S.cleanup?.hosts,certs:typeof S.cleanup==="boolean"?S.cleanup:S.cleanup?.certs,verbose:S.verbose})})}async function mc(r){Y("proxies","Starting proxy setup");let S=jt;Y("config",`User config: ${JSON.stringify(S,null,2)}`);let t={...S,...r};if(Y("config",`Starting with config: ${JSON.stringify(t,null,2)}`,t?.verbose),Y("config",`Is multi-proxy? ${"proxies"in t}`,t?.verbose),"proxies"in t&&Array.isArray(t.proxies)){Y("servers",`Found ${t.proxies.length} proxies in config`,t?.verbose);for(let c of t.proxies)if(c.start){let i=`${c.from}-${c.to}`;try{Y("watch",`Starting command for ${i} with command: ${c.start.command}`,t.verbose),ce.info(`Starting command for ${i}...`),await vr.startProcess(i,c.start,t.verbose);let v=new URL(c.from.startsWith("http")?c.from:`http://${c.from}`),f=v.hostname||"localhost",B=Number(v.port)||80;try{await mr(f,B,t.verbose),Y("watch",`Dev server is ready at ${f}:${B}`,t.verbose)}catch(_){throw Y("watch",`Dev server failed to initialize: ${_}`,t.verbose),new Error(`Dev server failed to initialize: ${_}`)}}catch(v){throw Y("watch",`Failed to start command for ${i}: ${v}`,t.verbose),new Error(`Failed to start command for ${i}: ${v}`)}}else Y("watch",`No start command for proxy ${c.from} -> ${c.to}`,t.verbose)}else if("start"in t&&t.start){Y("watch","Found start command in single proxy config",t.verbose);let c=`${t.from}-${t.to}`;try{Y("watch",`Starting command: ${t.start.command}`,t.verbose),await vr.startProcess(c,t.start,t.verbose);let i=new URL(t.from?.startsWith("http")?t.from:`http://${t.from}`),v=i.hostname||"localhost",f=Number(i.port)||80;try{await mr(v,f,t.verbose),Y("watch",`Dev server is ready at ${v}:${f}`,t.verbose)}catch(B){throw Y("watch",`Dev server failed to initialize: ${B}`,t.verbose),new Error(`Dev server failed to initialize: ${B}`)}}catch(i){throw Y("watch",`Failed to run start command: ${i}`,t.verbose),new Error(`Failed to run start command: ${i}`)}}else Y("watch","No start command found in config",t.verbose);let e="proxies"in t&&Array.isArray(t.proxies)?t.proxies[0]?.to:("to"in t)?t.to:"stacks.localhost";if(t.https){let c=await $r(t);if(c)Y("ssl",`Using existing certificates for ${e}`,t.verbose),t._cachedSSLConfig=c;else{Y("ssl",`No valid certificates found for ${e}, generating new ones`,t.verbose),await Zr(t);let i=await $r(t);if(!i)throw new Error(`Failed to load SSL certificates after generation for ${e}`);t._cachedSSLConfig=i}}let a="proxies"in t&&Array.isArray(t.proxies)?t.proxies.map((c)=>({...c,https:t.https,cleanup:t.cleanup,cleanUrls:c.cleanUrls??("cleanUrls"in t?t.cleanUrls:!1),vitePluginUsage:t.vitePluginUsage,verbose:t.verbose,_cachedSSLConfig:t._cachedSSLConfig})):[{from:"from"in t?t.from:"localhost:5173",to:"to"in t?t.to:"stacks.localhost",cleanUrls:"cleanUrls"in t?t.cleanUrls:!1,https:t.https,cleanup:t.cleanup,vitePluginUsage:t.vitePluginUsage,verbose:t.verbose,_cachedSSLConfig:t._cachedSSLConfig,start:t.start}],y=a.map((c)=>c.to||"stacks.localhost"),l=t._cachedSSLConfig,p=async()=>{Y("cleanup","Starting cleanup handler",t.verbose);try{await vr.stopAll(t.verbose)}catch(c){Y("cleanup",`Error stopping processes: ${c}`,t.verbose)}await xt({domains:y,hosts:typeof t.cleanup==="boolean"?t.cleanup:t.cleanup?.hosts,certs:typeof t.cleanup==="boolean"?t.cleanup:t.cleanup?.certs,verbose:t.verbose||!1})};pt.on("SIGINT",p),pt.on("SIGTERM",p),pt.on("uncaughtException",(c)=>{Y("process",`Uncaught exception: ${c}`,!0),console.error("Uncaught exception:",c),p()});for(let c of a)try{let i=c.to||"stacks.localhost";Y("proxy",`Starting proxy for ${i} with SSL config: ${!!l}`,c.verbose),await da({from:c.from||"localhost:5173",to:i,cleanUrls:c.cleanUrls||!1,https:c.https||!1,cleanup:c.cleanup||!1,vitePluginUsage:c.vitePluginUsage||!1,verbose:c.verbose||!1,_cachedSSLConfig:l})}catch(i){Y("proxies",`Failed to start proxy for ${c.to}: ${i}`,c.verbose),console.error(`Failed to start proxy for ${c.to}:`,i),p()}}
|
|
60
|
-
export{ti as a,jt as b,Y as c,Ws as d,ui as e,ir as f,li as g,Qt as h,ar as i,Zs as j,fi as k,bt as l,_i as m,Di as n,Ui as o,Jo as p,ia as q,Xr as r,aa as s,Wr as t,Zr as u,ec as v,$r as w,Nt as x,na as y,sc as z,xt as A,da as B,ks as C,Rs as D,vc as E,mc as F};
|