@certd/plugin-cert 1.20.5 → 1.20.6
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/CHANGELOG.md +6 -0
- package/dist/plugin-cert.mjs +6364 -28404
- package/dist/plugin-cert.umd.js +25 -103
- package/package.json +5 -4
- package/stats.html +6177 -0
- package/test/user.secret.ts +4 -0
- package/LICENSE +0 -661
package/dist/plugin-cert.umd.js
CHANGED
|
@@ -1,106 +1,28 @@
|
|
|
1
|
-
(function($e,dr){typeof exports=="object"&&typeof module<"u"?dr(exports,require("lodash"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","lodash","dayjs"],dr):($e=typeof globalThis<"u"?globalThis:$e||self,dr($e.pipeline={},$e._,$e.dayjs))})(this,function($e,dr,mi){"use strict";var nF=Object.defineProperty;var iF=($e,dr,mi)=>dr in $e?nF($e,dr,{enumerable:!0,configurable:!0,writable:!0,value:mi}):$e[dr]=mi;var ot=($e,dr,mi)=>(iF($e,typeof dr!="symbol"?dr+"":dr,mi),mi);const i0=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},bo=i0(dr),Xs=i0(mi);var a0=(e=>(e[e.AlwaysRun=0]="AlwaysRun",e[e.SkipWhenSucceed=1]="SkipWhenSucceed",e))(a0||{}),me=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function o0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pl(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var wr={exports:{}},gl,s0;function dS(){if(s0)return gl;s0=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,a=n*365.25;gl=function(l,f){f=f||{};var d=typeof l;if(d==="string"&&l.length>0)return o(l);if(d==="number"&&isFinite(l))return f.long?u(l):s(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(!!f){var d=parseFloat(f[1]),g=(f[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return d*a;case"weeks":case"week":case"w":return d*i;case"days":case"day":case"d":return d*n;case"hours":case"hour":case"hrs":case"hr":case"h":return d*r;case"minutes":case"minute":case"mins":case"min":case"m":return d*t;case"seconds":case"second":case"secs":case"sec":case"s":return d*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}}}function s(l){var f=Math.abs(l);return f>=n?Math.round(l/n)+"d":f>=r?Math.round(l/r)+"h":f>=t?Math.round(l/t)+"m":f>=e?Math.round(l/e)+"s":l+"ms"}function u(l){var f=Math.abs(l);return f>=n?c(l,f,n,"day"):f>=r?c(l,f,r,"hour"):f>=t?c(l,f,t,"minute"):f>=e?c(l,f,e,"second"):l+" ms"}function c(l,f,d,g){var h=f>=d*1.5;return Math.round(l/d)+" "+g+(h?"s":"")}return gl}function hS(e){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=i,r.enabled=o,r.humanize=dS(),r.destroy=c,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let f=0;for(let d=0;d<l.length;d++)f=(f<<5)-f+l.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=t;function r(l){let f,d=null,g,h;function v(...p){if(!v.enabled)return;const y=v,w=Number(new Date),m=w-(f||w);y.diff=m,y.prev=f,y.curr=w,f=w,p[0]=r.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let S=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(I,N)=>{if(I==="%%")return"%";S++;const T=r.formatters[N];if(typeof T=="function"){const M=p[S];I=T.call(y,M),p.splice(S,1),S--}return I}),r.formatArgs.call(y,p),(y.log||r.log).apply(y,p)}return v.namespace=l,v.useColors=r.useColors(),v.color=r.selectColor(l),v.extend=n,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(g!==r.namespaces&&(g=r.namespaces,h=r.enabled(l)),h),set:p=>{d=p}}),typeof r.init=="function"&&r.init(v),v}function n(l,f){const d=r(this.namespace+(typeof f>"u"?":":f)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f;const d=(typeof l=="string"?l:"").split(/[\s,]+/),g=d.length;for(f=0;f<g;f++)!d[f]||(l=d[f].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function a(){const l=[...r.names.map(s),...r.skips.map(s).map(f=>"-"+f)].join(",");return r.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let f,d;for(f=0,d=r.skips.length;f<d;f++)if(r.skips[f].test(l))return!1;for(f=0,d=r.names.length;f<d;f++)if(r.names[f].test(l))return!0;return!1}function s(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var pS=hS;(function(e,t){t.formatArgs=n,t.save=i,t.load=a,t.useColors=r,t.storage=o(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;u.splice(1,0,c,"color: inherit");let l=0,f=0;u[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(l++,d==="%c"&&(f=l))}),u.splice(f,0,c)}t.log=console.debug||console.log||(()=>{});function i(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function a(){let u;try{u=t.storage.getItem("debug")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=process.env.DEBUG),u}function o(){try{return localStorage}catch{}}e.exports=pS(t);const{formatters:s}=e.exports;s.j=function(u){try{return JSON.stringify(u)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}})(wr,wr.exports);const Ei={},_e=pl(Object.freeze(Object.defineProperty({__proto__:null,default:Ei},Symbol.toStringTag,{value:"Module"})));var gS=yS;function ea(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function yS(e){if(e=e||{},e.circles)return vS(e);return e.proto?n:r;function t(i,a){for(var o=Object.keys(i),s=new Array(o.length),u=0;u<o.length;u++){var c=o[u],l=i[c];typeof l!="object"||l===null?s[c]=l:l instanceof Date?s[c]=new Date(l):ArrayBuffer.isView(l)?s[c]=ea(l):s[c]=a(l)}return s}function r(i){if(typeof i!="object"||i===null)return i;if(i instanceof Date)return new Date(i);if(Array.isArray(i))return t(i,r);if(i instanceof Map)return new Map(t(Array.from(i),r));if(i instanceof Set)return new Set(t(Array.from(i),r));var a={};for(var o in i)if(Object.hasOwnProperty.call(i,o)!==!1){var s=i[o];typeof s!="object"||s===null?a[o]=s:s instanceof Date?a[o]=new Date(s):s instanceof Map?a[o]=new Map(t(Array.from(s),r)):s instanceof Set?a[o]=new Set(t(Array.from(s),r)):ArrayBuffer.isView(s)?a[o]=ea(s):a[o]=r(s)}return a}function n(i){if(typeof i!="object"||i===null)return i;if(i instanceof Date)return new Date(i);if(Array.isArray(i))return t(i,n);if(i instanceof Map)return new Map(t(Array.from(i),n));if(i instanceof Set)return new Set(t(Array.from(i),n));var a={};for(var o in i){var s=i[o];typeof s!="object"||s===null?a[o]=s:s instanceof Date?a[o]=new Date(s):s instanceof Map?a[o]=new Map(t(Array.from(s),n)):s instanceof Set?a[o]=new Set(t(Array.from(s),n)):ArrayBuffer.isView(s)?a[o]=ea(s):a[o]=n(s)}return a}}function vS(e){var t=[],r=[];return e.proto?a:i;function n(o,s){for(var u=Object.keys(o),c=new Array(u.length),l=0;l<u.length;l++){var f=u[l],d=o[f];if(typeof d!="object"||d===null)c[f]=d;else if(d instanceof Date)c[f]=new Date(d);else if(ArrayBuffer.isView(d))c[f]=ea(d);else{var g=t.indexOf(d);g!==-1?c[f]=r[g]:c[f]=s(d)}}return c}function i(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,i);if(o instanceof Map)return new Map(n(Array.from(o),i));if(o instanceof Set)return new Set(n(Array.from(o),i));var s={};t.push(o),r.push(s);for(var u in o)if(Object.hasOwnProperty.call(o,u)!==!1){var c=o[u];if(typeof c!="object"||c===null)s[u]=c;else if(c instanceof Date)s[u]=new Date(c);else if(c instanceof Map)s[u]=new Map(n(Array.from(c),i));else if(c instanceof Set)s[u]=new Set(n(Array.from(c),i));else if(ArrayBuffer.isView(c))s[u]=ea(c);else{var l=t.indexOf(c);l!==-1?s[u]=r[l]:s[u]=i(c)}}return t.pop(),r.pop(),s}function a(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,a);if(o instanceof Map)return new Map(n(Array.from(o),a));if(o instanceof Set)return new Set(n(Array.from(o),a));var s={};t.push(o),r.push(s);for(var u in o){var c=o[u];if(typeof c!="object"||c===null)s[u]=c;else if(c instanceof Date)s[u]=new Date(c);else if(c instanceof Map)s[u]=new Map(n(Array.from(c),a));else if(c instanceof Set)s[u]=new Set(n(Array.from(c),a));else if(ArrayBuffer.isView(c))s[u]=ea(c);else{var l=t.indexOf(c);l!==-1?s[u]=r[l]:s[u]=a(c)}}return t.pop(),r.pop(),s}}const mS=_e,bi=wr.exports("log4js:configuration"),Js=[],Zs=[],u0=e=>!e,c0=e=>e&&typeof e=="object"&&!Array.isArray(e),ES=e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),bS=e=>e&&typeof e=="number"&&Number.isInteger(e),_S=e=>{Zs.push(e),bi(`Added listener, now ${Zs.length} listeners`)},SS=e=>{Js.push(e),bi(`Added pre-processing listener, now ${Js.length} listeners`)},l0=(e,t,r)=>{(Array.isArray(t)?t:[t]).forEach(i=>{if(i)throw new Error(`Problem with log4js configuration: (${mS.inspect(e,{depth:5})}) - ${r}`)})};var _o={configure:e=>{bi("New configuration to be validated: ",e),l0(e,u0(c0(e)),"must be an object."),bi(`Calling pre-processing listeners (${Js.length})`),Js.forEach(t=>t(e)),bi("Configuration pre-processing finished."),bi(`Calling configuration listeners (${Zs.length})`),Zs.forEach(t=>t(e)),bi("Configuration finished.")},addListener:_S,addPreProcessingListener:SS,throwExceptionIf:l0,anObject:c0,anInteger:bS,validIdentifier:ES,not:u0},f0={exports:{}};(function(e){function t(c,l){for(var f=c.toString();f.length<l;)f="0"+f;return f}function r(c){return t(c,2)}function n(c){var l=Math.abs(c),f=String(Math.floor(l/60)),d=String(l%60);return f=("0"+f).slice(-2),d=("0"+d).slice(-2),c===0?"Z":(c<0?"+":"-")+f+":"+d}function i(c,l){typeof c!="string"&&(l=c,c=e.exports.ISO8601_FORMAT),l||(l=e.exports.now());var f=r(l.getDate()),d=r(l.getMonth()+1),g=r(l.getFullYear()),h=r(g.substring(2,4)),v=c.indexOf("yyyy")>-1?g:h,p=r(l.getHours()),y=r(l.getMinutes()),w=r(l.getSeconds()),m=t(l.getMilliseconds(),3),S=n(l.getTimezoneOffset()),A=c.replace(/dd/g,f).replace(/MM/g,d).replace(/y{1,4}/g,v).replace(/hh/g,p).replace(/mm/g,y).replace(/ss/g,w).replace(/SSS/g,m).replace(/O/g,S);return A}function a(c,l,f,d){c["set"+(d?"":"UTC")+l](f)}function o(c,l,f){var d=c.indexOf("O")<0,g=!1,h=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(S,A){a(S,"FullYear",A,d)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(S,A){a(S,"Month",A-1,d),S.getMonth()!==A-1&&(g=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(S,A){g&&a(S,"Month",S.getMonth()-1,d),a(S,"Date",A,d)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(S,A){a(S,"Hours",A,d)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(S,A){a(S,"Minutes",A,d)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(S,A){a(S,"Seconds",A,d)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(S,A){a(S,"Milliseconds",A,d)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(S,A){A==="Z"?A=0:A=A.replace(":","");var I=Math.abs(A),N=(A>0?-1:1)*(I%100+Math.floor(I/100)*60);S.setUTCMinutes(S.getUTCMinutes()+N)}}],v=h.reduce(function(S,A){return A.pattern.test(S.regexp)?(A.index=S.regexp.match(A.pattern).index,S.regexp=S.regexp.replace(A.pattern,"("+A.regexp+")")):A.index=-1,S},{regexp:c,index:[]}),p=h.filter(function(S){return S.index>-1});p.sort(function(S,A){return S.index-A.index});var y=new RegExp(v.regexp),w=y.exec(l);if(w){var m=f||e.exports.now();return p.forEach(function(S,A){S.fn(m,w[A+1])}),m}throw new Error("String '"+l+"' could not be parsed as '"+c+"'")}function s(c,l,f){if(!c)throw new Error("pattern must be supplied");return o(c,l,f)}function u(){return new Date}e.exports=i,e.exports.asString=i,e.exports.parse=s,e.exports.now=u,e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"})(f0);const Ln=f0.exports,d0=_e,So=_e,Co=_e,h0=_e,p0=wr.exports("log4js:layouts"),g0={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function y0(e){return e?`\x1B[${g0[e][0]}m`:""}function v0(e){return e?`\x1B[${g0[e][1]}m`:""}function CS(e,t){return y0(t)+e+v0(t)}function m0(e,t){return CS(So.format("[%s] [%s] %s - ",Ln.asString(e.startTime),e.level.toString(),e.categoryName),t)}function E0(e){return m0(e)+So.format(...e.data)}function eu(e){return m0(e,e.level.colour)+So.format(...e.data)}function b0(e){return So.format(...e.data)}function _0(e){return e.data[0]}function S0(e,t){const r="%r %p %c - %m%n",n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;e=e||r;function i(k,$){let G=k.categoryName;if($){const oe=parseInt($,10),se=G.split(".");oe<se.length&&(G=se.slice(se.length-oe).join("."))}return G}function a(k,$){let G=Ln.ISO8601_FORMAT;if($)switch(G=$,G){case"ISO8601":case"ISO8601_FORMAT":G=Ln.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":G=Ln.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),p0("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":G=Ln.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),p0("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":G=Ln.DATETIME_FORMAT;break}return Ln.asString(G,k.startTime)}function o(){return d0.hostname().toString()}function s(k,$){let G=k.data;if($){const[oe,se]=$.split(",");G=G.slice(oe,se)}return So.format(...G)}function u(){return d0.EOL}function c(k){return k.level.toString()}function l(k){return Ln.asString("hh:mm:ss",k.startTime)}function f(k){return y0(k.level.colour)}function d(k){return v0(k.level.colour)}function g(){return"%"}function h(k){return k&&k.pid?k.pid.toString():process.pid.toString()}function v(){return h()}function p(k,$){return typeof t[$]<"u"?typeof t[$]=="function"?t[$](k):t[$]:null}function y(k,$){const G=k.context[$];return typeof G<"u"?typeof G=="function"?G(k):G:null}function w(k,$){let G=k.fileName||"";if(G=function(se){const de="file://";return se.startsWith(de)&&(typeof h0.fileURLToPath=="function"?se=h0.fileURLToPath(se):(se=Co.normalize(se.replace(new RegExp(`^${de}`),"")),process.platform==="win32"&&(se.startsWith("\\")?se=se.slice(1):se=Co.sep+Co.sep+se))),se}(G),$){const se=parseInt($,10),de=G.split(Co.sep);de.length>se&&(G=de.slice(-se).join(Co.sep))}return G}function m(k){return k.lineNumber?`${k.lineNumber}`:""}function S(k){return k.columnNumber?`${k.columnNumber}`:""}function A(k){return k.callStack||""}function I(k){return k.className||""}function N(k){return k.functionName||""}function T(k){return k.functionAlias||""}function M(k){return k.callerName||""}const P={c:i,d:a,h:o,m:s,n:u,p:c,r:l,"[":f,"]":d,y:v,z:h,"%":g,x:p,X:y,f:w,l:m,o:S,s:A,C:I,M:N,A:T,F:M};function L(k,$,G){return P[k]($,G)}function B(k,$){let G;return k?(G=parseInt(k.slice(1),10),G>0?$.slice(0,G):$.slice(G)):$}function X(k,$){let G;if(k)if(k.charAt(0)==="-")for(G=parseInt(k.slice(1),10);$.length<G;)$+=" ";else for(G=parseInt(k,10);$.length<G;)$=` ${$}`;return $}function V(k,$,G){let oe=k;return oe=B($,oe),oe=X(G,oe),oe}return function(k){let $="",G,oe=e;for(;(G=n.exec(oe))!==null;){const se=G[1],de=G[2],le=G[3],Ee=G[5],pe=G[6];if(pe)$+=pe.toString();else{const J=L(le,k,Ee);$+=V(J,de,se)}oe=oe.slice(G.index+G[0].length)}return $}}const yl={messagePassThrough(){return b0},basic(){return E0},colored(){return eu},coloured(){return eu},pattern(e){return S0(e&&e.pattern,e&&e.tokens)},dummy(){return _0}};var C0={basicLayout:E0,messagePassThroughLayout:b0,patternLayout:S0,colouredLayout:eu,coloredLayout:eu,dummyLayout:_0,addLayout(e,t){yl[e]=t},layout(e,t){return yl[e]&&yl[e](t)}};const _t=_o,w0=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Tt{constructor(t,r,n){this.level=t,this.levelStr=r,this.colour=n}toString(){return this.levelStr}static getLevel(t,r){return t?t instanceof Tt?t:(t instanceof Object&&t.levelStr&&(t=t.levelStr),Tt[t.toString().toUpperCase()]||r):r}static addLevels(t){t&&(Object.keys(t).forEach(n=>{const i=n.toUpperCase();Tt[i]=new Tt(t[n].value,i,t[n].colour);const a=Tt.levels.findIndex(o=>o.levelStr===i);a>-1?Tt.levels[a]=Tt[i]:Tt.levels.push(Tt[i])}),Tt.levels.sort((n,i)=>n.level-i.level))}isLessThanOrEqualTo(t){return typeof t=="string"&&(t=Tt.getLevel(t)),this.level<=t.level}isGreaterThanOrEqualTo(t){return typeof t=="string"&&(t=Tt.getLevel(t)),this.level>=t.level}isEqualTo(t){return typeof t=="string"&&(t=Tt.getLevel(t)),this.level===t.level}}Tt.levels=[],Tt.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),_t.addListener(e=>{const t=e.levels;t&&(_t.throwExceptionIf(e,_t.not(_t.anObject(t)),"levels must be an object"),Object.keys(t).forEach(n=>{_t.throwExceptionIf(e,_t.not(_t.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),_t.throwExceptionIf(e,_t.not(_t.anObject(t[n])),`level "${n}" must be an object`),_t.throwExceptionIf(e,_t.not(t[n].value),`level "${n}" must have a 'value' property`),_t.throwExceptionIf(e,_t.not(_t.anInteger(t[n].value)),`level "${n}".value must have an integer value`),_t.throwExceptionIf(e,_t.not(t[n].colour),`level "${n}" must have a 'colour' property`),_t.throwExceptionIf(e,_t.not(w0.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${w0.join(", ")}`)}))}),_t.addListener(e=>{Tt.addLevels(e.levels)});var ta=Tt;function Tr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var tu={exports:{}};const wS=()=>!0,T0=[];var vl={onlyOnMaster:(e,t)=>e(),isMaster:wS,send:e=>{T0.forEach(t=>t(e))},onMessage:e=>{T0.push(e)}},A0={};function TS(e){if(typeof e=="number"&&Number.isInteger(e))return e;const t={K:1024,M:1024*1024,G:1024*1024*1024},r=Object.keys(t),n=e.slice(-1).toLocaleUpperCase(),i=e.slice(0,-1).trim();if(r.indexOf(n)<0||!Number.isInteger(Number(i)))throw Error(`maxLogSize: "${e}" is invalid`);return i*t[n]}function AS(e,t){const r=Object.assign({},t);return Object.keys(e).forEach(n=>{r[n]&&(r[n]=e[n](t[n]))}),r}function ml(e){return AS({maxLogSize:TS},e)}const x0={dateFile:ml,file:ml,fileSync:ml};A0.modifyConfig=e=>x0[e.type]?x0[e.type](e):e;var R0={};const xS=console.log.bind(console);function RS(e,t){return r=>{xS(e(r,t))}}function IS(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),RS(r,e.timezoneOffset)}R0.configure=IS;var I0={};function OS(e,t){return r=>{process.stdout.write(`${e(r,t)}
|
|
2
|
-
|
|
3
|
-
`)}}function PS(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),LS(r,e.timezoneOffset)}O0.configure=PS;var M0={};function NS(e,t,r,n){const i=n.getLevel(e),a=n.getLevel(t,n.FATAL);return o=>{const s=o.level;i.isLessThanOrEqualTo(s)&&a.isGreaterThanOrEqualTo(s)&&r(o)}}function BS(e,t,r,n){const i=r(e.appender);return NS(e.level,e.maxLevel,i,n)}M0.configure=BS;var L0={};const P0=wr.exports("log4js:categoryFilter");function DS(e,t){return typeof e=="string"&&(e=[e]),r=>{P0(`Checking ${r.categoryName} against ${e}`),e.indexOf(r.categoryName)===-1&&(P0("Not excluded, sending to appender"),t(r))}}function FS(e,t,r){const n=r(e.appender);return DS(e.exclude,n)}L0.configure=FS;var N0={};const B0=wr.exports("log4js:noLogFilter");function kS(e){return e.filter(r=>r!=null&&r!=="")}function US(e,t){return r=>{B0(`Checking data: ${r.data} against filters: ${e}`),typeof e=="string"&&(e=[e]),e=kS(e);const n=new RegExp(e.join("|"),"i");(e.length===0||r.data.findIndex(i=>n.test(i))<0)&&(B0("Not excluded, sending to appender"),t(r))}}function $S(e,t,r){const n=r(e.appender);return US(e.exclude,n)}N0.configure=$S;var El={},D0={};const Gr=wr.exports("log4js:tcp"),jS=_e;function KS(e,t){let r=!1;const n=[];let i,a=3,o="__LOG4JS__";function s(f){Gr("Writing log event to socket"),r=i.write(`${t(f)}${o}`,"utf8")}function u(){let f;for(Gr("emptying buffer");f=n.shift();)s(f)}function c(){Gr(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),o=`${e.endMsg||"__LOG4JS__"}`,i=jS.createConnection(e.port||5e3,e.host||"localhost"),i.on("connect",()=>{Gr("socket connected"),u(),r=!0}),i.on("drain",()=>{Gr("drain event received, emptying buffer"),r=!0,u()}),i.on("timeout",i.end.bind(i)),i.on("error",f=>{Gr("connection error",f),r=!1,u()}),i.on("close",c)}c();function l(f){r?s(f):(Gr("buffering log event because it cannot write at the moment"),n.push(f))}return l.shutdown=function(f){Gr("shutdown called"),n.length&&a?(Gr("buffer has items, waiting 100ms to empty"),a-=1,setTimeout(()=>{l.shutdown(f)},100)):(i.removeAllListeners("close"),i.end(f))},l}function qS(e,t){Gr(`configure with config = ${e}`);let r=function(n){return n.serialise()};return e.layout&&(r=t.layout(e.layout.type,e.layout)),KS(e,r)}D0.configure=qS;const bl=_e,Pn=wr.exports("log4js:appenders"),Ar=_o,F0=vl,VS=ta,GS=C0,HS=A0,Dr=new Map;Dr.set("console",R0),Dr.set("stdout",I0),Dr.set("stderr",O0),Dr.set("logLevelFilter",M0),Dr.set("categoryFilter",L0),Dr.set("noLogFilter",N0),Dr.set("file",El),Dr.set("dateFile",El),Dr.set("fileSync",El),Dr.set("tcp",D0);const wo=new Map,ru=(e,t)=>{let r;try{const n=`${e}.cjs`;r=require.resolve(n),Pn("Loading module from ",n)}catch{r=e,Pn("Loading module from ",e)}try{return Tr(r)}catch(n){Ar.throwExceptionIf(t,n.code!=="MODULE_NOT_FOUND",`appender "${e}" could not be loaded (error was: ${n})`);return}},YS=(e,t)=>Dr.get(e)||ru(`./${e}`,t)||ru(e,t)||require.main&&require.main.filename&&ru(bl.join(bl.dirname(require.main.filename),e),t)||ru(bl.join(process.cwd(),e),t),nu=new Set,k0=(e,t)=>{if(wo.has(e))return wo.get(e);if(!t.appenders[e])return!1;if(nu.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);nu.add(e),Pn(`Creating appender ${e}`);const r=WS(e,t);return nu.delete(e),wo.set(e,r),r},WS=(e,t)=>{const r=t.appenders[e],n=r.type.configure?r.type:YS(r.type,t);return Ar.throwExceptionIf(t,Ar.not(n),`appender "${e}" is not valid (type "${r.type}" could not be found)`),n.appender&&(process.emitWarning(`Appender ${r.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Pn("[log4js-node-DEP0001]",`DEPRECATION: Appender ${r.type} exports an appender function.`)),n.shutdown&&(process.emitWarning(`Appender ${r.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Pn("[log4js-node-DEP0002]",`DEPRECATION: Appender ${r.type} exports a shutdown function.`)),Pn(`${e}: clustering.isMaster ? ${F0.isMaster()}`),Pn(`${e}: appenderModule is ${_e.inspect(n)}`),F0.onlyOnMaster(()=>(Pn(`calling appenderModule.configure for ${e} / ${r.type}`),n.configure(HS.modifyConfig(r),GS,i=>k0(i,t),VS)),()=>{})},U0=e=>{if(wo.clear(),nu.clear(),!e)return;const t=[];Object.values(e.categories).forEach(r=>{t.push(...r.appenders)}),Object.keys(e.appenders).forEach(r=>{(t.includes(r)||e.appenders[r].type==="tcp-server"||e.appenders[r].type==="multiprocess")&&k0(r,e)})},$0=()=>{U0()};$0(),Ar.addListener(e=>{Ar.throwExceptionIf(e,Ar.not(Ar.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);Ar.throwExceptionIf(e,Ar.not(t.length),"must define at least one appender."),t.forEach(r=>{Ar.throwExceptionIf(e,Ar.not(e.appenders[r].type),`appender "${r}" is not valid (must be an object with property "type")`)})}),Ar.addListener(U0),tu.exports=wo,tu.exports.init=$0;var _l={exports:{}};(function(e){const t=wr.exports("log4js:categories"),r=_o,n=ta,i=tu.exports,a=new Map;function o(p,y,w){if(y.inherit===!1)return;const m=w.lastIndexOf(".");if(m<0)return;const S=w.slice(0,m);let A=p.categories[S];A||(A={inherit:!0,appenders:[]}),o(p,A,S),!p.categories[S]&&A.appenders&&A.appenders.length&&A.level&&(p.categories[S]=A),y.appenders=y.appenders||[],y.level=y.level||A.level,A.appenders.forEach(I=>{y.appenders.includes(I)||y.appenders.push(I)}),y.parent=A}function s(p){if(!p.categories)return;Object.keys(p.categories).forEach(w=>{const m=p.categories[w];o(p,m,w)})}r.addPreProcessingListener(p=>s(p)),r.addListener(p=>{r.throwExceptionIf(p,r.not(r.anObject(p.categories)),'must have a property "categories" of type object.');const y=Object.keys(p.categories);r.throwExceptionIf(p,r.not(y.length),"must define at least one category."),y.forEach(w=>{const m=p.categories[w];r.throwExceptionIf(p,[r.not(m.appenders),r.not(m.level)],`category "${w}" is not valid (must be an object with properties "appenders" and "level")`),r.throwExceptionIf(p,r.not(Array.isArray(m.appenders)),`category "${w}" is not valid (appenders must be an array of appender names)`),r.throwExceptionIf(p,r.not(m.appenders.length),`category "${w}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(m,"enableCallStack")&&r.throwExceptionIf(p,typeof m.enableCallStack!="boolean",`category "${w}" is not valid (enableCallStack must be boolean type)`),m.appenders.forEach(S=>{r.throwExceptionIf(p,r.not(i.get(S)),`category "${w}" is not valid (appender "${S}" is not defined)`)}),r.throwExceptionIf(p,r.not(n.getLevel(m.level)),`category "${w}" is not valid (level "${m.level}" not recognised; valid levels are ${n.levels.join(", ")})`)}),r.throwExceptionIf(p,r.not(p.categories.default),'must define a "default" category.')});const u=p=>{if(a.clear(),!p)return;Object.keys(p.categories).forEach(w=>{const m=p.categories[w],S=[];m.appenders.forEach(A=>{S.push(i.get(A)),t(`Creating category ${w}`),a.set(w,{appenders:S,level:n.getLevel(m.level),enableCallStack:m.enableCallStack||!1})})})},c=()=>{u()};c(),r.addListener(u);const l=p=>{if(t(`configForCategory: searching for config for ${p}`),a.has(p))return t(`configForCategory: ${p} exists in config, returning it`),a.get(p);let y;return p.indexOf(".")>0?(t(`configForCategory: ${p} has hierarchy, cloning from parents`),y={...l(p.slice(0,p.lastIndexOf(".")))}):(a.has("default")||u({categories:{default:{appenders:["out"],level:"OFF"}}}),t("configForCategory: cloning default category"),y={...a.get("default")}),a.set(p,y),y},f=p=>l(p).appenders,d=p=>l(p).level,g=(p,y)=>{l(p).level=y},h=p=>l(p).enableCallStack===!0,v=(p,y)=>{l(p).enableCallStack=y};e.exports=a,e.exports=Object.assign(e.exports,{appendersForCategory:f,getLevelForCategory:d,setLevelForCategory:g,getEnableCallStackForCategory:h,setEnableCallStackForCategory:v,init:c})})(_l);var To={};/*! (c) 2020 Andrea Giammarchi */const{parse:j0,stringify:K0}=JSON,{keys:zS}=Object,Ao=String,q0="string",V0={},iu="object",G0=(e,t)=>t,QS=e=>e instanceof Ao?Ao(e):e,XS=(e,t)=>typeof t===q0?new Ao(t):t,H0=(e,t,r,n)=>{const i=[];for(let a=zS(r),{length:o}=a,s=0;s<o;s++){const u=a[s],c=r[u];if(c instanceof Ao){const l=e[c];typeof l===iu&&!t.has(l)?(t.add(l),r[u]=V0,i.push({k:u,a:[e,t,l,n]})):r[u]=n.call(r,u,l)}else r[u]!==V0&&(r[u]=n.call(r,u,c))}for(let{length:a}=i,o=0;o<a;o++){const{k:s,a:u}=i[o];r[s]=n.call(r,s,H0.apply(null,u))}return r},Y0=(e,t,r)=>{const n=Ao(t.push(r)-1);return e.set(r,n),n},W0=(e,t)=>{const r=j0(e,XS).map(QS),n=r[0],i=t||G0,a=typeof n===iu&&n?H0(r,new Set,n,i):n;return i.call({"":a},"",a)};To.parse=W0;const z0=(e,t,r)=>{const n=t&&typeof t===iu?(l,f)=>l===""||-1<t.indexOf(l)?f:void 0:t||G0,i=new Map,a=[],o=[];let s=+Y0(i,a,n.call({"":e},"",e)),u=!s;for(;s<a.length;)u=!0,o[s]=K0(a[s++],c,r);return"["+o.join(",")+"]";function c(l,f){if(u)return u=!u,f;const d=n.call(this,l,f);switch(typeof d){case iu:if(d===null)return d;case q0:return i.get(d)||Y0(i,a,d)}return d}};To.stringify=z0;const JS=e=>j0(z0(e));To.toJSON=JS;const ZS=e=>W0(K0(e));To.fromJSON=ZS;const Q0=To,X0=ta;class eC{constructor(){const t={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=t,this.serMap={},Object.keys(this.deMap).forEach(r=>{const n=this.deMap[r];this.serMap[n]=r})}canSerialise(t){return typeof t=="string"?!1:t in this.serMap}serialise(t){return this.canSerialise(t)?this.serMap[t]:t}canDeserialise(t){return t in this.deMap}deserialise(t){return this.canDeserialise(t)?this.deMap[t]:t}}const J0=new eC;class au{constructor(t,r,n,i,a,o){if(this.startTime=new Date,this.categoryName=t,this.data=n,this.level=r,this.context=Object.assign({},i),this.pid=process.pid,this.error=o,typeof a<"u"){if(!a||typeof a!="object"||Array.isArray(a))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach(s=>{typeof a[s]<"u"&&(this[s]=a[s])})}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return Q0.stringify(this,(t,r)=>(r instanceof Error&&(r=Object.assign({message:r.message,stack:r.stack},r)),J0.serialise(r)))}static deserialise(t){let r;try{const n=Q0.parse(t,(i,a)=>{if(a&&a.message&&a.stack){const o=new Error(a);Object.keys(a).forEach(s=>{o[s]=a[s]}),a=o}return J0.deserialise(a)});this._getLocationKeys().forEach(i=>{typeof n[i]<"u"&&(n.location||(n.location={}),n.location[i]=n[i])}),r=new au(n.categoryName,X0.getLevel(n.level.levelStr),n.data,n.context,n.location,n.error),r.startTime=new Date(n.startTime),r.pid=n.pid,n.cluster&&(r.cluster=n.cluster)}catch(n){r=new au("log4js",X0.ERROR,["Unable to parse log:",t,"because: ",n])}return r}}var tC=au;const Z0=wr.exports("log4js:logger"),rC=tC,Hr=ta,nC=vl,ou=_l.exports,eg=_o,iC=/^(?:\s*)at (?:(.+) \()?(?:([^(]+?):(\d+):(\d+))\)?$/,Sl=1,tg=3;function rg(e,t=tg+Sl){try{const r=e.stack.split(`
|
|
4
|
-
`).slice(t);if(!r.length)return null;const n=iC.exec(r[0]);if(n&&n.length===5){let i="",a="",o="";return n[1]&&n[1]!==""&&([a,o]=n[1].replace(/[[\]]/g,"").split(" as "),o=o||"",a.includes(".")&&([i,a]=a.split("."))),{fileName:n[2],lineNumber:parseInt(n[3],10),columnNumber:parseInt(n[4],10),callStack:r.join(`
|
|
5
|
-
|
|
6
|
-
`;u.context.outputHandler.write(l)}}}return a(i,e.timezoneOffset)}};hg.configure({appenders:{std:{type:"stdout"},output:{type:RC}},categories:{default:{appenders:["std"],level:"info"},pipeline:{appenders:["std","output"],level:"info"}}});const wl=hg.getLogger("default");class IC{constructor(){ot(this,"result",{})}clearLastStatus(){this.result.clearLastStatus=!0}async onInstance(){}}class pg{constructor(){ot(this,"storage",{})}register(t,r){!t||r==null||(this.storage[t]=r)}get(t){if(!t)throw new Error("\u63D2\u4EF6\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");const r=this.storage[t];if(!r)throw new Error(`\u63D2\u4EF6${t}\u8FD8\u672A\u6CE8\u518C`);return r}getStorage(){return this.storage}getDefineList(){const t=[];for(const r in this.storage){const n=this.getDefine(r);n&&t.push({...n,key:r})}return t}getDefine(t){const r=this.storage[t];if(!!r)return r.define}}const OC=new pg,Tl={};function gg(e,t){let r=Tl[e];r==null&&(r={},Tl[e]=r),r[t]=!0}function MC(e){return Tl[e]||{}}function LC(e,t){return typeof e=="object"&&e.constructor&&(e=e.constructor),t!=null&&gg(e,t),e}function PC(e,t,r,n){bo.default.forEach(e,(i,a)=>{n&&n(i,a,t,r),r[a]!=null&&(t[a]=r[a])})}const Bn={target:LC,attachProperty:gg,getClassProperties:MC,inject:PC},Al="pipeline:autowire";function xo(e){return(t,r)=>{const n=Reflect.getMetadata("design:type",t,r);t=Bn.target(t,r),e=e||{},e.type=n,Reflect.defineMetadata(Al,e||{},t,r)}}const NC="pipeline:plugin";function BC(e){return console.log("IsTaskPlugin"),t=>{t=Bn.target(t);const r={},n={},i={},a=Bn.getClassProperties(t);for(const o in a){const s=Reflect.getMetadata(yg,t,o);s&&(r[o]=s);const u=Reflect.getMetadata(Al,t,o);u&&(n[o]=u);const c=Reflect.getMetadata(vg,t,o);c&&(i[o]=c)}bo.default.merge(e,{input:r,autowire:n,output:i}),Reflect.defineMetadata(NC,e,t),t.define=e,OC.register(e.name,{define:e,target:t})}}const yg="pipeline:plugin:input";function _i(e){return(t,r)=>{t=Bn.target(t,r),Reflect.defineMetadata(yg,e,t,r)}}const vg="pipeline:plugin:output";function DC(e){return(t,r)=>{t=Bn.target(t,r),Reflect.defineMetadata(vg,e,t,r)}}var mg={exports:{}},xl={exports:{}},Eg=function(t,r){return function(){for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];return t.apply(r,i)}},FC=Eg,Si=Object.prototype.toString;function Rl(e){return Si.call(e)==="[object Array]"}function Il(e){return typeof e>"u"}function kC(e){return e!==null&&!Il(e)&&e.constructor!==null&&!Il(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function UC(e){return Si.call(e)==="[object ArrayBuffer]"}function $C(e){return typeof FormData<"u"&&e instanceof FormData}function jC(e){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&e.buffer instanceof ArrayBuffer,t}function KC(e){return typeof e=="string"}function qC(e){return typeof e=="number"}function bg(e){return e!==null&&typeof e=="object"}function uu(e){if(Si.call(e)!=="[object Object]")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function VC(e){return Si.call(e)==="[object Date]"}function GC(e){return Si.call(e)==="[object File]"}function HC(e){return Si.call(e)==="[object Blob]"}function _g(e){return Si.call(e)==="[object Function]"}function YC(e){return bg(e)&&_g(e.pipe)}function WC(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams}function zC(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function QC(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Ol(e,t){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),Rl(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}function Ml(){var e={};function t(i,a){uu(e[a])&&uu(i)?e[a]=Ml(e[a],i):uu(i)?e[a]=Ml({},i):Rl(i)?e[a]=i.slice():e[a]=i}for(var r=0,n=arguments.length;r<n;r++)Ol(arguments[r],t);return e}function XC(e,t,r){return Ol(t,function(i,a){r&&typeof i=="function"?e[a]=FC(i,r):e[a]=i}),e}function JC(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var hr={isArray:Rl,isArrayBuffer:UC,isBuffer:kC,isFormData:$C,isArrayBufferView:jC,isString:KC,isNumber:qC,isObject:bg,isPlainObject:uu,isUndefined:Il,isDate:VC,isFile:GC,isBlob:HC,isFunction:_g,isStream:YC,isURLSearchParams:WC,isStandardBrowserEnv:QC,forEach:Ol,merge:Ml,extend:XC,trim:zC,stripBOM:JC},ia=hr;function Sg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Cg=function(t,r,n){if(!r)return t;var i;if(n)i=n(r);else if(ia.isURLSearchParams(r))i=r.toString();else{var a=[];ia.forEach(r,function(u,c){u===null||typeof u>"u"||(ia.isArray(u)?c=c+"[]":u=[u],ia.forEach(u,function(f){ia.isDate(f)?f=f.toISOString():ia.isObject(f)&&(f=JSON.stringify(f)),a.push(Sg(c)+"="+Sg(f))}))}),i=a.join("&")}if(i){var o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t},ZC=hr;function cu(){this.handlers=[]}cu.prototype.use=function(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1},cu.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},cu.prototype.forEach=function(t){ZC.forEach(this.handlers,function(n){n!==null&&t(n)})};var ew=cu,tw=hr,rw=function(t,r){tw.forEach(t,function(i,a){a!==r&&a.toUpperCase()===r.toUpperCase()&&(t[r]=i,delete t[a])})},wg=function(t,r,n,i,a){return t.config=r,n&&(t.code=n),t.request=i,t.response=a,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t},Ll,Tg;function Ag(){if(Tg)return Ll;Tg=1;var e=wg;return Ll=function(r,n,i,a,o){var s=new Error(r);return e(s,n,i,a,o)},Ll}var Pl,xg;function nw(){if(xg)return Pl;xg=1;var e=Ag();return Pl=function(r,n,i){var a=i.config.validateStatus;!i.status||!a||a(i.status)?r(i):n(e("Request failed with status code "+i.status,i.config,null,i.request,i))},Pl}var Nl,Rg;function iw(){if(Rg)return Nl;Rg=1;var e=hr;return Nl=e.isStandardBrowserEnv()?function(){return{write:function(n,i,a,o,s,u){var c=[];c.push(n+"="+encodeURIComponent(i)),e.isNumber(a)&&c.push("expires="+new Date(a).toGMTString()),e.isString(o)&&c.push("path="+o),e.isString(s)&&c.push("domain="+s),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(n){var i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Nl}var Bl,Ig;function aw(){return Ig||(Ig=1,Bl=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}),Bl}var Dl,Og;function ow(){return Og||(Og=1,Dl=function(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t}),Dl}var Fl,Mg;function sw(){if(Mg)return Fl;Mg=1;var e=aw(),t=ow();return Fl=function(n,i){return n&&!e(i)?t(n,i):i},Fl}var kl,Lg;function uw(){if(Lg)return kl;Lg=1;var e=hr,t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return kl=function(n){var i={},a,o,s;return n&&e.forEach(n.split(`
|
|
7
|
-
`),function(c){if(s=c.indexOf(":"),a=e.trim(c.substr(0,s)).toLowerCase(),o=e.trim(c.substr(s+1)),a){if(i[a]&&t.indexOf(a)>=0)return;a==="set-cookie"?i[a]=(i[a]?i[a]:[]).concat([o]):i[a]=i[a]?i[a]+", "+o:o}}),i},kl}var Ul,Pg;function cw(){if(Pg)return Ul;Pg=1;var e=hr;return Ul=e.isStandardBrowserEnv()?function(){var r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),i;function a(o){var s=o;return r&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=a(window.location.href),function(s){var u=e.isString(s)?a(s):s;return u.protocol===i.protocol&&u.host===i.host}}():function(){return function(){return!0}}(),Ul}var $l,Ng;function Bg(){if(Ng)return $l;Ng=1;var e=hr,t=nw(),r=iw(),n=Cg,i=sw(),a=uw(),o=cw(),s=Ag();return $l=function(c){return new Promise(function(f,d){var g=c.data,h=c.headers,v=c.responseType;e.isFormData(g)&&delete h["Content-Type"];var p=new XMLHttpRequest;if(c.auth){var y=c.auth.username||"",w=c.auth.password?unescape(encodeURIComponent(c.auth.password)):"";h.Authorization="Basic "+btoa(y+":"+w)}var m=i(c.baseURL,c.url);p.open(c.method.toUpperCase(),n(m,c.params,c.paramsSerializer),!0),p.timeout=c.timeout;function S(){if(!!p){var I="getAllResponseHeaders"in p?a(p.getAllResponseHeaders()):null,N=!v||v==="text"||v==="json"?p.responseText:p.response,T={data:N,status:p.status,statusText:p.statusText,headers:I,config:c,request:p};t(f,d,T),p=null}}if("onloadend"in p?p.onloadend=S:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(S)},p.onabort=function(){!p||(d(s("Request aborted",c,"ECONNABORTED",p)),p=null)},p.onerror=function(){d(s("Network Error",c,null,p)),p=null},p.ontimeout=function(){var N="timeout of "+c.timeout+"ms exceeded";c.timeoutErrorMessage&&(N=c.timeoutErrorMessage),d(s(N,c,c.transitional&&c.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},e.isStandardBrowserEnv()){var A=(c.withCredentials||o(m))&&c.xsrfCookieName?r.read(c.xsrfCookieName):void 0;A&&(h[c.xsrfHeaderName]=A)}"setRequestHeader"in p&&e.forEach(h,function(N,T){typeof g>"u"&&T.toLowerCase()==="content-type"?delete h[T]:p.setRequestHeader(T,N)}),e.isUndefined(c.withCredentials)||(p.withCredentials=!!c.withCredentials),v&&v!=="json"&&(p.responseType=c.responseType),typeof c.onDownloadProgress=="function"&&p.addEventListener("progress",c.onDownloadProgress),typeof c.onUploadProgress=="function"&&p.upload&&p.upload.addEventListener("progress",c.onUploadProgress),c.cancelToken&&c.cancelToken.promise.then(function(N){!p||(p.abort(),d(N),p=null)}),g||(g=null),p.send(g)})},$l}var Nt=hr,Dg=rw,lw=wg,fw={"Content-Type":"application/x-www-form-urlencoded"};function Fg(e,t){!Nt.isUndefined(e)&&Nt.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function dw(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=Bg()),e}function hw(e,t,r){if(Nt.isString(e))try{return(t||JSON.parse)(e),Nt.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var lu={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:dw(),transformRequest:[function(t,r){return Dg(r,"Accept"),Dg(r,"Content-Type"),Nt.isFormData(t)||Nt.isArrayBuffer(t)||Nt.isBuffer(t)||Nt.isStream(t)||Nt.isFile(t)||Nt.isBlob(t)?t:Nt.isArrayBufferView(t)?t.buffer:Nt.isURLSearchParams(t)?(Fg(r,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):Nt.isObject(t)||r&&r["Content-Type"]==="application/json"?(Fg(r,"application/json"),hw(t)):t}],transformResponse:[function(t){var r=this.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,a=!n&&this.responseType==="json";if(a||i&&Nt.isString(t)&&t.length)try{return JSON.parse(t)}catch(o){if(a)throw o.name==="SyntaxError"?lw(o,this,"E_JSON_PARSE"):o}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};lu.headers={common:{Accept:"application/json, text/plain, */*"}},Nt.forEach(["delete","get","head"],function(t){lu.headers[t]={}}),Nt.forEach(["post","put","patch"],function(t){lu.headers[t]=Nt.merge(fw)});var jl=lu,pw=hr,gw=jl,yw=function(t,r,n){var i=this||gw;return pw.forEach(n,function(o){t=o.call(i,t,r)}),t},Kl,kg;function Ug(){return kg||(kg=1,Kl=function(t){return!!(t&&t.__CANCEL__)}),Kl}var $g=hr,ql=yw,vw=Ug(),mw=jl;function Vl(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Ew=function(t){Vl(t),t.headers=t.headers||{},t.data=ql.call(t,t.data,t.headers,t.transformRequest),t.headers=$g.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),$g.forEach(["delete","get","head","post","put","patch","common"],function(i){delete t.headers[i]});var r=t.adapter||mw.adapter;return r(t).then(function(i){return Vl(t),i.data=ql.call(t,i.data,i.headers,t.transformResponse),i},function(i){return vw(i)||(Vl(t),i&&i.response&&(i.response.data=ql.call(t,i.response.data,i.response.headers,t.transformResponse))),Promise.reject(i)})},Kt=hr,jg=function(t,r){r=r||{};var n={},i=["url","method","data"],a=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function u(d,g){return Kt.isPlainObject(d)&&Kt.isPlainObject(g)?Kt.merge(d,g):Kt.isPlainObject(g)?Kt.merge({},g):Kt.isArray(g)?g.slice():g}function c(d){Kt.isUndefined(r[d])?Kt.isUndefined(t[d])||(n[d]=u(void 0,t[d])):n[d]=u(t[d],r[d])}Kt.forEach(i,function(g){Kt.isUndefined(r[g])||(n[g]=u(void 0,r[g]))}),Kt.forEach(a,c),Kt.forEach(o,function(g){Kt.isUndefined(r[g])?Kt.isUndefined(t[g])||(n[g]=u(void 0,t[g])):n[g]=u(void 0,r[g])}),Kt.forEach(s,function(g){g in r?n[g]=u(t[g],r[g]):g in t&&(n[g]=u(void 0,t[g]))});var l=i.concat(a).concat(o).concat(s),f=Object.keys(t).concat(Object.keys(r)).filter(function(g){return l.indexOf(g)===-1});return Kt.forEach(f,c),n},Kg={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},Gl={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){Gl[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var qg={},bw=Kg.version.split(".");function Vg(e,t){for(var r=t?t.split("."):bw,n=e.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}Gl.transitional=function(t,r,n){var i=r&&Vg(r);function a(o,s){return"[Axios v"+Kg.version+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return function(o,s,u){if(t===!1)throw new Error(a(s," has been removed in "+r));return i&&!qg[s]&&(qg[s]=!0,console.warn(a(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,s,u):!0}};function _w(e,t,r){if(typeof e!="object")throw new TypeError("options must be an object");for(var n=Object.keys(e),i=n.length;i-- >0;){var a=n[i],o=t[a];if(o){var s=e[a],u=s===void 0||o(s,a,e);if(u!==!0)throw new TypeError("option "+a+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+a)}}var Sw={isOlderVersion:Vg,assertOptions:_w,validators:Gl},Gg=hr,Cw=Cg,Hg=ew,Yg=Ew,fu=jg,Wg=Sw,aa=Wg.validators;function Ro(e){this.defaults=e,this.interceptors={request:new Hg,response:new Hg}}Ro.prototype.request=function(t){typeof t=="string"?(t=arguments[1]||{},t.url=arguments[0]):t=t||{},t=fu(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;r!==void 0&&Wg.assertOptions(r,{silentJSONParsing:aa.transitional(aa.boolean,"1.0.0"),forcedJSONParsing:aa.transitional(aa.boolean,"1.0.0"),clarifyTimeoutError:aa.transitional(aa.boolean,"1.0.0")},!1);var n=[],i=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(t)===!1||(i=i&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var a=[];this.interceptors.response.forEach(function(d){a.push(d.fulfilled,d.rejected)});var o;if(!i){var s=[Yg,void 0];for(Array.prototype.unshift.apply(s,n),s=s.concat(a),o=Promise.resolve(t);s.length;)o=o.then(s.shift(),s.shift());return o}for(var u=t;n.length;){var c=n.shift(),l=n.shift();try{u=c(u)}catch(f){l(f);break}}try{o=Yg(u)}catch(f){return Promise.reject(f)}for(;a.length;)o=o.then(a.shift(),a.shift());return o},Ro.prototype.getUri=function(t){return t=fu(this.defaults,t),Cw(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Gg.forEach(["delete","get","head","options"],function(t){Ro.prototype[t]=function(r,n){return this.request(fu(n||{},{method:t,url:r,data:(n||{}).data}))}}),Gg.forEach(["post","put","patch"],function(t){Ro.prototype[t]=function(r,n,i){return this.request(fu(i||{},{method:t,url:r,data:n}))}});var ww=Ro,Hl,zg;function Qg(){if(zg)return Hl;zg=1;function e(t){this.message=t}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,Hl=e,Hl}var Yl,Xg;function Tw(){if(Xg)return Yl;Xg=1;var e=Qg();function t(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(o){n=o});var i=this;r(function(o){i.reason||(i.reason=new e(o),n(i.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.source=function(){var n,i=new t(function(o){n=o});return{token:i,cancel:n}},Yl=t,Yl}var Wl,Jg;function Aw(){return Jg||(Jg=1,Wl=function(t){return function(n){return t.apply(null,n)}}),Wl}var zl,Zg;function xw(){return Zg||(Zg=1,zl=function(t){return typeof t=="object"&&t.isAxiosError===!0}),zl}var ey=hr,Rw=Eg,du=ww,Iw=jg,Ow=jl;function ty(e){var t=new du(e),r=Rw(du.prototype.request,t);return ey.extend(r,du.prototype,t),ey.extend(r,t),r}var Fr=ty(Ow);Fr.Axios=du,Fr.create=function(t){return ty(Iw(Fr.defaults,t))},Fr.Cancel=Qg(),Fr.CancelToken=Tw(),Fr.isCancel=Ug(),Fr.all=function(t){return Promise.all(t)},Fr.spread=Aw(),Fr.isAxiosError=xw(),xl.exports=Fr,xl.exports.default=Fr,function(e){e.exports=xl.exports}(mg);const Mw=o0(mg.exports);var Lw=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(r in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0},ry=typeof Symbol<"u"&&Symbol,Pw=Lw,Nw=function(){return typeof ry!="function"||typeof Symbol!="function"||typeof ry("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Pw()},Bw="Function.prototype.bind called on incompatible ",Ql=Array.prototype.slice,Dw=Object.prototype.toString,Fw="[object Function]",kw=function(t){var r=this;if(typeof r!="function"||Dw.call(r)!==Fw)throw new TypeError(Bw+r);for(var n=Ql.call(arguments,1),i,a=function(){if(this instanceof i){var l=r.apply(this,n.concat(Ql.call(arguments)));return Object(l)===l?l:this}else return r.apply(t,n.concat(Ql.call(arguments)))},o=Math.max(0,r.length-n.length),s=[],u=0;u<o;u++)s.push("$"+u);if(i=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var c=function(){};c.prototype=r.prototype,i.prototype=new c,c.prototype=null}return i},Uw=kw,Xl=Function.prototype.bind||Uw,$w=Xl,jw=$w.call(Function.call,Object.prototype.hasOwnProperty),Ye,oa=SyntaxError,ny=Function,sa=TypeError,Jl=function(e){try{return ny('"use strict"; return ('+e+").constructor;")()}catch{}},Ci=Object.getOwnPropertyDescriptor;if(Ci)try{Ci({},"")}catch{Ci=null}var Zl=function(){throw new sa},Kw=Ci?function(){try{return arguments.callee,Zl}catch{try{return Ci(arguments,"callee").get}catch{return Zl}}}():Zl,ua=Nw(),Yr=Object.getPrototypeOf||function(e){return e.__proto__},ca={},qw=typeof Uint8Array>"u"?Ye:Yr(Uint8Array),wi={"%AggregateError%":typeof AggregateError>"u"?Ye:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ye:ArrayBuffer,"%ArrayIteratorPrototype%":ua?Yr([][Symbol.iterator]()):Ye,"%AsyncFromSyncIteratorPrototype%":Ye,"%AsyncFunction%":ca,"%AsyncGenerator%":ca,"%AsyncGeneratorFunction%":ca,"%AsyncIteratorPrototype%":ca,"%Atomics%":typeof Atomics>"u"?Ye:Atomics,"%BigInt%":typeof BigInt>"u"?Ye:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ye:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ye:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ye:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Ye:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ye:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ye:FinalizationRegistry,"%Function%":ny,"%GeneratorFunction%":ca,"%Int8Array%":typeof Int8Array>"u"?Ye:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ye:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ye:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ua?Yr(Yr([][Symbol.iterator]())):Ye,"%JSON%":typeof JSON=="object"?JSON:Ye,"%Map%":typeof Map>"u"?Ye:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ua?Ye:Yr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ye:Promise,"%Proxy%":typeof Proxy>"u"?Ye:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Ye:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ye:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ua?Ye:Yr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ye:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ua?Yr(""[Symbol.iterator]()):Ye,"%Symbol%":ua?Symbol:Ye,"%SyntaxError%":oa,"%ThrowTypeError%":Kw,"%TypedArray%":qw,"%TypeError%":sa,"%Uint8Array%":typeof Uint8Array>"u"?Ye:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ye:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ye:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ye:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Ye:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ye:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ye:WeakSet};try{null.error}catch(e){var Vw=Yr(Yr(e));wi["%Error.prototype%"]=Vw}var Gw=function e(t){var r;if(t==="%AsyncFunction%")r=Jl("async function () {}");else if(t==="%GeneratorFunction%")r=Jl("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Jl("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&(r=Yr(i.prototype))}return wi[t]=r,r},iy={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Io=Xl,hu=jw,Hw=Io.call(Function.call,Array.prototype.concat),Yw=Io.call(Function.apply,Array.prototype.splice),ay=Io.call(Function.call,String.prototype.replace),pu=Io.call(Function.call,String.prototype.slice),Ww=Io.call(Function.call,RegExp.prototype.exec),zw=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Qw=/\\(\\)?/g,Xw=function(t){var r=pu(t,0,1),n=pu(t,-1);if(r==="%"&&n!=="%")throw new oa("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new oa("invalid intrinsic syntax, expected opening `%`");var i=[];return ay(t,zw,function(a,o,s,u){i[i.length]=s?ay(u,Qw,"$1"):o||a}),i},Jw=function(t,r){var n=t,i;if(hu(iy,n)&&(i=iy[n],n="%"+i[0]+"%"),hu(wi,n)){var a=wi[n];if(a===ca&&(a=Gw(n)),typeof a>"u"&&!r)throw new sa("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new oa("intrinsic "+t+" does not exist!")},ef=function(t,r){if(typeof t!="string"||t.length===0)throw new sa("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new sa('"allowMissing" argument must be a boolean');if(Ww(/^%?[^%]*%?$/,t)===null)throw new oa("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Xw(t),i=n.length>0?n[0]:"",a=Jw("%"+i+"%",r),o=a.name,s=a.value,u=!1,c=a.alias;c&&(i=c[0],Yw(n,Hw([0,1],c)));for(var l=1,f=!0;l<n.length;l+=1){var d=n[l],g=pu(d,0,1),h=pu(d,-1);if((g==='"'||g==="'"||g==="`"||h==='"'||h==="'"||h==="`")&&g!==h)throw new oa("property names with quotes must have matching quotes");if((d==="constructor"||!f)&&(u=!0),i+="."+d,o="%"+i+"%",hu(wi,o))s=wi[o];else if(s!=null){if(!(d in s)){if(!r)throw new sa("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ci&&l+1>=n.length){var v=Ci(s,d);f=!!v,f&&"get"in v&&!("originalValue"in v.get)?s=v.get:s=s[d]}else f=hu(s,d),s=s[d];f&&!u&&(wi[o]=s)}}return s},oy={exports:{}};(function(e){var t=Xl,r=ef,n=r("%Function.prototype.apply%"),i=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||t.call(i,n),o=r("%Object.getOwnPropertyDescriptor%",!0),s=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(s)try{s({},"a",{value:1})}catch{s=null}e.exports=function(f){var d=a(t,i,arguments);if(o&&s){var g=o(d,"length");g.configurable&&s(d,"length",{value:1+u(0,f.length-(arguments.length-1))})}return d};var c=function(){return a(t,n,arguments)};s?s(e.exports,"apply",{value:c}):e.exports.apply=c})(oy);var sy=ef,uy=oy.exports,Zw=uy(sy("String.prototype.indexOf")),e2=function(t,r){var n=sy(t,!!r);return typeof n=="function"&&Zw(t,".prototype.")>-1?uy(n):n},tf=typeof Map=="function"&&Map.prototype,rf=Object.getOwnPropertyDescriptor&&tf?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,gu=tf&&rf&&typeof rf.get=="function"?rf.get:null,cy=tf&&Map.prototype.forEach,nf=typeof Set=="function"&&Set.prototype,af=Object.getOwnPropertyDescriptor&&nf?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,yu=nf&&af&&typeof af.get=="function"?af.get:null,ly=nf&&Set.prototype.forEach,t2=typeof WeakMap=="function"&&WeakMap.prototype,Oo=t2?WeakMap.prototype.has:null,r2=typeof WeakSet=="function"&&WeakSet.prototype,Mo=r2?WeakSet.prototype.has:null,n2=typeof WeakRef=="function"&&WeakRef.prototype,fy=n2?WeakRef.prototype.deref:null,i2=Boolean.prototype.valueOf,a2=Object.prototype.toString,o2=Function.prototype.toString,s2=String.prototype.match,of=String.prototype.slice,Dn=String.prototype.replace,u2=String.prototype.toUpperCase,dy=String.prototype.toLowerCase,hy=RegExp.prototype.test,py=Array.prototype.concat,Wr=Array.prototype.join,c2=Array.prototype.slice,gy=Math.floor,sf=typeof BigInt=="function"?BigInt.prototype.valueOf:null,uf=Object.getOwnPropertySymbols,cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,la=typeof Symbol=="function"&&typeof Symbol.iterator=="object",qt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===la?"object":"symbol")?Symbol.toStringTag:null,yy=Object.prototype.propertyIsEnumerable,vy=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function my(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||hy.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var n=e<0?-gy(-e):gy(e);if(n!==e){var i=String(n),a=of.call(t,i.length+1);return Dn.call(i,r,"$&_")+"."+Dn.call(Dn.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Dn.call(t,r,"$&_")}var lf=_e,Ey=lf.custom,by=Cy(Ey)?Ey:null,l2=function e(t,r,n,i){var a=r||{};if(Fn(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Fn(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Fn(a,"customInspect")?a.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Fn(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Fn(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=a.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return Ty(t,a);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var u=String(t);return s?my(t,u):u}if(typeof t=="bigint"){var c=String(t)+"n";return s?my(t,c):c}var l=typeof a.depth>"u"?5:a.depth;if(typeof n>"u"&&(n=0),n>=l&&l>0&&typeof t=="object")return ff(t)?"[Array]":"[Object]";var f=R2(a,n);if(typeof i>"u")i=[];else if(wy(i,t)>=0)return"[Circular]";function d(X,V,k){if(V&&(i=c2.call(i),i.push(V)),k){var $={depth:a.depth};return Fn(a,"quoteStyle")&&($.quoteStyle=a.quoteStyle),e(X,$,n+1,i)}return e(X,a,n+1,i)}if(typeof t=="function"&&!Sy(t)){var g=E2(t),h=vu(t,d);return"[Function"+(g?": "+g:" (anonymous)")+"]"+(h.length>0?" { "+Wr.call(h,", ")+" }":"")}if(Cy(t)){var v=la?Dn.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):cf.call(t);return typeof t=="object"&&!la?Lo(v):v}if(T2(t)){for(var p="<"+dy.call(String(t.nodeName)),y=t.attributes||[],w=0;w<y.length;w++)p+=" "+y[w].name+"="+_y(f2(y[w].value),"double",a);return p+=">",t.childNodes&&t.childNodes.length&&(p+="..."),p+="</"+dy.call(String(t.nodeName))+">",p}if(ff(t)){if(t.length===0)return"[]";var m=vu(t,d);return f&&!x2(m)?"["+hf(m,f)+"]":"[ "+Wr.call(m,", ")+" ]"}if(h2(t)){var S=vu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!yy.call(t,"cause")?"{ ["+String(t)+"] "+Wr.call(py.call("[cause]: "+d(t.cause),S),", ")+" }":S.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Wr.call(S,", ")+" }"}if(typeof t=="object"&&o){if(by&&typeof t[by]=="function"&&lf)return lf(t,{depth:l-n});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(b2(t)){var A=[];return cy&&cy.call(t,function(X,V){A.push(d(V,t,!0)+" => "+d(X,t))}),Ay("Map",gu.call(t),A,f)}if(C2(t)){var I=[];return ly&&ly.call(t,function(X){I.push(d(X,t))}),Ay("Set",yu.call(t),I,f)}if(_2(t))return df("WeakMap");if(w2(t))return df("WeakSet");if(S2(t))return df("WeakRef");if(g2(t))return Lo(d(Number(t)));if(v2(t))return Lo(d(sf.call(t)));if(y2(t))return Lo(i2.call(t));if(p2(t))return Lo(d(String(t)));if(!d2(t)&&!Sy(t)){var N=vu(t,d),T=vy?vy(t)===Object.prototype:t instanceof Object||t.constructor===Object,M=t instanceof Object?"":"null prototype",P=!T&&qt&&Object(t)===t&&qt in t?of.call(kn(t),8,-1):M?"Object":"",L=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",B=L+(P||M?"["+Wr.call(py.call([],P||[],M||[]),": ")+"] ":"");return N.length===0?B+"{}":f?B+"{"+hf(N,f)+"}":B+"{ "+Wr.call(N,", ")+" }"}return String(t)};function _y(e,t,r){var n=(r.quoteStyle||t)==="double"?'"':"'";return n+e+n}function f2(e){return Dn.call(String(e),/"/g,""")}function ff(e){return kn(e)==="[object Array]"&&(!qt||!(typeof e=="object"&&qt in e))}function d2(e){return kn(e)==="[object Date]"&&(!qt||!(typeof e=="object"&&qt in e))}function Sy(e){return kn(e)==="[object RegExp]"&&(!qt||!(typeof e=="object"&&qt in e))}function h2(e){return kn(e)==="[object Error]"&&(!qt||!(typeof e=="object"&&qt in e))}function p2(e){return kn(e)==="[object String]"&&(!qt||!(typeof e=="object"&&qt in e))}function g2(e){return kn(e)==="[object Number]"&&(!qt||!(typeof e=="object"&&qt in e))}function y2(e){return kn(e)==="[object Boolean]"&&(!qt||!(typeof e=="object"&&qt in e))}function Cy(e){if(la)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!cf)return!1;try{return cf.call(e),!0}catch{}return!1}function v2(e){if(!e||typeof e!="object"||!sf)return!1;try{return sf.call(e),!0}catch{}return!1}var m2=Object.prototype.hasOwnProperty||function(e){return e in this};function Fn(e,t){return m2.call(e,t)}function kn(e){return a2.call(e)}function E2(e){if(e.name)return e.name;var t=s2.call(o2.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function wy(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function b2(e){if(!gu||!e||typeof e!="object")return!1;try{gu.call(e);try{yu.call(e)}catch{return!0}return e instanceof Map}catch{}return!1}function _2(e){if(!Oo||!e||typeof e!="object")return!1;try{Oo.call(e,Oo);try{Mo.call(e,Mo)}catch{return!0}return e instanceof WeakMap}catch{}return!1}function S2(e){if(!fy||!e||typeof e!="object")return!1;try{return fy.call(e),!0}catch{}return!1}function C2(e){if(!yu||!e||typeof e!="object")return!1;try{yu.call(e);try{gu.call(e)}catch{return!0}return e instanceof Set}catch{}return!1}function w2(e){if(!Mo||!e||typeof e!="object")return!1;try{Mo.call(e,Mo);try{Oo.call(e,Oo)}catch{return!0}return e instanceof WeakSet}catch{}return!1}function T2(e){return!e||typeof e!="object"?!1:typeof HTMLElement<"u"&&e instanceof HTMLElement?!0:typeof e.nodeName=="string"&&typeof e.getAttribute=="function"}function Ty(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Ty(of.call(e,0,t.maxStringLength),t)+n}var i=Dn.call(Dn.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,A2);return _y(i,"single",t)}function A2(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+u2.call(t.toString(16))}function Lo(e){return"Object("+e+")"}function df(e){return e+" { ? }"}function Ay(e,t,r,n){var i=n?hf(r,n):Wr.call(r,", ");return e+" ("+t+") {"+i+"}"}function x2(e){for(var t=0;t<e.length;t++)if(wy(e[t],`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`+t.prev}function vu(e,t){var r=ff(e),n=[];if(r){n.length=e.length;for(var i=0;i<e.length;i++)n[i]=Fn(e,i)?t(e[i],e):""}var a=typeof uf=="function"?uf(e):[],o;if(la){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var u in e)!Fn(e,u)||r&&String(Number(u))===u&&u<e.length||la&&o["$"+u]instanceof Symbol||(hy.call(/[^\w$]/,u)?n.push(t(u,e)+": "+t(e[u],e)):n.push(u+": "+t(e[u],e)));if(typeof uf=="function")for(var c=0;c<a.length;c++)yy.call(e,a[c])&&n.push("["+t(a[c])+"]: "+t(e[a[c]],e));return n}var pf=ef,fa=e2,I2=l2,O2=pf("%TypeError%"),mu=pf("%WeakMap%",!0),Eu=pf("%Map%",!0),M2=fa("WeakMap.prototype.get",!0),L2=fa("WeakMap.prototype.set",!0),P2=fa("WeakMap.prototype.has",!0),N2=fa("Map.prototype.get",!0),B2=fa("Map.prototype.set",!0),D2=fa("Map.prototype.has",!0),gf=function(e,t){for(var r=e,n;(n=r.next)!==null;r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n},F2=function(e,t){var r=gf(e,t);return r&&r.value},k2=function(e,t,r){var n=gf(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}},U2=function(e,t){return!!gf(e,t)},$2=function(){var t,r,n,i={assert:function(a){if(!i.has(a))throw new O2("Side channel does not contain "+I2(a))},get:function(a){if(mu&&a&&(typeof a=="object"||typeof a=="function")){if(t)return M2(t,a)}else if(Eu){if(r)return N2(r,a)}else if(n)return F2(n,a)},has:function(a){if(mu&&a&&(typeof a=="object"||typeof a=="function")){if(t)return P2(t,a)}else if(Eu){if(r)return D2(r,a)}else if(n)return U2(n,a);return!1},set:function(a,o){mu&&a&&(typeof a=="object"||typeof a=="function")?(t||(t=new mu),L2(t,a,o)):Eu?(r||(r=new Eu),B2(r,a,o)):(n||(n={key:{},next:null}),k2(n,a,o))}};return i},j2=String.prototype.replace,K2=/%20/g,yf={RFC1738:"RFC1738",RFC3986:"RFC3986"},vf={default:yf.RFC3986,formatters:{RFC1738:function(e){return j2.call(e,K2,"+")},RFC3986:function(e){return String(e)}},RFC1738:yf.RFC1738,RFC3986:yf.RFC3986},q2=vf,mf=Object.prototype.hasOwnProperty,Ti=Array.isArray,zr=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),V2=function(t){for(;t.length>1;){var r=t.pop(),n=r.obj[r.prop];if(Ti(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);r.obj[r.prop]=i}}},xy=function(t,r){for(var n=r&&r.plainObjects?Object.create(null):{},i=0;i<t.length;++i)typeof t[i]<"u"&&(n[i]=t[i]);return n},G2=function e(t,r,n){if(!r)return t;if(typeof r!="object"){if(Ti(t))t.push(r);else if(t&&typeof t=="object")(n&&(n.plainObjects||n.allowPrototypes)||!mf.call(Object.prototype,r))&&(t[r]=!0);else return[t,r];return t}if(!t||typeof t!="object")return[t].concat(r);var i=t;return Ti(t)&&!Ti(r)&&(i=xy(t,n)),Ti(t)&&Ti(r)?(r.forEach(function(a,o){if(mf.call(t,o)){var s=t[o];s&&typeof s=="object"&&a&&typeof a=="object"?t[o]=e(s,a,n):t.push(a)}else t[o]=a}),t):Object.keys(r).reduce(function(a,o){var s=r[o];return mf.call(a,o)?a[o]=e(a[o],s,n):a[o]=s,a},i)},H2=function(t,r){return Object.keys(r).reduce(function(n,i){return n[i]=r[i],n},t)},Y2=function(e,t,r){var n=e.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},W2=function(t,r,n,i,a){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});for(var s="",u=0;u<o.length;++u){var c=o.charCodeAt(u);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||a===q2.RFC1738&&(c===40||c===41)){s+=o.charAt(u);continue}if(c<128){s=s+zr[c];continue}if(c<2048){s=s+(zr[192|c>>6]+zr[128|c&63]);continue}if(c<55296||c>=57344){s=s+(zr[224|c>>12]+zr[128|c>>6&63]+zr[128|c&63]);continue}u+=1,c=65536+((c&1023)<<10|o.charCodeAt(u)&1023),s+=zr[240|c>>18]+zr[128|c>>12&63]+zr[128|c>>6&63]+zr[128|c&63]}return s},z2=function(t){for(var r=[{obj:{o:t},prop:"o"}],n=[],i=0;i<r.length;++i)for(var a=r[i],o=a.obj[a.prop],s=Object.keys(o),u=0;u<s.length;++u){var c=s[u],l=o[c];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(r.push({obj:o,prop:c}),n.push(l))}return V2(r),t},Q2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},X2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},J2=function(t,r){return[].concat(t,r)},Z2=function(t,r){if(Ti(t)){for(var n=[],i=0;i<t.length;i+=1)n.push(r(t[i]));return n}return r(t)},Ry={arrayToObject:xy,assign:H2,combine:J2,compact:z2,decode:Y2,encode:W2,isBuffer:X2,isRegExp:Q2,maybeMap:Z2,merge:G2},Iy=$2,bu=Ry,Po=vf,eT=Object.prototype.hasOwnProperty,Oy={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,r){return t+"["+r+"]"},repeat:function(t){return t}},pn=Array.isArray,tT=Array.prototype.push,My=function(e,t){tT.apply(e,pn(t)?t:[t])},rT=Date.prototype.toISOString,Ly=Po.default,Vt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:bu.encode,encodeValuesOnly:!1,format:Ly,formatter:Po.formatters[Ly],indices:!1,serializeDate:function(t){return rT.call(t)},skipNulls:!1,strictNullHandling:!1},nT=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Ef={},iT=function e(t,r,n,i,a,o,s,u,c,l,f,d,g,h,v,p){for(var y=t,w=p,m=0,S=!1;(w=w.get(Ef))!==void 0&&!S;){var A=w.get(t);if(m+=1,typeof A<"u"){if(A===m)throw new RangeError("Cyclic object value");S=!0}typeof w.get(Ef)>"u"&&(m=0)}if(typeof u=="function"?y=u(r,y):y instanceof Date?y=f(y):n==="comma"&&pn(y)&&(y=bu.maybeMap(y,function($){return $ instanceof Date?f($):$})),y===null){if(a)return s&&!h?s(r,Vt.encoder,v,"key",d):r;y=""}if(nT(y)||bu.isBuffer(y)){if(s){var I=h?r:s(r,Vt.encoder,v,"key",d);return[g(I)+"="+g(s(y,Vt.encoder,v,"value",d))]}return[g(r)+"="+g(String(y))]}var N=[];if(typeof y>"u")return N;var T;if(n==="comma"&&pn(y))h&&s&&(y=bu.maybeMap(y,s)),T=[{value:y.length>0?y.join(",")||null:void 0}];else if(pn(u))T=u;else{var M=Object.keys(y);T=c?M.sort(c):M}for(var P=i&&pn(y)&&y.length===1?r+"[]":r,L=0;L<T.length;++L){var B=T[L],X=typeof B=="object"&&typeof B.value<"u"?B.value:y[B];if(!(o&&X===null)){var V=pn(y)?typeof n=="function"?n(P,B):P:P+(l?"."+B:"["+B+"]");p.set(t,m);var k=Iy();k.set(Ef,p),My(N,e(X,V,n,i,a,o,n==="comma"&&h&&pn(y)?null:s,u,c,l,f,d,g,h,v,k))}}return N},aT=function(t){if(!t)return Vt;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=t.charset||Vt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=Po.default;if(typeof t.format<"u"){if(!eT.call(Po.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var i=Po.formatters[n],a=Vt.filter;return(typeof t.filter=="function"||pn(t.filter))&&(a=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Vt.addQueryPrefix,allowDots:typeof t.allowDots>"u"?Vt.allowDots:!!t.allowDots,charset:r,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Vt.charsetSentinel,delimiter:typeof t.delimiter>"u"?Vt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Vt.encode,encoder:typeof t.encoder=="function"?t.encoder:Vt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Vt.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Vt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Vt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Vt.strictNullHandling}},oT=function(e,t){var r=e,n=aT(t),i,a;typeof n.filter=="function"?(a=n.filter,r=a("",r)):pn(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof r!="object"||r===null)return"";var s;t&&t.arrayFormat in Oy?s=t.arrayFormat:t&&"indices"in t?s=t.indices?"indices":"repeat":s="indices";var u=Oy[s];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=u==="comma"&&t&&t.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=Iy(),f=0;f<i.length;++f){var d=i[f];n.skipNulls&&r[d]===null||My(o,iT(r[d],d,u,c,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}var g=o.join(n.delimiter),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),g.length>0?h+g:""},da=Ry,bf=Object.prototype.hasOwnProperty,sT=Array.isArray,At={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:da.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},uT=function(e){return e.replace(/&#(\d+);/g,function(t,r){return String.fromCharCode(parseInt(r,10))})},Py=function(e,t){return e&&typeof e=="string"&&t.comma&&e.indexOf(",")>-1?e.split(","):e},cT="utf8=%26%2310003%3B",lT="utf8=%E2%9C%93",fT=function(t,r){var n={},i=r.ignoreQueryPrefix?t.replace(/^\?/,""):t,a=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,a),s=-1,u,c=r.charset;if(r.charsetSentinel)for(u=0;u<o.length;++u)o[u].indexOf("utf8=")===0&&(o[u]===lT?c="utf-8":o[u]===cT&&(c="iso-8859-1"),s=u,u=o.length);for(u=0;u<o.length;++u)if(u!==s){var l=o[u],f=l.indexOf("]="),d=f===-1?l.indexOf("="):f+1,g,h;d===-1?(g=r.decoder(l,At.decoder,c,"key"),h=r.strictNullHandling?null:""):(g=r.decoder(l.slice(0,d),At.decoder,c,"key"),h=da.maybeMap(Py(l.slice(d+1),r),function(v){return r.decoder(v,At.decoder,c,"value")})),h&&r.interpretNumericEntities&&c==="iso-8859-1"&&(h=uT(h)),l.indexOf("[]=")>-1&&(h=sT(h)?[h]:h),bf.call(n,g)?n[g]=da.combine(n[g],h):n[g]=h}return n},dT=function(e,t,r,n){for(var i=n?t:Py(t,r),a=e.length-1;a>=0;--a){var o,s=e[a];if(s==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=s.charAt(0)==="["&&s.charAt(s.length-1)==="]"?s.slice(1,-1):s,c=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(c)&&s!==u&&String(c)===u&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},hT=function(t,r,n,i){if(!!t){var a=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(a),c=u?a.slice(0,u.index):a,l=[];if(c){if(!n.plainObjects&&bf.call(Object.prototype,c)&&!n.allowPrototypes)return;l.push(c)}for(var f=0;n.depth>0&&(u=s.exec(a))!==null&&f<n.depth;){if(f+=1,!n.plainObjects&&bf.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;l.push(u[1])}return u&&l.push("["+a.slice(u.index)+"]"),dT(l,r,n,i)}},pT=function(t){if(!t)return At;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof t.charset>"u"?At.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?At.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:At.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:At.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:At.arrayLimit,charset:r,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:At.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:At.comma,decoder:typeof t.decoder=="function"?t.decoder:At.decoder,delimiter:typeof t.delimiter=="string"||da.isRegExp(t.delimiter)?t.delimiter:At.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:At.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:At.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:At.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:At.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:At.strictNullHandling}},gT=function(e,t){var r=pT(t);if(e===""||e===null||typeof e>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof e=="string"?fT(e,r):e,i=r.plainObjects?Object.create(null):{},a=Object.keys(n),o=0;o<a.length;++o){var s=a[o],u=hT(s,n[s],r,typeof e=="string");i=da.merge(i,u,r)}return r.allowSparse===!0?i:da.compact(i)},yT=oT,vT=gT,mT=vf,ET={formats:mT,parse:vT,stringify:yT};function bT(){const e=Mw.create();return e.interceptors.request.use(t=>(t.formData&&(t.data=ET.stringify(t.formData,{arrayFormat:"indices",allowDots:!0}),delete t.formData),t),t=>(wl.error(t),Promise.reject(t))),e.interceptors.response.use(t=>(wl.info("http response:",JSON.stringify(t.data)),t.data),t=>(wl.error("\u8BF7\u6C42\u51FA\u9519\uFF1A",t.response.config.url,t),Promise.reject(t))),e}bT();var No={},_f={},Un={},Qr={};/*! *****************************************************************************
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
22
|
-
and limitations under the License.
|
|
23
|
-
***************************************************************************** */var Ny;(function(e){(function(t){var r=typeof me=="object"?me:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),n=i(e);typeof r.Reflect>"u"?r.Reflect=e:n=i(r.Reflect,n),t(n);function i(a,o){return function(s,u){typeof a[s]!="function"&&Object.defineProperty(a,s,{configurable:!0,writable:!0,value:u}),o&&o(s,u)}}})(function(t){var r=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",i=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",s={__proto__:[]}instanceof Array,u=!o&&!s,c={create:o?function(){return Pt(Object.create(null))}:s?function(){return Pt({__proto__:null})}:function(){return Pt({})},has:u?function(re,ue){return r.call(re,ue)}:function(re,ue){return ue in re},get:u?function(re,ue){return r.call(re,ue)?re[ue]:void 0}:function(re,ue){return re[ue]}},l=Object.getPrototypeOf(Function),f=typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL==="true",d=!f&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:mt(),g=!f&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:nt(),h=!f&&typeof WeakMap=="function"?WeakMap:We(),v=new h;function p(re,ue,ve,O){if(le(ve)){if(!x(re))throw new TypeError;if(!R(ue))throw new TypeError;return P(re,ue)}else{if(!x(re))throw new TypeError;if(!J(ue))throw new TypeError;if(!J(O)&&!le(O)&&!Ee(O))throw new TypeError;return Ee(O)&&(O=void 0),ve=_(ve),L(re,ue,ve,O)}}t("decorate",p);function y(re,ue){function ve(O,b){if(!J(O))throw new TypeError;if(!le(b)&&!K(b))throw new TypeError;G(re,ue,O,b)}return ve}t("metadata",y);function w(re,ue,ve,O){if(!J(ve))throw new TypeError;return le(O)||(O=_(O)),G(re,ue,ve,O)}t("defineMetadata",w);function m(re,ue,ve){if(!J(ue))throw new TypeError;return le(ve)||(ve=_(ve)),X(re,ue,ve)}t("hasMetadata",m);function S(re,ue,ve){if(!J(ue))throw new TypeError;return le(ve)||(ve=_(ve)),V(re,ue,ve)}t("hasOwnMetadata",S);function A(re,ue,ve){if(!J(ue))throw new TypeError;return le(ve)||(ve=_(ve)),k(re,ue,ve)}t("getMetadata",A);function I(re,ue,ve){if(!J(ue))throw new TypeError;return le(ve)||(ve=_(ve)),$(re,ue,ve)}t("getOwnMetadata",I);function N(re,ue){if(!J(re))throw new TypeError;return le(ue)||(ue=_(ue)),oe(re,ue)}t("getMetadataKeys",N);function T(re,ue){if(!J(re))throw new TypeError;return le(ue)||(ue=_(ue)),se(re,ue)}t("getOwnMetadataKeys",T);function M(re,ue,ve){if(!J(ue))throw new TypeError;le(ve)||(ve=_(ve));var O=B(ue,ve,!1);if(le(O)||!O.delete(re))return!1;if(O.size>0)return!0;var b=v.get(ue);return b.delete(ve),b.size>0||v.delete(ue),!0}t("deleteMetadata",M);function P(re,ue){for(var ve=re.length-1;ve>=0;--ve){var O=re[ve],b=O(ue);if(!le(b)&&!Ee(b)){if(!R(b))throw new TypeError;ue=b}}return ue}function L(re,ue,ve,O){for(var b=re.length-1;b>=0;--b){var C=re[b],j=C(ue,ve,O);if(!le(j)&&!Ee(j)){if(!J(j))throw new TypeError;O=j}}return O}function B(re,ue,ve){var O=v.get(re);if(le(O)){if(!ve)return;O=new d,v.set(re,O)}var b=O.get(ue);if(le(b)){if(!ve)return;b=new d,O.set(ue,b)}return b}function X(re,ue,ve){var O=V(re,ue,ve);if(O)return!0;var b=lt(ue);return Ee(b)?!1:X(re,b,ve)}function V(re,ue,ve){var O=B(ue,ve,!1);return le(O)?!1:z(O.has(re))}function k(re,ue,ve){var O=V(re,ue,ve);if(O)return $(re,ue,ve);var b=lt(ue);if(!Ee(b))return k(re,b,ve)}function $(re,ue,ve){var O=B(ue,ve,!1);if(!le(O))return O.get(re)}function G(re,ue,ve,O){var b=B(ve,O,!0);b.set(re,ue)}function oe(re,ue){var ve=se(re,ue),O=lt(re);if(O===null)return ve;var b=oe(O,ue);if(b.length<=0)return ve;if(ve.length<=0)return b;for(var C=new g,j=[],Y=0,te=ve;Y<te.length;Y++){var ae=te[Y],Re=C.has(ae);Re||(C.add(ae),j.push(ae))}for(var Je=0,it=b;Je<it.length;Je++){var ae=it[Je],Re=C.has(ae);Re||(C.add(ae),j.push(ae))}return j}function se(re,ue){var ve=[],O=B(re,ue,!1);if(le(O))return ve;for(var b=O.keys(),C=he(b),j=0;;){var Y=Me(C);if(!Y)return ve.length=j,ve;var te=Ce(Y);try{ve[j]=te}catch(ae){try{vt(C)}finally{throw ae}}j++}}function de(re){if(re===null)return 1;switch(typeof re){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return re===null?1:6;default:return 6}}function le(re){return re===void 0}function Ee(re){return re===null}function pe(re){return typeof re=="symbol"}function J(re){return typeof re=="object"?re!==null:typeof re=="function"}function ne(re,ue){switch(de(re)){case 0:return re;case 1:return re;case 2:return re;case 3:return re;case 4:return re;case 5:return re}var ve=ue===3?"string":ue===5?"number":"default",O=Q(re,i);if(O!==void 0){var b=O.call(re,ve);if(J(b))throw new TypeError;return b}return q(re,ve==="default"?"number":ve)}function q(re,ue){if(ue==="string"){var ve=re.toString;if(E(ve)){var O=ve.call(re);if(!J(O))return O}var b=re.valueOf;if(E(b)){var O=b.call(re);if(!J(O))return O}}else{var b=re.valueOf;if(E(b)){var O=b.call(re);if(!J(O))return O}var C=re.toString;if(E(C)){var O=C.call(re);if(!J(O))return O}}throw new TypeError}function z(re){return!!re}function W(re){return""+re}function _(re){var ue=ne(re,3);return pe(ue)?ue:W(ue)}function x(re){return Array.isArray?Array.isArray(re):re instanceof Object?re instanceof Array:Object.prototype.toString.call(re)==="[object Array]"}function E(re){return typeof re=="function"}function R(re){return typeof re=="function"}function K(re){switch(de(re)){case 3:return!0;case 4:return!0;default:return!1}}function Q(re,ue){var ve=re[ue];if(ve!=null){if(!E(ve))throw new TypeError;return ve}}function he(re){var ue=Q(re,a);if(!E(ue))throw new TypeError;var ve=ue.call(re);if(!J(ve))throw new TypeError;return ve}function Ce(re){return re.value}function Me(re){var ue=re.next();return ue.done?!1:ue}function vt(re){var ue=re.return;ue&&ue.call(re)}function lt(re){var ue=Object.getPrototypeOf(re);if(typeof re!="function"||re===l||ue!==l)return ue;var ve=re.prototype,O=ve&&Object.getPrototypeOf(ve);if(O==null||O===Object.prototype)return ue;var b=O.constructor;return typeof b!="function"||b===re?ue:b}function mt(){var re={},ue=[],ve=function(){function j(Y,te,ae){this._index=0,this._keys=Y,this._values=te,this._selector=ae}return j.prototype["@@iterator"]=function(){return this},j.prototype[a]=function(){return this},j.prototype.next=function(){var Y=this._index;if(Y>=0&&Y<this._keys.length){var te=this._selector(this._keys[Y],this._values[Y]);return Y+1>=this._keys.length?(this._index=-1,this._keys=ue,this._values=ue):this._index++,{value:te,done:!1}}return{value:void 0,done:!0}},j.prototype.throw=function(Y){throw this._index>=0&&(this._index=-1,this._keys=ue,this._values=ue),Y},j.prototype.return=function(Y){return this._index>=0&&(this._index=-1,this._keys=ue,this._values=ue),{value:Y,done:!0}},j}();return function(){function j(){this._keys=[],this._values=[],this._cacheKey=re,this._cacheIndex=-2}return Object.defineProperty(j.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),j.prototype.has=function(Y){return this._find(Y,!1)>=0},j.prototype.get=function(Y){var te=this._find(Y,!1);return te>=0?this._values[te]:void 0},j.prototype.set=function(Y,te){var ae=this._find(Y,!0);return this._values[ae]=te,this},j.prototype.delete=function(Y){var te=this._find(Y,!1);if(te>=0){for(var ae=this._keys.length,Re=te+1;Re<ae;Re++)this._keys[Re-1]=this._keys[Re],this._values[Re-1]=this._values[Re];return this._keys.length--,this._values.length--,Y===this._cacheKey&&(this._cacheKey=re,this._cacheIndex=-2),!0}return!1},j.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=re,this._cacheIndex=-2},j.prototype.keys=function(){return new ve(this._keys,this._values,O)},j.prototype.values=function(){return new ve(this._keys,this._values,b)},j.prototype.entries=function(){return new ve(this._keys,this._values,C)},j.prototype["@@iterator"]=function(){return this.entries()},j.prototype[a]=function(){return this.entries()},j.prototype._find=function(Y,te){return this._cacheKey!==Y&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=Y)),this._cacheIndex<0&&te&&(this._cacheIndex=this._keys.length,this._keys.push(Y),this._values.push(void 0)),this._cacheIndex},j}();function O(j,Y){return j}function b(j,Y){return Y}function C(j,Y){return[j,Y]}}function nt(){return function(){function re(){this._map=new d}return Object.defineProperty(re.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),re.prototype.has=function(ue){return this._map.has(ue)},re.prototype.add=function(ue){return this._map.set(ue,ue),this},re.prototype.delete=function(ue){return this._map.delete(ue)},re.prototype.clear=function(){this._map.clear()},re.prototype.keys=function(){return this._map.keys()},re.prototype.values=function(){return this._map.values()},re.prototype.entries=function(){return this._map.entries()},re.prototype["@@iterator"]=function(){return this.keys()},re.prototype[a]=function(){return this.keys()},re}()}function We(){var re=16,ue=c.create(),ve=O();return function(){function te(){this._key=O()}return te.prototype.has=function(ae){var Re=b(ae,!1);return Re!==void 0?c.has(Re,this._key):!1},te.prototype.get=function(ae){var Re=b(ae,!1);return Re!==void 0?c.get(Re,this._key):void 0},te.prototype.set=function(ae,Re){var Je=b(ae,!0);return Je[this._key]=Re,this},te.prototype.delete=function(ae){var Re=b(ae,!1);return Re!==void 0?delete Re[this._key]:!1},te.prototype.clear=function(){this._key=O()},te}();function O(){var te;do te="@@WeakMap@@"+Y();while(c.has(ue,te));return ue[te]=!0,te}function b(te,ae){if(!r.call(te,ve)){if(!ae)return;Object.defineProperty(te,ve,{value:c.create()})}return te[ve]}function C(te,ae){for(var Re=0;Re<ae;++Re)te[Re]=Math.random()*255|0;return te}function j(te){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(te)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(te)):C(new Uint8Array(te),te):C(new Array(te),te)}function Y(){var te=j(re);te[6]=te[6]&79|64,te[8]=te[8]&191|128;for(var ae="",Re=0;Re<re;++Re){var Je=te[Re];(Re===4||Re===6||Re===8)&&(ae+="-"),Je<16&&(ae+="0"),ae+=Je.toString(16).toLowerCase()}return ae}}function Pt(re){return re.__=void 0,delete re.__,re}})})(Ny||(Ny={}));var Ke={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MidwayProcessTypeEnum=e.ObjectLifeCycleEvent=e.ServerlessTriggerType=e.MidwayFrameworkType=e.FrameworkType=e.MSListenerType=e.MSProviderType=e.InjectModeEnum=e.ScopeEnum=void 0,function(n){n.Singleton="Singleton",n.Request="Request",n.Prototype="Prototype"}(e.ScopeEnum||(e.ScopeEnum={})),function(n){n.Identifier="Identifier",n.Class="Class",n.PropertyName="PropertyName"}(e.InjectModeEnum||(e.InjectModeEnum={})),function(n){n.DUBBO="dubbo",n.GRPC="gRPC"}(e.MSProviderType||(e.MSProviderType={})),function(n){n.RABBITMQ="rabbitmq",n.MQTT="mqtt",n.KAFKA="kafka",n.REDIS="redis"}(e.MSListenerType||(e.MSListenerType={}));class t{}e.FrameworkType=t;class r extends t{constructor(i){super(),this.name=i}}e.MidwayFrameworkType=r,r.WEB=new r("@midwayjs/web"),r.WEB_KOA=new r("@midwayjs/web-koa"),r.WEB_EXPRESS=new r("@midwayjs/express"),r.FAAS=new r("@midwayjs/faas"),r.MS_GRPC=new r("@midwayjs/grpc"),r.MS_RABBITMQ=new r("@midwayjs/rabbitmq"),r.MS_KAFKA=new r("@midwayjs/kafka"),r.WS_IO=new r("@midwayjs/socketio"),r.WS=new r("@midwayjs/ws"),r.SERVERLESS_APP=new r("@midwayjs/serverless-app"),r.CUSTOM=new r(""),r.EMPTY=new r("empty"),r.LIGHT=new r("light"),r.TASK=new r("@midwayjs/task"),function(n){n.EVENT="event",n.HTTP="http",n.API_GATEWAY="apigw",n.OS="os",n.CDN="cdn",n.LOG="log",n.TIMER="timer",n.MQ="mq",n.KAFKA="kafka",n.HSF="hsf",n.MTOP="mtop",n.SSR="ssr"}(e.ServerlessTriggerType||(e.ServerlessTriggerType={})),function(n){n.BEFORE_BIND="beforeBind",n.BEFORE_CREATED="beforeObjectCreated",n.AFTER_CREATED="afterObjectCreated",n.AFTER_INIT="afterObjectInit",n.BEFORE_DESTROY="beforeObjectDestroy"}(e.ObjectLifeCycleEvent||(e.ObjectLifeCycleEvent={})),function(n){n.APPLICATION="APPLICATION",n.AGENT="AGENT"}(e.MidwayProcessTypeEnum||(e.MidwayProcessTypeEnum={}))})(Ke);var fe={};Object.defineProperty(fe,"__esModule",{value:!0}),fe.TAGGED_CLS=fe.INJECT_CUSTOM_PARAM=fe.INJECT_CUSTOM_METHOD=fe.INJECT_CUSTOM_PROPERTY=fe.INJECT_TAG=fe.NAMED_TAG=fe.CLASS_KEY_CONSTRUCTOR=fe.APPLICATION_CONTEXT_KEY=fe.APPLICATION_KEY=fe.LOGGER_KEY=fe.PLUGIN_KEY=fe.CONFIG_KEY=fe.MS_HSF_METHOD_KEY=fe.MS_DUBBO_METHOD_KEY=fe.MS_GRPC_METHOD_KEY=fe.MS_PROVIDER_KEY=fe.MS_PRODUCER_KEY=fe.MS_CONSUMER_KEY=fe.RPC_DUBBO_KEY=fe.RPC_GRPC_KEY=fe.HSF_KEY=fe.WS_EVENT_KEY=fe.WS_CONTROLLER_KEY=fe.MODULE_TASK_QUEUE_OPTIONS=fe.MODULE_TASK_QUEUE_KEY=fe.MODULE_TASK_TASK_LOCAL_OPTIONS=fe.MODULE_TASK_TASK_LOCAL_KEY=fe.MODULE_TASK_METADATA=fe.MODULE_TASK_KEY=fe.WEB_RESPONSE_RENDER=fe.WEB_RESPONSE_CONTENT_TYPE=fe.WEB_RESPONSE_HEADER=fe.WEB_RESPONSE_REDIRECT=fe.WEB_RESPONSE_HTTP_CODE=fe.WEB_RESPONSE_KEY=fe.WEB_ROUTER_PARAM_KEY=fe.WEB_ROUTER_KEY=fe.CONTROLLER_KEY=fe.SERVERLESS_FUNC_KEY=fe.FUNC_KEY=fe.FACTORY_SERVICE_CLIENT_KEY=fe.MOCK_KEY=fe.GUARD_KEY=fe.MATCH_KEY=fe.CATCH_KEY=fe.ASPECT_KEY=fe.FRAMEWORK_KEY=fe.CONFIGURATION_KEY=fe.SCHEDULE_KEY=fe.ALL=void 0,fe.PRIVATE_META_DATA_KEY=fe.MAIN_MODULE_KEY=fe.LIFECYCLE_IDENTIFIER_PREFIX=fe.PIPELINE_IDENTIFIER=fe.OBJ_DEF_CLS=fe.TAGGED_FUN=void 0,fe.ALL="common:all_value_key",fe.SCHEDULE_KEY="common:schedule",fe.CONFIGURATION_KEY="common:configuration",fe.FRAMEWORK_KEY="common:framework",fe.ASPECT_KEY="common:aspect",fe.CATCH_KEY="common:catch",fe.MATCH_KEY="common:match",fe.GUARD_KEY="common:guard",fe.MOCK_KEY="common:mock",fe.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client",fe.FUNC_KEY="faas:func",fe.SERVERLESS_FUNC_KEY="faas:serverless:function",fe.CONTROLLER_KEY="web:controller",fe.WEB_ROUTER_KEY="web:router",fe.WEB_ROUTER_PARAM_KEY="web:router_param",fe.WEB_RESPONSE_KEY="web:response",fe.WEB_RESPONSE_HTTP_CODE="web:response_http_code",fe.WEB_RESPONSE_REDIRECT="web:response_redirect",fe.WEB_RESPONSE_HEADER="web:response_header",fe.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type",fe.WEB_RESPONSE_RENDER="web:response_render",fe.MODULE_TASK_KEY="task:task",fe.MODULE_TASK_METADATA="task:task:options",fe.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local",fe.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options",fe.MODULE_TASK_QUEUE_KEY="task:task:queue",fe.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options",fe.WS_CONTROLLER_KEY="ws:controller",fe.WS_EVENT_KEY="ws:event",fe.HSF_KEY="rpc:hsf",fe.RPC_GRPC_KEY="rpc:grpc",fe.RPC_DUBBO_KEY="rpc:dubbo",fe.MS_CONSUMER_KEY="ms:consumer",fe.MS_PRODUCER_KEY="ms:producer",fe.MS_PROVIDER_KEY="ms:provider",fe.MS_GRPC_METHOD_KEY="ms:grpc:method",fe.MS_DUBBO_METHOD_KEY="ms:dubbo:method",fe.MS_HSF_METHOD_KEY="ms:hsf:method",fe.CONFIG_KEY="config",fe.PLUGIN_KEY="plugin",fe.LOGGER_KEY="logger",fe.APPLICATION_KEY="__midway_framework_app__",fe.APPLICATION_CONTEXT_KEY="__midway_application_context__",fe.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor",fe.NAMED_TAG="named",fe.INJECT_TAG="inject",fe.INJECT_CUSTOM_PROPERTY="inject_custom_property",fe.INJECT_CUSTOM_METHOD="inject_custom_method",fe.INJECT_CUSTOM_PARAM="inject_custom_param",fe.TAGGED_CLS="injection:tagged_class",fe.TAGGED_FUN="injection:tagged_function",fe.OBJ_DEF_CLS="injection:object_definition_class",fe.PIPELINE_IDENTIFIER="__pipeline_identifier__",fe.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__",fe.MAIN_MODULE_KEY="__main__",fe.PRIVATE_META_DATA_KEY="__midway_private_meta_data__";var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.Types=Ne.isNullOrUndefined=Ne.isNull=Ne.isUndefined=Ne.isRegExp=Ne.isSet=Ne.isMap=Ne.isProxy=Ne.isNumber=Ne.isPlainObject=Ne.isObject=Ne.isFunction=Ne.isPromise=Ne.isGeneratorFunction=Ne.isAsyncFunction=Ne.isClass=Ne.isString=void 0;const Ai=_e,_T=Function.prototype.toString,Sf=Object.prototype.hasOwnProperty,ST=Object.prototype.toString;function By(e){return typeof e=="string"}Ne.isString=By;function Dy(e){if(typeof e!="function")return!1;if(/^class[\s{]/.test(_T.call(e)))return!0}Ne.isClass=Dy;function Fy(e){return Ai.types.isAsyncFunction(e)}Ne.isAsyncFunction=Fy;function ky(e){return Ai.types.isGeneratorFunction(e)}Ne.isGeneratorFunction=ky;function Uy(e){return Ai.types.isPromise(e)}Ne.isPromise=Uy;function $y(e){return typeof e=="function"}Ne.isFunction=$y;function jy(e){return e!==null&&typeof e=="object"}Ne.isObject=jy;function Ky(e){if(!e||ST.call(e)!=="[object Object]")return!1;const t=Sf.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Sf.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!r)return!1;let n;for(n in e);return typeof n>"u"||Sf.call(e,n)}Ne.isPlainObject=Ky;function qy(e){return typeof e=="number"}Ne.isNumber=qy;function Vy(e){return Ai.types.isProxy(e)}Ne.isProxy=Vy;function Gy(e){return Ai.types.isMap(e)}Ne.isMap=Gy;function Hy(e){return Ai.types.isSet(e)}Ne.isSet=Hy;function Yy(e){return Ai.types.isRegExp(e)}Ne.isRegExp=Yy;function Cf(e){return e===void 0}Ne.isUndefined=Cf;function wf(e){return e===null}Ne.isNull=wf;function Wy(e){return Cf(e)||wf(e)}Ne.isNullOrUndefined=Wy,Ne.Types={isClass:Dy,isAsyncFunction:Fy,isGeneratorFunction:ky,isString:By,isPromise:Uy,isFunction:$y,isObject:jy,isPlainObject:Ky,isNumber:qy,isProxy:Vy,isMap:Gy,isSet:Hy,isRegExp:Yy,isUndefined:Cf,isNull:wf,isNullOrUndefined:Wy};var xi={};Object.defineProperty(xi,"__esModule",{value:!0}),xi.pascalCase=xi.camelCase=void 0;const CT=/[\p{Lu}]/u,wT=/[\p{Ll}]/u,zy=/([\p{Alpha}\p{N}_]|$)/u,Tf=/[_.\- ]+/,TT=new RegExp("^"+Tf.source),Qy=new RegExp(Tf.source+zy.source,"gu"),Xy=new RegExp("\\d+"+zy.source,"gu"),AT=(e,t,r)=>{let n=!1,i=!1,a=!1;for(let o=0;o<e.length;o++){const s=e[o];n&&CT.test(s)?(e=e.slice(0,o)+"-"+e.slice(o),n=!1,a=i,i=!0,o++):i&&a&&wT.test(s)?(e=e.slice(0,o-1)+"-"+e.slice(o-1),a=i,i=!1,n=!0):(n=t(s)===s&&r(s)!==s,a=i,i=r(s)===s&&t(s)!==s)}return e},xT=(e,t)=>(Qy.lastIndex=0,Xy.lastIndex=0,e.replace(Qy,(r,n)=>t(n)).replace(Xy,r=>t(r)));function Jy(e,t){if(t={pascalCase:!1,...t},e=e.trim(),e.length===0)return"";const r=a=>a.toLowerCase(),n=a=>a.toUpperCase();return e.length===1?Tf.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=AT(e,r,n)),e=e.replace(TT,""),e=r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),xT(e,n))}function RT(e){return Jy(e,{pascalCase:!1})}xi.camelCase=RT;function IT(e){return Jy(e,{pascalCase:!0})}xi.pascalCase=IT;var zt={exports:{}},je;(function(e){e[e.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",e[e.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",e[e.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"})(je||(je={}));var OT=function(){function e(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return e.prototype.addTypeMetadata=function(t){this._typeMetadatas.has(t.target)||this._typeMetadatas.set(t.target,new Map),this._typeMetadatas.get(t.target).set(t.propertyName,t)},e.prototype.addTransformMetadata=function(t){this._transformMetadatas.has(t.target)||this._transformMetadatas.set(t.target,new Map),this._transformMetadatas.get(t.target).has(t.propertyName)||this._transformMetadatas.get(t.target).set(t.propertyName,[]),this._transformMetadatas.get(t.target).get(t.propertyName).push(t)},e.prototype.addExposeMetadata=function(t){this._exposeMetadatas.has(t.target)||this._exposeMetadatas.set(t.target,new Map),this._exposeMetadatas.get(t.target).set(t.propertyName,t)},e.prototype.addExcludeMetadata=function(t){this._excludeMetadatas.has(t.target)||this._excludeMetadatas.set(t.target,new Map),this._excludeMetadatas.get(t.target).set(t.propertyName,t)},e.prototype.findTransformMetadatas=function(t,r,n){return this.findMetadatas(this._transformMetadatas,t,r).filter(function(i){return!i.options||i.options.toClassOnly===!0&&i.options.toPlainOnly===!0?!0:i.options.toClassOnly===!0?n===je.CLASS_TO_CLASS||n===je.PLAIN_TO_CLASS:i.options.toPlainOnly===!0?n===je.CLASS_TO_PLAIN:!0})},e.prototype.findExcludeMetadata=function(t,r){return this.findMetadata(this._excludeMetadatas,t,r)},e.prototype.findExposeMetadata=function(t,r){return this.findMetadata(this._exposeMetadatas,t,r)},e.prototype.findExposeMetadataByCustomName=function(t,r){return this.getExposedMetadatas(t).find(function(n){return n.options&&n.options.name===r})},e.prototype.findTypeMetadata=function(t,r){return this.findMetadata(this._typeMetadatas,t,r)},e.prototype.getStrategy=function(t){var r=this._excludeMetadatas.get(t),n=r&&r.get(void 0),i=this._exposeMetadatas.get(t),a=i&&i.get(void 0);return n&&a||!n&&!a?"none":n?"excludeAll":"exposeAll"},e.prototype.getExposedMetadatas=function(t){return this.getMetadata(this._exposeMetadatas,t)},e.prototype.getExcludedMetadatas=function(t){return this.getMetadata(this._excludeMetadatas,t)},e.prototype.getExposedProperties=function(t,r){return this.getExposedMetadatas(t).filter(function(n){return!n.options||n.options.toClassOnly===!0&&n.options.toPlainOnly===!0?!0:n.options.toClassOnly===!0?r===je.CLASS_TO_CLASS||r===je.PLAIN_TO_CLASS:n.options.toPlainOnly===!0?r===je.CLASS_TO_PLAIN:!0}).map(function(n){return n.propertyName})},e.prototype.getExcludedProperties=function(t,r){return this.getExcludedMetadatas(t).filter(function(n){return!n.options||n.options.toClassOnly===!0&&n.options.toPlainOnly===!0?!0:n.options.toClassOnly===!0?r===je.CLASS_TO_CLASS||r===je.PLAIN_TO_CLASS:n.options.toPlainOnly===!0?r===je.CLASS_TO_PLAIN:!0}).map(function(n){return n.propertyName})},e.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},e.prototype.getMetadata=function(t,r){var n=t.get(r),i;n&&(i=Array.from(n.values()).filter(function(f){return f.propertyName!==void 0}));for(var a=[],o=0,s=this.getAncestors(r);o<s.length;o++){var u=s[o],c=t.get(u);if(c){var l=Array.from(c.values()).filter(function(f){return f.propertyName!==void 0});a.push.apply(a,l)}}return a.concat(i||[])},e.prototype.findMetadata=function(t,r,n){var i=t.get(r);if(i){var a=i.get(n);if(a)return a}for(var o=0,s=this.getAncestors(r);o<s.length;o++){var u=s[o],c=t.get(u);if(c){var l=c.get(n);if(l)return l}}},e.prototype.findMetadatas=function(t,r,n){var i=t.get(r),a;i&&(a=i.get(n));for(var o=[],s=0,u=this.getAncestors(r);s<u.length;s++){var c=u[s],l=t.get(c);l&&l.has(n)&&o.push.apply(o,l.get(n))}return o.slice().reverse().concat((a||[]).slice().reverse())},e.prototype.getAncestors=function(t){if(!t)return[];if(!this._ancestorsMap.has(t)){for(var r=[],n=Object.getPrototypeOf(t.prototype.constructor);typeof n.prototype<"u";n=Object.getPrototypeOf(n.prototype.constructor))r.push(n);this._ancestorsMap.set(t,r)}return this._ancestorsMap.get(t)},e}(),xt=new OT;function MT(){if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global;if(typeof window<"u")return window;if(typeof self<"u")return self}function LT(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Zy=globalThis&&globalThis.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))};function PT(e){var t=new e;return!(t instanceof Set)&&!("push"in t)?[]:t}var ha=function(){function e(t,r){this.transformationType=t,this.options=r,this.recursionStack=new Set}return e.prototype.transform=function(t,r,n,i,a,o){var s=this;if(o===void 0&&(o=0),Array.isArray(r)||r instanceof Set){var u=i&&this.transformationType===je.PLAIN_TO_CLASS?PT(i):[];return r.forEach(function(p,y){var w=t?t[y]:void 0;if(!s.options.enableCircularCheck||!s.isCircular(p)){var m=void 0;if(typeof n!="function"&&n&&n.options&&n.options.discriminator&&n.options.discriminator.property&&n.options.discriminator.subTypes){if(s.transformationType===je.PLAIN_TO_CLASS){m=n.options.discriminator.subTypes.find(function(N){return N.name===p[n.options.discriminator.property]});var S={newObject:u,object:p,property:void 0},A=n.typeFunction(S);m===void 0?m=A:m=m.value,n.options.keepDiscriminatorProperty||delete p[n.options.discriminator.property]}s.transformationType===je.CLASS_TO_CLASS&&(m=p.constructor),s.transformationType===je.CLASS_TO_PLAIN&&(p[n.options.discriminator.property]=n.options.discriminator.subTypes.find(function(N){return N.value===p.constructor}).name)}else m=n;var I=s.transform(w,p,m,void 0,p instanceof Map,o+1);u instanceof Set?u.add(I):u.push(I)}else s.transformationType===je.CLASS_TO_CLASS&&(u instanceof Set?u.add(p):u.push(p))}),u}else{if(n===String&&!a)return r==null?r:String(r);if(n===Number&&!a)return r==null?r:Number(r);if(n===Boolean&&!a)return r==null?r:Boolean(r);if((n===Date||r instanceof Date)&&!a)return r instanceof Date?new Date(r.valueOf()):r==null?r:new Date(r);if(!!MT().Buffer&&(n===Buffer||r instanceof Buffer)&&!a)return r==null?r:Buffer.from(r);if(LT(r)&&!a)return new Promise(function(p,y){r.then(function(w){return p(s.transform(void 0,w,n,void 0,void 0,o+1))},y)});if(!a&&r!==null&&typeof r=="object"&&typeof r.then=="function")return r;if(typeof r=="object"&&r!==null){!n&&r.constructor!==Object&&(!Array.isArray(r)&&r.constructor===Array||(n=r.constructor)),!n&&t&&(n=t.constructor),this.options.enableCircularCheck&&this.recursionStack.add(r);var c=this.getKeys(n,r,a),l=t||{};!t&&(this.transformationType===je.PLAIN_TO_CLASS||this.transformationType===je.CLASS_TO_CLASS)&&(a?l=new Map:n?l=new n:l={});for(var f=function(p){if(p==="__proto__"||p==="constructor")return"continue";var y=p,w=p,m=p;if(!d.options.ignoreDecorators&&n){if(d.transformationType===je.PLAIN_TO_CLASS){var S=xt.findExposeMetadataByCustomName(n,p);S&&(m=S.propertyName,w=S.propertyName)}else if(d.transformationType===je.CLASS_TO_PLAIN||d.transformationType===je.CLASS_TO_CLASS){var S=xt.findExposeMetadata(n,p);S&&S.options&&S.options.name&&(w=S.options.name)}}var A=void 0;d.transformationType===je.PLAIN_TO_CLASS?A=r[y]:r instanceof Map?A=r.get(y):r[y]instanceof Function?A=r[y]():A=r[y];var I=void 0,N=A instanceof Map;if(n&&a)I=n;else if(n){var T=xt.findTypeMetadata(n,m);if(T){var M={newObject:l,object:r,property:m},P=T.typeFunction?T.typeFunction(M):T.reflectedType;T.options&&T.options.discriminator&&T.options.discriminator.property&&T.options.discriminator.subTypes?r[y]instanceof Array?I=T:(d.transformationType===je.PLAIN_TO_CLASS&&(I=T.options.discriminator.subTypes.find(function(G){if(A&&A instanceof Object&&T.options.discriminator.property in A)return G.name===A[T.options.discriminator.property]}),I===void 0?I=P:I=I.value,T.options.keepDiscriminatorProperty||A&&A instanceof Object&&T.options.discriminator.property in A&&delete A[T.options.discriminator.property]),d.transformationType===je.CLASS_TO_CLASS&&(I=A.constructor),d.transformationType===je.CLASS_TO_PLAIN&&A&&(A[T.options.discriminator.property]=T.options.discriminator.subTypes.find(function(G){return G.value===A.constructor}).name)):I=P,N=N||T.reflectedType===Map}else if(d.options.targetMaps)d.options.targetMaps.filter(function(G){return G.target===n&&!!G.properties[m]}).forEach(function(G){return I=G.properties[m]});else if(d.options.enableImplicitConversion&&d.transformationType===je.PLAIN_TO_CLASS){var L=Reflect.getMetadata("design:type",n.prototype,m);L&&(I=L)}}var B=Array.isArray(r[y])?d.getReflectedType(n,m):void 0,X=t?t[y]:void 0;if(l.constructor.prototype){var V=Object.getOwnPropertyDescriptor(l.constructor.prototype,w);if((d.transformationType===je.PLAIN_TO_CLASS||d.transformationType===je.CLASS_TO_CLASS)&&(V&&!V.set||l[w]instanceof Function))return"continue"}if(!d.options.enableCircularCheck||!d.isCircular(A)){var k=d.transformationType===je.PLAIN_TO_CLASS?w:p,$=void 0;d.transformationType===je.CLASS_TO_PLAIN?($=r[k],$=d.applyCustomTransformations($,n,k,r,d.transformationType),$=r[k]===$?A:$,$=d.transform(X,$,I,B,N,o+1)):A===void 0&&d.options.exposeDefaultValues?$=l[w]:($=d.transform(X,A,I,B,N,o+1),$=d.applyCustomTransformations($,n,k,r,d.transformationType)),($!==void 0||d.options.exposeUnsetFields)&&(l instanceof Map?l.set(w,$):l[w]=$)}else if(d.transformationType===je.CLASS_TO_CLASS){var $=A;$=d.applyCustomTransformations($,n,p,r,d.transformationType),($!==void 0||d.options.exposeUnsetFields)&&(l instanceof Map?l.set(w,$):l[w]=$)}},d=this,g=0,h=c;g<h.length;g++){var v=h[g];f(v)}return this.options.enableCircularCheck&&this.recursionStack.delete(r),l}else return r}},e.prototype.applyCustomTransformations=function(t,r,n,i,a){var o=this,s=xt.findTransformMetadatas(r,n,this.transformationType);return this.options.version!==void 0&&(s=s.filter(function(u){return u.options?o.checkVersion(u.options.since,u.options.until):!0})),this.options.groups&&this.options.groups.length?s=s.filter(function(u){return u.options?o.checkGroups(u.options.groups):!0}):s=s.filter(function(u){return!u.options||!u.options.groups||!u.options.groups.length}),s.forEach(function(u){t=u.transformFn({value:t,key:n,obj:i,type:a,options:o.options})}),t},e.prototype.isCircular=function(t){return this.recursionStack.has(t)},e.prototype.getReflectedType=function(t,r){if(!!t){var n=xt.findTypeMetadata(t,r);return n?n.reflectedType:void 0}},e.prototype.getKeys=function(t,r,n){var i=this,a=xt.getStrategy(t);a==="none"&&(a=this.options.strategy||"exposeAll");var o=[];if((a==="exposeAll"||n)&&(r instanceof Map?o=Array.from(r.keys()):o=Object.keys(r)),n)return o;if(this.options.ignoreDecorators&&this.options.excludeExtraneousValues&&t){var s=xt.getExposedProperties(t,this.transformationType),u=xt.getExcludedProperties(t,this.transformationType);o=Zy(Zy([],s,!0),u,!0)}if(!this.options.ignoreDecorators&&t){var s=xt.getExposedProperties(t,this.transformationType);this.transformationType===je.PLAIN_TO_CLASS&&(s=s.map(function(f){var d=xt.findExposeMetadata(t,f);return d&&d.options&&d.options.name?d.options.name:f})),this.options.excludeExtraneousValues?o=s:o=o.concat(s);var c=xt.getExcludedProperties(t,this.transformationType);c.length>0&&(o=o.filter(function(f){return!c.includes(f)})),this.options.version!==void 0&&(o=o.filter(function(f){var d=xt.findExposeMetadata(t,f);return!d||!d.options?!0:i.checkVersion(d.options.since,d.options.until)})),this.options.groups&&this.options.groups.length?o=o.filter(function(f){var d=xt.findExposeMetadata(t,f);return!d||!d.options?!0:i.checkGroups(d.options.groups)}):o=o.filter(function(f){var d=xt.findExposeMetadata(t,f);return!d||!d.options||!d.options.groups||!d.options.groups.length})}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(o=o.filter(function(l){return i.options.excludePrefixes.every(function(f){return l.substr(0,f.length)!==f})})),o=o.filter(function(l,f,d){return d.indexOf(l)===f}),o},e.prototype.checkVersion=function(t,r){var n=!0;return n&&t&&(n=this.options.version>=t),n&&r&&(n=this.options.version<r),n},e.prototype.checkGroups=function(t){return t?this.options.groups.some(function(r){return t.includes(r)}):!0},e}(),pa={enableCircularCheck:!1,enableImplicitConversion:!1,excludeExtraneousValues:!1,excludePrefixes:void 0,exposeDefaultValues:!1,exposeUnsetFields:!0,groups:void 0,ignoreDecorators:!1,strategy:void 0,targetMaps:void 0,version:void 0},ir=globalThis&&globalThis.__assign||function(){return ir=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},ir.apply(this,arguments)},Bo=function(){function e(){}return e.prototype.instanceToPlain=function(t,r){var n=new ha(je.CLASS_TO_PLAIN,ir(ir({},pa),r));return n.transform(void 0,t,void 0,void 0,void 0,void 0)},e.prototype.classToPlainFromExist=function(t,r,n){var i=new ha(je.CLASS_TO_PLAIN,ir(ir({},pa),n));return i.transform(r,t,void 0,void 0,void 0,void 0)},e.prototype.plainToInstance=function(t,r,n){var i=new ha(je.PLAIN_TO_CLASS,ir(ir({},pa),n));return i.transform(void 0,r,t,void 0,void 0,void 0)},e.prototype.plainToClassFromExist=function(t,r,n){var i=new ha(je.PLAIN_TO_CLASS,ir(ir({},pa),n));return i.transform(t,r,void 0,void 0,void 0,void 0)},e.prototype.instanceToInstance=function(t,r){var n=new ha(je.CLASS_TO_CLASS,ir(ir({},pa),r));return n.transform(void 0,t,void 0,void 0,void 0,void 0)},e.prototype.classToClassFromExist=function(t,r,n){var i=new ha(je.CLASS_TO_CLASS,ir(ir({},pa),n));return i.transform(r,t,void 0,void 0,void 0,void 0)},e.prototype.serialize=function(t,r){return JSON.stringify(this.instanceToPlain(t,r))},e.prototype.deserialize=function(t,r,n){var i=JSON.parse(r);return this.plainToInstance(t,i,n)},e.prototype.deserializeArray=function(t,r,n){var i=JSON.parse(r);return this.plainToInstance(t,i,n)},e}();function NT(e){return e===void 0&&(e={}),function(t,r){xt.addExcludeMetadata({target:t instanceof Function?t:t.constructor,propertyName:r,options:e})}}function BT(e){return e===void 0&&(e={}),function(t,r){xt.addExposeMetadata({target:t instanceof Function?t:t.constructor,propertyName:r,options:e})}}function DT(e){return function(t,r,n){var i=new Bo,a=n.value;n.value=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=a.apply(this,o),c=!!u&&(typeof u=="object"||typeof u=="function")&&typeof u.then=="function";return c?u.then(function(l){return i.instanceToInstance(l,e)}):i.instanceToInstance(u,e)}}}function FT(e){return function(t,r,n){var i=new Bo,a=n.value;n.value=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=a.apply(this,o),c=!!u&&(typeof u=="object"||typeof u=="function")&&typeof u.then=="function";return c?u.then(function(l){return i.instanceToPlain(l,e)}):i.instanceToPlain(u,e)}}}function kT(e,t){return function(r,n,i){var a=new Bo,o=i.value;i.value=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];var c=o.apply(this,s),l=!!c&&(typeof c=="object"||typeof c=="function")&&typeof c.then=="function";return l?c.then(function(f){return a.plainToInstance(e,f,t)}):a.plainToInstance(e,c,t)}}}function UT(e,t){return t===void 0&&(t={}),function(r,n){xt.addTransformMetadata({target:r.constructor,propertyName:n,transformFn:e,options:t})}}function $T(e,t){return t===void 0&&(t={}),function(r,n){var i=Reflect.getMetadata("design:type",r,n);xt.addTypeMetadata({target:r.constructor,propertyName:n,reflectedType:i,typeFunction:e,options:t})}}var kr=new Bo;function jT(e,t){return kr.instanceToPlain(e,t)}function KT(e,t){return kr.instanceToPlain(e,t)}function qT(e,t,r){return kr.classToPlainFromExist(e,t,r)}function VT(e,t,r){return kr.plainToInstance(e,t,r)}function GT(e,t,r){return kr.plainToInstance(e,t,r)}function HT(e,t,r){return kr.plainToClassFromExist(e,t,r)}function YT(e,t){return kr.instanceToInstance(e,t)}function WT(e,t,r){return kr.classToClassFromExist(e,t,r)}function zT(e,t){return kr.serialize(e,t)}function QT(e,t,r){return kr.deserialize(e,t,r)}function XT(e,t,r){return kr.deserializeArray(e,t,r)}const JT=pl(Object.freeze(Object.defineProperty({__proto__:null,classToPlain:jT,instanceToPlain:KT,classToPlainFromExist:qT,plainToClass:VT,plainToInstance:GT,plainToClassFromExist:HT,instanceToInstance:YT,classToClassFromExist:WT,serialize:zT,deserialize:QT,deserializeArray:XT,ClassTransformer:Bo,Exclude:NT,Expose:BT,TransformInstanceToInstance:DT,TransformInstanceToPlain:FT,TransformPlainToInstance:kT,Transform:UT,Type:$T,get TransformationType(){return je}},Symbol.toStringTag,{value:"Module"})));var ga={};Object.defineProperty(ga,"__esModule",{value:!0}),ga.PathToRegexpUtil=void 0;function ZT(e){const t=[];let r=0;for(;r<e.length;){const n=e[r];if(n==="*"||n==="+"||n==="?"){t.push({type:"MODIFIER",index:r,value:e[r++]});continue}if(n==="\\"){t.push({type:"ESCAPED_CHAR",index:r++,value:e[r++]});continue}if(n==="{"){t.push({type:"OPEN",index:r,value:e[r++]});continue}if(n==="}"){t.push({type:"CLOSE",index:r,value:e[r++]});continue}if(n===":"){let i="",a=r+1;for(;a<e.length;){const o=e.charCodeAt(a);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){i+=e[a++];continue}break}if(!i)throw new TypeError(`Missing parameter name at ${r}`);t.push({type:"NAME",index:r,value:i}),r=a;continue}if(n==="("){let i=1,a="",o=r+1;if(e[o]==="?")throw new TypeError(`Pattern cannot start with "?" at ${o}`);for(;o<e.length;){if(e[o]==="\\"){a+=e[o++]+e[o++];continue}if(e[o]===")"){if(i--,i===0){o++;break}}else if(e[o]==="("&&(i++,e[o+1]!=="?"))throw new TypeError(`Capturing groups are not allowed at ${o}`);a+=e[o++]}if(i)throw new TypeError(`Unbalanced pattern at ${r}`);if(!a)throw new TypeError(`Missing pattern at ${r}`);t.push({type:"PATTERN",index:r,value:a}),r=o;continue}t.push({type:"CHAR",index:r,value:e[r++]})}return t.push({type:"END",index:r,value:""}),t}function Af(e,t={}){const r=ZT(e),{prefixes:n="./"}=t,i=`[^${ya(t.delimiter||"/#?")}]+?`,a=[];let o=0,s=0,u="";const c=d=>{if(s<r.length&&r[s].type===d)return r[s++].value},l=d=>{const g=c(d);if(g!==void 0)return g;const{type:h,index:v}=r[s];throw new TypeError(`Unexpected ${h} at ${v}, expected ${d}`)},f=()=>{let d="",g;for(;g=c("CHAR")||c("ESCAPED_CHAR");)d+=g;return d};for(;s<r.length;){const d=c("CHAR"),g=c("NAME"),h=c("PATTERN");if(g||h){let y=d||"";n.indexOf(y)===-1&&(u+=y,y=""),u&&(a.push(u),u=""),a.push({name:g||o++,prefix:y,suffix:"",pattern:h||i,modifier:c("MODIFIER")||""});continue}const v=d||c("ESCAPED_CHAR");if(v){u+=v;continue}if(u&&(a.push(u),u=""),c("OPEN")){const y=f(),w=c("NAME")||"",m=c("PATTERN")||"",S=f();l("CLOSE"),a.push({name:w||(m?o++:""),pattern:w&&!m?i:m,prefix:y,suffix:S,modifier:c("MODIFIER")||""});continue}l("END")}return a}function eA(e,t){return tA(Af(e,t),t)}function tA(e,t={}){const r=xf(t),{encode:n=o=>o,validate:i=!0}=t,a=e.map(o=>{if(typeof o=="object")return new RegExp(`^(?:${o.pattern})$`,r)});return o=>{let s="";for(let u=0;u<e.length;u++){const c=e[u];if(typeof c=="string"){s+=c;continue}const l=o?o[c.name]:void 0,f=c.modifier==="?"||c.modifier==="*",d=c.modifier==="*"||c.modifier==="+";if(Array.isArray(l)){if(!d)throw new TypeError(`Expected "${c.name}" to not repeat, but got an array`);if(l.length===0){if(f)continue;throw new TypeError(`Expected "${c.name}" to not be empty`)}for(let h=0;h<l.length;h++){const v=n(l[h],c);if(i&&!a[u].test(v))throw new TypeError(`Expected all "${c.name}" to match "${c.pattern}", but got "${v}"`);s+=c.prefix+v+c.suffix}continue}if(typeof l=="string"||typeof l=="number"){const h=n(String(l),c);if(i&&!a[u].test(h))throw new TypeError(`Expected "${c.name}" to match "${c.pattern}", but got "${h}"`);s+=c.prefix+h+c.suffix;continue}if(f)continue;const g=d?"an array":"a string";throw new TypeError(`Expected "${c.name}" to be ${g}`)}return s}}function rA(e,t){const r=[],n=Rf(e,r,t);return nA(n,r,t)}function nA(e,t,r={}){const{decode:n=i=>i}=r;return function(i){const a=e.exec(i);if(!a)return!1;const{0:o,index:s}=a,u=Object.create(null);for(let c=1;c<a.length;c++){if(a[c]===void 0)continue;const l=t[c-1];l.modifier==="*"||l.modifier==="+"?u[l.name]=a[c].split(l.prefix+l.suffix).map(f=>n(f,l)):u[l.name]=n(a[c],l)}return{path:o,index:s,params:u}}}function ya(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function xf(e){return e&&e.sensitive?"":"i"}function iA(e,t){if(!t)return e;const r=/\((?:\?<(.*?)>)?(?!\?)/g;let n=0,i=r.exec(e.source);for(;i;)t.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=r.exec(e.source);return e}function aA(e,t,r){const n=e.map(i=>Rf(i,t,r).source);return new RegExp(`(?:${n.join("|")})`,xf(r))}function oA(e,t,r){return sA(Af(e,r),t,r)}function sA(e,t,r={}){const{strict:n=!1,start:i=!0,end:a=!0,encode:o=d=>d,delimiter:s="/#?",endsWith:u=""}=r,c=`[${ya(u)}]|$`,l=`[${ya(s)}]`;let f=i?"^":"";for(const d of e)if(typeof d=="string")f+=ya(o(d));else{const g=ya(o(d.prefix)),h=ya(o(d.suffix));if(d.pattern)if(t&&t.push(d),g||h)if(d.modifier==="+"||d.modifier==="*"){const v=d.modifier==="*"?"?":"";f+=`(?:${g}((?:${d.pattern})(?:${h}${g}(?:${d.pattern}))*)${h})${v}`}else f+=`(?:${g}(${d.pattern})${h})${d.modifier}`;else d.modifier==="+"||d.modifier==="*"?f+=`((?:${d.pattern})${d.modifier})`:f+=`(${d.pattern})${d.modifier}`;else f+=`(?:${g}${h})${d.modifier}`}if(a)n||(f+=`${l}?`),f+=r.endsWith?`(?=${c})`:"$";else{const d=e[e.length-1],g=typeof d=="string"?l.indexOf(d[d.length-1])>-1:d===void 0;n||(f+=`(?:${l}(?=${c}))?`),g||(f+=`(?=${l}|${c})`)}return new RegExp(f,xf(r))}function Rf(e,t,r){return e instanceof RegExp?iA(e,t):Array.isArray(e)?aA(e,t,r):oA(e,t,r)}ga.PathToRegexpUtil={toRegexp:Rf,compile:eA,parse:Af,match:rA};var Gt={},Xr={};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.MidwayHttpError=Xr.MidwayError=Xr.registerErrorCode=void 0;const uA=_e,ev=new Set;function cA(e,t){if(ev.has(e))throw new If(`Error group ${e} is duplicated, please check before adding.`);ev.add(e);const r={};for(const n in t)r[n]=e.toUpperCase()+"_"+String(t[n]).toUpperCase();return r}Xr.registerErrorCode=cA;class If extends Error{constructor(t,r,n){super(t),(!r||typeof r=="object")&&(n=r,r="MIDWAY_10000"),this.name=this.constructor.name,this.code=r,this.cause=n==null?void 0:n.cause}}Xr.MidwayError=If;class lA extends If{constructor(t,r,n,i){super(t?typeof t=="string"?t:t.message:uA.STATUS_CODES[r],n!=null?n:String(r),i),t&&t.stack&&(this.stack=t.stack),this.status=r}}Xr.MidwayHttpError=lA;var tv={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.httpError=e.GatewayTimeoutError=e.ServiceUnavailableError=e.BadGatewayError=e.NotImplementedError=e.InternalServerErrorError=e.UnprocessableEntityError=e.UnsupportedMediaTypeError=e.PayloadTooLargeError=e.GoneError=e.ConflictError=e.RequestTimeoutError=e.NotAcceptableError=e.ForbiddenError=e.NotFoundError=e.UnauthorizedError=e.BadRequestError=e.HttpStatus=void 0;const t=Xr;var r;(function(m){m[m.CONTINUE=100]="CONTINUE",m[m.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",m[m.PROCESSING=102]="PROCESSING",m[m.EARLYHINTS=103]="EARLYHINTS",m[m.OK=200]="OK",m[m.CREATED=201]="CREATED",m[m.ACCEPTED=202]="ACCEPTED",m[m.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",m[m.NO_CONTENT=204]="NO_CONTENT",m[m.RESET_CONTENT=205]="RESET_CONTENT",m[m.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",m[m.AMBIGUOUS=300]="AMBIGUOUS",m[m.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",m[m.FOUND=302]="FOUND",m[m.SEE_OTHER=303]="SEE_OTHER",m[m.NOT_MODIFIED=304]="NOT_MODIFIED",m[m.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",m[m.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",m[m.BAD_REQUEST=400]="BAD_REQUEST",m[m.UNAUTHORIZED=401]="UNAUTHORIZED",m[m.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",m[m.FORBIDDEN=403]="FORBIDDEN",m[m.NOT_FOUND=404]="NOT_FOUND",m[m.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",m[m.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",m[m.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",m[m.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",m[m.CONFLICT=409]="CONFLICT",m[m.GONE=410]="GONE",m[m.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",m[m.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",m[m.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",m[m.URI_TOO_LONG=414]="URI_TOO_LONG",m[m.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",m[m.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",m[m.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",m[m.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",m[m.MISDIRECTED=421]="MISDIRECTED",m[m.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",m[m.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",m[m.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",m[m.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",m[m.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",m[m.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",m[m.BAD_GATEWAY=502]="BAD_GATEWAY",m[m.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",m[m.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",m[m.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED"})(r=e.HttpStatus||(e.HttpStatus={}));class n extends t.MidwayHttpError{constructor(S){super(S,r.BAD_REQUEST)}}e.BadRequestError=n;class i extends t.MidwayHttpError{constructor(S){super(S,r.UNAUTHORIZED)}}e.UnauthorizedError=i;class a extends t.MidwayHttpError{constructor(S){super(S,r.NOT_FOUND)}}e.NotFoundError=a;class o extends t.MidwayHttpError{constructor(S){super(S,r.FORBIDDEN)}}e.ForbiddenError=o;class s extends t.MidwayHttpError{constructor(S){super(S,r.NOT_ACCEPTABLE)}}e.NotAcceptableError=s;class u extends t.MidwayHttpError{constructor(S){super(S,r.REQUEST_TIMEOUT)}}e.RequestTimeoutError=u;class c extends t.MidwayHttpError{constructor(S){super(S,r.CONFLICT)}}e.ConflictError=c;class l extends t.MidwayHttpError{constructor(S){super(S,r.GONE)}}e.GoneError=l;class f extends t.MidwayHttpError{constructor(S){super(S,r.PAYLOAD_TOO_LARGE)}}e.PayloadTooLargeError=f;class d extends t.MidwayHttpError{constructor(S){super(S,r.UNSUPPORTED_MEDIA_TYPE)}}e.UnsupportedMediaTypeError=d;class g extends t.MidwayHttpError{constructor(S){super(S,r.UNPROCESSABLE_ENTITY)}}e.UnprocessableEntityError=g;class h extends t.MidwayHttpError{constructor(S){super(S,r.INTERNAL_SERVER_ERROR)}}e.InternalServerErrorError=h;class v extends t.MidwayHttpError{constructor(S){super(S,r.NOT_IMPLEMENTED)}}e.NotImplementedError=v;class p extends t.MidwayHttpError{constructor(S){super(S,r.BAD_GATEWAY)}}e.BadGatewayError=p;class y extends t.MidwayHttpError{constructor(S){super(S,r.SERVICE_UNAVAILABLE)}}e.ServiceUnavailableError=y;class w extends t.MidwayHttpError{constructor(S){super(S,r.GATEWAY_TIMEOUT)}}e.GatewayTimeoutError=w,e.httpError={BadRequestError:n,UnauthorizedError:i,NotFoundError:a,ForbiddenError:o,NotAcceptableError:s,RequestTimeoutError:u,ConflictError:c,GoneError:l,PayloadTooLargeError:f,UnsupportedMediaTypeError:d,UnprocessableEntityError:g,InternalServerErrorError:h,NotImplementedError:v,BadGatewayError:p,ServiceUnavailableError:y,GatewayTimeoutError:w}})(tv);var rv={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MidwayInvokeForbiddenError=e.MidwayRetryExceededMaxTimesError=e.MidwayDuplicateControllerOptionsError=e.MidwayDuplicateClassNameError=e.MidwayInconsistentVersionError=e.MidwayUtilHttpClientTimeoutError=e.MidwayMissingImportComponentError=e.MidwaySingletonInjectRequestError=e.MidwayUseWrongMethodError=e.MidwayDuplicateRouteError=e.MidwayResolverMissingError=e.MidwayInvalidConfigError=e.MidwayConfigMissingError=e.MidwayFeatureNotImplementedError=e.MidwayFeatureNoLongerSupportedError=e.MidwayDefinitionNotFoundError=e.MidwayParameterError=e.MidwayCommonError=e.FrameworkErrorEnum=void 0;const t=Xr;e.FrameworkErrorEnum=(0,t.registerErrorCode)("midway",{UNKNOWN:1e4,COMMON:10001,PARAM_TYPE:10002,DEFINITION_NOT_FOUND:10003,FEATURE_NO_LONGER_SUPPORTED:10004,FEATURE_NOT_IMPLEMENTED:10004,MISSING_CONFIG:10006,MISSING_RESOLVER:10007,DUPLICATE_ROUTER:10008,USE_WRONG_METHOD:10009,SINGLETON_INJECT_REQUEST:10010,MISSING_IMPORTS:10011,UTIL_HTTP_TIMEOUT:10012,INCONSISTENT_VERSION:10013,INVALID_CONFIG:10014,DUPLICATE_CLASS_NAME:10015,DUPLICATE_CONTROLLER_PREFIX_OPTIONS:10016,RETRY_OVER_MAX_TIME:10017,INVOKE_METHOD_FORBIDDEN:10018});class r extends t.MidwayError{constructor(A){super(A,e.FrameworkErrorEnum.COMMON)}}e.MidwayCommonError=r;class n extends t.MidwayError{constructor(A){super(A!=null?A:"Parameter type not match",e.FrameworkErrorEnum.PARAM_TYPE)}}e.MidwayParameterError=n;class i extends t.MidwayError{static isClosePrototypeOf(A){return A?A[i.type]===i.type:!1}constructor(A){super(`${A} is not valid in current context`,e.FrameworkErrorEnum.DEFINITION_NOT_FOUND),this[i.type]=i.type}updateErrorMsg(A){const I=this.message.split(" is not valid in current context")[0];this.message=`${I} in class ${A} is not valid in current context`}}e.MidwayDefinitionNotFoundError=i,i.type=Symbol.for("#NotFoundError");class a extends t.MidwayError{constructor(A){super(`This feature no longer supported
|
|
24
|
-
`+A,e.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}e.MidwayFeatureNoLongerSupportedError=a;class o extends t.MidwayError{constructor(A){super(`This feature not implemented
|
|
25
|
-
`+A,e.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}e.MidwayFeatureNotImplementedError=o;class s extends t.MidwayError{constructor(A){super(`Can't found config key "${A}" in your config, please set it first`,e.FrameworkErrorEnum.MISSING_CONFIG)}}e.MidwayConfigMissingError=s;class u extends t.MidwayError{constructor(A){super(`Invalid config file
|
|
26
|
-
`+A,e.FrameworkErrorEnum.INVALID_CONFIG)}}e.MidwayInvalidConfigError=u;class c extends t.MidwayError{constructor(A){super(`Resolver "${A}" is missing.`,e.FrameworkErrorEnum.MISSING_RESOLVER)}}e.MidwayResolverMissingError=c;class l extends t.MidwayError{constructor(A,I,N){super(`Duplicate router "${A}" at "${I}" and "${N}"`,e.FrameworkErrorEnum.DUPLICATE_ROUTER)}}e.MidwayDuplicateRouteError=l;class f extends t.MidwayError{constructor(A,I,N){const T=N?`${N} not valid by ${A}, Use ${I} instead!`:`You should not invoked by ${A}, Use ${I} instead!`;super(T,e.FrameworkErrorEnum.USE_WRONG_METHOD)}}e.MidwayUseWrongMethodError=f;class d extends t.MidwayError{constructor(A,I){const N=`${A} with singleton scope can't implicitly inject ${I} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${I} or use "ctx.requestContext.getAsync(${I})".`;super(N,e.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}e.MidwaySingletonInjectRequestError=d;class g extends t.MidwayError{constructor(A){const I=`"${A}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(I,e.FrameworkErrorEnum.MISSING_IMPORTS)}}e.MidwayMissingImportComponentError=g;class h extends t.MidwayError{constructor(A){super(A,e.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}e.MidwayUtilHttpClientTimeoutError=h;class v extends t.MidwayError{constructor(){const A='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(A,e.FrameworkErrorEnum.INCONSISTENT_VERSION)}}e.MidwayInconsistentVersionError=v;class p extends t.MidwayError{constructor(A,I,N){super(`"${A}" duplicated between "${I}" and "${N}"`,e.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}e.MidwayDuplicateClassNameError=p;class y extends t.MidwayError{constructor(A,I,N){super(`"Prefix ${A}" with duplicated controller options between "${I}" and "${N}"`,e.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}e.MidwayDuplicateControllerOptionsError=y;class w extends t.MidwayError{constructor(A,I,N){super(`Invoke "${A}" retries exceeded the maximum number of times(${I}), error: ${N.message}`,e.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:N})}}e.MidwayRetryExceededMaxTimesError=w;class m extends t.MidwayError{constructor(A,I){super(`Invoke "${I?I.name:"unknown"}.${A}" is forbidden.`,e.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}e.MidwayInvokeForbiddenError=m})(rv),function(e){var t=me&&me.__createBinding||(Object.create?function(i,a,o,s){s===void 0&&(s=o);var u=Object.getOwnPropertyDescriptor(a,o);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,s,u)}:function(i,a,o,s){s===void 0&&(s=o),i[s]=a[o]}),r=me&&me.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.httpError=e.HttpStatus=void 0,r(Xr,e);var n=tv;Object.defineProperty(e,"HttpStatus",{enumerable:!0,get:function(){return n.HttpStatus}}),Object.defineProperty(e,"httpError",{enumerable:!0,get:function(){return n.httpError}}),r(rv,e)}(Gt);var _u={};Object.defineProperty(_u,"__esModule",{value:!0}),_u.randomUUID=void 0;const Of=_e,Su=new Uint8Array(256);let Cu=Su.length;function fA(){return Cu>Su.length-16&&(Of.randomFillSync(Su),Cu=0),Su.slice(Cu,Cu+=16)}const Bt=[];for(let e=0;e<256;++e)Bt.push((e+256).toString(16).slice(1));function dA(e,t=0){return(Bt[e[t+0]]+Bt[e[t+1]]+Bt[e[t+2]]+Bt[e[t+3]]+"-"+Bt[e[t+4]]+Bt[e[t+5]]+"-"+Bt[e[t+6]]+Bt[e[t+7]]+"-"+Bt[e[t+8]]+Bt[e[t+9]]+"-"+Bt[e[t+10]]+Bt[e[t+11]]+Bt[e[t+12]]+Bt[e[t+13]]+Bt[e[t+14]]+Bt[e[t+15]]).toLowerCase()}function hA(e){if(!e&&Of.randomUUID)return Of.randomUUID();const t=fA();return t[6]=t[6]&15|64,t[8]=t[8]&63|128,dA(t)}_u.randomUUID=hA;var va={};/*! (c) 2020 Andrea Giammarchi */Object.defineProperty(va,"__esModule",{value:!0}),va.safeStringify=va.safeParse=void 0;const{parse:pA,stringify:gA}=JSON,{keys:yA}=Object,Do=String,nv="string",iv={},wu="object",av=(e,t)=>t,vA=e=>e instanceof Do?Do(e):e,mA=(e,t)=>typeof t===nv?new Do(t):t,ov=(e,t,r,n)=>{const i=[];for(let a=yA(r),{length:o}=a,s=0;s<o;s++){const u=a[s],c=r[u];if(c instanceof Do){const l=e[c];typeof l===wu&&!t.has(l)?(t.add(l),r[u]=iv,i.push({k:u,a:[e,t,l,n]})):r[u]=n.call(r,u,l)}else r[u]!==iv&&(r[u]=n.call(r,u,c))}for(let{length:a}=i,o=0;o<a;o++){const{k:s,a:u}=i[o];r[s]=n.call(r,s,ov.apply(null,u))}return r},sv=(e,t,r)=>{const n=Do(t.push(r)-1);return e.set(r,n),n};function EA(e,t){const r=pA(e,mA).map(vA),n=r[0],i=t||av,a=typeof n===wu&&n?ov(r,new Set,n,i):n;return i.call({"":a},"",a)}va.safeParse=EA;function bA(e,t,r){const n=t&&typeof t===wu?(l,f)=>l===""||-1<t.indexOf(l)?f:void 0:t||av,i=new Map,a=[],o=[];let s=+sv(i,a,n.call({"":e},"",e)),u=!s;for(;s<a.length;)u=!0,o[s]=gA(a[s++],c,r);return"["+o.join(",")+"]";function c(l,f){if(u)return u=!u,f;const d=n.call(this,l,f);switch(typeof d){case wu:if(d===null)return d;case nv:return i.get(d)||sv(i,a,d)}return d}}va.safeStringify=bA,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Utils=t.toAsyncFunction=t.merge=t.generateRandomId=t.getParamNames=t.sleep=t.wrapAsync=t.isIncludeProperty=t.wrapMiddleware=t.pathMatching=t.toPathMatch=t.transformRequestObjectByType=t.deprecatedOutput=t.getCurrentDateString=t.delegateTargetProperties=t.delegateTargetMethod=t.delegateTargetAllPrototypeMethod=t.delegateTargetPrototypeMethod=t.joinURLPath=t.getUserHome=t.parsePrefix=t.safelyGet=t.safeRequire=t.getCurrentEnvironment=t.isDevelopmentEnvironment=void 0;const r=_e,n=_e,i=_e,a=JT,o=ga,s=Gt,u=xi,c=_u,l=va,f=_e,d=Ne,g=(0,i.debuglog)("midway:debug"),h=J=>["local","test","unittest"].includes(J);t.isDevelopmentEnvironment=h;const v=()=>process.env.MIDWAY_SERVER_ENV||process.env.NODE_ENV||"prod";t.getCurrentEnvironment=v;const p=(J,ne=!0)=>{(J.startsWith(`.${r.sep}`)||J.startsWith(`..${r.sep}`))&&(J=(0,r.resolve)((0,r.dirname)(e.parent.filename),J));try{if(ne)return Tr(J);{const q=(0,n.readFileSync)(J,{encoding:"utf-8"});return JSON.parse(q)}}catch(q){g(`[core]: SafeRequire Warning
|
|
27
|
-
|
|
28
|
-
${q.message}
|
|
29
|
-
`);return}};t.safeRequire=p;function y(J,ne){if(arguments.length===1)return W=>y(J,W);if(typeof ne>"u"||typeof ne!="object"||ne===null)return;const q=typeof J=="string"?J.split("."):J;let z=ne;for(const W of q){if(typeof z>"u"||z===null)return;if(typeof z!="object")return;z=z[W]}return z}t.safelyGet=y;function w(J){return J.includes("@")?J.slice(1):J}t.parsePrefix=w;function m(){return process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}t.getUserHome=m;function S(...J){if(J=J.filter(q=>!!q),J.length===0)return"";let ne=r.posix.join(...J);return ne=ne.replace(/\/+$/,""),/^\//.test(ne)||(ne="/"+ne),ne}t.joinURLPath=S;function A(J,ne,q){ne.forEach(z=>{z.prototype&&Object.getOwnPropertyNames(z.prototype).forEach(W=>{W!=="constructor"&&!/^_/.test(W)&&!J.prototype[W]&&(J.prototype[W]=function(..._){return this.instance[W](..._)})})}),q&&N(J,q)}t.delegateTargetPrototypeMethod=A;function I(J,ne){do A(J,[ne]),ne=Object.getPrototypeOf(ne);while(ne)}t.delegateTargetAllPrototypeMethod=I;function N(J,ne){ne.forEach(q=>{J.prototype[q]=function(...z){return this.instance[q](...z)}})}t.delegateTargetMethod=N;function T(J,ne){ne.forEach(q=>{Object.defineProperty(J.prototype,q,{get(){return this.instance[q]}})})}t.delegateTargetProperties=T;const M=(J=Date.now())=>{const ne=new Date(J);return`${ne.getFullYear()}-${(ne.getMonth()+1).toString().padStart(2,"0")}-${ne.getDate().toString().padStart(2,"0")}`};t.getCurrentDateString=M;const P=J=>{console.warn("DeprecationWarning: "+J)};t.deprecatedOutput=P;const L=(J,ne)=>{if(ne==null||ne===Object||typeof J>"u")return J;switch(ne){case Number:return Number(J);case String:return String(J);case Boolean:return J==="0"||J==="false"?!1:Boolean(J);default:return J instanceof ne?J:(a.plainToClass||a.plainToInstance)(ne,J)}};t.transformRequestObjectByType=L;function B(J){if(typeof J=="boolean")return ne=>J;if(typeof J=="string"){const ne=o.PathToRegexpUtil.toRegexp(J.replace("*","(.*)"));return ne.global&&(ne.lastIndex=0),q=>ne.test(q.path)}if(J instanceof RegExp)return ne=>(J.global&&(J.lastIndex=0),J.test(ne.path));if(typeof J=="function")return J;if(Array.isArray(J)){const ne=J.map(q=>B(q));return q=>ne.some(z=>z(q))}throw new s.MidwayCommonError("match/ignore pattern must be RegExp, Array or String, but got "+J)}t.toPathMatch=B;function X(J){if(J=J||{},J.match&&J.ignore)throw new s.MidwayCommonError("options.match and options.ignore can not both present");if(!J.match&&!J.ignore)return()=>!0;J.match&&!Array.isArray(J.match)&&(J.match=[J.match]),J.ignore&&!Array.isArray(J.ignore)&&(J.ignore=[J.ignore]);const ne=z=>{const W=z.map(_=>J.thisResolver?B(_).bind(J.thisResolver):B(_));return _=>{for(let x=0;x<W.length;x++)if(W[x](_))return!0;return!1}},q=J.match?ne(J.match):ne(J.ignore);return function(W){const _=q(W);return J.match?_:!_}}t.pathMatching=X;function V(J,ne){if(ne.enable===!1)return null;if(!ne.match&&!ne.ignore)return J;const q=X(ne),z=(W,_)=>q(W)?J(W,_):_();return z._name=J._name+"middlewareWrapper",z}t.wrapMiddleware=V;function k(J,ne){if(J==null)return!1;const q=typeof J;return q!=="object"&&q!=="function"?!1:!!Object.getOwnPropertyDescriptor(J,ne)}function $(J,ne){for(;J;){if(k(J,ne))return!0;J=Object.getPrototypeOf(J)}return!1}t.isIncludeProperty=$;function G(J){return(...ne)=>{if(typeof ne[ne.length-1]=="function"){const q=ne.pop();if(J.constructor.name!=="AsyncFunction"){const z=new TypeError("Must be an AsyncFunction");return q(z)}return J.apply(J,ne).then(z=>{q(null,z)},z=>{q(z)})}else return J.apply(J,ne)}}t.wrapAsync=G;function oe(J=1e3){return new Promise(ne=>{setTimeout(()=>{ne()},J)})}t.sleep=oe;const se=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function de(J){const ne=J.toString().replace(se,"");let q=ne.slice(ne.indexOf("(")+1,ne.indexOf(")")).split(",").map(z=>z.trim().replace(/\s?=.*$/,""));return q.length===1&&q[0]===""&&(q=[]),q}t.getParamNames=de;function le(){return f.randomBytes(16).toString("hex")}t.generateRandomId=le;function Ee(J,ne){if(J||(J=ne,ne=null),!J)return null;if(Array.isArray(J))return J.concat(ne||[]);if(typeof J=="object")return Object.assign({},J,ne);throw new Error("can not merge meta that type of "+typeof J)}t.merge=Ee;function pe(J){return d.Types.isAsyncFunction(J)?J:async function(...ne){return Promise.resolve(J.call(this,...ne))}}t.toAsyncFunction=pe,t.Utils={sleep:oe,getParamNames:de,camelCase:u.camelCase,pascalCase:u.pascalCase,randomUUID:c.randomUUID,generateRandomId:le,toAsyncFunction:pe,safeStringify:l.safeStringify,safeParse:l.safeParse}}(zt,zt.exports);var pr={};Object.defineProperty(pr,"__esModule",{value:!0}),pr.getModuleRequirePathList=pr.PathFileUtil=pr.getFileContentSync=pr.isPathEqual=pr.isPath=void 0;const _A=_e,SA=_e;function uv(e){return!!/(^[\.\/])|:|\\/.test(e)}pr.isPath=uv;function cv(e,t){if(!e||!t)return!1;const r=(0,_A.extname)(e);return e.replace(r,"")===t}pr.isPathEqual=cv;function lv(e,t){return typeof e=="string"?(0,SA.readFileSync)(e,{encoding:t}):e}pr.getFileContentSync=lv,pr.PathFileUtil={isPath:uv,isPathEqual:cv,getFileContentSync:lv};function CA(e){const t=[e,e.replace(/\//g,"_")];let r={};const n=[];return Object.keys(require.cache||{}).forEach(i=>{let a=-1;for(const s of t){const u=s.indexOf(s);if(u!==-1){a=u;break}}if(a===-1)return;const o=i.slice(0,a);r[o]||(r[o]=!0,n.push(o))}),r=void 0,n}pr.getModuleRequirePathList=CA,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomParamDecorator=e.createCustomMethodDecorator=e.createCustomPropertyDecorator=e.getMethodReturnTypes=e.getPropertyType=e.getMethodParamTypes=e.BaseType=e.isProvide=e.getProviderUUId=e.getProviderName=e.getProviderId=e.saveProviderId=e.getObjectDefinition=e.saveObjectDefinition=e.getPropertyInject=e.savePropertyInject=e.transformTypeFromTSDesign=e.clearAllModule=e.resetModule=e.listModule=e.clearBindContainer=e.bindContainer=e.saveModule=e.listPreloadModule=e.savePreloadModule=e.getPropertyMetadata=e.attachPropertyMetadata=e.savePropertyMetadata=e.listPropertyDataFromClass=e.getPropertyDataFromClass=e.attachPropertyDataToClass=e.savePropertyDataToClass=e.getClassMetadata=e.getClassExtendedMetadata=e.attachClassMetadata=e.saveClassMetadata=e.DecoratorManager=e.INJECT_CLASS_KEY_PREFIX=e.PRELOAD_MODULE_KEY=void 0;const t=Ke,r=fe,n=Ne,i=xi,a=zt.exports,o=pr,s=_e.debuglog("midway:core");e.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY",e.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class u extends Map{constructor(){super(...arguments),this.injectClassKeyPrefix=e.INJECT_CLASS_KEY_PREFIX,this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA",this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(x,E){if(this.container)return this.container.saveModule(x,E);this.has(x)||this.set(x,new Set),this.get(x).add(E)}listModule(x){return this.container?this.container.listModule(x):Array.from(this.get(x)||{})}resetModule(x){this.set(x,new Set)}bindContainer(x){this.container=x,this.container.transformModule(this)}static getDecoratorClassKey(x){return x.toString()+"_CLS"}static removeDecoratorClassKeySuffix(x){return x.toString().replace("_CLS","")}static getDecoratorMethodKey(x){return x.toString()+"_METHOD"}static getDecoratorClsExtendedKey(x){return x.toString()+"_EXT"}static getDecoratorClsMethodPrefix(x){return x.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(x,E){return u.getDecoratorClsMethodPrefix(x)+":"+E.toString()}static getDecoratorMethod(x,E){return u.getDecoratorMethodKey(x)+"_"+E.toString()}static saveMetadata(x,E,R,K){typeof E=="object"&&E.constructor&&(E=E.constructor);let Q;Reflect.hasOwnMetadata(x,E)?Q=Reflect.getMetadata(x,E):Q=new Map,Q.set(R,K),Reflect.defineMetadata(x,Q,E)}static attachMetadata(x,E,R,K,Q,he="one"){typeof E=="object"&&E.constructor&&(E=E.constructor);let Ce;Reflect.hasOwnMetadata(x,E)?Ce=Reflect.getMetadata(x,E):Ce=new Map,Ce.has(R)||(Q?Ce.set(R,{}):Ce.set(R,[])),Q?he==="one"?Ce.get(R)[Q]=K:Ce.get(R)[Q]?Ce.get(R)[Q].push(K):Ce.get(R)[Q]=[K]:Ce.get(R).push(K),Reflect.defineMetadata(x,Ce,E)}static getMetadata(x,E,R){typeof E=="object"&&E.constructor&&(E=E.constructor);let K;return Reflect.hasOwnMetadata(x,E)?K=Reflect.getMetadata(x,E):(K=new Map,Reflect.defineMetadata(x,K,E)),R?K.get(R):K}saveMetadata(x,E,R,K){if(K){const Q=u.getDecoratorMethod(x,K);u.saveMetadata(this.injectMethodKeyPrefix,R,Q,E)}else{const Q=u.getDecoratorClassKey(x);u.saveMetadata(this.injectClassKeyPrefix,R,Q,E)}}attachMetadata(x,E,R,K,Q,he){if(K){const Ce=u.getDecoratorMethod(x,K);u.attachMetadata(this.injectMethodKeyPrefix,R,Ce,E,Q,he)}else{const Ce=u.getDecoratorClassKey(x);u.attachMetadata(this.injectClassKeyPrefix,R,Ce,E,Q,he)}}getMetadata(x,E,R){if(R){const K=u.getDecoratorMethod(x,R);return u.getMetadata(this.injectMethodKeyPrefix,E,K)}else{const K=`${u.getDecoratorClassKey(x)}`;return u.getMetadata(this.injectClassKeyPrefix,E,K)}}savePropertyDataToClass(x,E,R,K){const Q=u.getDecoratorClsMethodKey(x,K);u.saveMetadata(this.injectClassMethodKeyPrefix,R,Q,E)}attachPropertyDataToClass(x,E,R,K,Q){const he=u.getDecoratorClsMethodKey(x,K);u.attachMetadata(this.injectClassMethodKeyPrefix,R,he,E,Q)}getPropertyDataFromClass(x,E,R){const K=u.getDecoratorClsMethodKey(x,R);return u.getMetadata(this.injectClassMethodKeyPrefix,E,K)}listPropertyDataFromClass(x,E){const R=u.getMetadata(this.injectClassMethodKeyPrefix,E),K=[];for(const[Q,he]of R)Q.indexOf(u.getDecoratorClsMethodPrefix(x))!==-1&&K.push(he);return K}}e.DecoratorManager=u;let c=new u;if(typeof me=="object")if(me.MIDWAY_GLOBAL_DECORATOR_MANAGER){console.warn('DecoratorManager not singleton and please check @midwayjs/core version by "npm ls @midwayjs/core"');const _=(0,o.getModuleRequirePathList)("@midwayjs/core");_.length&&(console.info("The module may be located in:"),_.forEach((x,E)=>{console.info(`${E+1}. ${x}`)})),c=me.MIDWAY_GLOBAL_DECORATOR_MANAGER}else me.MIDWAY_GLOBAL_DECORATOR_MANAGER=c;function l(_,x,E,R){if(R&&typeof x=="object"){const K=c.getMetadata(_,E);return K?Array.isArray(K)?c.saveMetadata(_,K.concat(x),E):c.saveMetadata(_,Object.assign(K,x),E):c.saveMetadata(_,x,E)}else return c.saveMetadata(_,x,E)}e.saveClassMetadata=l;function f(_,x,E,R,K){return c.attachMetadata(_,x,E,void 0,R,K)}e.attachClassMetadata=f;function d(_,x,E,R){R===void 0&&(R=!0);const K=u.getDecoratorClsExtendedKey(_);let Q=c.getMetadata(K,x,E);if(R&&Q!==void 0)return Q;const he=Reflect.getPrototypeOf(x);return he&&he.constructor!==Object&&(Q=(0,a.merge)(d(_,he,E,R),c.getMetadata(_,x,E))),c.saveMetadata(K,Q||null,x,E),Q}e.getClassExtendedMetadata=d;function g(_,x){return c.getMetadata(_,x)}e.getClassMetadata=g;function h(_,x,E,R){return c.savePropertyDataToClass(_,x,E,R)}e.savePropertyDataToClass=h;function v(_,x,E,R,K){return c.attachPropertyDataToClass(_,x,E,R,K)}e.attachPropertyDataToClass=v;function p(_,x,E){return c.getPropertyDataFromClass(_,x,E)}e.getPropertyDataFromClass=p;function y(_,x){return c.listPropertyDataFromClass(_,x)}e.listPropertyDataFromClass=y;function w(_,x,E,R){return c.saveMetadata(_,x,E,R)}e.savePropertyMetadata=w;function m(_,x,E,R){return c.attachMetadata(_,x,E,R)}e.attachPropertyMetadata=m;function S(_,x,E){return c.getMetadata(_,x,E)}e.getPropertyMetadata=S;function A(_){return N(e.PRELOAD_MODULE_KEY,_)}e.savePreloadModule=A;function I(){return P(e.PRELOAD_MODULE_KEY)}e.listPreloadModule=I;function N(_,x){return(0,n.isClass)(x)&&oe(void 0,x),c.saveModule(_,x)}e.saveModule=N;function T(_){return c.bindContainer(_)}e.bindContainer=T;function M(){return c.container=null}e.clearBindContainer=M;function P(_,x){const E=c.listModule(_);return x?E.filter(x):E}e.listModule=P;function L(_){return c.resetModule(_)}e.resetModule=L;function B(){return s("--- clear all module here ---"),c.clear()}e.clearAllModule=B;function X(_){if((0,n.isNullOrUndefined)(_))return{name:"undefined",isBaseType:!0,originDesign:_};switch(_.name){case"String":return{name:"string",isBaseType:!0,originDesign:_};case"Number":return{name:"number",isBaseType:!0,originDesign:_};case"Boolean":return{name:"boolean",isBaseType:!0,originDesign:_};case"Symbol":return{name:"symbol",isBaseType:!0,originDesign:_};case"Object":return{name:"object",isBaseType:!0,originDesign:_};case"Function":return{name:"function",isBaseType:!0,originDesign:_};default:return{name:_.name,isBaseType:!1,originDesign:_}}}e.transformTypeFromTSDesign=X;function V(_){let x=_.identifier,E=t.InjectModeEnum.Identifier;if(!x){const R=J(_.target,_.targetKey);!R.isBaseType&&(0,n.isClass)(R.originDesign)&&Ee(R.originDesign)&&(x=le(R.originDesign),E=t.InjectModeEnum.Class),x||(x=_.targetKey,E=t.InjectModeEnum.PropertyName)}f(r.INJECT_TAG,{targetKey:_.targetKey,value:x,args:_.args,injectMode:E},_.target,_.targetKey)}e.savePropertyInject=V;function k(_,x){return d(r.INJECT_TAG,_,void 0,x)}e.getPropertyInject=k;function $(_,x={}){return l(r.OBJ_DEF_CLS,x,_,!0),_}e.saveObjectDefinition=$;function G(_){return d(r.OBJ_DEF_CLS,_)}e.getObjectDefinition=G;function oe(_,x){if(Ee(x)){if(_){const E=g(r.TAGGED_CLS,x);E.id!==_&&(E.id=_,l(r.TAGGED_CLS,E,x),s(`update provide: ${x.name} -> ${E.uuid}`))}}else{const E=(0,a.generateRandomId)();l(r.TAGGED_CLS,{id:_,originName:x.name,uuid:E,name:(0,i.camelCase)(x.name)},x),s(`save provide: ${x.name} -> ${E}`)}return x}e.saveProviderId=oe;function se(_){const x=g(r.TAGGED_CLS,_);if(x&&x.id)return x.id}e.getProviderId=se;function de(_){const x=g(r.TAGGED_CLS,_);if(x&&x.name)return x.name}e.getProviderName=de;function le(_){const x=g(r.TAGGED_CLS,_);if(x&&x.uuid)return x.uuid}e.getProviderUUId=le;function Ee(_){return!!g(r.TAGGED_CLS,_)}e.isProvide=Ee,function(_){_.Boolean="boolean",_.Number="number",_.String="string"}(e.BaseType||(e.BaseType={}));function pe(_,x){return(0,n.isClass)(_)&&(_=_.prototype),Reflect.getMetadata("design:paramtypes",_,x)}e.getMethodParamTypes=pe;function J(_,x){return X(Reflect.getMetadata("design:type",_,x))}e.getPropertyType=J;function ne(_,x){return(0,n.isClass)(_)&&(_=_.prototype),Reflect.getMetadata("design:returntype",_,x)}e.getMethodReturnTypes=ne;function q(_,x,E=!0){return function(R,K){f(r.INJECT_CUSTOM_PROPERTY,{propertyName:K,key:_,metadata:x,impl:E},R,K)}}e.createCustomPropertyDecorator=q;function z(_,x,E={impl:!0}){return typeof E=="boolean"&&(E={impl:E}),E.impl===void 0&&(E.impl=!0),function(R,K,Q){f(r.INJECT_CUSTOM_METHOD,{propertyName:K,key:_,metadata:x,options:E},R)}}e.createCustomMethodDecorator=z;function W(_,x,E={impl:!0}){return typeof E=="boolean"&&(E={impl:E}),E.impl===void 0&&(E.impl=!0),function(R,K,Q){f(r.INJECT_CUSTOM_PARAM,{key:_,parameterIndex:Q,propertyName:K,metadata:x,options:E},R,K,"multi")}}e.createCustomParamDecorator=W}(Qr),Object.defineProperty(Un,"__esModule",{value:!0}),Un.Provide=void 0;const wA=Qr;function TA(e){return function(t){return(0,wA.saveProviderId)(e,t)}}Un.Provide=TA;var ma={};Object.defineProperty(ma,"__esModule",{value:!0}),ma.InjectClient=ma.Inject=void 0;const fv=Qr,AA=fe;function xA(e){return function(t,r){(0,fv.savePropertyInject)({target:t,targetKey:r,identifier:e})}}ma.Inject=xA;function RA(e,t){return(0,fv.createCustomPropertyDecorator)(AA.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:e,clientName:t})}ma.InjectClient=RA;var Tu={};Object.defineProperty(Tu,"__esModule",{value:!0}),Tu.Pipeline=void 0;const IA=Qr,OA=fe;function MA(e){return(0,IA.createCustomPropertyDecorator)(OA.PIPELINE_IDENTIFIER,{valves:e})}Tu.Pipeline=MA;var Fo={},gr={};Object.defineProperty(gr,"__esModule",{value:!0}),gr.Singleton=gr.Scope=gr.Destroy=gr.Init=void 0;const Mf=Qr,LA=Un,PA=Ke;function NA(){return function(e,t){(0,Mf.saveObjectDefinition)(e,{initMethod:t})}}gr.Init=NA;function BA(){return function(e,t){(0,Mf.saveObjectDefinition)(e,{destroyMethod:t})}}gr.Destroy=BA;function dv(e,t){return function(r){(0,Mf.saveObjectDefinition)(r,{scope:e,...t})}}gr.Scope=dv;function DA(){return function(e){dv(PA.ScopeEnum.Singleton)(e),(0,LA.Provide)()(e)}}gr.Singleton=DA;var hv;function FA(){if(hv)return Fo;hv=1,Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.Aspect=void 0;const e=Pe(),t=gr,r=Ke;function n(i,a,o){return function(s){(0,e.saveModule)(e.ASPECT_KEY,s);const u=[].concat(i);for(const c of u)(0,e.attachClassMetadata)(e.ASPECT_KEY,{aspectTarget:c,match:a,priority:o},s);(0,t.Scope)(r.ScopeEnum.Singleton)(s),(0,e.Provide)()(s)}}return Fo.Aspect=n,Fo}var Au={};Object.defineProperty(Au,"__esModule",{value:!0}),Au.Autoload=void 0;const kA=Qr,UA=Un;function $A(){return function(e){(0,kA.savePreloadModule)(e),(0,UA.Provide)()(e)}}Au.Autoload=$A;var ko={},pv;function jA(){if(pv)return ko;pv=1,Object.defineProperty(ko,"__esModule",{value:!0}),ko.Configuration=void 0;const e=Pe();function t(r={}){return n=>{(0,e.saveClassMetadata)(e.CONFIGURATION_KEY,r,n)}}return ko.Configuration=t,ko}var Qt={},gv;function KA(){if(gv)return Qt;gv=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.ApplicationContext=Qt.Logger=Qt.App=Qt.Config=Qt.Plugin=Qt.Framework=void 0;const e=Pe(),t=Ke;function r(){return u=>{(0,e.saveModule)(e.FRAMEWORK_KEY,u),(0,e.Scope)(t.ScopeEnum.Singleton)(u),(0,e.Provide)()(u)}}Qt.Framework=r;function n(u){return(0,e.createCustomPropertyDecorator)(e.PLUGIN_KEY,{identifier:u})}Qt.Plugin=n;function i(u){return(0,e.createCustomPropertyDecorator)(e.CONFIG_KEY,{identifier:u})}Qt.Config=i;function a(u){return(0,e.createCustomPropertyDecorator)(e.APPLICATION_KEY,{type:u})}Qt.App=a;function o(u){return(0,e.createCustomPropertyDecorator)(e.LOGGER_KEY,{identifier:u})}Qt.Logger=o;function s(){return(0,e.createCustomPropertyDecorator)(e.APPLICATION_CONTEXT_KEY,{})}return Qt.ApplicationContext=s,Qt}var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0}),Ea.Match=Ea.Catch=void 0;const yv=Qr,vv=fe,mv=gr,Ev=Un,bv=Ke;function qA(e,t={}){return function(r){const n=e?[].concat(e):void 0;(0,yv.saveClassMetadata)(vv.CATCH_KEY,{catchTargets:n,catchOptions:t},r),(0,mv.Scope)(bv.ScopeEnum.Singleton)(r),(0,Ev.Provide)()(r)}}Ea.Catch=qA;function VA(e=!0){return function(t){(0,yv.saveClassMetadata)(vv.MATCH_KEY,{matchPattern:e},t),(0,mv.Scope)(bv.ScopeEnum.Singleton)(t),(0,Ev.Provide)()(t)}}Ea.Match=VA;var Uo={},_v;function GA(){if(_v)return Uo;_v=1,Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.Middleware=void 0;const e=Pe(),t=Ke;function r(){return n=>{(0,e.Scope)(t.ScopeEnum.Singleton)(n),(0,e.Provide)()(n)}}return Uo.Middleware=r,Uo}var ba={};Object.defineProperty(ba,"__esModule",{value:!0}),ba.Guard=ba.UseGuard=void 0;const Sv=Qr,HA=Ke,Cv=fe,YA=Un,WA=gr;function zA(e){return(t,r,n)=>{Array.isArray(e)||(e=[e]),r?(0,Sv.savePropertyMetadata)(Cv.GUARD_KEY,e,t,r):(0,Sv.saveClassMetadata)(Cv.GUARD_KEY,e,t)}}ba.UseGuard=zA;function QA(){return e=>{(0,YA.Provide)()(e),(0,WA.Scope)(HA.ScopeEnum.Singleton)(e)}}ba.Guard=QA;var $o={},wv;function XA(){if(wv)return $o;wv=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.Pipe=void 0;const e=Pe(),t=Ke;function r(){return n=>{(0,e.Scope)(t.ScopeEnum.Singleton)(n),(0,e.Provide)()(n)}}return $o.Pipe=r,$o}var jo={},Tv;function JA(){if(Tv)return jo;Tv=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.Mock=void 0;const e=Pe(),t=Ke;function r(){return n=>{(0,e.saveModule)(e.MOCK_KEY,n),(0,e.Scope)(t.ScopeEnum.Singleton)(n),(0,e.Provide)()(n)}}return jo.Mock=r,jo}var Ri={},Av;function ZA(){if(Av)return Ri;Av=1,Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.ServerlessTrigger=Ri.ServerlessFunction=void 0;const e=Pe(),t=Ke;function r(i){return(a,o,s)=>{(0,e.savePropertyMetadata)(e.SERVERLESS_FUNC_KEY,i,a,o)}}Ri.ServerlessFunction=r;function n(i,a={}){return(o,s,u)=>{var c;(i===t.ServerlessTriggerType.HTTP||i===t.ServerlessTriggerType.API_GATEWAY)&&(a.method=(c=a.method)!==null&&c!==void 0?c:"get"),(0,e.saveModule)(e.FUNC_KEY,o.constructor),a=a||{},(0,e.attachClassMetadata)(e.FUNC_KEY,{type:i,methodName:s,metadata:a},o.constructor)}}return Ri.ServerlessTrigger=n,Ri}var Ko={},xv;function ex(){if(xv)return Ko;xv=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.Controller=void 0;const e=Pe(),t=Ke;function r(n="/",i={middleware:[],sensitive:!0}){return a=>{(0,e.saveModule)(e.CONTROLLER_KEY,a),n&&(0,e.saveClassMetadata)(e.CONTROLLER_KEY,{prefix:n,routerOptions:i},a),(0,e.Scope)(t.ScopeEnum.Request)(a),(0,e.Provide)()(a)}}return Ko.Controller=r,Ko}var Lf={},Rv;function tx(){return Rv||(Rv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Fields=e.Queries=e.RequestIP=e.RequestPath=e.Files=e.File=e.Headers=e.Param=e.Query=e.Body=e.Session=e.createRequestParamDecorator=e.RouteParamTypes=void 0;const t=Pe();var r;(function(p){p.QUERY="query",p.BODY="body",p.PARAM="param",p.HEADERS="headers",p.SESSION="session",p.FILESTREAM="file_stream",p.FILESSTREAM="files_stream",p.NEXT="next",p.REQUEST_PATH="request_path",p.REQUEST_IP="request_ip",p.QUERIES="queries",p.FIELDS="fields",p.CUSTOM="custom"})(r=e.RouteParamTypes||(e.RouteParamTypes={}));const n=function(p){return(y,w)=>{let m=y;return Array.isArray(y)&&w===void 0&&(w=y,m=void 0),(0,t.createCustomParamDecorator)(t.WEB_ROUTER_PARAM_KEY,{type:p,propertyData:m},{pipes:w})}},i=function(p,y){return y=y||{},Array.isArray(y)&&(y={pipes:y}),n(r.CUSTOM)(p,y.pipes)};e.createRequestParamDecorator=i;const a=(p,y)=>n(r.SESSION)(p,y);e.Session=a;const o=(p,y)=>n(r.BODY)(p,y);e.Body=o;const s=(p,y)=>n(r.QUERY)(p,y);e.Query=s;const u=(p,y)=>n(r.PARAM)(p,y);e.Param=u;const c=(p,y)=>n(r.HEADERS)(p,y);e.Headers=c;const l=(p,y)=>n(r.FILESTREAM)(p,y);e.File=l;const f=(p,y)=>n(r.FILESSTREAM)(p,y);e.Files=f;const d=p=>n(r.REQUEST_PATH)(void 0,p);e.RequestPath=d;const g=p=>n(r.REQUEST_IP)(void 0,p);e.RequestIP=g;const h=(p,y)=>n(r.QUERIES)(p,y);e.Queries=h;const v=(p,y)=>n(r.FIELDS)(p,y);e.Fields=v}(Lf)),Lf}var Pf={},Iv;function rx(){return Iv||(Iv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.All=e.Head=e.Options=e.Patch=e.Put=e.Del=e.Get=e.Post=e.RequestMapping=e.RequestMethod=void 0;const t=Pe();e.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const r={path:"/",requestMethod:e.RequestMethod.GET,routerName:null,middleware:[]},n=(a=r)=>{const o=a.path||"/",s=a.requestMethod||e.RequestMethod.GET,u=a.routerName,c=a.middleware;return(l,f,d)=>{var g;return(0,t.attachClassMetadata)(t.WEB_ROUTER_KEY,{path:o,requestMethod:s,routerName:u,method:f,middleware:c,summary:(a==null?void 0:a.summary)||"",description:(a==null?void 0:a.description)||"",ignoreGlobalPrefix:(g=a==null?void 0:a.ignoreGlobalPrefix)!==null&&g!==void 0?g:!1},l),d}};e.RequestMapping=n;const i=a=>(o,s={middleware:[]})=>(0,e.RequestMapping)(Object.assign(s,{requestMethod:a,path:o}));e.Post=i(e.RequestMethod.POST),e.Get=i(e.RequestMethod.GET),e.Del=i(e.RequestMethod.DELETE),e.Put=i(e.RequestMethod.PUT),e.Patch=i(e.RequestMethod.PATCH),e.Options=i(e.RequestMethod.OPTIONS),e.Head=i(e.RequestMethod.HEAD),e.All=i(e.RequestMethod.ALL)}(Pf)),Pf}var yr={},Ov;function nx(){if(Ov)return yr;Ov=1,Object.defineProperty(yr,"__esModule",{value:!0}),yr.createRender=yr.ContentType=yr.SetHeader=yr.HttpCode=yr.Redirect=void 0;const e=Pe();function t(o,s=302){return(u,c,l)=>((0,e.attachPropertyMetadata)(e.WEB_RESPONSE_KEY,{type:e.WEB_RESPONSE_REDIRECT,url:o,code:s},u,c),l)}yr.Redirect=t;function r(o){return(s,u,c)=>((0,e.attachPropertyMetadata)(e.WEB_RESPONSE_KEY,{type:e.WEB_RESPONSE_HTTP_CODE,code:o},s,u),c)}yr.HttpCode=r;function n(o,s){return(u,c,l)=>{let f={};return s?f[o]=s:f=o,(0,e.attachPropertyMetadata)(e.WEB_RESPONSE_KEY,{type:e.WEB_RESPONSE_HEADER,setHeaders:f},u,c),l}}yr.SetHeader=n;function i(o){return(s,u,c)=>((0,e.attachPropertyMetadata)(e.WEB_RESPONSE_KEY,{type:e.WEB_RESPONSE_CONTENT_TYPE,contentType:o},s,u),c)}yr.ContentType=i;function a(o){return s=>(u,c,l)=>((0,e.attachPropertyMetadata)(e.WEB_RESPONSE_KEY,{type:e.WEB_RESPONSE_RENDER,templateName:s},u,c),l)}return yr.createRender=a,yr}var qo={},Mv;function ix(){if(Mv)return qo;Mv=1,Object.defineProperty(qo,"__esModule",{value:!0}),qo.Consumer=void 0;const e=Pe(),t=Ke;function r(n,i={}){return a=>{(0,e.saveModule)(e.MS_CONSUMER_KEY,a),(0,e.saveClassMetadata)(e.MS_CONSUMER_KEY,{type:n,metadata:i},a),(0,e.Scope)(t.ScopeEnum.Request)(a),(0,e.Provide)()(a)}}return qo.Consumer=r,qo}var Nf={},Lv;function ax(){return Lv||(Lv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DubboMethod=e.GrpcMethod=e.GrpcStreamTypeEnum=e.Provider=void 0;const t=Pe(),r=Ke;function n(s,u={}){return c=>{(0,t.saveModule)(t.MS_PROVIDER_KEY,c),(0,t.saveClassMetadata)(t.MS_PROVIDER_KEY,{type:s,metadata:u},c),(0,t.Scope)(r.ScopeEnum.Request)(c),(0,t.Provide)()(c)}}e.Provider=n;var i;(function(s){s.BASE="base",s.DUPLEX="ServerDuplexStream",s.READABLE="ServerReadableStream",s.WRITEABLE="ServerWritableStream"})(i=e.GrpcStreamTypeEnum||(e.GrpcStreamTypeEnum={}));function a(s={}){return(u,c,l)=>(s.type||(s.type=i.BASE),(0,t.savePropertyMetadata)(t.MS_GRPC_METHOD_KEY,{methodName:s.methodName||c,type:s.type,onEnd:s.onEnd},u,c),l)}e.GrpcMethod=a;function o(s){return(u,c,l)=>((0,t.attachClassMetadata)(t.MS_DUBBO_METHOD_KEY,{methodName:s||c},u),l)}e.DubboMethod=o}(Nf)),Nf}var Vo={},Pv;function ox(){if(Pv)return Vo;Pv=1,Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.RabbitMQListener=void 0;const e=Pe();function t(r,n={}){return(i,a)=>{n.queueName=r,n.propertyKey=a,(0,e.attachPropertyDataToClass)(e.MS_CONSUMER_KEY,n,i,a)}}return Vo.RabbitMQListener=t,Vo}var Go={},Nv;function sx(){if(Nv)return Go;Nv=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.KafkaListener=void 0;const e=Pe();function t(r,n={}){return(i,a)=>{n.topic=r,n.propertyKey=a,(0,e.attachPropertyDataToClass)(e.MS_CONSUMER_KEY,n,i,a)}}return Go.KafkaListener=t,Go}var Ho={},Bv;function ux(){if(Bv)return Ho;Bv=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.HSF=void 0;const e=Pe(),t=Ke;function r(n={}){return i=>{(0,e.saveModule)(e.HSF_KEY,i),(0,e.saveClassMetadata)(e.HSF_KEY,n,i),(0,e.Scope)(t.ScopeEnum.Request)(i),(0,e.Provide)()(i)}}return Ho.HSF=r,Ho}var Yo={},Dv;function cx(){if(Dv)return Yo;Dv=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.Queue=void 0;const e=Pe(),t=fe;function r(n){return function(i){(0,e.saveModule)(t.MODULE_TASK_QUEUE_KEY,i),(0,e.saveClassMetadata)(t.MODULE_TASK_QUEUE_OPTIONS,{options:n,name:i.name},i),(0,e.Provide)()(i)}}return Yo.Queue=r,Yo}var Wo={},Fv;function lx(){if(Fv)return Wo;Fv=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.Task=void 0;const e=Pe(),t=fe;function r(n){return function(i,a,o){(0,e.saveModule)(t.MODULE_TASK_KEY,i.constructor),(0,e.attachClassMetadata)(t.MODULE_TASK_METADATA,{options:n,propertyKey:a,value:o.value,name:i.constructor.name},i)}}return Wo.Task=r,Wo}var zo={},kv;function fx(){if(kv)return zo;kv=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.TaskLocal=void 0;const e=Pe(),t=fe;function r(n){return function(i,a,o){(0,e.saveModule)(t.MODULE_TASK_TASK_LOCAL_KEY,i.constructor),(0,e.attachClassMetadata)(t.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:n,propertyKey:a,value:o.value},i)}}return zo.TaskLocal=r,zo}var Qo={},Uv;function dx(){if(Uv)return Qo;Uv=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.Schedule=void 0;const e=Pe(),t=Ke;function r(n){return function(i){(0,e.saveModule)(e.SCHEDULE_KEY,i),(0,e.saveClassMetadata)(e.SCHEDULE_KEY,n,i),(0,e.Scope)(t.ScopeEnum.Request)(i),(0,e.Provide)()(i)}}return Qo.Schedule=r,Qo}var Xo={},$v;function hx(){if($v)return Xo;$v=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.WSController=void 0;const e=Pe(),t=Ke;function r(n="/",i={middleware:[],connectionMiddleware:[]}){return a=>{(0,e.saveModule)(e.WS_CONTROLLER_KEY,a),(0,e.saveClassMetadata)(e.WS_CONTROLLER_KEY,{namespace:n,routerOptions:i},a),(0,e.Scope)(t.ScopeEnum.Request)(a),(0,e.Provide)()(a)}}return Xo.WSController=r,Xo}var Bf={},jv;function px(){return jv||(jv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OnConnection=e.OnDisConnection=e.Emit=e.OnMessage=e.WSBroadCast=e.WSEmit=e.OnWSMessage=e.OnWSDisConnection=e.OnWSConnection=e.WSEventTypeEnum=void 0;const t=Pe();var r;(function(u){u.ON_CONNECTION="ws:onConnection",u.ON_DISCONNECTION="ws:onDisconnection",u.ON_MESSAGE="ws:onMessage",u.ON_SOCKET_ERROR="ws:onSocketError",u.EMIT="ws:Emit",u.BROADCAST="ws:broadcast"})(r=e.WSEventTypeEnum||(e.WSEventTypeEnum={}));function n(u={}){return(c,l,f)=>{(0,t.attachClassMetadata)(t.WS_EVENT_KEY,{eventType:r.ON_CONNECTION,propertyName:l,eventOptions:u,descriptor:f},c.constructor)}}e.OnWSConnection=n;function i(){return(u,c,l)=>{(0,t.attachClassMetadata)(t.WS_EVENT_KEY,{eventType:r.ON_DISCONNECTION,propertyName:c,descriptor:l},u.constructor)}}e.OnWSDisConnection=i;function a(u,c={}){return(l,f,d)=>{(0,t.attachClassMetadata)(t.WS_EVENT_KEY,{eventType:r.ON_MESSAGE,messageEventName:u,propertyName:f,eventOptions:c,descriptor:d},l.constructor)}}e.OnWSMessage=a;function o(u,c=[]){return(l,f,d)=>{(0,t.attachClassMetadata)(t.WS_EVENT_KEY,{eventType:r.EMIT,propertyName:f,messageEventName:u,roomName:[].concat(c),descriptor:d},l.constructor)}}e.WSEmit=o;function s(u="",c=[]){return(l,f,d)=>{(0,t.attachClassMetadata)(t.WS_EVENT_KEY,{eventType:r.BROADCAST,propertyName:f,messageEventName:u,roomName:[].concat(c),descriptor:d},l.constructor)}}e.WSBroadCast=s,e.OnMessage=a,e.Emit=o,e.OnDisConnection=i,e.OnConnection=n}(Bf)),Bf}var Kv;function Pe(){return Kv||(Kv=1,function(e){var t=me&&me.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),r=me&&me.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),r(Un,e),r(ma,e),r(Tu,e),r(FA(),e),r(Au,e),r(jA(),e),r(gr,e),r(KA(),e),r(Ea,e),r(GA(),e),r(ba,e),r(XA(),e),r(JA(),e),r(ZA(),e),r(ex(),e),r(tx(),e),r(rx(),e),r(nx(),e),r(fe,e),r(Qr,e),r(ix(),e),r(ax(),e),r(ox(),e),r(sx(),e),r(ux(),e),r(cx(),e),r(lx(),e),r(fx(),e),r(dx(),e),r(hx(),e),r(px(),e)}(_f)),_f}var Df={},_a={},$n={};Object.defineProperty($n,"__esModule",{value:!0}),$n.createConfiguration=$n.FunctionalConfiguration=void 0;class qv{constructor(t){this.options=t,this.readyHandler=()=>{},this.stopHandler=()=>{},this.configLoadHandler=()=>{},this.serverReadyHandler=()=>{}}onConfigLoad(t,r){if(typeof t=="function")this.configLoadHandler=t;else return this.configLoadHandler(t,r);return this}onReady(t,r){if(typeof t=="function")this.readyHandler=t;else return this.readyHandler(t,r);return this}onServerReady(t,r){if(typeof t=="function")this.serverReadyHandler=t;else return this.serverReadyHandler(t,r);return this}onStop(t,r){if(typeof t=="function")this.stopHandler=t;else return this.stopHandler(t,r);return this}getConfigurationOptions(){return this.options}}$n.FunctionalConfiguration=qv;const gx=e=>new qv(e);$n.createConfiguration=gx;var xu={};Object.defineProperty(xu,"__esModule",{value:!0}),xu.ObjectDefinitionRegistry=void 0;const Ru=Pe(),Iu="_id_default_";class Vv extends Map{saveClassRelation(t,r){const n=(0,Ru.getProviderUUId)(t);if(this.set(n,n),n){const i=(0,Ru.getProviderId)(t);i&&this.set(i,n),this.set((0,Ru.getProviderName)(t),n),r&&this.set(r+":"+(0,Ru.getProviderName)(t),n)}}saveFunctionRelation(t,r){this.set(r,r),this.set(t,r)}hasRelation(t){return this.has(t)}getRelation(t){return this.get(t)}}class yx extends Map{constructor(){super(...arguments),this.singletonIds=[],this._identifierRelation=new Vv}get identifierRelation(){return this._identifierRelation||(this._identifierRelation=new Vv),this._identifierRelation}set identifierRelation(t){this._identifierRelation=t}get identifiers(){const t=[];for(const r of this.keys())r.indexOf(Iu)===-1&&t.push(r);return t}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(t){const r=[];for(const n of this.values()){const i=n;i.name===t&&r.push(i)}return r}registerDefinition(t,r){r.isSingletonScope()&&this.singletonIds.push(t),this.set(t,r)}getDefinition(t){var r;return t=(r=this.identifierRelation.getRelation(t))!==null&&r!==void 0?r:t,this.get(t)}removeDefinition(t){this.delete(t)}hasDefinition(t){var r;return t=(r=this.identifierRelation.getRelation(t))!==null&&r!==void 0?r:t,this.has(t)}clearAll(){this.singletonIds=[],this.clear()}hasObject(t){var r;return t=(r=this.identifierRelation.getRelation(t))!==null&&r!==void 0?r:t,this.has(Iu+t)}registerObject(t,r){this.set(Iu+t,r)}getObject(t){var r;return t=(r=this.identifierRelation.getRelation(t))!==null&&r!==void 0?r:t,this.get(Iu+t)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(t){this.identifierRelation=t}}xu.ObjectDefinitionRegistry=yx;var ze={};Object.defineProperty(ze,"__esModule",{value:!0}),ze.IGNORE_PATTERN=ze.DEFAULT_PATTERN=ze.ASYNC_CONTEXT_MANAGER_KEY=ze.ASYNC_CONTEXT_KEY=ze.REQUEST_CTX_LOGGER_CACHE_KEY=ze.HTTP_SERVER_KEY=ze.REQUEST_OBJ_CTX_KEY=ze.REQUEST_CTX_KEY=ze.MIDWAY_LOGGER_WRITEABLE_DIR=ze.FUNCTION_INJECT_KEY=ze.KEYS=void 0,ze.KEYS={OBJECTS_ELEMENT:"objects",OBJECT_ELEMENT:"object",IMPORT_ELEMENT:"import",PROPERTY_ELEMENT:"property",LIST_ELEMENT:"list",MAP_ELEMENT:"map",ENTRY_ELEMENT:"entry",VALUE_ELEMENT:"value",PROPS_ELEMENT:"props",PROP_ELEMENT:"prop",SET_ELEMENT:"set",CONSTRUCTOR_ARG_ELEMENT:"constructor-arg",REF_ELEMENT:"ref",JSON_ELEMENT:"json",CONFIGURATION_ELEMENT:"configuration",ID_ATTRIBUTE:"id",PATH_ATTRIBUTE:"path",DIRECT_ATTRIBUTE:"direct",AUTOWIRE_ATTRIBUTE:"autowire",ASYNC_ATTRIBUTE:"async",NAME_ATTRIBUTE:"name",REF_ATTRIBUTE:"ref",KEY_ATTRIBUTE:"key",VALUE_ATTRIBUTE:"value",TYPE_ATTRIBUTE:"type",EXTERNAL_ATTRIBUTE:"external",OBJECT_ATTRIBUTE:"object",RESOURCE_ATTRIBUTE:"resource",SCOPE_ATTRIBUTE:"scope",ASPECT_ELEMENT:"aspect",AROUND_ELEMENT:"around",EXPRESSION_ATTRIBUTE:"expression",EXECUTE_ATTRIBUTE:"execute"},ze.FUNCTION_INJECT_KEY="midway:function_inject_key",ze.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR",ze.REQUEST_CTX_KEY="ctx",ze.REQUEST_OBJ_CTX_KEY="_req_ctx",ze.HTTP_SERVER_KEY="_midway_http_server",ze.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache",ze.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY"),ze.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY",ze.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"],ze.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];var Ou={},Mu={};Object.defineProperty(Mu,"__esModule",{value:!0}),Mu.ObjectProperties=void 0;class vx extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(t,r){return this.has(t)?this.get(t):r}setProperty(t,r){return this.set(t,r)}}Mu.ObjectProperties=vx;var Jo={};Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.ObjectCreator=void 0;const Gv=Gt,Sa=Ne;class mx{constructor(t){this.definition=t}load(){let t=null;if(typeof this.definition.path=="string"){if(!this.definition.path)return t;const r=this.definition.path;this.definition.export?t=Tr(r)[this.definition.export]:t=Tr(r)}else t=this.definition.path;return t}doConstruct(t,r){if(!t)return Object.create(null);let n;return this.definition.constructMethod?n=t[this.definition.constructMethod].apply(t,r):n=Reflect.construct(t,r),n}async doConstructAsync(t,r){if(!t)return Object.create(null);let n;if(this.definition.constructMethod){const i=t[this.definition.constructMethod];Sa.Types.isAsyncFunction(i)?n=await i.apply(t,r):n=i.apply(t,r)}else n=Reflect.construct(t,r);return n}doInit(t){const r=t;if(this.definition.initMethod&&r[this.definition.initMethod]){if(Sa.Types.isGeneratorFunction(r[this.definition.initMethod])||Sa.Types.isAsyncFunction(r[this.definition.initMethod]))throw new Gv.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id);{const n=r[this.definition.initMethod].call(r);if(Sa.Types.isPromise(n))throw new Gv.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}async doInitAsync(t){const r=t;if(this.definition.initMethod&&r[this.definition.initMethod]){const n=r[this.definition.initMethod];Sa.Types.isAsyncFunction(n)?await n.call(r):n.length===1?await new Promise(i=>{n.call(r,i)}):n.call(r)}}doDestroy(t){this.definition.destroyMethod&&t[this.definition.destroyMethod]&&t[this.definition.destroyMethod].call(t)}async doDestroyAsync(t){if(this.definition.destroyMethod&&t[this.definition.destroyMethod]){const r=t[this.definition.destroyMethod];Sa.Types.isAsyncFunction(r)?await r.call(t):r.length===1?await new Promise(n=>{r.call(t,n)}):r.call(t)}}}Jo.ObjectCreator=mx,Object.defineProperty(Ou,"__esModule",{value:!0}),Ou.ObjectDefinition=void 0;const Ff=Ke,Ex=Mu,bx=Jo;class _x{constructor(){this._attrs=new Map,this._asynchronous=!1,this.scope=Ff.ScopeEnum.Singleton,this.creator=null,this.id=null,this.name=null,this.initMethod=null,this.destroyMethod=null,this.constructMethod=null,this.constructorArgs=[],this.path=null,this.export=null,this.dependsOn=[],this.properties=new Ex.ObjectProperties,this.namespace="",this.handlerProps=[],this.allowDowngrade=!1,this.creator=new bx.ObjectCreator(this)}set asynchronous(t){this._asynchronous=t}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===Ff.ScopeEnum.Singleton}isRequestScope(){return this.scope===Ff.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(t){return this._attrs.get(t)}hasAttr(t){return this._attrs.has(t)}setAttr(t,r){this._attrs.set(t,r)}}Ou.ObjectDefinition=_x;var Lu={};Object.defineProperty(Lu,"__esModule",{value:!0}),Lu.FunctionDefinition=void 0;const kf=Ke,Sx=Jo;class Cx extends Sx.ObjectCreator{doConstruct(t,r,n){return t?t(n,r):null}async doConstructAsync(t,r,n){return t?t(n,r):null}}class wx{constructor(){this.constructorArgs=[],this.namespace="",this.asynchronous=!0,this.handlerProps=[],this.allowDowngrade=!1,this.innerAutowire=!1,this.innerScope=kf.ScopeEnum.Singleton,this.creator=new Cx(this)}getAttr(t){}hasAttr(t){return!1}hasConstructorArgs(){return!1}hasDependsOn(){return!1}isAsync(){return this.asynchronous}isDirect(){return!1}isExternal(){return!1}set scope(t){this.innerScope=t}isSingletonScope(){return this.innerScope===kf.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===kf.ScopeEnum.Request}setAttr(t,r){}}Lu.FunctionDefinition=wx;var Ca={};Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.ManagedResolverFactory=Ca.ManagedReference=void 0;const wa=ze,gn=Ke,Hv=_e,Jr=Gt,Xt=Hv.debuglog("midway:managedresolver"),Yv=Hv.debuglog("midway:debug");class Tx{constructor(){this.type=wa.KEYS.REF_ELEMENT}}Ca.ManagedReference=Tx;class Ax{constructor(t){this.factory=t}get type(){return wa.KEYS.REF_ELEMENT}resolve(t,r){var n;const i=t;if(i.injectMode===gn.InjectModeEnum.Class&&!((n=this.factory.context.parent)!==null&&n!==void 0?n:this.factory.context).hasDefinition(i.name))throw r==="loggerService"?new Jr.MidwayInconsistentVersionError:new Jr.MidwayMissingImportComponentError(r);return this.factory.context.get(i.name,i.args,{originName:r})}async resolveAsync(t,r){var n;const i=t;if(i.injectMode===gn.InjectModeEnum.Class&&!((n=this.factory.context.parent)!==null&&n!==void 0?n:this.factory.context).hasDefinition(i.name))throw r==="loggerService"?new Jr.MidwayInconsistentVersionError:new Jr.MidwayMissingImportComponentError(r);return this.factory.context.getAsync(i.name,i.args,{originName:r})}}class xx{constructor(t){this.resolvers={},this.creating=new Map,this.singletonCache=new Map,this.context=t,this.resolvers={ref:new Ax(this)}}registerResolver(t){this.resolvers[t.type]=t}resolveManaged(t,r){const n=this.resolvers[t.type];if(!n||n.type!==t.type)throw new Jr.MidwayResolverMissingError(t.type);return n.resolve(t,r)}async resolveManagedAsync(t,r){const n=this.resolvers[t.type];if(!n||n.type!==t.type)throw new Jr.MidwayResolverMissingError(t.type);return n.resolveAsync(t,r)}create(t){const{definition:r,args:n}=t;if(r.isSingletonScope()&&this.singletonCache.has(r.id))return this.singletonCache.get(r.id);let i=this.createProxyReference(r);if(i)return i;if(this.compareAndSetCreateStatus(r),r.hasDependsOn())for(const s of r.dependsOn)this.context.get(s,n);Yv(`[core]: Create id = "${r.name}" ${r.id}.`);const a=r.creator.load();let o=[];if(n&&Array.isArray(n)&&n.length>0&&(o=n),this.getObjectEventTarget().emit(gn.ObjectLifeCycleEvent.BEFORE_CREATED,a,{constructorArgs:o,definition:r,context:this.context}),i=r.creator.doConstruct(a,o,this.context),r.isRequestScope()&&r.constructor.name==="ObjectDefinition"&&Object.defineProperty(i,wa.REQUEST_OBJ_CTX_KEY,{value:this.context.get(wa.REQUEST_CTX_KEY),writable:!1,enumerable:!1}),r.properties){const s=r.properties.propertyKeys();for(const u of s){this.checkSingletonInvokeRequest(r,u);try{i[u]=this.resolveManaged(r.properties.get(u),u)}catch(c){if(Jr.MidwayDefinitionNotFoundError.isClosePrototypeOf(c)){const l=r.path.name;c.updateErrorMsg(l)}throw this.removeCreateStatus(r,!0),c}}}return this.getObjectEventTarget().emit(gn.ObjectLifeCycleEvent.AFTER_CREATED,i,{context:this.context,definition:r,replaceCallback:s=>{i=s}}),r.creator.doInit(i),this.getObjectEventTarget().emit(gn.ObjectLifeCycleEvent.AFTER_INIT,i,{context:this.context,definition:r}),r.isSingletonScope()&&r.id&&this.singletonCache.set(r.id,i),r.isRequestScope()&&r.id&&this.context.registerObject(r.id,i),this.removeCreateStatus(r,!0),i}async createAsync(t){const{definition:r,args:n}=t;if(r.isSingletonScope()&&this.singletonCache.has(r.id))return Xt(`id = ${r.id}(${r.name}) get from singleton cache.`),this.singletonCache.get(r.id);let i=this.createProxyReference(r);if(i)return Xt(`id = ${r.id}(${r.name}) from proxy reference.`),i;if(this.compareAndSetCreateStatus(r),r.hasDependsOn())for(const s of r.dependsOn)Xt("id = %s init depend %s.",r.id,s),await this.context.getAsync(s,n);Yv(`[core]: Create id = "${r.name}" ${r.id}.`);const a=r.creator.load();let o=[];if(n&&Array.isArray(n)&&n.length>0&&(o=n),this.getObjectEventTarget().emit(gn.ObjectLifeCycleEvent.BEFORE_CREATED,a,{constructorArgs:o,context:this.context}),i=await r.creator.doConstructAsync(a,o,this.context),!i)throw this.removeCreateStatus(r,!1),new Jr.MidwayCommonError(`${r.id} construct return undefined`);if(r.isRequestScope()&&r.constructor.name==="ObjectDefinition"&&(Xt("id = %s inject ctx",r.id),Object.defineProperty(i,wa.REQUEST_OBJ_CTX_KEY,{value:this.context.get(wa.REQUEST_CTX_KEY),writable:!1,enumerable:!1})),r.properties){const s=r.properties.propertyKeys();for(const u of s){this.checkSingletonInvokeRequest(r,u);try{i[u]=await this.resolveManagedAsync(r.properties.get(u),u)}catch(c){if(Jr.MidwayDefinitionNotFoundError.isClosePrototypeOf(c)){const l=r.path.name;c.updateErrorMsg(l)}throw this.removeCreateStatus(r,!1),c}}}return this.getObjectEventTarget().emit(gn.ObjectLifeCycleEvent.AFTER_CREATED,i,{context:this.context,definition:r,replaceCallback:s=>{i=s}}),await r.creator.doInitAsync(i),this.getObjectEventTarget().emit(gn.ObjectLifeCycleEvent.AFTER_INIT,i,{context:this.context,definition:r}),r.isSingletonScope()&&r.id&&(Xt(`id = ${r.id}(${r.name}) set to singleton cache`),this.singletonCache.set(r.id,i)),r.isRequestScope()&&r.id&&(Xt(`id = ${r.id}(${r.name}) set to register object`),this.context.registerObject(r.id,i)),this.removeCreateStatus(r,!0),i}async destroyCache(){for(const t of this.singletonCache.keys()){const r=this.context.registry.getDefinition(t);if(r.creator){const n=this.singletonCache.get(t);this.getObjectEventTarget().emit(gn.ObjectLifeCycleEvent.BEFORE_DESTROY,n,{context:this.context,definition:r}),await r.creator.doDestroyAsync(n)}}this.singletonCache.clear(),this.creating.clear()}removeCreateStatus(t,r){return this.creating.has(t.id)&&this.creating.set(t.id,!1),!0}isCreating(t){return this.creating.has(t.id)&&this.creating.get(t.id)}compareAndSetCreateStatus(t){(!this.creating.has(t.id)||!this.creating.get(t.id))&&this.creating.set(t.id,!0)}createProxyReference(t){return this.isCreating(t)?(Xt("create proxy for %s.",t.id),this.depthFirstSearch(t.id,t)?new Proxy({__is_proxy__:!0,__target_id__:t.id},{get:(r,n)=>{let i;if(t.isRequestScope()?i=this.context.registry.getObject(t.id):t.isSingletonScope()?i=this.singletonCache.get(t.id):i=this.context.get(t.id),i)return typeof i[n]=="function"?i[n].bind(i):i[n]}}):(Xt("id = %s after dfs return null",t.id),null)):null}depthFirstSearch(t,r,n){var i;if(r){if(Xt("dfs for %s == %s start.",t,r.id),r.properties){const a=r.properties.propertyKeys();if(a.indexOf(t)>-1)return Xt("dfs exist in properties %s == %s.",t,r.id),!0;for(const o of a){Array.isArray(n)||(n=[t]);let s=o;const u=r.properties.get(o);if(u&&u.name&&(s=(i=this.context.identifierMapping.getRelation(u.name))!==null&&i!==void 0?i:u.name),s===t)return Xt("dfs exist in properties key %s == %s.",t,r.id),!0;if(n.indexOf(s)>-1){Xt("dfs depth circular %s == %s, %s, %j.",t,r.id,s,n);continue}else n.push(s),Xt("dfs depth push %s == %s, %j.",t,s,n);let c=this.context.registry.getDefinition(s);if(!c&&this.context.parent&&(c=this.context.parent.registry.getDefinition(s)),this.depthFirstSearch(t,c,n))return Xt("dfs exist in sub tree %s == %s subId = %s.",t,r.id,c.id),!0}}Xt("dfs for %s == %s end.",t,r.id)}return!1}getObjectEventTarget(){return this.context.parent?this.context.parent.objectCreateEventTarget:this.context.objectCreateEventTarget}checkSingletonInvokeRequest(t,r){if(t.isSingletonScope()){const n=t.properties.get(r);if(this.context.hasDefinition(n==null?void 0:n.name)){const i=this.context.registry.getDefinition(n.name);if(i.isRequestScope()&&!i.allowDowngrade)throw new Jr.MidwaySingletonInjectRequestError(t.path.name,i.path.name)}}return!0}}Ca.ManagedResolverFactory=xx;var Ii={},Rx=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.MidwayEnvironmentService=void 0;const Ix=Ke,Wv=zt.exports,zv=Pe();let Uf=class{getCurrentEnvironment(){return this.environment||(this.environment=(0,Wv.getCurrentEnvironment)()),this.environment}setCurrentEnvironment(t){this.environment=t}isDevelopmentEnvironment(){return(0,Wv.isDevelopmentEnvironment)(this.environment)}};Uf=Rx([(0,zv.Provide)(),(0,zv.Scope)(Ix.ScopeEnum.Singleton)],Uf),Ii.MidwayEnvironmentService=Uf;var yn={},Ta={},Pu=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Zo=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.MidwayInformationService=void 0;const Ox=Ke,Nu=zt.exports,Qv=_e,es=Pe();let Aa=class{init(){this.baseDir?(this.appDir||(this.appDir=(0,Qv.dirname)(this.baseDir)),this.pkg=(0,Nu.safeRequire)((0,Qv.join)(this.appDir,"package.json"))||{}):this.pkg={}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,Nu.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var t;return((t=this.pkg)===null||t===void 0?void 0:t.name)||""}getRoot(){return(0,Nu.isDevelopmentEnvironment)((0,Nu.getCurrentEnvironment)())?this.getAppDir():this.getHome()}};Pu([(0,es.Inject)(),Zo("design:type",String)],Aa.prototype,"appDir",void 0),Pu([(0,es.Inject)(),Zo("design:type",String)],Aa.prototype,"baseDir",void 0),Pu([(0,es.Init)(),Zo("design:type",Function),Zo("design:paramtypes",[]),Zo("design:returntype",void 0)],Aa.prototype,"init",null),Aa=Pu([(0,es.Provide)(),(0,es.Scope)(Ox.ScopeEnum.Singleton)],Aa),Ta.MidwayInformationService=Aa;var jn={};Object.defineProperty(jn,"__esModule",{value:!0}),jn.extend=void 0;const Xv=Ne;function Jv(...e){let t,r,n,i,a,o=e[0],s=1;const u=e.length;let c=!1;for(typeof o=="boolean"?(c=o,o=e[1]||{},s=2):(typeof o!="object"&&typeof o!="function"||o==null)&&(o={});s<u;++s)if(t=e[s],t!=null)for(r in t)r!=="__proto__"&&(n=o[r],i=t[r],o!==i&&(c&&i&&Xv.Types.isPlainObject(i)?(a=n&&Xv.Types.isPlainObject(n)?n:{},o[r]=Jv(c,a,i)):typeof i<"u"&&(o[r]=i)));return o}jn.extend=Jv;var Bu=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},ts=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(yn,"__esModule",{value:!0}),yn.MidwayConfigService=void 0;const Zv=_e,Mx=Ke,Lx=zt.exports,em=_e,Px=_e,Nx=Ii,Bx=Ta,Du=jn,Dx=Gt,rs=Pe(),Fx=Ne,Kn=Px.debuglog("midway:debug");let xa=class{constructor(){this.envDirMap=new Map,this.aliasMap={prod:"production",unittest:"test"},this.configMergeOrder=[],this.configuration={},this.isReady=!1,this.externalObject=[],this.configFilterList=[]}init(){this.appInfo={pkg:this.informationService.getPkg(),name:this.informationService.getProjectName(),baseDir:this.informationService.getBaseDir(),appDir:this.informationService.getAppDir(),HOME:this.informationService.getHome(),root:this.informationService.getRoot(),env:this.environmentService.getCurrentEnvironment()}}add(t){for(const r of t)if(typeof r=="string"){if(/\.\w+$/.test(r)){const n=this.getConfigEnv(r);this.getEnvSet(n).add(r),this.aliasMap[n]&&this.getEnvSet(this.aliasMap[n]).add(r)}else if((0,em.statSync)(r).isDirectory()){const i=(0,em.readdirSync)(r);this.add(i.map(a=>(0,Zv.join)(r,a)))}}else for(const n in r)this.getEnvSet(n).add(r[n]),this.aliasMap[n]&&this.getEnvSet(this.aliasMap[n]).add(r[n])}addObject(t,r=!1){if(this.isReady){if(t=this.runWithFilter(t),!t){Kn("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:t}),r?this.configuration=(0,Du.extend)(!0,t,this.configuration):(0,Du.extend)(!0,this.configuration,t)}else this.externalObject.push(t)}getEnvSet(t){return this.envDirMap.has(t)||this.envDirMap.set(t,new Set),this.envDirMap.get(t)}getConfigEnv(t){const n=(0,Zv.basename)(t).split("."),i=n.pop();return i!=="js"&&i!=="ts"?i:n.pop()}load(){if(this.isReady)return;const t=this.getEnvSet("default"),r=this.getEnvSet(this.environmentService.getCurrentEnvironment()),n={},i=t.size;for(const[a,o]of[...t,...r].entries()){let s=this.loadConfig(o);if(Fx.Types.isFunction(s)&&(s=s.apply(null,[this.appInfo,n])),!!s){if(s=this.runWithFilter(s),!s){Kn("[config]: Filter config and got undefined will be drop it");continue}typeof o=="string"?Kn("[config]: Loaded config %s, %j",o,s):Kn("[config]: Loaded config %j",s),this.configMergeOrder.push({env:a<i?"default":this.environmentService.getCurrentEnvironment(),extraPath:o,value:s}),(0,Du.extend)(!0,n,s)}}if(this.externalObject.length){for(let a of this.externalObject)if(a){if(a=this.runWithFilter(a),!a){Kn("[config]: Filter config and got undefined will be drop it");continue}Kn("[config]: Loaded external object %j",a),(0,Du.extend)(!0,n,a),this.configMergeOrder.push({env:"default",extraPath:"",value:a})}}this.configuration=n,this.isReady=!0}getConfiguration(t){return t?(0,Lx.safelyGet)(t,this.configuration):this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(t){let r=typeof t=="string"?Tr(t):t;if(r&&r.__esModule&&r&&r.default){if(Object.keys(r).length>1)throw new Dx.MidwayInvalidConfigError(`${t} should not have both a default export and named export`);r=r.default}return r}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(t){this.configFilterList.push(t)}runWithFilter(t){for(const r of this.configFilterList)Kn(`[config]: Filter config by filter = "${r.name||"anonymous filter"}"`),t=r(t),Kn("[config]: Filter config result = %j",t);return t}};Bu([(0,rs.Inject)(),ts("design:type",Nx.MidwayEnvironmentService)],xa.prototype,"environmentService",void 0),Bu([(0,rs.Inject)(),ts("design:type",Bx.MidwayInformationService)],xa.prototype,"informationService",void 0),Bu([(0,rs.Init)(),ts("design:type",Function),ts("design:paramtypes",[]),ts("design:returntype",void 0)],xa.prototype,"init",null),xa=Bu([(0,rs.Provide)(),(0,rs.Scope)(Mx.ScopeEnum.Singleton)],xa),yn.MidwayConfigService=xa;var Ra={exports:{}},Ia=typeof Reflect=="object"?Reflect:null,tm=Ia&&typeof Ia.apply=="function"?Ia.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},Fu;Ia&&typeof Ia.ownKeys=="function"?Fu=Ia.ownKeys:Object.getOwnPropertySymbols?Fu=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Fu=function(t){return Object.getOwnPropertyNames(t)};function kx(e){console&&console.warn&&console.warn(e)}var rm=Number.isNaN||function(t){return t!==t};function et(){et.init.call(this)}Ra.exports=et,Ra.exports.once=Kx,et.EventEmitter=et,et.prototype._events=void 0,et.prototype._eventsCount=0,et.prototype._maxListeners=void 0;var nm=10;function ku(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(et,"defaultMaxListeners",{enumerable:!0,get:function(){return nm},set:function(e){if(typeof e!="number"||e<0||rm(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");nm=e}}),et.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},et.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||rm(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function im(e){return e._maxListeners===void 0?et.defaultMaxListeners:e._maxListeners}et.prototype.getMaxListeners=function(){return im(this)},et.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=t==="error",a=this._events;if(a!==void 0)i=i&&a.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=a[t];if(u===void 0)return!1;if(typeof u=="function")tm(u,this,r);else for(var c=u.length,l=cm(u,c),n=0;n<c;++n)tm(l[n],this,r);return!0};function am(e,t,r,n){var i,a,o;if(ku(r),a=e._events,a===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),o===void 0)o=a[t]=r,++e._eventsCount;else if(typeof o=="function"?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=im(e),i>0&&o.length>i&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=o.length,kx(s)}return e}et.prototype.addListener=function(t,r){return am(this,t,r,!1)},et.prototype.on=et.prototype.addListener,et.prototype.prependListener=function(t,r){return am(this,t,r,!0)};function Ux(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function om(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=Ux.bind(n);return i.listener=r,n.wrapFn=i,i}et.prototype.once=function(t,r){return ku(r),this.on(t,om(this,t,r)),this},et.prototype.prependOnceListener=function(t,r){return ku(r),this.prependListener(t,om(this,t,r)),this},et.prototype.removeListener=function(t,r){var n,i,a,o,s;if(ku(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(a=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){s=n[o].listener,a=o;break}if(a<0)return this;a===0?n.shift():$x(n,a),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,s||r)}return this},et.prototype.off=et.prototype.removeListener,et.prototype.removeAllListeners=function(t){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var a=Object.keys(n),o;for(i=0;i<a.length;++i)o=a[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(t,r[i]);return this};function sm(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?jx(i):cm(i,i.length)}et.prototype.listeners=function(t){return sm(this,t,!0)},et.prototype.rawListeners=function(t){return sm(this,t,!1)},et.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):um.call(e,t)},et.prototype.listenerCount=um;function um(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}et.prototype.eventNames=function(){return this._eventsCount>0?Fu(this._events):[]};function cm(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function $x(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function jx(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function Kx(e,t){return new Promise(function(r,n){function i(o){e.removeListener(t,a),n(o)}function a(){typeof e.removeListener=="function"&&e.removeListener("error",i),r([].slice.call(arguments))}lm(e,t,a,{once:!0}),t!=="error"&&qx(e,i,{once:!0})})}function qx(e,t,r){typeof e.on=="function"&&lm(e,"error",t,r)}function lm(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function i(a){n.once&&e.removeEventListener(t,i),r(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(_a,"__esModule",{value:!0}),_a.MidwayContainer=void 0;const Ht=Pe(),Uu=$n,fm=_e,Vx=xu,vn=Ke,dm=ze,Gx=Ou,Hx=Lu,$f=Ca,Yx=Ii,jf=yn,Wx=Ra.exports,hm=Gt,zx=jn,vr=Ne,Qx=zt.exports,$u=fm.debuglog("midway:debug"),ns=fm.debuglog("midway:bind"),is=9;class Xx{constructor(t){this.container=t,this.loadedMap=new WeakMap,this.namespaceList=[],this.detectorOptionsList=[]}load(t){let r=Ht.MAIN_MODULE_KEY;const n=this.getConfigurationExport(t);if(!!n.length){for(let i=0;i<n.length;i++){const a=n[i];if(this.loadedMap.get(a))continue;let o;a instanceof Uu.FunctionalConfiguration?o=a.getConfigurationOptions():o=(0,Ht.getClassMetadata)(Ht.CONFIGURATION_KEY,a),this.loadedMap.set(a,!0),o&&(o.namespace!==void 0&&(r=o.namespace,this.namespaceList.push(r)),this.detectorOptionsList.push({conflictCheck:o.conflictCheck,...o.detectorOptions}),$u(`[core]: load configuration in namespace="${r}"`),this.addImports(o.imports),this.addImportObjects(o.importObjects),this.addImportConfigs(o.importConfigs),this.addImportConfigFilter(o.importConfigFilter),this.bindConfigurationClass(a,r))}this.container.bindClass(t,{namespace:r})}}addImportConfigs(t){t&&(Array.isArray(t)?this.container.get(jf.MidwayConfigService).add(t):this.container.get(jf.MidwayConfigService).addObject(t))}addImportConfigFilter(t){t&&this.container.get(jf.MidwayConfigService).addFilter(t)}addImports(t=[]){var r;for(let n of t)!n||(typeof n=="string"&&(n=Tr(n)),"Configuration"in n?this.load(n):"component"in n?n!=null&&n.enabledEnvironment?!((r=n==null?void 0:n.enabledEnvironment)===null||r===void 0)&&r.includes(this.container.get(Yx.MidwayEnvironmentService).getCurrentEnvironment())&&this.load(n.component):this.load(n.component):this.load(n))}addImportObjects(t){if(t){const r=Object.keys(t);for(const n of r)typeof t[n]!==void 0&&this.container.registerObject(n,t[n])}}bindConfigurationClass(t,r){if(!(t instanceof Uu.FunctionalConfiguration)){(0,Ht.saveProviderId)(void 0,t);const a=(0,Ht.getProviderUUId)(t);this.container.bind(a,t,{namespace:r,scope:vn.ScopeEnum.Singleton})}(0,Ht.listModule)(Ht.CONFIGURATION_KEY).find(a=>a.target===t)||(0,Ht.saveModule)(Ht.CONFIGURATION_KEY,{target:t,namespace:r})}getConfigurationExport(t){const r=[];if(vr.Types.isClass(t)||vr.Types.isFunction(t)||t instanceof Uu.FunctionalConfiguration)r.push(t);else for(const n in t){const i=t[n];(vr.Types.isClass(i)||vr.Types.isFunction(i)||i instanceof Uu.FunctionalConfiguration)&&r.push(i)}return r}getNamespaceList(){return this.namespaceList}getDetectorOptionsList(){return this.detectorOptionsList}}class Kf{constructor(t){this._resolverFactory=null,this._registry=null,this._identifierMapping=null,this.moduleMap=null,this.parent=null,this.ctx={},this.attrMap=new Map,this._namespaceSet=null,this.isLoad=!1,this.parent=t,this.init()}init(){this.registerObject(dm.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){return this._objectCreateEventTarget||(this._objectCreateEventTarget=new Wx),this._objectCreateEventTarget}get registry(){return this._registry||(this._registry=new Vx.ObjectDefinitionRegistry),this._registry}set registry(t){this._registry=t}get managedResolverFactory(){return this._resolverFactory||(this._resolverFactory=new $f.ManagedResolverFactory(this)),this._resolverFactory}get identifierMapping(){return this._identifierMapping||(this._identifierMapping=this.registry.getIdentifierRelation()),this._identifierMapping}get namespaceSet(){return this._namespaceSet||(this._namespaceSet=new Set),this._namespaceSet}load(t){var r;if(t){const n=new Xx(this);n.load(t);for(const a of n.getNamespaceList())this.namespaceSet.add(a),$u(`[core]: load configuration in namespace="${a}" complete`);const i={};for(const a of n.getDetectorOptionsList())(0,zx.extend)(!0,i,a);(r=this.fileDetector)===null||r===void 0||r.setExtraDetectorOptions(i),this.isLoad=!0}}loadDefinitions(){var t;this.isLoad||this.load(),(t=this.fileDetector)===null||t===void 0||t.run(this)}bindClass(t,r){if(vr.Types.isClass(t)||vr.Types.isFunction(t))this.bindModule(t,r);else for(const n in t){const i=t[n];(vr.Types.isClass(i)||vr.Types.isFunction(i))&&this.bindModule(i,r)}}bind(t,r,n){var i;if(vr.Types.isClass(t)||vr.Types.isFunction(t))return this.bindModule(t,r);if(this.registry.hasDefinition(t))return;n!=null&&n.bindHook&&n.bindHook(r,n);let a;vr.Types.isClass(r)?(a=new Gx.ObjectDefinition,a.name=(0,Ht.getProviderName)(r)):(a=new Hx.FunctionDefinition,vr.Types.isAsyncFunction(r)||(a.asynchronous=!1),a.name=a.id),a.path=r,a.id=t,a.srcPath=(n==null?void 0:n.srcPath)||null,a.namespace=(n==null?void 0:n.namespace)||"",a.scope=(n==null?void 0:n.scope)||vn.ScopeEnum.Request,a.createFrom=n==null?void 0:n.createFrom,a.srcPath?$u(`[core]: bind id "${a.name} (${a.srcPath}) ${t}"`):$u(`[core]: bind id "${a.name}" ${t}`);const o=(0,Ht.getPropertyInject)(r);for(const c in o){const l=o[c];ns(`${" ".repeat(is)}inject properties => [${JSON.stringify(l)}]`);const f=new $f.ManagedReference;f.args=l.args,f.name=l.value,f.injectMode=l.injectMode,a.properties.set(l.targetKey,f)}const s=(0,Ht.getClassExtendedMetadata)(Ht.INJECT_CUSTOM_PROPERTY,r);for(const c in s){const l=s[c];a.handlerProps.push(l)}const u=(i=(0,Ht.getObjectDefinition)(r))!==null&&i!==void 0?i:{};u.initMethod&&(ns(`${" ".repeat(is)}register initMethod = ${u.initMethod}`),a.initMethod=u.initMethod),u.destroyMethod&&(ns(`${" ".repeat(is)}register destroyMethod = ${u.destroyMethod}`),a.destroyMethod=u.destroyMethod),u.scope&&(ns(`${" ".repeat(is)}register scope = ${u.scope}`),a.scope=u.scope),u.allowDowngrade&&(ns(`${" ".repeat(is)}register allowDowngrade = ${u.allowDowngrade}`),a.allowDowngrade=u.allowDowngrade),this.objectCreateEventTarget.emit(vn.ObjectLifeCycleEvent.BEFORE_BIND,r,{context:this,definition:a,replaceCallback:c=>{a=c}}),a&&this.registry.registerDefinition(a.id,a)}bindModule(t,r){if(vr.Types.isClass(t)){const n=(0,Ht.getProviderUUId)(t);n&&(this.identifierMapping.saveClassRelation(t,r==null?void 0:r.namespace),this.bind(n,t,r))}else{const n=t[dm.FUNCTION_INJECT_KEY];if(n&&n.id){n.scope||(n.scope=vn.ScopeEnum.Request);const i=Qx.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(n.id,i),this.bind(i,t,{scope:n.scope,namespace:r.namespace,srcPath:r.srcPath,createFrom:r.createFrom})}}}setFileDetector(t){this.fileDetector=t}createChild(){return new Kf(this)}setAttr(t,r){this.attrMap.set(t,r)}getAttr(t){return this.attrMap.get(t)}getIdentifier(t){return(0,Ht.getProviderUUId)(t)}getManagedResolverFactory(){return this._resolverFactory||(this._resolverFactory=new $f.ManagedResolverFactory(this)),this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache(),this.registry.clearAll()}ready(){this.loadDefinitions()}get(t,r,n){var i;if(r=r!=null?r:[],n=n!=null?n:{originName:t},typeof t!="string"&&(n.originName=t.name,t=this.getIdentifier(t)),this.registry.hasObject(t))return this.registry.getObject(t);const a=this.registry.getDefinition(t);if(!a&&this.parent)return this.parent.get(t,r);if(!a)throw new hm.MidwayDefinitionNotFoundError((i=n==null?void 0:n.originName)!==null&&i!==void 0?i:t);return this.getManagedResolverFactory().create({definition:a,args:r})}async getAsync(t,r,n){var i;if(r=r!=null?r:[],n=n!=null?n:{originName:t},typeof t!="string"&&(n.originName=t.name,t=this.getIdentifier(t)),this.registry.hasObject(t))return this.registry.getObject(t);const a=this.registry.getDefinition(t);if(!a&&this.parent)return this.parent.getAsync(t,r);if(!a)throw new hm.MidwayDefinitionNotFoundError((i=n==null?void 0:n.originName)!==null&&i!==void 0?i:t);return this.getManagedResolverFactory().createAsync({definition:a,args:r})}registerObject(t,r){this.registry.registerObject(t,r)}onBeforeBind(t){this.objectCreateEventTarget.on(vn.ObjectLifeCycleEvent.BEFORE_BIND,t)}onBeforeObjectCreated(t){this.objectCreateEventTarget.on(vn.ObjectLifeCycleEvent.BEFORE_CREATED,t)}onObjectCreated(t){this.objectCreateEventTarget.on(vn.ObjectLifeCycleEvent.AFTER_CREATED,t)}onObjectInit(t){this.objectCreateEventTarget.on(vn.ObjectLifeCycleEvent.AFTER_INIT,t)}onBeforeObjectDestroy(t){this.objectCreateEventTarget.on(vn.ObjectLifeCycleEvent.BEFORE_DESTROY,t)}saveModule(t,r){this.moduleMap.has(t)||this.moduleMap.set(t,new Set),this.moduleMap.get(t).add(r)}listModule(t){return Array.from(this.moduleMap.get(t)||{})}transformModule(t){this.moduleMap=new Map(t)}hasNamespace(t){return this.namespaceSet.has(t)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(t){return this.registry.hasDefinition(t)}hasObject(t){return this.registry.hasObject(t)}}_a.MidwayContainer=Kf;var as={};Object.defineProperty(as,"__esModule",{value:!0}),as.MidwayRequestContainer=void 0;const Jx=_a,pm=Pe(),Zx=ze;class eR extends Jx.MidwayContainer{constructor(t,r){super(r),this.applicationContext=r,this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation()),this.ctx=t,this.registerObject(Zx.REQUEST_CTX_KEY,t),this.registerObject("res",{}),t.logger&&this.registerObject("logger",t.logger)}init(){}get(t,r){if(typeof t!="string"&&(t=this.getIdentifier(t)),this.registry.hasObject(t))return this.registry.getObject(t);const n=this.applicationContext.registry.getDefinition(t);if(n&&(n.isRequestScope()||n.id===pm.PIPELINE_IDENTIFIER))return this.getManagedResolverFactory().create({definition:n,args:r});if(this.parent)return this.parent.get(t,r)}async getAsync(t,r){if(typeof t!="string"&&(t=this.getIdentifier(t)),this.registry.hasObject(t))return this.registry.getObject(t);const n=this.applicationContext.registry.getDefinition(t);if(n&&(n.isRequestScope()||n.id===pm.PIPELINE_IDENTIFIER))return this.getManagedResolverFactory().createAsync({definition:n,args:r});if(this.parent)return this.parent.getAsync(t,r)}ready(){}getContext(){return this.ctx}}as.MidwayRequestContainer=eR;var os={},Oa={},ss={};Object.defineProperty(ss,"__esModule",{value:!0}),ss.ServiceFactory=void 0;const gm=jn;class tR{constructor(){this.clients=new Map,this.options={}}async initClients(t={}){if(this.options=t,t.client&&(t.clients=t.clients||{},t.clients.default=t.clients.default||{},(0,gm.extend)(!0,t.clients.default,t.client)),t.clients)for(const r of Object.keys(t.clients))await this.createInstance(t.clients[r],r)}get(t="default"){return this.clients.get(t)}has(t){return this.clients.has(t)}async createInstance(t,r){t=(0,gm.extend)(!0,{},this.options.default,t);const n=await this.createClient(t,r);if(n)return r&&this.clients.set(r,n),n}async destroyClient(t){}async stop(){for(const t of this.clients.values())await this.destroyClient(t)}getDefaultClientName(){return this.options.defaultClientName}}ss.ServiceFactory=tR;var ym={},us={},qn={},cs={},ju={};function qf(e){return qf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qf(e)}function vm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rR(e,t,r){return t&&vm(e.prototype,t),r&&vm(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iR(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ls(e,t)}function aR(e){var t=Em();return function(){var n=fs(e),i;if(t){var a=fs(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return oR(this,i)}}function oR(e,t){if(t&&(qf(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mm(e)}function mm(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vf(e){var t=typeof Map=="function"?new Map:void 0;return Vf=function(n){if(n===null||!sR(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return Ku(n,arguments,fs(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ls(i,n)},Vf(e)}function Ku(e,t,r){return Em()?Ku=Reflect.construct.bind():Ku=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),c=new u;return o&&ls(c,o.prototype),c},Ku.apply(null,arguments)}function Em(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function sR(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function ls(e,t){return ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ls(e,t)}function fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fs(e)}var uR=function(e){iR(r,e);var t=aR(r);function r(n){var i;return nR(this,r),i=t.call(this,`Format functions must be synchronous taking a two arguments: (info, opts)
|
|
30
|
-
Found: `.concat(n.toString().split(`
|
|
31
|
-
`)[0],`
|
|
32
|
-
`)),Error.captureStackTrace(mm(i),r),i}return rR(r)}(Vf(Error)),mr=function(e){if(e.length>2)throw new uR(e);function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=n}t.prototype.transform=e;function r(n){return new t(n)}return r.Format=t,r},Ma={exports:{}},Gf={exports:{}},bm={exports:{}},_m={exports:{}};(function(e){var t={};e.exports=t;var r={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(r).forEach(function(n){var i=r[n],a=t[n]=[];a.open="\x1B["+i[0]+"m",a.close="\x1B["+i[1]+"m"})})(_m);var cR=function(e,t){t=t||process.argv;var r=t.indexOf("--"),n=/^-{1,2}/.test(e)?"":"--",i=t.indexOf(n+e);return i!==-1&&(r===-1?!0:i<r)},lR=_e,Ur=cR,Jt=process.env,La=void 0;Ur("no-color")||Ur("no-colors")||Ur("color=false")?La=!1:(Ur("color")||Ur("colors")||Ur("color=true")||Ur("color=always"))&&(La=!0),"FORCE_COLOR"in Jt&&(La=Jt.FORCE_COLOR.length===0||parseInt(Jt.FORCE_COLOR,10)!==0);function fR(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function dR(e){if(La===!1)return 0;if(Ur("color=16m")||Ur("color=full")||Ur("color=truecolor"))return 3;if(Ur("color=256"))return 2;if(e&&!e.isTTY&&La!==!0)return 0;var t=La?1:0;if(process.platform==="win32"){var r=lR.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Jt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in Jt})||Jt.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in Jt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Jt.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Jt){var n=parseInt((Jt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Jt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Jt.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Jt.TERM)||"COLORTERM"in Jt?1:(Jt.TERM==="dumb",t)}function Hf(e){var t=dR(e);return fR(t)}var hR={supportsColor:Hf,stdout:Hf(process.stdout),stderr:Hf(process.stderr)},Yf={exports:{}},Sm;function pR(){return Sm||(Sm=1,function(e){e.exports=function(r,n){var i="";r=r||"Run the trap, drop the bass",r=r.split("");var a={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return r.forEach(function(o){o=o.toLowerCase();var s=a[o]||[" "],u=Math.floor(Math.random()*s.length);typeof a[o]<"u"?i+=a[o][u]:i+=o}),i}}(Yf)),Yf.exports}var Wf={exports:{}},Cm;function gR(){return Cm||(Cm=1,function(e){e.exports=function(r,n){r=r||" he is here ";var i={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},a=[].concat(i.up,i.down,i.mid);function o(c){var l=Math.floor(Math.random()*c);return l}function s(c){var l=!1;return a.filter(function(f){l=f===c}),l}function u(c,l){var f="",d,g;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",c=c.split("");for(g in c)if(!s(g)){switch(f=f+c[g],d={up:0,down:0,mid:0},l.size){case"mini":d.up=o(8),d.mid=o(2),d.down=o(8);break;case"maxi":d.up=o(16)+3,d.mid=o(4)+1,d.down=o(64)+3;break;default:d.up=o(8)+1,d.mid=o(6)/2,d.down=o(8)+1;break}var h=["up","mid","down"];for(var v in h)for(var p=h[v],y=0;y<=d[p];y++)l[p]&&(f=f+i[p][o(i[p].length)])}return f}return u(r,n)}}(Wf)),Wf.exports}var zf={exports:{}},wm;function yR(){return wm||(wm=1,function(e){e.exports=function(t){return function(r,n,i){if(r===" ")return r;switch(n%3){case 0:return t.red(r);case 1:return t.white(r);case 2:return t.blue(r)}}}}(zf)),zf.exports}var Qf={exports:{}},Tm;function vR(){return Tm||(Tm=1,function(e){e.exports=function(t){return function(r,n,i){return n%2===0?r:t.inverse(r)}}}(Qf)),Qf.exports}var Xf={exports:{}},Am;function mR(){return Am||(Am=1,function(e){e.exports=function(t){var r=["red","yellow","green","blue","magenta"];return function(n,i,a){return n===" "?n:t[r[i++%r.length]](n)}}}(Xf)),Xf.exports}var Jf={exports:{}},xm;function ER(){return xm||(xm=1,function(e){e.exports=function(t){var r=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(n,i,a){return n===" "?n:t[r[Math.round(Math.random()*(r.length-2))]](n)}}}(Jf)),Jf.exports}(function(e){var t={};e.exports=t,t.themes={};var r=_e,n=t.styles=_m.exports,i=Object.defineProperties,a=new RegExp(/[\r\n]+/g);t.supportsColor=hR.supportsColor,typeof t.enabled>"u"&&(t.enabled=t.supportsColor()!==!1),t.enable=function(){t.enabled=!0},t.disable=function(){t.enabled=!1},t.stripColors=t.strip=function(v){return(""+v).replace(/\x1B\[\d+m/g,"")},t.stylize=function(p,y){if(!t.enabled)return p+"";var w=n[y];return!w&&y in t?t[y](p):w.open+p+w.close};var o=/[|\\{}()[\]^$+*?.]/g,s=function(v){if(typeof v!="string")throw new TypeError("Expected a string");return v.replace(o,"\\$&")};function u(v){var p=function y(){return f.apply(y,arguments)};return p._styles=v,p.__proto__=l,p}var c=function(){var v={};return n.grey=n.gray,Object.keys(n).forEach(function(p){n[p].closeRe=new RegExp(s(n[p].close),"g"),v[p]={get:function(){return u(this._styles.concat(p))}}}),v}(),l=i(function(){},c);function f(){var v=Array.prototype.slice.call(arguments),p=v.map(function(A){return A!=null&&A.constructor===String?A:r.inspect(A)}).join(" ");if(!t.enabled||!p)return p;for(var y=p.indexOf(`
|
|
33
|
-
`)!=-1,w=this._styles,m=w.length;m--;){var S=n[w[m]];p=S.open+p.replace(S.closeRe,S.open)+S.close,y&&(p=p.replace(a,function(A){return S.close+A+S.open}))}return p}t.setTheme=function(v){if(typeof v=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var p in v)(function(y){t[y]=function(w){if(typeof v[y]=="object"){var m=w;for(var S in v[y])m=t[v[y][S]](m);return m}return t[v[y]](w)}})(p)};function d(){var v={};return Object.keys(c).forEach(function(p){v[p]={get:function(){return u([p])}}}),v}var g=function(p,y){var w=y.split("");return w=w.map(p),w.join("")};t.trap=pR(),t.zalgo=gR(),t.maps={},t.maps.america=yR()(t),t.maps.zebra=vR()(t),t.maps.rainbow=mR()(t),t.maps.random=ER()(t);for(var h in t.maps)(function(v){t[v]=function(p){return g(t.maps[v],p)}})(h);i(t,d())})(bm),function(e){var t=bm.exports;e.exports=t}(Gf);var ht={},Rm={},Zf={};Zf.levels={error:0,warn:1,help:2,data:3,info:4,debug:5,prompt:6,verbose:7,input:8,silly:9},Zf.colors={error:"red",warn:"yellow",help:"cyan",data:"grey",info:"green",debug:"blue",prompt:"grey",verbose:"cyan",input:"grey",silly:"magenta"};var ed={};ed.levels={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6},ed.colors={error:"red",warn:"yellow",info:"green",http:"green",verbose:"cyan",debug:"blue",silly:"magenta"};var td={};td.levels={emerg:0,alert:1,crit:2,error:3,warning:4,notice:5,info:6,debug:7},td.colors={emerg:"red",alert:"yellow",crit:"red",error:"red",warning:"red",notice:"yellow",info:"green",debug:"blue"},function(e){Object.defineProperty(e,"cli",{value:Zf}),Object.defineProperty(e,"npm",{value:ed}),Object.defineProperty(e,"syslog",{value:td})}(Rm),function(e){Object.defineProperty(e,"LEVEL",{value:Symbol.for("level")}),Object.defineProperty(e,"MESSAGE",{value:Symbol.for("message")}),Object.defineProperty(e,"SPLAT",{value:Symbol.for("splat")}),Object.defineProperty(e,"configs",{value:Rm})}(ht);function bR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Im(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _R(e,t,r){return t&&Im(e.prototype,t),r&&Im(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var rd=Gf.exports,Om=ht,nd=Om.LEVEL,id=Om.MESSAGE;rd.enabled=!0;var Mm=/\s+/,Lm=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bR(this,e),t.colors&&this.addColors(t.colors),this.options=t}return _R(e,[{key:"addColors",value:function(r){return e.addColors(r)}},{key:"colorize",value:function(r,n,i){if(typeof i>"u"&&(i=n),!Array.isArray(e.allColors[r]))return rd[e.allColors[r]](i);for(var a=0,o=e.allColors[r].length;a<o;a++)i=rd[e.allColors[r][a]](i);return i}},{key:"transform",value:function(r,n){return n.all&&typeof r[id]=="string"&&(r[id]=this.colorize(r[nd],r.level,r[id])),(n.level||n.all||!n.message)&&(r.level=this.colorize(r[nd],r.level)),(n.all||n.message)&&(r.message=this.colorize(r[nd],r.level,r.message)),r}}],[{key:"addColors",value:function(r){var n=Object.keys(r).reduce(function(i,a){return i[a]=Mm.test(r[a])?r[a].split(Mm):r[a],i},{});return e.allColors=Object.assign({},e.allColors||{},n),e.allColors}}]),e}();Ma.exports=function(e){return new Lm(e)},Ma.exports.Colorizer=Ma.exports.Format=Lm;var SR=Ma.exports,CR=SR.Colorizer,wR=function(e){return CR.addColors(e.colors||e),e},TR=mr,AR=TR(function(e){return e.message=" ".concat(e.message),e}),ad={exports:{}},ds={exports:{}};function xR(e){return MR(e)||OR(e)||IR(e)||RR()}function RR(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
34
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IR(e,t){if(!!e){if(typeof e=="string")return od(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return od(e,t)}}function OR(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function MR(e){if(Array.isArray(e))return od(e)}function od(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function LR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function PR(e,t,r){return t&&Pm(e.prototype,t),r&&Pm(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var sd=ht,NR=sd.configs,Nm=sd.LEVEL,ud=sd.MESSAGE,Bm=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{levels:NR.npm.levels};LR(this,e),this.paddings=e.paddingForLevels(t.levels,t.filler),this.options=t}return PR(e,[{key:"transform",value:function(r,n){return r.message="".concat(this.paddings[r[Nm]]).concat(r.message),r[ud]&&(r[ud]="".concat(this.paddings[r[Nm]]).concat(r[ud])),r}}],[{key:"getLongestLevel",value:function(r){var n=Object.keys(r).map(function(i){return i.length});return Math.max.apply(Math,xR(n))}},{key:"paddingForLevel",value:function(r,n,i){var a=i+1-r.length,o=Math.floor(a/n.length),s="".concat(n).concat(n.repeat(o));return s.slice(0,a)}},{key:"paddingForLevels",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:" ",i=e.getLongestLevel(r);return Object.keys(r).reduce(function(a,o){return a[o]=e.paddingForLevel(o,n,i),a},{})}}]),e}();ds.exports=function(e){return new Bm(e)},ds.exports.Padder=ds.exports.Format=Bm;function BR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function DR(e,t,r){return t&&Dm(e.prototype,t),r&&Dm(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var FR=Ma.exports,kR=FR.Colorizer,UR=ds.exports,$R=UR.Padder,Fm=ht,jR=Fm.configs,KR=Fm.MESSAGE,km=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};BR(this,e),t.levels||(t.levels=jR.cli.levels),this.colorizer=new kR(t),this.padder=new $R(t),this.options=t}return DR(e,[{key:"transform",value:function(r,n){return this.colorizer.transform(this.padder.transform(r,n),n),r[KR]="".concat(r.level,":").concat(r.message),r}}]),e}();ad.exports=function(e){return new km(e)},ad.exports.Format=km;var cd={exports:{}},qR=mr;function Um(e){if(!!e.every(VR))return function(t){for(var r=t,n=0;n<e.length;n++)if(r=e[n].transform(r,e[n].options),!r)return!1;return r}}function VR(e){if(typeof e.transform!="function")throw new Error(["No transform function found on format. Did you create a format instance?","const myFormat = format(formatFn);","const instance = myFormat();"].join(`
|
|
35
|
-
`));return!0}cd.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=qR(Um(t)),i=n();return i.Format=n.Format,i},cd.exports.cascade=Um;function ld(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var GR=mr,$m=ht,jm=$m.LEVEL,fd=$m.MESSAGE,HR=GR(function(e,t){var r=t.stack,n=t.cause;if(e instanceof Error){var i,a=Object.assign({},e,(i={level:e.level},ld(i,jm,e[jm]||e.level),ld(i,"message",e.message),ld(i,fd,e[fd]||e.message),i));return r&&(a.stack=e.stack),n&&(a.cause=e.cause),a}if(!(e.message instanceof Error))return e;var o=e.message;return Object.assign(e,o),e.message=o.message,e[fd]=o.message,r&&(e.stack=o.stack),n&&(e.cause=o.cause),e}),Oi={exports:{}};(function(e,t){const{hasOwnProperty:r}=Object.prototype,n=p();n.configure=p,n.stringify=n,n.default=n,t.stringify=n,t.configure=p,e.exports=n;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function a(y){return y.length<5e3&&!i.test(y)?`"${y}"`:JSON.stringify(y)}function o(y){if(y.length>200)return y.sort();for(let w=1;w<y.length;w++){const m=y[w];let S=w;for(;S!==0&&y[S-1]>m;)y[S]=y[S-1],S--;y[S]=m}return y}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(y){return s.call(y)!==void 0&&y.length!==0}function c(y,w,m){y.length<m&&(m=y.length);const S=w===","?"":" ";let A=`"0":${S}${y[0]}`;for(let I=1;I<m;I++)A+=`${w}"${I}":${S}${y[I]}`;return A}function l(y){if(r.call(y,"circularValue")){const w=y.circularValue;if(typeof w=="string")return`"${w}"`;if(w==null)return w;if(w===Error||w===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function f(y,w){let m;if(r.call(y,w)&&(m=y[w],typeof m!="boolean"))throw new TypeError(`The "${w}" argument must be of type boolean`);return m===void 0?!0:m}function d(y,w){let m;if(r.call(y,w)){if(m=y[w],typeof m!="number")throw new TypeError(`The "${w}" argument must be of type number`);if(!Number.isInteger(m))throw new TypeError(`The "${w}" argument must be an integer`);if(m<1)throw new RangeError(`The "${w}" argument must be >= 1`)}return m===void 0?1/0:m}function g(y){return y===1?"1 item":`${y} items`}function h(y){const w=new Set;for(const m of y)(typeof m=="string"||typeof m=="number")&&w.add(String(m));return w}function v(y){if(r.call(y,"strict")){const w=y.strict;if(typeof w!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(w)return m=>{let S=`Object can not safely be stringified. Received type ${typeof m}`;throw typeof m!="function"&&(S+=` (${m.toString()})`),new Error(S)}}}function p(y){y={...y};const w=v(y);w&&(y.bigint===void 0&&(y.bigint=!1),"circularValue"in y||(y.circularValue=Error));const m=l(y),S=f(y,"bigint"),A=f(y,"deterministic"),I=d(y,"maximumDepth"),N=d(y,"maximumBreadth");function T(X,V,k,$,G,oe){let se=V[X];switch(typeof se=="object"&&se!==null&&typeof se.toJSON=="function"&&(se=se.toJSON(X)),se=$.call(V,X,se),typeof se){case"string":return a(se);case"object":{if(se===null)return"null";if(k.indexOf(se)!==-1)return m;let de="",le=",";const Ee=oe;if(Array.isArray(se)){if(se.length===0)return"[]";if(I<k.length+1)return'"[Array]"';k.push(se),G!==""&&(oe+=G,de+=`
|
|
36
|
-
${oe}`,le=`,
|
|
37
|
-
${oe}`);const W=Math.min(se.length,N);let _=0;for(;_<W-1;_++){const E=T(String(_),se,k,$,G,oe);de+=E!==void 0?E:"null",de+=le}const x=T(String(_),se,k,$,G,oe);if(de+=x!==void 0?x:"null",se.length-1>N){const E=se.length-N-1;de+=`${le}"... ${g(E)} not stringified"`}return G!==""&&(de+=`
|
|
38
|
-
${Ee}`),k.pop(),`[${de}]`}let pe=Object.keys(se);const J=pe.length;if(J===0)return"{}";if(I<k.length+1)return'"[Object]"';let ne="",q="";G!==""&&(oe+=G,le=`,
|
|
39
|
-
${oe}`,ne=" ");const z=Math.min(J,N);A&&!u(se)&&(pe=o(pe)),k.push(se);for(let W=0;W<z;W++){const _=pe[W],x=T(_,se,k,$,G,oe);x!==void 0&&(de+=`${q}${a(_)}:${ne}${x}`,q=le)}if(J>N){const W=J-N;de+=`${q}"...":${ne}"${g(W)} not stringified"`,q=le}return G!==""&&q.length>1&&(de=`
|
|
40
|
-
${oe}${de}
|
|
41
|
-
${Ee}`),k.pop(),`{${de}}`}case"number":return isFinite(se)?String(se):w?w(se):"null";case"boolean":return se===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(se);default:return w?w(se):void 0}}function M(X,V,k,$,G,oe){switch(typeof V=="object"&&V!==null&&typeof V.toJSON=="function"&&(V=V.toJSON(X)),typeof V){case"string":return a(V);case"object":{if(V===null)return"null";if(k.indexOf(V)!==-1)return m;const se=oe;let de="",le=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(I<k.length+1)return'"[Array]"';k.push(V),G!==""&&(oe+=G,de+=`
|
|
42
|
-
${oe}`,le=`,
|
|
43
|
-
${oe}`);const J=Math.min(V.length,N);let ne=0;for(;ne<J-1;ne++){const z=M(String(ne),V[ne],k,$,G,oe);de+=z!==void 0?z:"null",de+=le}const q=M(String(ne),V[ne],k,$,G,oe);if(de+=q!==void 0?q:"null",V.length-1>N){const z=V.length-N-1;de+=`${le}"... ${g(z)} not stringified"`}return G!==""&&(de+=`
|
|
44
|
-
${se}`),k.pop(),`[${de}]`}k.push(V);let Ee="";G!==""&&(oe+=G,le=`,
|
|
45
|
-
${oe}`,Ee=" ");let pe="";for(const J of $){const ne=M(J,V[J],k,$,G,oe);ne!==void 0&&(de+=`${pe}${a(J)}:${Ee}${ne}`,pe=le)}return G!==""&&pe.length>1&&(de=`
|
|
46
|
-
${oe}${de}
|
|
47
|
-
${se}`),k.pop(),`{${de}}`}case"number":return isFinite(V)?String(V):w?w(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(V);default:return w?w(V):void 0}}function P(X,V,k,$,G){switch(typeof V){case"string":return a(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(X),typeof V!="object")return P(X,V,k,$,G);if(V===null)return"null"}if(k.indexOf(V)!==-1)return m;const oe=G;if(Array.isArray(V)){if(V.length===0)return"[]";if(I<k.length+1)return'"[Array]"';k.push(V),G+=$;let ne=`
|
|
48
|
-
${G}`;const q=`,
|
|
49
|
-
${G}`,z=Math.min(V.length,N);let W=0;for(;W<z-1;W++){const x=P(String(W),V[W],k,$,G);ne+=x!==void 0?x:"null",ne+=q}const _=P(String(W),V[W],k,$,G);if(ne+=_!==void 0?_:"null",V.length-1>N){const x=V.length-N-1;ne+=`${q}"... ${g(x)} not stringified"`}return ne+=`
|
|
50
|
-
${oe}`,k.pop(),`[${ne}]`}let se=Object.keys(V);const de=se.length;if(de===0)return"{}";if(I<k.length+1)return'"[Object]"';G+=$;const le=`,
|
|
51
|
-
${G}`;let Ee="",pe="",J=Math.min(de,N);u(V)&&(Ee+=c(V,le,N),se=se.slice(V.length),J-=V.length,pe=le),A&&(se=o(se)),k.push(V);for(let ne=0;ne<J;ne++){const q=se[ne],z=P(q,V[q],k,$,G);z!==void 0&&(Ee+=`${pe}${a(q)}: ${z}`,pe=le)}if(de>N){const ne=de-N;Ee+=`${pe}"...": "${g(ne)} not stringified"`,pe=le}return pe!==""&&(Ee=`
|
|
52
|
-
${G}${Ee}
|
|
53
|
-
${oe}`),k.pop(),`{${Ee}}`}case"number":return isFinite(V)?String(V):w?w(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(V);default:return w?w(V):void 0}}function L(X,V,k){switch(typeof V){case"string":return a(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(X),typeof V!="object")return L(X,V,k);if(V===null)return"null"}if(k.indexOf(V)!==-1)return m;let $="";if(Array.isArray(V)){if(V.length===0)return"[]";if(I<k.length+1)return'"[Array]"';k.push(V);const le=Math.min(V.length,N);let Ee=0;for(;Ee<le-1;Ee++){const J=L(String(Ee),V[Ee],k);$+=J!==void 0?J:"null",$+=","}const pe=L(String(Ee),V[Ee],k);if($+=pe!==void 0?pe:"null",V.length-1>N){const J=V.length-N-1;$+=`,"... ${g(J)} not stringified"`}return k.pop(),`[${$}]`}let G=Object.keys(V);const oe=G.length;if(oe===0)return"{}";if(I<k.length+1)return'"[Object]"';let se="",de=Math.min(oe,N);u(V)&&($+=c(V,",",N),G=G.slice(V.length),de-=V.length,se=","),A&&(G=o(G)),k.push(V);for(let le=0;le<de;le++){const Ee=G[le],pe=L(Ee,V[Ee],k);pe!==void 0&&($+=`${se}${a(Ee)}:${pe}`,se=",")}if(oe>N){const le=oe-N;$+=`${se}"...":"${g(le)} not stringified"`}return k.pop(),`{${$}}`}case"number":return isFinite(V)?String(V):w?w(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(V);default:return w?w(V):void 0}}function B(X,V,k){if(arguments.length>1){let $="";if(typeof k=="number"?$=" ".repeat(Math.min(k,10)):typeof k=="string"&&($=k.slice(0,10)),V!=null){if(typeof V=="function")return T("",{"":X},[],V,$,"");if(Array.isArray(V))return M("",X,[],h(V),$,"")}if($.length!==0)return P("",X,[],$,"")}return L("",X,[])}return B}})(Oi,Oi.exports);var YR=mr,WR=ht,zR=WR.MESSAGE,QR=Oi.exports;function XR(e,t){return typeof t=="bigint"?t.toString():t}var JR=YR(function(e,t){var r=QR.configure(t);return e[zR]=r(e,t.replacer||XR,t.space),e}),ZR=mr,eI=ZR(function(e,t){return t.message?(e.message="[".concat(t.label,"] ").concat(e.message),e):(e.label=t.label,e)}),tI=mr,rI=ht,nI=rI.MESSAGE,iI=Oi.exports,aI=tI(function(e){var t={};return e.message&&(t["@message"]=e.message,delete e.message),e.timestamp&&(t["@timestamp"]=e.timestamp,delete e.timestamp),t["@fields"]=e,e[nI]=iI(t),e});function oI(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var sI=mr;function uI(e,t,r){var n=t.reduce(function(a,o){return a[o]=e[o],delete e[o],a},{}),i=Object.keys(e).reduce(function(a,o){return a[o]=e[o],delete e[o],a},{});return Object.assign(e,n,oI({},r,i)),e}function cI(e,t,r){return e[r]=t.reduce(function(n,i){return n[i]=e[i],delete e[i],n},{}),e}var lI=sI(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r="metadata";t.key&&(r=t.key);var n=[];return!t.fillExcept&&!t.fillWith&&(n.push("level"),n.push("message")),t.fillExcept&&(n=t.fillExcept),n.length>0?uI(e,n,r):t.fillWith?cI(e,t.fillWith,r):e}),Pa=1e3,Na=Pa*60,Ba=Na*60,Mi=Ba*24,fI=Mi*7,dI=Mi*365.25,hI=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return pI(e);if(r==="number"&&isFinite(e))return t.long?yI(e):gI(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function pI(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*dI;case"weeks":case"week":case"w":return r*fI;case"days":case"day":case"d":return r*Mi;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Ba;case"minutes":case"minute":case"mins":case"min":case"m":return r*Na;case"seconds":case"second":case"secs":case"sec":case"s":return r*Pa;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function gI(e){var t=Math.abs(e);return t>=Mi?Math.round(e/Mi)+"d":t>=Ba?Math.round(e/Ba)+"h":t>=Na?Math.round(e/Na)+"m":t>=Pa?Math.round(e/Pa)+"s":e+"ms"}function yI(e){var t=Math.abs(e);return t>=Mi?qu(e,t,Mi,"day"):t>=Ba?qu(e,t,Ba,"hour"):t>=Na?qu(e,t,Na,"minute"):t>=Pa?qu(e,t,Pa,"second"):e+" ms"}function qu(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}var Vu=void 0,vI=mr,mI=hI,EI=vI(function(e){var t=+new Date;return Vu.diff=t-(Vu.prevTime||t),Vu.prevTime=t,e.ms="+".concat(mI(Vu.diff)),e}),bI=_e.inspect,_I=mr,dd=ht,SI=dd.LEVEL,Km=dd.MESSAGE,CI=dd.SPLAT,wI=_I(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=Object.assign({},e);return delete r[SI],delete r[Km],delete r[CI],e[Km]=bI(r,!1,t.depth||null,t.colorize),e}),Gu={exports:{}};function TI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function AI(e,t,r){return t&&qm(e.prototype,t),r&&qm(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var xI=ht,RI=xI.MESSAGE,Vm=function(){function e(t){TI(this,e),this.template=t}return AI(e,[{key:"transform",value:function(r){return r[RI]=this.template(r),r}}]),e}();Gu.exports=function(e){return new Vm(e)},Gu.exports.Printf=Gu.exports.Format=Vm;var II=mr,OI=ht,Gm=OI.MESSAGE,MI=Oi.exports,LI=II(function(e){var t=MI(Object.assign({},e,{level:void 0,message:void 0,splat:void 0})),r=e.padding&&e.padding[e.level]||"";return t!=="{}"?e[Gm]="".concat(e.level,":").concat(r," ").concat(e.message," ").concat(t):e[Gm]="".concat(e.level,":").concat(r," ").concat(e.message),e});function PI(e){return FI(e)||DI(e)||BI(e)||NI()}function NI(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
54
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BI(e,t){if(!!e){if(typeof e=="string")return hd(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hd(e,t)}}function DI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function FI(e){if(Array.isArray(e))return hd(e)}function hd(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function kI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function UI(e,t,r){return t&&Hm(e.prototype,t),r&&Hm(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ym=_e,$I=ht,Wm=$I.SPLAT,jI=/%[scdjifoO%]/g,KI=/%%/g,qI=function(){function e(t){kI(this,e),this.options=t}return UI(e,[{key:"_splat",value:function(r,n){var i=r.message,a=r[Wm]||r.splat||[],o=i.match(KI),s=o&&o.length||0,u=n.length-s,c=u-a.length,l=c<0?a.splice(c,-1*c):[],f=l.length;if(f)for(var d=0;d<f;d++)Object.assign(r,l[d]);return r.message=Ym.format.apply(Ym,[i].concat(PI(a))),r}},{key:"transform",value:function(r){var n=r.message,i=r[Wm]||r.splat;if(!i||!i.length)return r;var a=n&&n.match&&n.match(jI);if(!a&&(i||i.length)){var o=i.length>1?i.splice(0):i,s=o.length;if(s)for(var u=0;u<s;u++)Object.assign(r,o[u]);return r}return a?this._splat(r,a):r}}]),e}(),VI=function(e){return new qI(e)},zm=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Vn="\\d\\d?",Gn="\\d\\d",GI="\\d{3}",HI="\\d{4}",hs="[^\\s]+",Qm=/\[([^]*?)\]/gm;function Xm(e,t){for(var r=[],n=0,i=e.length;n<i;n++)r.push(e[n].substr(0,t));return r}var Jm=function(e){return function(t,r){var n=r[e].map(function(a){return a.toLowerCase()}),i=n.indexOf(t.toLowerCase());return i>-1?i:null}};function Hn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0,i=t;n<i.length;n++){var a=i[n];for(var o in a)e[o]=a[o]}return e}var Zm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],e1=["January","February","March","April","May","June","July","August","September","October","November","December"],YI=Xm(e1,3),WI=Xm(Zm,3),pd={dayNamesShort:WI,dayNames:Zm,monthNamesShort:YI,monthNames:e1,amPm:["am","pm"],DoFn:function(e){return e+["th","st","nd","rd"][e%10>3?0:(e-e%10!==10?1:0)*e%10]}},Hu=Hn({},pd),t1=function(e){return Hu=Hn(Hu,e)},r1=function(e){return e.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},ar=function(e,t){for(t===void 0&&(t=2),e=String(e);e.length<t;)e="0"+e;return e},zI={D:function(e){return String(e.getDate())},DD:function(e){return ar(e.getDate())},Do:function(e,t){return t.DoFn(e.getDate())},d:function(e){return String(e.getDay())},dd:function(e){return ar(e.getDay())},ddd:function(e,t){return t.dayNamesShort[e.getDay()]},dddd:function(e,t){return t.dayNames[e.getDay()]},M:function(e){return String(e.getMonth()+1)},MM:function(e){return ar(e.getMonth()+1)},MMM:function(e,t){return t.monthNamesShort[e.getMonth()]},MMMM:function(e,t){return t.monthNames[e.getMonth()]},YY:function(e){return ar(String(e.getFullYear()),4).substr(2)},YYYY:function(e){return ar(e.getFullYear(),4)},h:function(e){return String(e.getHours()%12||12)},hh:function(e){return ar(e.getHours()%12||12)},H:function(e){return String(e.getHours())},HH:function(e){return ar(e.getHours())},m:function(e){return String(e.getMinutes())},mm:function(e){return ar(e.getMinutes())},s:function(e){return String(e.getSeconds())},ss:function(e){return ar(e.getSeconds())},S:function(e){return String(Math.round(e.getMilliseconds()/100))},SS:function(e){return ar(Math.round(e.getMilliseconds()/10),2)},SSS:function(e){return ar(e.getMilliseconds(),3)},a:function(e,t){return e.getHours()<12?t.amPm[0]:t.amPm[1]},A:function(e,t){return e.getHours()<12?t.amPm[0].toUpperCase():t.amPm[1].toUpperCase()},ZZ:function(e){var t=e.getTimezoneOffset();return(t>0?"-":"+")+ar(Math.floor(Math.abs(t)/60)*100+Math.abs(t)%60,4)},Z:function(e){var t=e.getTimezoneOffset();return(t>0?"-":"+")+ar(Math.floor(Math.abs(t)/60),2)+":"+ar(Math.abs(t)%60,2)}},n1=function(e){return+e-1},i1=[null,Vn],a1=[null,hs],o1=["isPm",hs,function(e,t){var r=e.toLowerCase();return r===t.amPm[0]?0:r===t.amPm[1]?1:null}],s1=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(e){var t=(e+"").match(/([+-]|\d\d)/gi);if(t){var r=+t[1]*60+parseInt(t[2],10);return t[0]==="+"?r:-r}return 0}],QI={D:["day",Vn],DD:["day",Gn],Do:["day",Vn+hs,function(e){return parseInt(e,10)}],M:["month",Vn,n1],MM:["month",Gn,n1],YY:["year",Gn,function(e){var t=new Date,r=+(""+t.getFullYear()).substr(0,2);return+(""+(+e>68?r-1:r)+e)}],h:["hour",Vn,void 0,"isPm"],hh:["hour",Gn,void 0,"isPm"],H:["hour",Vn],HH:["hour",Gn],m:["minute",Vn],mm:["minute",Gn],s:["second",Vn],ss:["second",Gn],YYYY:["year",HI],S:["millisecond","\\d",function(e){return+e*100}],SS:["millisecond",Gn,function(e){return+e*10}],SSS:["millisecond",GI],d:i1,dd:i1,ddd:a1,dddd:a1,MMM:["month",hs,Jm("monthNamesShort")],MMMM:["month",hs,Jm("monthNames")],a:o1,A:o1,ZZ:s1,Z:s1},Yu={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},u1=function(e){return Hn(Yu,e)},c1=function(e,t,r){if(t===void 0&&(t=Yu.default),r===void 0&&(r={}),typeof e=="number"&&(e=new Date(e)),Object.prototype.toString.call(e)!=="[object Date]"||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");t=Yu[t]||t;var n=[];t=t.replace(Qm,function(a,o){return n.push(o),"@@@"});var i=Hn(Hn({},Hu),r);return t=t.replace(zm,function(a){return zI[a](e,i)}),t.replace(/@@@/g,function(){return n.shift()})};function l1(e,t,r){if(r===void 0&&(r={}),typeof t!="string")throw new Error("Invalid format in fecha parse");if(t=Yu[t]||t,e.length>1e3)return null;var n=new Date,i={year:n.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},a=[],o=[],s=t.replace(Qm,function(S,A){return o.push(r1(A)),"@@@"}),u={},c={};s=r1(s).replace(zm,function(S){var A=QI[S],I=A[0],N=A[1],T=A[3];if(u[I])throw new Error("Invalid format. "+I+" specified twice in format");return u[I]=!0,T&&(c[T]=!0),a.push(A),"("+N+")"}),Object.keys(c).forEach(function(S){if(!u[S])throw new Error("Invalid format. "+S+" is required in specified format")}),s=s.replace(/@@@/g,function(){return o.shift()});var l=e.match(new RegExp(s,"i"));if(!l)return null;for(var f=Hn(Hn({},Hu),r),d=1;d<l.length;d++){var g=a[d-1],h=g[0],v=g[2],p=v?v(l[d],f):+l[d];if(p==null)return null;i[h]=p}i.isPm===1&&i.hour!=null&&+i.hour!=12?i.hour=+i.hour+12:i.isPm===0&&+i.hour==12&&(i.hour=0);var y;if(i.timezoneOffset==null){y=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);for(var w=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],d=0,m=w.length;d<m;d++)if(u[w[d][0]]&&i[w[d][0]]!==y[w[d][1]]())return null}else if(y=new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond)),i.month>11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return y}var XI={format:c1,parse:l1,defaultI18n:pd,setGlobalDateI18n:t1,setGlobalDateMasks:u1},JI=pl(Object.freeze(Object.defineProperty({__proto__:null,default:XI,assign:Hn,format:c1,parse:l1,defaultI18n:pd,setGlobalDateI18n:t1,setGlobalDateMasks:u1},Symbol.toStringTag,{value:"Module"}))),ZI=mr,eO=ZI(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.format&&(e.timestamp=typeof t.format=="function"?t.format():JI.format(new Date,t.format)),e.timestamp||(e.timestamp=new Date().toISOString()),t.alias&&(e[t.alias]=e.timestamp),e}),gd=Gf.exports,tO=mr,rO=ht,yd=rO.MESSAGE,nO=tO(function(e,t){return t.level!==!1&&(e.level=gd.strip(e.level)),t.message!==!1&&(e.message=gd.strip(String(e.message))),t.raw!==!1&&e[yd]&&(e[yd]=gd.strip(String(e[yd]))),e}),Dt=ju.format=mr;ju.levels=wR,Object.defineProperty(Dt,"align",{value:AR}),Object.defineProperty(Dt,"cli",{value:ad.exports}),Object.defineProperty(Dt,"colorize",{value:Ma.exports}),Object.defineProperty(Dt,"combine",{value:cd.exports}),Object.defineProperty(Dt,"errors",{value:HR}),Object.defineProperty(Dt,"json",{value:JR}),Object.defineProperty(Dt,"label",{value:eI}),Object.defineProperty(Dt,"logstash",{value:aI}),Object.defineProperty(Dt,"metadata",{value:lI}),Object.defineProperty(Dt,"ms",{value:EI}),Object.defineProperty(Dt,"padLevels",{value:ds.exports}),Object.defineProperty(Dt,"prettyPrint",{value:wI}),Object.defineProperty(Dt,"printf",{value:Gu.exports}),Object.defineProperty(Dt,"simple",{value:LI}),Object.defineProperty(Dt,"splat",{value:VI}),Object.defineProperty(Dt,"timestamp",{value:eO}),Object.defineProperty(Dt,"uncolorize",{value:nO});var vd={};(function(e){var t=_e,r=t.format;e.warn={deprecated:function(i){return function(){throw new Error(r("{ %s } was removed in winston@3.0.0.",i))}},useFormat:function(i){return function(){throw new Error([r("{ %s } was removed in winston@3.0.0.",i),"Use a custom winston.format = winston.format(function) instead."].join(`
|
|
55
|
-
`))}},forFunctions:function(i,a,o){o.forEach(function(s){i[s]=e.warn[a](s)})},moved:function(i,a,o){function s(){return function(){throw new Error([r("winston.%s was moved in winston@3.0.0.",o),r("Use a winston.%s instead.",a)].join(`
|
|
56
|
-
`))}}Object.defineProperty(i,o,{get:s,set:s})},forProperties:function(i,a,o){o.forEach(function(s){var u=e.warn[a](s);Object.defineProperty(i,s,{get:u,set:u})})}}})(vd);const iO={name:"winston",description:"A logger for just about everything.",version:"3.8.2",author:"Charlie Robbins <charlie.robbins@gmail.com>",maintainers:["David Hyde <dabh@alumni.stanford.edu>"],repository:{type:"git",url:"https://github.com/winstonjs/winston.git"},keywords:["winston","logger","logging","logs","sysadmin","bunyan","pino","loglevel","tools","json","stream"],dependencies:{"@dabh/diagnostics":"^2.0.2","@colors/colors":"1.5.0",async:"^3.2.3","is-stream":"^2.0.0",logform:"^2.4.0","one-time":"^1.0.0","readable-stream":"^3.4.0","safe-stable-stringify":"^2.3.1","stack-trace":"0.0.x","triple-beam":"^1.3.0","winston-transport":"^4.5.0"},devDependencies:{"@babel/cli":"^7.17.0","@babel/core":"^7.17.2","@babel/preset-env":"^7.16.7","@dabh/eslint-config-populist":"^5.0.0","@types/node":"^18.0.0","abstract-winston-transport":"^0.5.1",assume:"^2.2.0","cross-spawn-async":"^2.2.5",eslint:"^8.9.0",hock:"^1.4.1",mocha:"8.1.3",nyc:"^15.1.0",rimraf:"^3.0.2",split2:"^4.1.0","std-mocks":"^1.0.1",through2:"^4.0.2","winston-compat":"^0.1.5"},main:"./lib/winston.js",browser:"./dist/winston",types:"./index.d.ts",scripts:{lint:"eslint lib/*.js lib/winston/*.js lib/winston/**/*.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist",test:"mocha","test:coverage":"nyc npm run test:unit","test:unit":"mocha test/unit","test:integration":"mocha test/integration",build:"rimraf dist && babel lib -d dist",prepublishOnly:"npm run build"},engines:{node:">= 12.0.0"},license:"MIT"};var f1={},Wu={exports:{}},aO=oO;function oO(e,t){if(md("noDeprecation"))return e;var r=!1;function n(){if(!r){if(md("throwDeprecation"))throw new Error(t);md("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function md(e){try{if(!me.localStorage)return!1}catch{return!1}var t=me.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var d1=Ra.exports.EventEmitter,Da={},zu={};zu.byteLength=cO,zu.toByteArray=fO,zu.fromByteArray=pO;for(var Zr=[],xr=[],sO=typeof Uint8Array<"u"?Uint8Array:Array,Ed="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fa=0,uO=Ed.length;Fa<uO;++Fa)Zr[Fa]=Ed[Fa],xr[Ed.charCodeAt(Fa)]=Fa;xr["-".charCodeAt(0)]=62,xr["_".charCodeAt(0)]=63;function h1(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function cO(e){var t=h1(e),r=t[0],n=t[1];return(r+n)*3/4-n}function lO(e,t,r){return(t+r)*3/4-r}function fO(e){var t,r=h1(e),n=r[0],i=r[1],a=new sO(lO(e,n,i)),o=0,s=i>0?n-4:n,u;for(u=0;u<s;u+=4)t=xr[e.charCodeAt(u)]<<18|xr[e.charCodeAt(u+1)]<<12|xr[e.charCodeAt(u+2)]<<6|xr[e.charCodeAt(u+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=xr[e.charCodeAt(u)]<<2|xr[e.charCodeAt(u+1)]>>4,a[o++]=t&255),i===1&&(t=xr[e.charCodeAt(u)]<<10|xr[e.charCodeAt(u+1)]<<4|xr[e.charCodeAt(u+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function dO(e){return Zr[e>>18&63]+Zr[e>>12&63]+Zr[e>>6&63]+Zr[e&63]}function hO(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(dO(n));return i.join("")}function pO(e){for(var t,r=e.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(hO(e,o,o+a>s?s:o+a));return n===1?(t=e[r-1],i.push(Zr[t>>2]+Zr[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Zr[t>>10]+Zr[t>>4&63]+Zr[t<<2&63]+"=")),i.join("")}var bd={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */bd.read=function(e,t,r,n,i){var a,o,s=i*8-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,d=r?-1:1,g=e[t+f];for(f+=d,a=g&(1<<-l)-1,g>>=-l,l+=s;l>0;a=a*256+e[t+f],f+=d,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=o*256+e[t+f],f+=d,l-=8);if(a===0)a=1-c;else{if(a===u)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-c}return(g?-1:1)*o*Math.pow(2,a-n)},bd.write=function(e,t,r,n,i,a){var o,s,u,c=a*8-i-1,l=(1<<c)-1,f=l>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,h=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+f>=1?t+=d/u:t+=d*Math.pow(2,1-f),t*u>=2&&(o++,u/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o=o+f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+g]=s&255,g+=h,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+g]=o&255,g+=h,o/=256,c-=8);e[r+g-h]|=v*128};/*!
|
|
57
|
-
* The buffer module from node.js, for the browser.
|
|
58
|
-
*
|
|
59
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
60
|
-
* @license MIT
|
|
61
|
-
*/(function(e){const t=zu,r=bd,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{const O=new Uint8Array(1),b={foo:function(){return 42}};return Object.setPrototypeOf(b,Uint8Array.prototype),Object.setPrototypeOf(O,b),O.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.byteOffset}});function o(O){if(O>i)throw new RangeError('The value "'+O+'" is invalid for option "size"');const b=new Uint8Array(O);return Object.setPrototypeOf(b,s.prototype),b}function s(O,b,C){if(typeof O=="number"){if(typeof b=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(O)}return u(O,b,C)}s.poolSize=8192;function u(O,b,C){if(typeof O=="string")return d(O,b);if(ArrayBuffer.isView(O))return h(O);if(O==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof O);if(We(O,ArrayBuffer)||O&&We(O.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(We(O,SharedArrayBuffer)||O&&We(O.buffer,SharedArrayBuffer)))return v(O,b,C);if(typeof O=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const j=O.valueOf&&O.valueOf();if(j!=null&&j!==O)return s.from(j,b,C);const Y=p(O);if(Y)return Y;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof O[Symbol.toPrimitive]=="function")return s.from(O[Symbol.toPrimitive]("string"),b,C);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof O)}s.from=function(O,b,C){return u(O,b,C)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(O){if(typeof O!="number")throw new TypeError('"size" argument must be of type number');if(O<0)throw new RangeError('The value "'+O+'" is invalid for option "size"')}function l(O,b,C){return c(O),O<=0?o(O):b!==void 0?typeof C=="string"?o(O).fill(b,C):o(O).fill(b):o(O)}s.alloc=function(O,b,C){return l(O,b,C)};function f(O){return c(O),o(O<0?0:y(O)|0)}s.allocUnsafe=function(O){return f(O)},s.allocUnsafeSlow=function(O){return f(O)};function d(O,b){if((typeof b!="string"||b==="")&&(b="utf8"),!s.isEncoding(b))throw new TypeError("Unknown encoding: "+b);const C=m(O,b)|0;let j=o(C);const Y=j.write(O,b);return Y!==C&&(j=j.slice(0,Y)),j}function g(O){const b=O.length<0?0:y(O.length)|0,C=o(b);for(let j=0;j<b;j+=1)C[j]=O[j]&255;return C}function h(O){if(We(O,Uint8Array)){const b=new Uint8Array(O);return v(b.buffer,b.byteOffset,b.byteLength)}return g(O)}function v(O,b,C){if(b<0||O.byteLength<b)throw new RangeError('"offset" is outside of buffer bounds');if(O.byteLength<b+(C||0))throw new RangeError('"length" is outside of buffer bounds');let j;return b===void 0&&C===void 0?j=new Uint8Array(O):C===void 0?j=new Uint8Array(O,b):j=new Uint8Array(O,b,C),Object.setPrototypeOf(j,s.prototype),j}function p(O){if(s.isBuffer(O)){const b=y(O.length)|0,C=o(b);return C.length===0||O.copy(C,0,0,b),C}if(O.length!==void 0)return typeof O.length!="number"||Pt(O.length)?o(0):g(O);if(O.type==="Buffer"&&Array.isArray(O.data))return g(O.data)}function y(O){if(O>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return O|0}function w(O){return+O!=O&&(O=0),s.alloc(+O)}s.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==s.prototype},s.compare=function(b,C){if(We(b,Uint8Array)&&(b=s.from(b,b.offset,b.byteLength)),We(C,Uint8Array)&&(C=s.from(C,C.offset,C.byteLength)),!s.isBuffer(b)||!s.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(b===C)return 0;let j=b.length,Y=C.length;for(let te=0,ae=Math.min(j,Y);te<ae;++te)if(b[te]!==C[te]){j=b[te],Y=C[te];break}return j<Y?-1:Y<j?1:0},s.isEncoding=function(b){switch(String(b).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(b,C){if(!Array.isArray(b))throw new TypeError('"list" argument must be an Array of Buffers');if(b.length===0)return s.alloc(0);let j;if(C===void 0)for(C=0,j=0;j<b.length;++j)C+=b[j].length;const Y=s.allocUnsafe(C);let te=0;for(j=0;j<b.length;++j){let ae=b[j];if(We(ae,Uint8Array))te+ae.length>Y.length?(s.isBuffer(ae)||(ae=s.from(ae)),ae.copy(Y,te)):Uint8Array.prototype.set.call(Y,ae,te);else if(s.isBuffer(ae))ae.copy(Y,te);else throw new TypeError('"list" argument must be an Array of Buffers');te+=ae.length}return Y};function m(O,b){if(s.isBuffer(O))return O.length;if(ArrayBuffer.isView(O)||We(O,ArrayBuffer))return O.byteLength;if(typeof O!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof O);const C=O.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&C===0)return 0;let Y=!1;for(;;)switch(b){case"ascii":case"latin1":case"binary":return C;case"utf8":case"utf-8":return Me(O).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C*2;case"hex":return C>>>1;case"base64":return mt(O).length;default:if(Y)return j?-1:Me(O).length;b=(""+b).toLowerCase(),Y=!0}}s.byteLength=m;function S(O,b,C){let j=!1;if((b===void 0||b<0)&&(b=0),b>this.length||((C===void 0||C>this.length)&&(C=this.length),C<=0)||(C>>>=0,b>>>=0,C<=b))return"";for(O||(O="utf8");;)switch(O){case"hex":return se(this,b,C);case"utf8":case"utf-8":return V(this,b,C);case"ascii":return G(this,b,C);case"latin1":case"binary":return oe(this,b,C);case"base64":return X(this,b,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,b,C);default:if(j)throw new TypeError("Unknown encoding: "+O);O=(O+"").toLowerCase(),j=!0}}s.prototype._isBuffer=!0;function A(O,b,C){const j=O[b];O[b]=O[C],O[C]=j}s.prototype.swap16=function(){const b=this.length;if(b%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<b;C+=2)A(this,C,C+1);return this},s.prototype.swap32=function(){const b=this.length;if(b%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<b;C+=4)A(this,C,C+3),A(this,C+1,C+2);return this},s.prototype.swap64=function(){const b=this.length;if(b%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<b;C+=8)A(this,C,C+7),A(this,C+1,C+6),A(this,C+2,C+5),A(this,C+3,C+4);return this},s.prototype.toString=function(){const b=this.length;return b===0?"":arguments.length===0?V(this,0,b):S.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(b){if(!s.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b?!0:s.compare(this,b)===0},s.prototype.inspect=function(){let b="";const C=e.INSPECT_MAX_BYTES;return b=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(b+=" ... "),"<Buffer "+b+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(b,C,j,Y,te){if(We(b,Uint8Array)&&(b=s.from(b,b.offset,b.byteLength)),!s.isBuffer(b))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof b);if(C===void 0&&(C=0),j===void 0&&(j=b?b.length:0),Y===void 0&&(Y=0),te===void 0&&(te=this.length),C<0||j>b.length||Y<0||te>this.length)throw new RangeError("out of range index");if(Y>=te&&C>=j)return 0;if(Y>=te)return-1;if(C>=j)return 1;if(C>>>=0,j>>>=0,Y>>>=0,te>>>=0,this===b)return 0;let ae=te-Y,Re=j-C;const Je=Math.min(ae,Re),it=this.slice(Y,te),Et=b.slice(C,j);for(let at=0;at<Je;++at)if(it[at]!==Et[at]){ae=it[at],Re=Et[at];break}return ae<Re?-1:Re<ae?1:0};function I(O,b,C,j,Y){if(O.length===0)return-1;if(typeof C=="string"?(j=C,C=0):C>2147483647?C=2147483647:C<-2147483648&&(C=-2147483648),C=+C,Pt(C)&&(C=Y?0:O.length-1),C<0&&(C=O.length+C),C>=O.length){if(Y)return-1;C=O.length-1}else if(C<0)if(Y)C=0;else return-1;if(typeof b=="string"&&(b=s.from(b,j)),s.isBuffer(b))return b.length===0?-1:N(O,b,C,j,Y);if(typeof b=="number")return b=b&255,typeof Uint8Array.prototype.indexOf=="function"?Y?Uint8Array.prototype.indexOf.call(O,b,C):Uint8Array.prototype.lastIndexOf.call(O,b,C):N(O,[b],C,j,Y);throw new TypeError("val must be string, number or Buffer")}function N(O,b,C,j,Y){let te=1,ae=O.length,Re=b.length;if(j!==void 0&&(j=String(j).toLowerCase(),j==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(O.length<2||b.length<2)return-1;te=2,ae/=2,Re/=2,C/=2}function Je(Et,at){return te===1?Et[at]:Et.readUInt16BE(at*te)}let it;if(Y){let Et=-1;for(it=C;it<ae;it++)if(Je(O,it)===Je(b,Et===-1?0:it-Et)){if(Et===-1&&(Et=it),it-Et+1===Re)return Et*te}else Et!==-1&&(it-=it-Et),Et=-1}else for(C+Re>ae&&(C=ae-Re),it=C;it>=0;it--){let Et=!0;for(let at=0;at<Re;at++)if(Je(O,it+at)!==Je(b,at)){Et=!1;break}if(Et)return it}return-1}s.prototype.includes=function(b,C,j){return this.indexOf(b,C,j)!==-1},s.prototype.indexOf=function(b,C,j){return I(this,b,C,j,!0)},s.prototype.lastIndexOf=function(b,C,j){return I(this,b,C,j,!1)};function T(O,b,C,j){C=Number(C)||0;const Y=O.length-C;j?(j=Number(j),j>Y&&(j=Y)):j=Y;const te=b.length;j>te/2&&(j=te/2);let ae;for(ae=0;ae<j;++ae){const Re=parseInt(b.substr(ae*2,2),16);if(Pt(Re))return ae;O[C+ae]=Re}return ae}function M(O,b,C,j){return nt(Me(b,O.length-C),O,C,j)}function P(O,b,C,j){return nt(vt(b),O,C,j)}function L(O,b,C,j){return nt(mt(b),O,C,j)}function B(O,b,C,j){return nt(lt(b,O.length-C),O,C,j)}s.prototype.write=function(b,C,j,Y){if(C===void 0)Y="utf8",j=this.length,C=0;else if(j===void 0&&typeof C=="string")Y=C,j=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(j)?(j=j>>>0,Y===void 0&&(Y="utf8")):(Y=j,j=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const te=this.length-C;if((j===void 0||j>te)&&(j=te),b.length>0&&(j<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");Y||(Y="utf8");let ae=!1;for(;;)switch(Y){case"hex":return T(this,b,C,j);case"utf8":case"utf-8":return M(this,b,C,j);case"ascii":case"latin1":case"binary":return P(this,b,C,j);case"base64":return L(this,b,C,j);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,b,C,j);default:if(ae)throw new TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),ae=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function X(O,b,C){return b===0&&C===O.length?t.fromByteArray(O):t.fromByteArray(O.slice(b,C))}function V(O,b,C){C=Math.min(O.length,C);const j=[];let Y=b;for(;Y<C;){const te=O[Y];let ae=null,Re=te>239?4:te>223?3:te>191?2:1;if(Y+Re<=C){let Je,it,Et,at;switch(Re){case 1:te<128&&(ae=te);break;case 2:Je=O[Y+1],(Je&192)===128&&(at=(te&31)<<6|Je&63,at>127&&(ae=at));break;case 3:Je=O[Y+1],it=O[Y+2],(Je&192)===128&&(it&192)===128&&(at=(te&15)<<12|(Je&63)<<6|it&63,at>2047&&(at<55296||at>57343)&&(ae=at));break;case 4:Je=O[Y+1],it=O[Y+2],Et=O[Y+3],(Je&192)===128&&(it&192)===128&&(Et&192)===128&&(at=(te&15)<<18|(Je&63)<<12|(it&63)<<6|Et&63,at>65535&&at<1114112&&(ae=at))}}ae===null?(ae=65533,Re=1):ae>65535&&(ae-=65536,j.push(ae>>>10&1023|55296),ae=56320|ae&1023),j.push(ae),Y+=Re}return $(j)}const k=4096;function $(O){const b=O.length;if(b<=k)return String.fromCharCode.apply(String,O);let C="",j=0;for(;j<b;)C+=String.fromCharCode.apply(String,O.slice(j,j+=k));return C}function G(O,b,C){let j="";C=Math.min(O.length,C);for(let Y=b;Y<C;++Y)j+=String.fromCharCode(O[Y]&127);return j}function oe(O,b,C){let j="";C=Math.min(O.length,C);for(let Y=b;Y<C;++Y)j+=String.fromCharCode(O[Y]);return j}function se(O,b,C){const j=O.length;(!b||b<0)&&(b=0),(!C||C<0||C>j)&&(C=j);let Y="";for(let te=b;te<C;++te)Y+=re[O[te]];return Y}function de(O,b,C){const j=O.slice(b,C);let Y="";for(let te=0;te<j.length-1;te+=2)Y+=String.fromCharCode(j[te]+j[te+1]*256);return Y}s.prototype.slice=function(b,C){const j=this.length;b=~~b,C=C===void 0?j:~~C,b<0?(b+=j,b<0&&(b=0)):b>j&&(b=j),C<0?(C+=j,C<0&&(C=0)):C>j&&(C=j),C<b&&(C=b);const Y=this.subarray(b,C);return Object.setPrototypeOf(Y,s.prototype),Y};function le(O,b,C){if(O%1!==0||O<0)throw new RangeError("offset is not uint");if(O+b>C)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(b,C,j){b=b>>>0,C=C>>>0,j||le(b,C,this.length);let Y=this[b],te=1,ae=0;for(;++ae<C&&(te*=256);)Y+=this[b+ae]*te;return Y},s.prototype.readUintBE=s.prototype.readUIntBE=function(b,C,j){b=b>>>0,C=C>>>0,j||le(b,C,this.length);let Y=this[b+--C],te=1;for(;C>0&&(te*=256);)Y+=this[b+--C]*te;return Y},s.prototype.readUint8=s.prototype.readUInt8=function(b,C){return b=b>>>0,C||le(b,1,this.length),this[b]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(b,C){return b=b>>>0,C||le(b,2,this.length),this[b]|this[b+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(b,C){return b=b>>>0,C||le(b,2,this.length),this[b]<<8|this[b+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(b,C){return b=b>>>0,C||le(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+this[b+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(b,C){return b=b>>>0,C||le(b,4,this.length),this[b]*16777216+(this[b+1]<<16|this[b+2]<<8|this[b+3])},s.prototype.readBigUInt64LE=ue(function(b){b=b>>>0,K(b,"offset");const C=this[b],j=this[b+7];(C===void 0||j===void 0)&&Q(b,this.length-8);const Y=C+this[++b]*2**8+this[++b]*2**16+this[++b]*2**24,te=this[++b]+this[++b]*2**8+this[++b]*2**16+j*2**24;return BigInt(Y)+(BigInt(te)<<BigInt(32))}),s.prototype.readBigUInt64BE=ue(function(b){b=b>>>0,K(b,"offset");const C=this[b],j=this[b+7];(C===void 0||j===void 0)&&Q(b,this.length-8);const Y=C*2**24+this[++b]*2**16+this[++b]*2**8+this[++b],te=this[++b]*2**24+this[++b]*2**16+this[++b]*2**8+j;return(BigInt(Y)<<BigInt(32))+BigInt(te)}),s.prototype.readIntLE=function(b,C,j){b=b>>>0,C=C>>>0,j||le(b,C,this.length);let Y=this[b],te=1,ae=0;for(;++ae<C&&(te*=256);)Y+=this[b+ae]*te;return te*=128,Y>=te&&(Y-=Math.pow(2,8*C)),Y},s.prototype.readIntBE=function(b,C,j){b=b>>>0,C=C>>>0,j||le(b,C,this.length);let Y=C,te=1,ae=this[b+--Y];for(;Y>0&&(te*=256);)ae+=this[b+--Y]*te;return te*=128,ae>=te&&(ae-=Math.pow(2,8*C)),ae},s.prototype.readInt8=function(b,C){return b=b>>>0,C||le(b,1,this.length),this[b]&128?(255-this[b]+1)*-1:this[b]},s.prototype.readInt16LE=function(b,C){b=b>>>0,C||le(b,2,this.length);const j=this[b]|this[b+1]<<8;return j&32768?j|4294901760:j},s.prototype.readInt16BE=function(b,C){b=b>>>0,C||le(b,2,this.length);const j=this[b+1]|this[b]<<8;return j&32768?j|4294901760:j},s.prototype.readInt32LE=function(b,C){return b=b>>>0,C||le(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},s.prototype.readInt32BE=function(b,C){return b=b>>>0,C||le(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},s.prototype.readBigInt64LE=ue(function(b){b=b>>>0,K(b,"offset");const C=this[b],j=this[b+7];(C===void 0||j===void 0)&&Q(b,this.length-8);const Y=this[b+4]+this[b+5]*2**8+this[b+6]*2**16+(j<<24);return(BigInt(Y)<<BigInt(32))+BigInt(C+this[++b]*2**8+this[++b]*2**16+this[++b]*2**24)}),s.prototype.readBigInt64BE=ue(function(b){b=b>>>0,K(b,"offset");const C=this[b],j=this[b+7];(C===void 0||j===void 0)&&Q(b,this.length-8);const Y=(C<<24)+this[++b]*2**16+this[++b]*2**8+this[++b];return(BigInt(Y)<<BigInt(32))+BigInt(this[++b]*2**24+this[++b]*2**16+this[++b]*2**8+j)}),s.prototype.readFloatLE=function(b,C){return b=b>>>0,C||le(b,4,this.length),r.read(this,b,!0,23,4)},s.prototype.readFloatBE=function(b,C){return b=b>>>0,C||le(b,4,this.length),r.read(this,b,!1,23,4)},s.prototype.readDoubleLE=function(b,C){return b=b>>>0,C||le(b,8,this.length),r.read(this,b,!0,52,8)},s.prototype.readDoubleBE=function(b,C){return b=b>>>0,C||le(b,8,this.length),r.read(this,b,!1,52,8)};function Ee(O,b,C,j,Y,te){if(!s.isBuffer(O))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>Y||b<te)throw new RangeError('"value" argument is out of bounds');if(C+j>O.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(b,C,j,Y){if(b=+b,C=C>>>0,j=j>>>0,!Y){const Re=Math.pow(2,8*j)-1;Ee(this,b,C,j,Re,0)}let te=1,ae=0;for(this[C]=b&255;++ae<j&&(te*=256);)this[C+ae]=b/te&255;return C+j},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(b,C,j,Y){if(b=+b,C=C>>>0,j=j>>>0,!Y){const Re=Math.pow(2,8*j)-1;Ee(this,b,C,j,Re,0)}let te=j-1,ae=1;for(this[C+te]=b&255;--te>=0&&(ae*=256);)this[C+te]=b/ae&255;return C+j},s.prototype.writeUint8=s.prototype.writeUInt8=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,1,255,0),this[C]=b&255,C+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,2,65535,0),this[C]=b&255,this[C+1]=b>>>8,C+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,2,65535,0),this[C]=b>>>8,this[C+1]=b&255,C+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,4,4294967295,0),this[C+3]=b>>>24,this[C+2]=b>>>16,this[C+1]=b>>>8,this[C]=b&255,C+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,4,4294967295,0),this[C]=b>>>24,this[C+1]=b>>>16,this[C+2]=b>>>8,this[C+3]=b&255,C+4};function pe(O,b,C,j,Y){R(b,j,Y,O,C,7);let te=Number(b&BigInt(4294967295));O[C++]=te,te=te>>8,O[C++]=te,te=te>>8,O[C++]=te,te=te>>8,O[C++]=te;let ae=Number(b>>BigInt(32)&BigInt(4294967295));return O[C++]=ae,ae=ae>>8,O[C++]=ae,ae=ae>>8,O[C++]=ae,ae=ae>>8,O[C++]=ae,C}function J(O,b,C,j,Y){R(b,j,Y,O,C,7);let te=Number(b&BigInt(4294967295));O[C+7]=te,te=te>>8,O[C+6]=te,te=te>>8,O[C+5]=te,te=te>>8,O[C+4]=te;let ae=Number(b>>BigInt(32)&BigInt(4294967295));return O[C+3]=ae,ae=ae>>8,O[C+2]=ae,ae=ae>>8,O[C+1]=ae,ae=ae>>8,O[C]=ae,C+8}s.prototype.writeBigUInt64LE=ue(function(b,C=0){return pe(this,b,C,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=ue(function(b,C=0){return J(this,b,C,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(b,C,j,Y){if(b=+b,C=C>>>0,!Y){const Je=Math.pow(2,8*j-1);Ee(this,b,C,j,Je-1,-Je)}let te=0,ae=1,Re=0;for(this[C]=b&255;++te<j&&(ae*=256);)b<0&&Re===0&&this[C+te-1]!==0&&(Re=1),this[C+te]=(b/ae>>0)-Re&255;return C+j},s.prototype.writeIntBE=function(b,C,j,Y){if(b=+b,C=C>>>0,!Y){const Je=Math.pow(2,8*j-1);Ee(this,b,C,j,Je-1,-Je)}let te=j-1,ae=1,Re=0;for(this[C+te]=b&255;--te>=0&&(ae*=256);)b<0&&Re===0&&this[C+te+1]!==0&&(Re=1),this[C+te]=(b/ae>>0)-Re&255;return C+j},s.prototype.writeInt8=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,1,127,-128),b<0&&(b=255+b+1),this[C]=b&255,C+1},s.prototype.writeInt16LE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,2,32767,-32768),this[C]=b&255,this[C+1]=b>>>8,C+2},s.prototype.writeInt16BE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,2,32767,-32768),this[C]=b>>>8,this[C+1]=b&255,C+2},s.prototype.writeInt32LE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,4,2147483647,-2147483648),this[C]=b&255,this[C+1]=b>>>8,this[C+2]=b>>>16,this[C+3]=b>>>24,C+4},s.prototype.writeInt32BE=function(b,C,j){return b=+b,C=C>>>0,j||Ee(this,b,C,4,2147483647,-2147483648),b<0&&(b=4294967295+b+1),this[C]=b>>>24,this[C+1]=b>>>16,this[C+2]=b>>>8,this[C+3]=b&255,C+4},s.prototype.writeBigInt64LE=ue(function(b,C=0){return pe(this,b,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=ue(function(b,C=0){return J(this,b,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ne(O,b,C,j,Y,te){if(C+j>O.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("Index out of range")}function q(O,b,C,j,Y){return b=+b,C=C>>>0,Y||ne(O,b,C,4),r.write(O,b,C,j,23,4),C+4}s.prototype.writeFloatLE=function(b,C,j){return q(this,b,C,!0,j)},s.prototype.writeFloatBE=function(b,C,j){return q(this,b,C,!1,j)};function z(O,b,C,j,Y){return b=+b,C=C>>>0,Y||ne(O,b,C,8),r.write(O,b,C,j,52,8),C+8}s.prototype.writeDoubleLE=function(b,C,j){return z(this,b,C,!0,j)},s.prototype.writeDoubleBE=function(b,C,j){return z(this,b,C,!1,j)},s.prototype.copy=function(b,C,j,Y){if(!s.isBuffer(b))throw new TypeError("argument should be a Buffer");if(j||(j=0),!Y&&Y!==0&&(Y=this.length),C>=b.length&&(C=b.length),C||(C=0),Y>0&&Y<j&&(Y=j),Y===j||b.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(j<0||j>=this.length)throw new RangeError("Index out of range");if(Y<0)throw new RangeError("sourceEnd out of bounds");Y>this.length&&(Y=this.length),b.length-C<Y-j&&(Y=b.length-C+j);const te=Y-j;return this===b&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,j,Y):Uint8Array.prototype.set.call(b,this.subarray(j,Y),C),te},s.prototype.fill=function(b,C,j,Y){if(typeof b=="string"){if(typeof C=="string"?(Y=C,C=0,j=this.length):typeof j=="string"&&(Y=j,j=this.length),Y!==void 0&&typeof Y!="string")throw new TypeError("encoding must be a string");if(typeof Y=="string"&&!s.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);if(b.length===1){const ae=b.charCodeAt(0);(Y==="utf8"&&ae<128||Y==="latin1")&&(b=ae)}}else typeof b=="number"?b=b&255:typeof b=="boolean"&&(b=Number(b));if(C<0||this.length<C||this.length<j)throw new RangeError("Out of range index");if(j<=C)return this;C=C>>>0,j=j===void 0?this.length:j>>>0,b||(b=0);let te;if(typeof b=="number")for(te=C;te<j;++te)this[te]=b;else{const ae=s.isBuffer(b)?b:s.from(b,Y),Re=ae.length;if(Re===0)throw new TypeError('The value "'+b+'" is invalid for argument "value"');for(te=0;te<j-C;++te)this[te+C]=ae[te%Re]}return this};const W={};function _(O,b,C){W[O]=class extends C{constructor(){super(),Object.defineProperty(this,"message",{value:b.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${O}]`,this.stack,delete this.name}get code(){return O}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${O}]: ${this.message}`}}}_("ERR_BUFFER_OUT_OF_BOUNDS",function(O){return O?`${O} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),_("ERR_INVALID_ARG_TYPE",function(O,b){return`The "${O}" argument must be of type number. Received type ${typeof b}`},TypeError),_("ERR_OUT_OF_RANGE",function(O,b,C){let j=`The value of "${O}" is out of range.`,Y=C;return Number.isInteger(C)&&Math.abs(C)>2**32?Y=x(String(C)):typeof C=="bigint"&&(Y=String(C),(C>BigInt(2)**BigInt(32)||C<-(BigInt(2)**BigInt(32)))&&(Y=x(Y)),Y+="n"),j+=` It must be ${b}. Received ${Y}`,j},RangeError);function x(O){let b="",C=O.length;const j=O[0]==="-"?1:0;for(;C>=j+4;C-=3)b=`_${O.slice(C-3,C)}${b}`;return`${O.slice(0,C)}${b}`}function E(O,b,C){K(b,"offset"),(O[b]===void 0||O[b+C]===void 0)&&Q(b,O.length-(C+1))}function R(O,b,C,j,Y,te){if(O>C||O<b){const ae=typeof b=="bigint"?"n":"";let Re;throw te>3?b===0||b===BigInt(0)?Re=`>= 0${ae} and < 2${ae} ** ${(te+1)*8}${ae}`:Re=`>= -(2${ae} ** ${(te+1)*8-1}${ae}) and < 2 ** ${(te+1)*8-1}${ae}`:Re=`>= ${b}${ae} and <= ${C}${ae}`,new W.ERR_OUT_OF_RANGE("value",Re,O)}E(j,Y,te)}function K(O,b){if(typeof O!="number")throw new W.ERR_INVALID_ARG_TYPE(b,"number",O)}function Q(O,b,C){throw Math.floor(O)!==O?(K(O,C),new W.ERR_OUT_OF_RANGE(C||"offset","an integer",O)):b<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE(C||"offset",`>= ${C?1:0} and <= ${b}`,O)}const he=/[^+/0-9A-Za-z-_]/g;function Ce(O){if(O=O.split("=")[0],O=O.trim().replace(he,""),O.length<2)return"";for(;O.length%4!==0;)O=O+"=";return O}function Me(O,b){b=b||1/0;let C;const j=O.length;let Y=null;const te=[];for(let ae=0;ae<j;++ae){if(C=O.charCodeAt(ae),C>55295&&C<57344){if(!Y){if(C>56319){(b-=3)>-1&&te.push(239,191,189);continue}else if(ae+1===j){(b-=3)>-1&&te.push(239,191,189);continue}Y=C;continue}if(C<56320){(b-=3)>-1&&te.push(239,191,189),Y=C;continue}C=(Y-55296<<10|C-56320)+65536}else Y&&(b-=3)>-1&&te.push(239,191,189);if(Y=null,C<128){if((b-=1)<0)break;te.push(C)}else if(C<2048){if((b-=2)<0)break;te.push(C>>6|192,C&63|128)}else if(C<65536){if((b-=3)<0)break;te.push(C>>12|224,C>>6&63|128,C&63|128)}else if(C<1114112){if((b-=4)<0)break;te.push(C>>18|240,C>>12&63|128,C>>6&63|128,C&63|128)}else throw new Error("Invalid code point")}return te}function vt(O){const b=[];for(let C=0;C<O.length;++C)b.push(O.charCodeAt(C)&255);return b}function lt(O,b){let C,j,Y;const te=[];for(let ae=0;ae<O.length&&!((b-=2)<0);++ae)C=O.charCodeAt(ae),j=C>>8,Y=C%256,te.push(Y),te.push(j);return te}function mt(O){return t.toByteArray(Ce(O))}function nt(O,b,C,j){let Y;for(Y=0;Y<j&&!(Y+C>=b.length||Y>=O.length);++Y)b[Y+C]=O[Y];return Y}function We(O,b){return O instanceof b||O!=null&&O.constructor!=null&&O.constructor.name!=null&&O.constructor.name===b.name}function Pt(O){return O!==O}const re=function(){const O="0123456789abcdef",b=new Array(256);for(let C=0;C<16;++C){const j=C*16;for(let Y=0;Y<16;++Y)b[j+Y]=O[C]+O[Y]}return b}();function ue(O){return typeof BigInt>"u"?ve:O}function ve(){throw new Error("BigInt not supported")}})(Da);function gO(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(_d,this,e)):process.nextTick(_d,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?r._writableState?r._writableState.errorEmitted?process.nextTick(Qu,r):(r._writableState.errorEmitted=!0,process.nextTick(p1,r,a)):process.nextTick(p1,r,a):t?(process.nextTick(Qu,r),t(a)):process.nextTick(Qu,r)}),this)}function p1(e,t){_d(e,t),Qu(e)}function Qu(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function yO(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function _d(e,t){e.emit("error",t)}function vO(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var g1={destroy:gO,undestroy:yO,errorOrDestroy:vO},Li={};function mO(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var y1={};function Rr(e,t,r){r||(r=Error);function n(a,o,s){return typeof t=="string"?t:t(a,o,s)}var i=function(a){mO(o,a);function o(s,u,c){return a.call(this,n(s,u,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=e,y1[e]=i}function v1(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function EO(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function bO(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function _O(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}Rr("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),Rr("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&EO(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(bO(e," argument"))i="The ".concat(e," ").concat(n," ").concat(v1(t,"type"));else{var a=_O(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(v1(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError),Rr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Rr("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),Rr("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Rr("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),Rr("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Rr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Rr("ERR_STREAM_WRITE_AFTER_END","write after end"),Rr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Rr("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),Rr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Li.codes=y1;var SO=Li.codes.ERR_INVALID_OPT_VALUE;function CO(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function wO(e,t,r,n){var i=CO(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var a=n?r:"highWaterMark";throw new SO(a,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var m1={getHighWaterMark:wO},Pi={exports:{}};typeof Object.create=="function"?Pi.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Pi.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}};var Sd,E1;function TO(){if(E1)return Sd;E1=1;function e(h,v){var p=Object.keys(h);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(h);v&&(y=y.filter(function(w){return Object.getOwnPropertyDescriptor(h,w).enumerable})),p.push.apply(p,y)}return p}function t(h){for(var v=1;v<arguments.length;v++){var p=arguments[v]!=null?arguments[v]:{};v%2?e(Object(p),!0).forEach(function(y){r(h,y,p[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(p)):e(Object(p)).forEach(function(y){Object.defineProperty(h,y,Object.getOwnPropertyDescriptor(p,y))})}return h}function r(h,v,p){return v=o(v),v in h?Object.defineProperty(h,v,{value:p,enumerable:!0,configurable:!0,writable:!0}):h[v]=p,h}function n(h,v){if(!(h instanceof v))throw new TypeError("Cannot call a class as a function")}function i(h,v){for(var p=0;p<v.length;p++){var y=v[p];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(h,o(y.key),y)}}function a(h,v,p){return v&&i(h.prototype,v),p&&i(h,p),Object.defineProperty(h,"prototype",{writable:!1}),h}function o(h){var v=s(h,"string");return typeof v=="symbol"?v:String(v)}function s(h,v){if(typeof h!="object"||h===null)return h;var p=h[Symbol.toPrimitive];if(p!==void 0){var y=p.call(h,v||"default");if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(v==="string"?String:Number)(h)}var u=Da,c=u.Buffer,l=_e,f=l.inspect,d=f&&f.custom||"inspect";function g(h,v,p){c.prototype.copy.call(h,v,p)}return Sd=function(){function h(){n(this,h),this.head=null,this.tail=null,this.length=0}return a(h,[{key:"push",value:function(p){var y={data:p,next:null};this.length>0?this.tail.next=y:this.head=y,this.tail=y,++this.length}},{key:"unshift",value:function(p){var y={data:p,next:this.head};this.length===0&&(this.tail=y),this.head=y,++this.length}},{key:"shift",value:function(){if(this.length!==0){var p=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,p}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(p){if(this.length===0)return"";for(var y=this.head,w=""+y.data;y=y.next;)w+=p+y.data;return w}},{key:"concat",value:function(p){if(this.length===0)return c.alloc(0);for(var y=c.allocUnsafe(p>>>0),w=this.head,m=0;w;)g(w.data,y,m),m+=w.data.length,w=w.next;return y}},{key:"consume",value:function(p,y){var w;return p<this.head.data.length?(w=this.head.data.slice(0,p),this.head.data=this.head.data.slice(p)):p===this.head.data.length?w=this.shift():w=y?this._getString(p):this._getBuffer(p),w}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(p){var y=this.head,w=1,m=y.data;for(p-=m.length;y=y.next;){var S=y.data,A=p>S.length?S.length:p;if(A===S.length?m+=S:m+=S.slice(0,p),p-=A,p===0){A===S.length?(++w,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=S.slice(A));break}++w}return this.length-=w,m}},{key:"_getBuffer",value:function(p){var y=c.allocUnsafe(p),w=this.head,m=1;for(w.data.copy(y),p-=w.data.length;w=w.next;){var S=w.data,A=p>S.length?S.length:p;if(S.copy(y,y.length-p,0,A),p-=A,p===0){A===S.length?(++m,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=S.slice(A));break}++m}return this.length-=m,y}},{key:d,value:function(p,y){return f(this,t(t({},y),{},{depth:0,customInspect:!1}))}}]),h}(),Sd}var Cd={},Xu={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var b1;function AO(){return b1||(b1=1,function(e,t){var r=Da,n=r.Buffer;function i(o,s){for(var u in o)s[u]=o[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=a);function a(o,s,u){return n(o,s,u)}a.prototype=Object.create(n.prototype),i(n,a),a.from=function(o,s,u){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,s,u)},a.alloc=function(o,s,u){if(typeof o!="number")throw new TypeError("Argument must be a number");var c=n(o);return s!==void 0?typeof u=="string"?c.fill(s,u):c.fill(s):c.fill(0),c},a.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},a.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}}(Xu,Xu.exports)),Xu.exports}var _1;function S1(){if(_1)return Cd;_1=1;var e=AO().Buffer,t=e.isEncoding||function(y){switch(y=""+y,y&&y.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(y){if(!y)return"utf8";for(var w;;)switch(y){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return y;default:if(w)return;y=(""+y).toLowerCase(),w=!0}}function n(y){var w=r(y);if(typeof w!="string"&&(e.isEncoding===t||!t(y)))throw new Error("Unknown encoding: "+y);return w||y}Cd.StringDecoder=i;function i(y){this.encoding=n(y);var w;switch(this.encoding){case"utf16le":this.text=f,this.end=d,w=4;break;case"utf8":this.fillLast=u,w=4;break;case"base64":this.text=g,this.end=h,w=3;break;default:this.write=v,this.end=p;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(w)}i.prototype.write=function(y){if(y.length===0)return"";var w,m;if(this.lastNeed){if(w=this.fillLast(y),w===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<y.length?w?w+this.text(y,m):this.text(y,m):w||""},i.prototype.end=l,i.prototype.text=c,i.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length};function a(y){return y<=127?0:y>>5===6?2:y>>4===14?3:y>>3===30?4:y>>6===2?-1:-2}function o(y,w,m){var S=w.length-1;if(S<m)return 0;var A=a(w[S]);return A>=0?(A>0&&(y.lastNeed=A-1),A):--S<m||A===-2?0:(A=a(w[S]),A>=0?(A>0&&(y.lastNeed=A-2),A):--S<m||A===-2?0:(A=a(w[S]),A>=0?(A>0&&(A===2?A=0:y.lastNeed=A-3),A):0))}function s(y,w,m){if((w[0]&192)!==128)return y.lastNeed=0,"\uFFFD";if(y.lastNeed>1&&w.length>1){if((w[1]&192)!==128)return y.lastNeed=1,"\uFFFD";if(y.lastNeed>2&&w.length>2&&(w[2]&192)!==128)return y.lastNeed=2,"\uFFFD"}}function u(y){var w=this.lastTotal-this.lastNeed,m=s(this,y);if(m!==void 0)return m;if(this.lastNeed<=y.length)return y.copy(this.lastChar,w,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,w,0,y.length),this.lastNeed-=y.length}function c(y,w){var m=o(this,y,w);if(!this.lastNeed)return y.toString("utf8",w);this.lastTotal=m;var S=y.length-(m-this.lastNeed);return y.copy(this.lastChar,0,S),y.toString("utf8",w,S)}function l(y){var w=y&&y.length?this.write(y):"";return this.lastNeed?w+"\uFFFD":w}function f(y,w){if((y.length-w)%2===0){var m=y.toString("utf16le",w);if(m){var S=m.charCodeAt(m.length-1);if(S>=55296&&S<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",w,y.length-1)}function d(y){var w=y&&y.length?this.write(y):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return w+this.lastChar.toString("utf16le",0,m)}return w}function g(y,w){var m=(y.length-w)%3;return m===0?y.toString("base64",w):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",w,y.length-m))}function h(y){var w=y&&y.length?this.write(y):"";return this.lastNeed?w+this.lastChar.toString("base64",0,3-this.lastNeed):w}function v(y){return y.toString(this.encoding)}function p(y){return y&&y.length?this.write(y):""}return Cd}var C1=Li.codes.ERR_STREAM_PREMATURE_CLOSE;function xO(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}function RO(){}function IO(e){return e.setHeader&&typeof e.abort=="function"}function w1(e,t,r){if(typeof t=="function")return w1(e,null,t);t||(t={}),r=xO(r||RO);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,a=function(){e.writable||s()},o=e._writableState&&e._writableState.finished,s=function(){i=!1,o=!0,n||r.call(e)},u=e._readableState&&e._readableState.endEmitted,c=function(){n=!1,u=!0,i||r.call(e)},l=function(h){r.call(e,h)},f=function(){var h;if(n&&!u)return(!e._readableState||!e._readableState.ended)&&(h=new C1),r.call(e,h);if(i&&!o)return(!e._writableState||!e._writableState.ended)&&(h=new C1),r.call(e,h)},d=function(){e.req.on("finish",s)};return IO(e)?(e.on("complete",s),e.on("abort",f),e.req?d():e.on("request",d)):i&&!e._writableState&&(e.on("end",a),e.on("close",a)),e.on("end",c),e.on("finish",s),t.error!==!1&&e.on("error",l),e.on("close",f),function(){e.removeListener("complete",s),e.removeListener("abort",f),e.removeListener("request",d),e.req&&e.req.removeListener("finish",s),e.removeListener("end",a),e.removeListener("close",a),e.removeListener("finish",s),e.removeListener("end",c),e.removeListener("error",l),e.removeListener("close",f)}}var wd=w1,Td,T1;function OO(){if(T1)return Td;T1=1;var e;function t(m,S,A){return S=r(S),S in m?Object.defineProperty(m,S,{value:A,enumerable:!0,configurable:!0,writable:!0}):m[S]=A,m}function r(m){var S=n(m,"string");return typeof S=="symbol"?S:String(S)}function n(m,S){if(typeof m!="object"||m===null)return m;var A=m[Symbol.toPrimitive];if(A!==void 0){var I=A.call(m,S||"default");if(typeof I!="object")return I;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(m)}var i=wd,a=Symbol("lastResolve"),o=Symbol("lastReject"),s=Symbol("error"),u=Symbol("ended"),c=Symbol("lastPromise"),l=Symbol("handlePromise"),f=Symbol("stream");function d(m,S){return{value:m,done:S}}function g(m){var S=m[a];if(S!==null){var A=m[f].read();A!==null&&(m[c]=null,m[a]=null,m[o]=null,S(d(A,!1)))}}function h(m){process.nextTick(g,m)}function v(m,S){return function(A,I){m.then(function(){if(S[u]){A(d(void 0,!0));return}S[l](A,I)},I)}}var p=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((e={get stream(){return this[f]},next:function(){var S=this,A=this[s];if(A!==null)return Promise.reject(A);if(this[u])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise(function(M,P){process.nextTick(function(){S[s]?P(S[s]):M(d(void 0,!0))})});var I=this[c],N;if(I)N=new Promise(v(I,this));else{var T=this[f].read();if(T!==null)return Promise.resolve(d(T,!1));N=new Promise(this[l])}return this[c]=N,N}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var S=this;return new Promise(function(A,I){S[f].destroy(null,function(N){if(N){I(N);return}A(d(void 0,!0))})})}),e),p),w=function(S){var A,I=Object.create(y,(A={},t(A,f,{value:S,writable:!0}),t(A,a,{value:null,writable:!0}),t(A,o,{value:null,writable:!0}),t(A,s,{value:null,writable:!0}),t(A,u,{value:S._readableState.endEmitted,writable:!0}),t(A,l,{value:function(T,M){var P=I[f].read();P?(I[c]=null,I[a]=null,I[o]=null,T(d(P,!1))):(I[a]=T,I[o]=M)},writable:!0}),A));return I[c]=null,i(S,function(N){if(N&&N.code!=="ERR_STREAM_PREMATURE_CLOSE"){var T=I[o];T!==null&&(I[c]=null,I[a]=null,I[o]=null,T(N)),I[s]=N;return}var M=I[a];M!==null&&(I[c]=null,I[a]=null,I[o]=null,M(d(void 0,!0))),I[u]=!0}),S.on("readable",h.bind(null,I)),I};return Td=w,Td}var Ad,A1;function MO(){return A1||(A1=1,Ad=function(){throw new Error("Readable.from is not available in the browser")}),Ad}var xd,x1;function R1(){if(x1)return xd;x1=1,xd=M;var e;M.ReadableState=T,Ra.exports.EventEmitter;var t=function(R,K){return R.listeners(K).length},r=d1,n=Da.Buffer,i=(typeof me<"u"?me:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(E){return n.from(E)}function o(E){return n.isBuffer(E)||E instanceof i}var s=_e,u;s&&s.debuglog?u=s.debuglog("stream"):u=function(){};var c=TO(),l=g1,f=m1,d=f.getHighWaterMark,g=Li.codes,h=g.ERR_INVALID_ARG_TYPE,v=g.ERR_STREAM_PUSH_AFTER_EOF,p=g.ERR_METHOD_NOT_IMPLEMENTED,y=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,w,m,S;Pi.exports(M,r);var A=l.errorOrDestroy,I=["error","close","destroy","pause","resume"];function N(E,R,K){if(typeof E.prependListener=="function")return E.prependListener(R,K);!E._events||!E._events[R]?E.on(R,K):Array.isArray(E._events[R])?E._events[R].unshift(K):E._events[R]=[K,E._events[R]]}function T(E,R,K){e=e||ka(),E=E||{},typeof K!="boolean"&&(K=R instanceof e),this.objectMode=!!E.objectMode,K&&(this.objectMode=this.objectMode||!!E.readableObjectMode),this.highWaterMark=d(this,E,"readableHighWaterMark",K),this.buffer=new c,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=E.emitClose!==!1,this.autoDestroy=!!E.autoDestroy,this.destroyed=!1,this.defaultEncoding=E.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,E.encoding&&(w||(w=S1().StringDecoder),this.decoder=new w(E.encoding),this.encoding=E.encoding)}function M(E){if(e=e||ka(),!(this instanceof M))return new M(E);var R=this instanceof e;this._readableState=new T(E,this,R),this.readable=!0,E&&(typeof E.read=="function"&&(this._read=E.read),typeof E.destroy=="function"&&(this._destroy=E.destroy)),r.call(this)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(R){!this._readableState||(this._readableState.destroyed=R)}}),M.prototype.destroy=l.destroy,M.prototype._undestroy=l.undestroy,M.prototype._destroy=function(E,R){R(E)},M.prototype.push=function(E,R){var K=this._readableState,Q;return K.objectMode?Q=!0:typeof E=="string"&&(R=R||K.defaultEncoding,R!==K.encoding&&(E=n.from(E,R),R=""),Q=!0),P(this,E,R,!1,Q)},M.prototype.unshift=function(E){return P(this,E,null,!0,!1)};function P(E,R,K,Q,he){u("readableAddChunk",R);var Ce=E._readableState;if(R===null)Ce.reading=!1,$(E,Ce);else{var Me;if(he||(Me=B(Ce,R)),Me)A(E,Me);else if(Ce.objectMode||R&&R.length>0)if(typeof R!="string"&&!Ce.objectMode&&Object.getPrototypeOf(R)!==n.prototype&&(R=a(R)),Q)Ce.endEmitted?A(E,new y):L(E,Ce,R,!0);else if(Ce.ended)A(E,new v);else{if(Ce.destroyed)return!1;Ce.reading=!1,Ce.decoder&&!K?(R=Ce.decoder.write(R),Ce.objectMode||R.length!==0?L(E,Ce,R,!1):se(E,Ce)):L(E,Ce,R,!1)}else Q||(Ce.reading=!1,se(E,Ce))}return!Ce.ended&&(Ce.length<Ce.highWaterMark||Ce.length===0)}function L(E,R,K,Q){R.flowing&&R.length===0&&!R.sync?(R.awaitDrain=0,E.emit("data",K)):(R.length+=R.objectMode?1:K.length,Q?R.buffer.unshift(K):R.buffer.push(K),R.needReadable&&G(E)),se(E,R)}function B(E,R){var K;return!o(R)&&typeof R!="string"&&R!==void 0&&!E.objectMode&&(K=new h("chunk",["string","Buffer","Uint8Array"],R)),K}M.prototype.isPaused=function(){return this._readableState.flowing===!1},M.prototype.setEncoding=function(E){w||(w=S1().StringDecoder);var R=new w(E);this._readableState.decoder=R,this._readableState.encoding=this._readableState.decoder.encoding;for(var K=this._readableState.buffer.head,Q="";K!==null;)Q+=R.write(K.data),K=K.next;return this._readableState.buffer.clear(),Q!==""&&this._readableState.buffer.push(Q),this._readableState.length=Q.length,this};var X=1073741824;function V(E){return E>=X?E=X:(E--,E|=E>>>1,E|=E>>>2,E|=E>>>4,E|=E>>>8,E|=E>>>16,E++),E}function k(E,R){return E<=0||R.length===0&&R.ended?0:R.objectMode?1:E!==E?R.flowing&&R.length?R.buffer.head.data.length:R.length:(E>R.highWaterMark&&(R.highWaterMark=V(E)),E<=R.length?E:R.ended?R.length:(R.needReadable=!0,0))}M.prototype.read=function(E){u("read",E),E=parseInt(E,10);var R=this._readableState,K=E;if(E!==0&&(R.emittedReadable=!1),E===0&&R.needReadable&&((R.highWaterMark!==0?R.length>=R.highWaterMark:R.length>0)||R.ended))return u("read: emitReadable",R.length,R.ended),R.length===0&&R.ended?W(this):G(this),null;if(E=k(E,R),E===0&&R.ended)return R.length===0&&W(this),null;var Q=R.needReadable;u("need readable",Q),(R.length===0||R.length-E<R.highWaterMark)&&(Q=!0,u("length less than watermark",Q)),R.ended||R.reading?(Q=!1,u("reading or ended",Q)):Q&&(u("do read"),R.reading=!0,R.sync=!0,R.length===0&&(R.needReadable=!0),this._read(R.highWaterMark),R.sync=!1,R.reading||(E=k(K,R)));var he;return E>0?he=z(E,R):he=null,he===null?(R.needReadable=R.length<=R.highWaterMark,E=0):(R.length-=E,R.awaitDrain=0),R.length===0&&(R.ended||(R.needReadable=!0),K!==E&&R.ended&&W(this)),he!==null&&this.emit("data",he),he};function $(E,R){if(u("onEofChunk"),!R.ended){if(R.decoder){var K=R.decoder.end();K&&K.length&&(R.buffer.push(K),R.length+=R.objectMode?1:K.length)}R.ended=!0,R.sync?G(E):(R.needReadable=!1,R.emittedReadable||(R.emittedReadable=!0,oe(E)))}}function G(E){var R=E._readableState;u("emitReadable",R.needReadable,R.emittedReadable),R.needReadable=!1,R.emittedReadable||(u("emitReadable",R.flowing),R.emittedReadable=!0,process.nextTick(oe,E))}function oe(E){var R=E._readableState;u("emitReadable_",R.destroyed,R.length,R.ended),!R.destroyed&&(R.length||R.ended)&&(E.emit("readable"),R.emittedReadable=!1),R.needReadable=!R.flowing&&!R.ended&&R.length<=R.highWaterMark,q(E)}function se(E,R){R.readingMore||(R.readingMore=!0,process.nextTick(de,E,R))}function de(E,R){for(;!R.reading&&!R.ended&&(R.length<R.highWaterMark||R.flowing&&R.length===0);){var K=R.length;if(u("maybeReadMore read 0"),E.read(0),K===R.length)break}R.readingMore=!1}M.prototype._read=function(E){A(this,new p("_read()"))},M.prototype.pipe=function(E,R){var K=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=E;break;case 1:Q.pipes=[Q.pipes,E];break;default:Q.pipes.push(E);break}Q.pipesCount+=1,u("pipe count=%d opts=%j",Q.pipesCount,R);var he=(!R||R.end!==!1)&&E!==process.stdout&&E!==process.stderr,Ce=he?vt:ve;Q.endEmitted?process.nextTick(Ce):K.once("end",Ce),E.on("unpipe",Me);function Me(O,b){u("onunpipe"),O===K&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,nt())}function vt(){u("onend"),E.end()}var lt=le(K);E.on("drain",lt);var mt=!1;function nt(){u("cleanup"),E.removeListener("close",re),E.removeListener("finish",ue),E.removeListener("drain",lt),E.removeListener("error",Pt),E.removeListener("unpipe",Me),K.removeListener("end",vt),K.removeListener("end",ve),K.removeListener("data",We),mt=!0,Q.awaitDrain&&(!E._writableState||E._writableState.needDrain)&<()}K.on("data",We);function We(O){u("ondata");var b=E.write(O);u("dest.write",b),b===!1&&((Q.pipesCount===1&&Q.pipes===E||Q.pipesCount>1&&x(Q.pipes,E)!==-1)&&!mt&&(u("false write response, pause",Q.awaitDrain),Q.awaitDrain++),K.pause())}function Pt(O){u("onerror",O),ve(),E.removeListener("error",Pt),t(E,"error")===0&&A(E,O)}N(E,"error",Pt);function re(){E.removeListener("finish",ue),ve()}E.once("close",re);function ue(){u("onfinish"),E.removeListener("close",re),ve()}E.once("finish",ue);function ve(){u("unpipe"),K.unpipe(E)}return E.emit("pipe",K),Q.flowing||(u("pipe resume"),K.resume()),E};function le(E){return function(){var K=E._readableState;u("pipeOnDrain",K.awaitDrain),K.awaitDrain&&K.awaitDrain--,K.awaitDrain===0&&t(E,"data")&&(K.flowing=!0,q(E))}}M.prototype.unpipe=function(E){var R=this._readableState,K={hasUnpiped:!1};if(R.pipesCount===0)return this;if(R.pipesCount===1)return E&&E!==R.pipes?this:(E||(E=R.pipes),R.pipes=null,R.pipesCount=0,R.flowing=!1,E&&E.emit("unpipe",this,K),this);if(!E){var Q=R.pipes,he=R.pipesCount;R.pipes=null,R.pipesCount=0,R.flowing=!1;for(var Ce=0;Ce<he;Ce++)Q[Ce].emit("unpipe",this,{hasUnpiped:!1});return this}var Me=x(R.pipes,E);return Me===-1?this:(R.pipes.splice(Me,1),R.pipesCount-=1,R.pipesCount===1&&(R.pipes=R.pipes[0]),E.emit("unpipe",this,K),this)},M.prototype.on=function(E,R){var K=r.prototype.on.call(this,E,R),Q=this._readableState;return E==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):E==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,u("on readable",Q.length,Q.reading),Q.length?G(this):Q.reading||process.nextTick(pe,this)),K},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(E,R){var K=r.prototype.removeListener.call(this,E,R);return E==="readable"&&process.nextTick(Ee,this),K},M.prototype.removeAllListeners=function(E){var R=r.prototype.removeAllListeners.apply(this,arguments);return(E==="readable"||E===void 0)&&process.nextTick(Ee,this),R};function Ee(E){var R=E._readableState;R.readableListening=E.listenerCount("readable")>0,R.resumeScheduled&&!R.paused?R.flowing=!0:E.listenerCount("data")>0&&E.resume()}function pe(E){u("readable nexttick read 0"),E.read(0)}M.prototype.resume=function(){var E=this._readableState;return E.flowing||(u("resume"),E.flowing=!E.readableListening,J(this,E)),E.paused=!1,this};function J(E,R){R.resumeScheduled||(R.resumeScheduled=!0,process.nextTick(ne,E,R))}function ne(E,R){u("resume",R.reading),R.reading||E.read(0),R.resumeScheduled=!1,E.emit("resume"),q(E),R.flowing&&!R.reading&&E.read(0)}M.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function q(E){var R=E._readableState;for(u("flow",R.flowing);R.flowing&&E.read()!==null;);}M.prototype.wrap=function(E){var R=this,K=this._readableState,Q=!1;E.on("end",function(){if(u("wrapped end"),K.decoder&&!K.ended){var Me=K.decoder.end();Me&&Me.length&&R.push(Me)}R.push(null)}),E.on("data",function(Me){if(u("wrapped data"),K.decoder&&(Me=K.decoder.write(Me)),!(K.objectMode&&Me==null)&&!(!K.objectMode&&(!Me||!Me.length))){var vt=R.push(Me);vt||(Q=!0,E.pause())}});for(var he in E)this[he]===void 0&&typeof E[he]=="function"&&(this[he]=function(vt){return function(){return E[vt].apply(E,arguments)}}(he));for(var Ce=0;Ce<I.length;Ce++)E.on(I[Ce],this.emit.bind(this,I[Ce]));return this._read=function(Me){u("wrapped _read",Me),Q&&(Q=!1,E.resume())},this},typeof Symbol=="function"&&(M.prototype[Symbol.asyncIterator]=function(){return m===void 0&&(m=OO()),m(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){this._readableState&&(this._readableState.flowing=R)}}),M._fromList=z,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function z(E,R){if(R.length===0)return null;var K;return R.objectMode?K=R.buffer.shift():!E||E>=R.length?(R.decoder?K=R.buffer.join(""):R.buffer.length===1?K=R.buffer.first():K=R.buffer.concat(R.length),R.buffer.clear()):K=R.buffer.consume(E,R.decoder),K}function W(E){var R=E._readableState;u("endReadable",R.endEmitted),R.endEmitted||(R.ended=!0,process.nextTick(_,R,E))}function _(E,R){if(u("endReadableNT",E.endEmitted,E.length),!E.endEmitted&&E.length===0&&(E.endEmitted=!0,R.readable=!1,R.emit("end"),E.autoDestroy)){var K=R._writableState;(!K||K.autoDestroy&&K.finished)&&R.destroy()}}typeof Symbol=="function"&&(M.from=function(E,R){return S===void 0&&(S=MO()),S(M,E,R)});function x(E,R){for(var K=0,Q=E.length;K<Q;K++)if(E[K]===R)return K;return-1}return xd}var Rd,I1;function ka(){if(I1)return Rd;I1=1;var e=Object.keys||function(c){var l=[];for(var f in c)l.push(f);return l};Rd=o;var t=R1(),r=Od();Pi.exports(o,t);for(var n=e(r.prototype),i=0;i<n.length;i++){var a=n[i];o.prototype[a]||(o.prototype[a]=r.prototype[a])}function o(c){if(!(this instanceof o))return new o(c);t.call(this,c),r.call(this,c),this.allowHalfOpen=!0,c&&(c.readable===!1&&(this.readable=!1),c.writable===!1&&(this.writable=!1),c.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",s)))}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function s(){this._writableState.ended||process.nextTick(u,this)}function u(c){c.end()}return Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(l){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=l,this._writableState.destroyed=l)}}),Rd}var Id,O1;function Od(){if(O1)return Id;O1=1,Id=T;function e(q){var z=this;this.next=null,this.entry=null,this.finish=function(){ne(z,q)}}var t;T.WritableState=I;var r={deprecate:aO},n=d1,i=Da.Buffer,a=(typeof me<"u"?me:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(q){return i.from(q)}function s(q){return i.isBuffer(q)||q instanceof a}var u=g1,c=m1,l=c.getHighWaterMark,f=Li.codes,d=f.ERR_INVALID_ARG_TYPE,g=f.ERR_METHOD_NOT_IMPLEMENTED,h=f.ERR_MULTIPLE_CALLBACK,v=f.ERR_STREAM_CANNOT_PIPE,p=f.ERR_STREAM_DESTROYED,y=f.ERR_STREAM_NULL_VALUES,w=f.ERR_STREAM_WRITE_AFTER_END,m=f.ERR_UNKNOWN_ENCODING,S=u.errorOrDestroy;Pi.exports(T,n);function A(){}function I(q,z,W){t=t||ka(),q=q||{},typeof W!="boolean"&&(W=z instanceof t),this.objectMode=!!q.objectMode,W&&(this.objectMode=this.objectMode||!!q.writableObjectMode),this.highWaterMark=l(this,q,"writableHighWaterMark",W),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var _=q.decodeStrings===!1;this.decodeStrings=!_,this.defaultEncoding=q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(x){$(z,x)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=q.emitClose!==!1,this.autoDestroy=!!q.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}I.prototype.getBuffer=function(){for(var z=this.bufferedRequest,W=[];z;)W.push(z),z=z.next;return W},function(){try{Object.defineProperty(I.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var N;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(N=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(z){return N.call(this,z)?!0:this!==T?!1:z&&z._writableState instanceof I}})):N=function(z){return z instanceof this};function T(q){t=t||ka();var z=this instanceof t;if(!z&&!N.call(T,this))return new T(q);this._writableState=new I(q,this,z),this.writable=!0,q&&(typeof q.write=="function"&&(this._write=q.write),typeof q.writev=="function"&&(this._writev=q.writev),typeof q.destroy=="function"&&(this._destroy=q.destroy),typeof q.final=="function"&&(this._final=q.final)),n.call(this)}T.prototype.pipe=function(){S(this,new v)};function M(q,z){var W=new w;S(q,W),process.nextTick(z,W)}function P(q,z,W,_){var x;return W===null?x=new y:typeof W!="string"&&!z.objectMode&&(x=new d("chunk",["string","Buffer"],W)),x?(S(q,x),process.nextTick(_,x),!1):!0}T.prototype.write=function(q,z,W){var _=this._writableState,x=!1,E=!_.objectMode&&s(q);return E&&!i.isBuffer(q)&&(q=o(q)),typeof z=="function"&&(W=z,z=null),E?z="buffer":z||(z=_.defaultEncoding),typeof W!="function"&&(W=A),_.ending?M(this,W):(E||P(this,_,q,W))&&(_.pendingcb++,x=B(this,_,E,q,z,W)),x},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var q=this._writableState;q.corked&&(q.corked--,!q.writing&&!q.corked&&!q.bufferProcessing&&q.bufferedRequest&&se(this,q))},T.prototype.setDefaultEncoding=function(z){if(typeof z=="string"&&(z=z.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((z+"").toLowerCase())>-1))throw new m(z);return this._writableState.defaultEncoding=z,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function L(q,z,W){return!q.objectMode&&q.decodeStrings!==!1&&typeof z=="string"&&(z=i.from(z,W)),z}Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function B(q,z,W,_,x,E){if(!W){var R=L(z,_,x);_!==R&&(W=!0,x="buffer",_=R)}var K=z.objectMode?1:_.length;z.length+=K;var Q=z.length<z.highWaterMark;if(Q||(z.needDrain=!0),z.writing||z.corked){var he=z.lastBufferedRequest;z.lastBufferedRequest={chunk:_,encoding:x,isBuf:W,callback:E,next:null},he?he.next=z.lastBufferedRequest:z.bufferedRequest=z.lastBufferedRequest,z.bufferedRequestCount+=1}else X(q,z,!1,K,_,x,E);return Q}function X(q,z,W,_,x,E,R){z.writelen=_,z.writecb=R,z.writing=!0,z.sync=!0,z.destroyed?z.onwrite(new p("write")):W?q._writev(x,z.onwrite):q._write(x,E,z.onwrite),z.sync=!1}function V(q,z,W,_,x){--z.pendingcb,W?(process.nextTick(x,_),process.nextTick(pe,q,z),q._writableState.errorEmitted=!0,S(q,_)):(x(_),q._writableState.errorEmitted=!0,S(q,_),pe(q,z))}function k(q){q.writing=!1,q.writecb=null,q.length-=q.writelen,q.writelen=0}function $(q,z){var W=q._writableState,_=W.sync,x=W.writecb;if(typeof x!="function")throw new h;if(k(W),z)V(q,W,_,z,x);else{var E=de(W)||q.destroyed;!E&&!W.corked&&!W.bufferProcessing&&W.bufferedRequest&&se(q,W),_?process.nextTick(G,q,W,E,x):G(q,W,E,x)}}function G(q,z,W,_){W||oe(q,z),z.pendingcb--,_(),pe(q,z)}function oe(q,z){z.length===0&&z.needDrain&&(z.needDrain=!1,q.emit("drain"))}function se(q,z){z.bufferProcessing=!0;var W=z.bufferedRequest;if(q._writev&&W&&W.next){var _=z.bufferedRequestCount,x=new Array(_),E=z.corkedRequestsFree;E.entry=W;for(var R=0,K=!0;W;)x[R]=W,W.isBuf||(K=!1),W=W.next,R+=1;x.allBuffers=K,X(q,z,!0,z.length,x,"",E.finish),z.pendingcb++,z.lastBufferedRequest=null,E.next?(z.corkedRequestsFree=E.next,E.next=null):z.corkedRequestsFree=new e(z),z.bufferedRequestCount=0}else{for(;W;){var Q=W.chunk,he=W.encoding,Ce=W.callback,Me=z.objectMode?1:Q.length;if(X(q,z,!1,Me,Q,he,Ce),W=W.next,z.bufferedRequestCount--,z.writing)break}W===null&&(z.lastBufferedRequest=null)}z.bufferedRequest=W,z.bufferProcessing=!1}T.prototype._write=function(q,z,W){W(new g("_write()"))},T.prototype._writev=null,T.prototype.end=function(q,z,W){var _=this._writableState;return typeof q=="function"?(W=q,q=null,z=null):typeof z=="function"&&(W=z,z=null),q!=null&&this.write(q,z),_.corked&&(_.corked=1,this.uncork()),_.ending||J(this,_,W),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function de(q){return q.ending&&q.length===0&&q.bufferedRequest===null&&!q.finished&&!q.writing}function le(q,z){q._final(function(W){z.pendingcb--,W&&S(q,W),z.prefinished=!0,q.emit("prefinish"),pe(q,z)})}function Ee(q,z){!z.prefinished&&!z.finalCalled&&(typeof q._final=="function"&&!z.destroyed?(z.pendingcb++,z.finalCalled=!0,process.nextTick(le,q,z)):(z.prefinished=!0,q.emit("prefinish")))}function pe(q,z){var W=de(z);if(W&&(Ee(q,z),z.pendingcb===0&&(z.finished=!0,q.emit("finish"),z.autoDestroy))){var _=q._readableState;(!_||_.autoDestroy&&_.endEmitted)&&q.destroy()}return W}function J(q,z,W){z.ending=!0,pe(q,z),W&&(z.finished?process.nextTick(W):q.once("finish",W)),z.ended=!0,q.writable=!1}function ne(q,z,W){var _=q.entry;for(q.entry=null;_;){var x=_.callback;z.pendingcb--,x(W),_=_.next}z.corkedRequestsFree.next=q}return Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(z){!this._writableState||(this._writableState.destroyed=z)}}),T.prototype.destroy=u.destroy,T.prototype._undestroy=u.undestroy,T.prototype._destroy=function(q,z){z(q)},Id}var Md={exports:{}},M1;function LO(){if(M1)return Md.exports;M1=1;var e=_e,t=ht,r=t.LEVEL,n=mn(),i=Md.exports=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(n.call(this,o),!o.transport||typeof o.transport.log!="function")throw new Error("Invalid transport, must be an object with a log method.");this.transport=o.transport,this.level=this.level||o.transport.level,this.handleExceptions=this.handleExceptions||o.transport.handleExceptions,this._deprecated();function s(u){this.emit("error",u,this.transport)}this.transport.__winstonError||(this.transport.__winstonError=s.bind(this),this.transport.on("error",this.transport.__winstonError))};return e.inherits(i,n),i.prototype._write=function(o,s,u){if(this.silent||o.exception===!0&&!this.handleExceptions)return u(null);(!this.level||this.levels[this.level]>=this.levels[o[r]])&&this.transport.log(o[r],o.message,o,this._nop),u(null)},i.prototype._writev=function(o,s){for(var u=0;u<o.length;u++)this._accept(o[u])&&(this.transport.log(o[u].chunk[r],o[u].chunk.message,o[u].chunk,this._nop),o[u].callback());return s(null)},i.prototype._deprecated=function(){console.error([this.transport.name+" is a legacy winston transport. Consider upgrading: ","- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md"].join(`
|
|
62
|
-
`))},i.prototype.close=function(){this.transport.close&&this.transport.close(),this.transport.__winstonError&&(this.transport.removeListener("error",this.transport.__winstonError),this.transport.__winstonError=null)},Md.exports}var L1;function mn(){if(L1)return Wu.exports;L1=1;var e=_e,t=Od(),r=ht,n=r.LEVEL,i=Wu.exports=function(){var o=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.call(this,{objectMode:!0,highWaterMark:s.highWaterMark}),this.format=s.format,this.level=s.level,this.handleExceptions=s.handleExceptions,this.handleRejections=s.handleRejections,this.silent=s.silent,s.log&&(this.log=s.log),s.logv&&(this.logv=s.logv),s.close&&(this.close=s.close),this.once("pipe",function(u){o.levels=u.levels,o.parent=u}),this.once("unpipe",function(u){u===o.parent&&(o.parent=null,o.close&&o.close())})};return e.inherits(i,t),i.prototype._write=function(o,s,u){if(this.silent||o.exception===!0&&!this.handleExceptions)return u(null);var c=this.level||this.parent&&this.parent.level;if(!c||this.levels[c]>=this.levels[o[n]]){if(o&&!this.format)return this.log(o,u);var l=void 0,f=void 0;try{f=this.format.transform(Object.assign({},o),this.format.options)}catch(d){l=d}if(l||!f){if(u(),l)throw l;return}return this.log(f,u)}return this._writableState.sync=!1,u(null)},i.prototype._writev=function(o,s){if(this.logv){var u=o.filter(this._accept,this);return u.length?this.logv(u,s):s(null)}for(var c=0;c<o.length;c++)if(!!this._accept(o[c])){if(o[c].chunk&&!this.format){this.log(o[c].chunk,o[c].callback);continue}var l=void 0,f=void 0;try{f=this.format.transform(Object.assign({},o[c].chunk),this.format.options)}catch(d){l=d}if(l||!f){if(o[c].callback(),l)throw s(null),l}else this.log(f,o[c].callback)}return s(null)},i.prototype._accept=function(o){var s=o.chunk;if(this.silent)return!1;var u=this.level||this.parent&&this.parent.level;return!!((s.exception===!0||!u||this.levels[u]>=this.levels[s[n]])&&(this.handleExceptions||s.exception!==!0))},i.prototype._nop=function(){},Wu.exports.LegacyTransportStream=LO(),Wu.exports}var Ld,P1;function PO(){if(P1)return Ld;P1=1;function e(p){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},e(p)}function t(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}function r(p,y){for(var w=0;w<y.length;w++){var m=y[w];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(p,m.key,m)}}function n(p,y,w){return y&&r(p.prototype,y),w&&r(p,w),Object.defineProperty(p,"prototype",{writable:!1}),p}function i(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(y&&y.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),Object.defineProperty(p,"prototype",{writable:!1}),y&&a(p,y)}function a(p,y){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,S){return m.__proto__=S,m},a(p,y)}function o(p){var y=c();return function(){var m=l(p),S;if(y){var A=l(this).constructor;S=Reflect.construct(m,arguments,A)}else S=m.apply(this,arguments);return s(this,S)}}function s(p,y){if(y&&(e(y)==="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return u(p)}function u(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function c(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function l(p){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(w){return w.__proto__||Object.getPrototypeOf(w)},l(p)}var f=_e,d=ht,g=d.LEVEL,h=d.MESSAGE,v=mn();return Ld=function(p){i(w,p);var y=o(w);function w(){var m,S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t(this,w),m=y.call(this,S),m.name=S.name||"console",m.stderrLevels=m._stringArrayToSet(S.stderrLevels),m.consoleWarnLevels=m._stringArrayToSet(S.consoleWarnLevels),m.eol=typeof S.eol=="string"?S.eol:f.EOL,m.setMaxListeners(30),m}return n(w,[{key:"log",value:function(S,A){var I=this;if(setImmediate(function(){return I.emit("logged",S)}),this.stderrLevels[S[g]]){console._stderr?console._stderr.write("".concat(S[h]).concat(this.eol)):console.error(S[h]),A&&A();return}else if(this.consoleWarnLevels[S[g]]){console._stderr?console._stderr.write("".concat(S[h]).concat(this.eol)):console.warn(S[h]),A&&A();return}console._stdout?console._stdout.write("".concat(S[h]).concat(this.eol)):console.log(S[h]),A&&A()}},{key:"_stringArrayToSet",value:function(S,A){if(!S)return{};if(A=A||"Cannot make set from type other than Array of string elements",!Array.isArray(S))throw new Error(A);return S.reduce(function(I,N){if(typeof N!="string")throw new Error(A);return I[N]=!0,I},{})}}]),w}(v),Ld}var Ju={exports:{}},Zu={exports:{}},ps={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){return n&&typeof n.length=="number"&&n.length>=0&&n.length%1===0}e.exports=t.default})(ps,ps.exports);var en={},ec={exports:{}},Pd={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r){return function(...n){var i=n.pop();return r.call(this,n,i)}},e.exports=t.default})(Pd,Pd.exports);var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.fallback=N1,Yn.wrap=B1;var NO=Yn.hasQueueMicrotask=typeof queueMicrotask=="function"&&queueMicrotask,BO=Yn.hasSetImmediate=typeof setImmediate=="function"&&setImmediate,DO=Yn.hasNextTick=typeof process=="object"&&typeof process.nextTick=="function";function N1(e){setTimeout(e,0)}function B1(e){return(t,...r)=>e(()=>t(...r))}var gs;NO?gs=queueMicrotask:BO?gs=setImmediate:DO?gs=process.nextTick:gs=N1,Yn.default=B1(gs);var D1;function FO(){return D1||(D1=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=Pd.exports,n=s(r),i=Yn,a=s(i),o=Ua();function s(f){return f&&f.__esModule?f:{default:f}}function u(f){return(0,o.isAsync)(f)?function(...d){const g=d.pop(),h=f.apply(this,d);return c(h,g)}:(0,n.default)(function(d,g){var h;try{h=f.apply(this,d)}catch(v){return g(v)}if(h&&typeof h.then=="function")return c(h,g);g(null,h)})}function c(f,d){return f.then(g=>{l(d,null,g)},g=>{l(d,g&&g.message?g:new Error(g))})}function l(f,d,g){try{f(d,g)}catch(h){(0,a.default)(v=>{throw v},h)}}e.exports=t.default}(ec,ec.exports)),ec.exports}var F1;function Ua(){if(F1)return en;F1=1,Object.defineProperty(en,"__esModule",{value:!0}),en.isAsyncIterable=en.isAsyncGenerator=en.isAsync=void 0;var e=FO(),t=r(e);function r(s){return s&&s.__esModule?s:{default:s}}function n(s){return s[Symbol.toStringTag]==="AsyncFunction"}function i(s){return s[Symbol.toStringTag]==="AsyncGenerator"}function a(s){return typeof s[Symbol.asyncIterator]=="function"}function o(s){if(typeof s!="function")throw new Error("expected a function");return n(s)?(0,t.default)(s):s}return en.default=o,en.isAsync=n,en.isAsyncGenerator=i,en.isAsyncIterable=a,en}var Ni={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n,i=n.length){if(!i)throw new Error("arity is undefined");function a(...o){return typeof o[i-1]=="function"?n.apply(this,o):new Promise((s,u)=>{o[i-1]=(c,...l)=>{if(c)return u(c);s(l.length>1?l:l[0])},n.apply(this,o)})}return a}e.exports=t.default})(Ni,Ni.exports);var k1;function kO(){return k1||(k1=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=ps.exports,n=u(r),i=Ua(),a=u(i),o=Ni.exports,s=u(o);function u(c){return c&&c.__esModule?c:{default:c}}t.default=(0,s.default)((c,l,f)=>{var d=(0,n.default)(l)?[]:{};c(l,(g,h,v)=>{(0,a.default)(g)((p,...y)=>{y.length<2&&([y]=y),d[h]=y,v(p)})},g=>f(g,d))},3),e.exports=t.default}(Zu,Zu.exports)),Zu.exports}var tc={exports:{}},rc={exports:{}},Nd={exports:{}},nc={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){function i(...a){if(n!==null){var o=n;n=null,o.apply(this,a)}}return Object.assign(i,n),i}e.exports=t.default})(nc,nc.exports);var Bd={exports:{}},Dd={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r){return r[Symbol.iterator]&&r[Symbol.iterator]()},e.exports=t.default})(Dd,Dd.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var r=ps.exports,n=o(r),i=Dd.exports,a=o(i);function o(f){return f&&f.__esModule?f:{default:f}}function s(f){var d=-1,g=f.length;return function(){return++d<g?{value:f[d],key:d}:null}}function u(f){var d=-1;return function(){var h=f.next();return h.done?null:(d++,{value:h.value,key:d})}}function c(f){var d=f?Object.keys(f):[],g=-1,h=d.length;return function v(){var p=d[++g];return p==="__proto__"?v():g<h?{value:f[p],key:p}:null}}function l(f){if((0,n.default)(f))return s(f);var d=(0,a.default)(f);return d?u(d):c(f)}e.exports=t.default}(Bd,Bd.exports);var ic={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){return function(...i){if(n===null)throw new Error("Callback was already called.");var a=n;n=null,a.apply(this,i)}}e.exports=t.default})(ic,ic.exports);var Fd={exports:{}},ys={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r={};t.default=r,e.exports=t.default})(ys,ys.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=a;var r=ys.exports,n=i(r);function i(o){return o&&o.__esModule?o:{default:o}}function a(o,s,u,c){let l=!1,f=!1,d=!1,g=0,h=0;function v(){g>=s||d||l||(d=!0,o.next().then(({value:w,done:m})=>{if(!(f||l)){if(d=!1,m){l=!0,g<=0&&c(null);return}g++,u(w,h,p),h++,v()}}).catch(y))}function p(w,m){if(g-=1,!f){if(w)return y(w);if(w===!1){l=!0,f=!0;return}if(m===n.default||l&&g<=0)return l=!0,c(null);v()}}function y(w){f||(d=!1,l=!0,c(w))}v()}e.exports=t.default}(Fd,Fd.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=nc.exports,n=g(r),i=Bd.exports,a=g(i),o=ic.exports,s=g(o),u=Ua(),c=Fd.exports,l=g(c),f=ys.exports,d=g(f);function g(h){return h&&h.__esModule?h:{default:h}}t.default=h=>(v,p,y)=>{if(y=(0,n.default)(y),h<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!v)return y(null);if((0,u.isAsyncGenerator)(v))return(0,l.default)(v,h,p,y);if((0,u.isAsyncIterable)(v))return(0,l.default)(v[Symbol.asyncIterator](),h,p,y);var w=(0,a.default)(v),m=!1,S=!1,A=0,I=!1;function N(M,P){if(!S)if(A-=1,M)m=!0,y(M);else if(M===!1)m=!0,S=!0;else{if(P===d.default||m&&A<=0)return m=!0,y(null);I||T()}}function T(){for(I=!0;A<h&&!m;){var M=w();if(M===null){m=!0,A<=0&&y(null);return}A+=1,p(M.value,M.key,(0,s.default)(N))}I=!1}T()},e.exports=t.default}(Nd,Nd.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=Nd.exports,n=u(r),i=Ua(),a=u(i),o=Ni.exports,s=u(o);function u(l){return l&&l.__esModule?l:{default:l}}function c(l,f,d,g){return(0,n.default)(f)(l,(0,a.default)(d),g)}t.default=(0,s.default)(c,4),e.exports=t.default}(rc,rc.exports);var U1;function UO(){return U1||(U1=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=rc.exports,n=o(r),i=Ni.exports,a=o(i);function o(u){return u&&u.__esModule?u:{default:u}}function s(u,c,l){return(0,n.default)(u,1,c,l)}t.default=(0,a.default)(s,3),e.exports=t.default}(tc,tc.exports)),tc.exports}var $1;function $O(){return $1||($1=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=kO(),n=o(r),i=UO(),a=o(i);function o(u){return u&&u.__esModule?u:{default:u}}function s(u,c){return(0,n.default)(a.default,u,c)}e.exports=t.default}(Ju,Ju.exports)),Ju.exports}var Bi={exports:{}},j1=En,ac=Li.codes,jO=ac.ERR_METHOD_NOT_IMPLEMENTED,KO=ac.ERR_MULTIPLE_CALLBACK,qO=ac.ERR_TRANSFORM_ALREADY_TRANSFORMING,VO=ac.ERR_TRANSFORM_WITH_LENGTH_0,oc=ka();Pi.exports(En,oc);function GO(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new KO);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function En(e){if(!(this instanceof En))return new En(e);oc.call(this,e),this._transformState={afterTransform:GO.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",HO)}function HO(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){K1(e,t,r)}):K1(this,null,null)}En.prototype.push=function(e,t){return this._transformState.needTransform=!1,oc.prototype.push.call(this,e,t)},En.prototype._transform=function(e,t,r){r(new jO("_transform()"))},En.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},En.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},En.prototype._destroy=function(e,t){oc.prototype._destroy.call(this,e,function(r){t(r)})};function K1(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new VO;if(e._transformState.transforming)throw new qO;return e.push(null)}var YO=vs,q1=j1;Pi.exports(vs,q1);function vs(e){if(!(this instanceof vs))return new vs(e);q1.call(this,e)}vs.prototype._transform=function(e,t,r){r(null,e)};var kd;function WO(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var V1=Li.codes,zO=V1.ERR_MISSING_ARGS,QO=V1.ERR_STREAM_DESTROYED;function G1(e){if(e)throw e}function XO(e){return e.setHeader&&typeof e.abort=="function"}function JO(e,t,r,n){n=WO(n);var i=!1;e.on("close",function(){i=!0}),kd===void 0&&(kd=wd),kd(e,{readable:t,writable:r},function(o){if(o)return n(o);i=!0,n()});var a=!1;return function(o){if(!i&&!a){if(a=!0,XO(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(o||new QO("pipe"))}}}function H1(e){e()}function ZO(e,t){return e.pipe(t)}function eM(e){return!e.length||typeof e[e.length-1]!="function"?G1:e.pop()}function tM(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=eM(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new zO("streams");var i,a=t.map(function(o,s){var u=s<t.length-1,c=s>0;return JO(o,u,c,function(l){i||(i=l),l&&a.forEach(H1),!u&&(a.forEach(H1),n(i))})});return t.reduce(ZO)}var rM=tM;(function(e,t){t=e.exports=R1(),t.Stream=t,t.Readable=t,t.Writable=Od(),t.Duplex=ka(),t.Transform=j1,t.PassThrough=YO,t.finished=wd,t.pipeline=rM})(Bi,Bi.exports);var ms={exports:{}},Ud,Y1;function W1(){if(Y1)return Ud;Y1=1;var e=[],t=[],r=function(){};function n(d){return~e.indexOf(d)?!1:(e.push(d),!0)}function i(d){r=d}function a(d){for(var g=[],h=0;h<e.length;h++){if(e[h].async){g.push(e[h]);continue}if(e[h](d))return!0}return g.length?new Promise(function(p){Promise.all(g.map(function(w){return w(d)})).then(function(w){p(w.some(Boolean))})}):!1}function o(d){return~t.indexOf(d)?!1:(t.push(d),!0)}function s(){r.apply(r,arguments)}function u(d){for(var g=0;g<t.length;g++)d=t[g].apply(t[g],arguments);return d}function c(d,g){var h=Object.prototype.hasOwnProperty;for(var v in g)h.call(g,v)&&(d[v]=g[v]);return d}function l(d){return d.enabled=!1,d.modify=o,d.set=i,d.use=n,c(function(){return!1},d)}function f(d){function g(){var h=Array.prototype.slice.call(arguments,0);return s.call(s,d,u(h,d)),!0}return d.enabled=!0,d.modify=o,d.set=i,d.use=n,c(g,d)}return Ud=function(g){return g.introduce=c,g.enabled=a,g.process=u,g.modify=o,g.write=s,g.nope=l,g.yep=f,g.set=i,g.use=n,g},Ud}var $d,z1;function nM(){if(z1)return $d;z1=1;var e=W1(),t=e(function r(n,i){return i=i||{},i.namespace=n,i.prod=!0,i.dev=!1,i.force||r.force?r.yep(i):r.nope(i)});return $d=t,$d}var jd={exports:{}},Kd,Q1;function iM(){return Q1||(Q1=1,Kd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),Kd}var qd={exports:{}},Vd,X1;function aM(){return X1||(X1=1,Vd=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")}),Vd}var J1;function oM(){if(J1)return qd.exports;J1=1;var e=aM(),t=Array.prototype.concat,r=Array.prototype.slice,n=qd.exports=function(a){for(var o=[],s=0,u=a.length;s<u;s++){var c=a[s];e(c)?o=t.call(o,r.call(c)):o.push(c)}return o};return n.wrap=function(i){return function(){return i(n(arguments))}},qd.exports}var Z1;function sM(){if(Z1)return jd.exports;Z1=1;var e=iM(),t=oM(),r=Object.hasOwnProperty,n=Object.create(null);for(var i in e)r.call(e,i)&&(n[e[i]]=i);var a=jd.exports={to:{},get:{}};a.get=function(u){var c=u.substring(0,3).toLowerCase(),l,f;switch(c){case"hsl":l=a.get.hsl(u),f="hsl";break;case"hwb":l=a.get.hwb(u),f="hwb";break;default:l=a.get.rgb(u),f="rgb";break}return l?{model:f,value:l}:null},a.get.rgb=function(u){if(!u)return null;var c=/^#([a-f0-9]{3,4})$/i,l=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,f=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,d=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,g=/^(\w+)$/,h=[0,0,0,1],v,p,y;if(v=u.match(l)){for(y=v[2],v=v[1],p=0;p<3;p++){var w=p*2;h[p]=parseInt(v.slice(w,w+2),16)}y&&(h[3]=parseInt(y,16)/255)}else if(v=u.match(c)){for(v=v[1],y=v[3],p=0;p<3;p++)h[p]=parseInt(v[p]+v[p],16);y&&(h[3]=parseInt(y+y,16)/255)}else if(v=u.match(f)){for(p=0;p<3;p++)h[p]=parseInt(v[p+1],0);v[4]&&(v[5]?h[3]=parseFloat(v[4])*.01:h[3]=parseFloat(v[4]))}else if(v=u.match(d)){for(p=0;p<3;p++)h[p]=Math.round(parseFloat(v[p+1])*2.55);v[4]&&(v[5]?h[3]=parseFloat(v[4])*.01:h[3]=parseFloat(v[4]))}else return(v=u.match(g))?v[1]==="transparent"?[0,0,0,0]:r.call(e,v[1])?(h=e[v[1]],h[3]=1,h):null:null;for(p=0;p<3;p++)h[p]=o(h[p],0,255);return h[3]=o(h[3],0,1),h},a.get.hsl=function(u){if(!u)return null;var c=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,l=u.match(c);if(l){var f=parseFloat(l[4]),d=(parseFloat(l[1])%360+360)%360,g=o(parseFloat(l[2]),0,100),h=o(parseFloat(l[3]),0,100),v=o(isNaN(f)?1:f,0,1);return[d,g,h,v]}return null},a.get.hwb=function(u){if(!u)return null;var c=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,l=u.match(c);if(l){var f=parseFloat(l[4]),d=(parseFloat(l[1])%360+360)%360,g=o(parseFloat(l[2]),0,100),h=o(parseFloat(l[3]),0,100),v=o(isNaN(f)?1:f,0,1);return[d,g,h,v]}return null},a.to.hex=function(){var u=t(arguments);return"#"+s(u[0])+s(u[1])+s(u[2])+(u[3]<1?s(Math.round(u[3]*255)):"")},a.to.rgb=function(){var u=t(arguments);return u.length<4||u[3]===1?"rgb("+Math.round(u[0])+", "+Math.round(u[1])+", "+Math.round(u[2])+")":"rgba("+Math.round(u[0])+", "+Math.round(u[1])+", "+Math.round(u[2])+", "+u[3]+")"},a.to.rgb.percent=function(){var u=t(arguments),c=Math.round(u[0]/255*100),l=Math.round(u[1]/255*100),f=Math.round(u[2]/255*100);return u.length<4||u[3]===1?"rgb("+c+"%, "+l+"%, "+f+"%)":"rgba("+c+"%, "+l+"%, "+f+"%, "+u[3]+")"},a.to.hsl=function(){var u=t(arguments);return u.length<4||u[3]===1?"hsl("+u[0]+", "+u[1]+"%, "+u[2]+"%)":"hsla("+u[0]+", "+u[1]+"%, "+u[2]+"%, "+u[3]+")"},a.to.hwb=function(){var u=t(arguments),c="";return u.length>=4&&u[3]!==1&&(c=", "+u[3]),"hwb("+u[0]+", "+u[1]+"%, "+u[2]+"%"+c+")"},a.to.keyword=function(u){return n[u.slice(0,3)]};function o(u,c,l){return Math.min(Math.max(c,u),l)}function s(u){var c=Math.round(u).toString(16).toUpperCase();return c.length<2?"0"+c:c}return jd.exports}var Gd={exports:{}},Hd,eE;function uM(){return eE||(eE=1,Hd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),Hd}var tE;function rE(){if(tE)return Gd.exports;tE=1;var e=uM(),t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);var n=Gd.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var i in n)if(n.hasOwnProperty(i)){if(!("channels"in n[i]))throw new Error("missing channels property: "+i);if(!("labels"in n[i]))throw new Error("missing channel labels property: "+i);if(n[i].labels.length!==n[i].channels)throw new Error("channel and label counts mismatch: "+i);var a=n[i].channels,o=n[i].labels;delete n[i].channels,delete n[i].labels,Object.defineProperty(n[i],"channels",{value:a}),Object.defineProperty(n[i],"labels",{value:o})}n.rgb.hsl=function(u){var c=u[0]/255,l=u[1]/255,f=u[2]/255,d=Math.min(c,l,f),g=Math.max(c,l,f),h=g-d,v,p,y;return g===d?v=0:c===g?v=(l-f)/h:l===g?v=2+(f-c)/h:f===g&&(v=4+(c-l)/h),v=Math.min(v*60,360),v<0&&(v+=360),y=(d+g)/2,g===d?p=0:y<=.5?p=h/(g+d):p=h/(2-g-d),[v,p*100,y*100]},n.rgb.hsv=function(u){var c,l,f,d,g,h=u[0]/255,v=u[1]/255,p=u[2]/255,y=Math.max(h,v,p),w=y-Math.min(h,v,p),m=function(S){return(y-S)/6/w+1/2};return w===0?d=g=0:(g=w/y,c=m(h),l=m(v),f=m(p),h===y?d=f-l:v===y?d=1/3+c-f:p===y&&(d=2/3+l-c),d<0?d+=1:d>1&&(d-=1)),[d*360,g*100,y*100]},n.rgb.hwb=function(u){var c=u[0],l=u[1],f=u[2],d=n.rgb.hsl(u)[0],g=1/255*Math.min(c,Math.min(l,f));return f=1-1/255*Math.max(c,Math.max(l,f)),[d,g*100,f*100]},n.rgb.cmyk=function(u){var c=u[0]/255,l=u[1]/255,f=u[2]/255,d,g,h,v;return v=Math.min(1-c,1-l,1-f),d=(1-c-v)/(1-v)||0,g=(1-l-v)/(1-v)||0,h=(1-f-v)/(1-v)||0,[d*100,g*100,h*100,v*100]};function s(u,c){return Math.pow(u[0]-c[0],2)+Math.pow(u[1]-c[1],2)+Math.pow(u[2]-c[2],2)}return n.rgb.keyword=function(u){var c=t[u];if(c)return c;var l=1/0,f;for(var d in e)if(e.hasOwnProperty(d)){var g=e[d],h=s(u,g);h<l&&(l=h,f=d)}return f},n.keyword.rgb=function(u){return e[u]},n.rgb.xyz=function(u){var c=u[0]/255,l=u[1]/255,f=u[2]/255;c=c>.04045?Math.pow((c+.055)/1.055,2.4):c/12.92,l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92,f=f>.04045?Math.pow((f+.055)/1.055,2.4):f/12.92;var d=c*.4124+l*.3576+f*.1805,g=c*.2126+l*.7152+f*.0722,h=c*.0193+l*.1192+f*.9505;return[d*100,g*100,h*100]},n.rgb.lab=function(u){var c=n.rgb.xyz(u),l=c[0],f=c[1],d=c[2],g,h,v;return l/=95.047,f/=100,d/=108.883,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,d=d>.008856?Math.pow(d,1/3):7.787*d+16/116,g=116*f-16,h=500*(l-f),v=200*(f-d),[g,h,v]},n.hsl.rgb=function(u){var c=u[0]/360,l=u[1]/100,f=u[2]/100,d,g,h,v,p;if(l===0)return p=f*255,[p,p,p];f<.5?g=f*(1+l):g=f+l-f*l,d=2*f-g,v=[0,0,0];for(var y=0;y<3;y++)h=c+1/3*-(y-1),h<0&&h++,h>1&&h--,6*h<1?p=d+(g-d)*6*h:2*h<1?p=g:3*h<2?p=d+(g-d)*(2/3-h)*6:p=d,v[y]=p*255;return v},n.hsl.hsv=function(u){var c=u[0],l=u[1]/100,f=u[2]/100,d=l,g=Math.max(f,.01),h,v;return f*=2,l*=f<=1?f:2-f,d*=g<=1?g:2-g,v=(f+l)/2,h=f===0?2*d/(g+d):2*l/(f+l),[c,h*100,v*100]},n.hsv.rgb=function(u){var c=u[0]/60,l=u[1]/100,f=u[2]/100,d=Math.floor(c)%6,g=c-Math.floor(c),h=255*f*(1-l),v=255*f*(1-l*g),p=255*f*(1-l*(1-g));switch(f*=255,d){case 0:return[f,p,h];case 1:return[v,f,h];case 2:return[h,f,p];case 3:return[h,v,f];case 4:return[p,h,f];case 5:return[f,h,v]}},n.hsv.hsl=function(u){var c=u[0],l=u[1]/100,f=u[2]/100,d=Math.max(f,.01),g,h,v;return v=(2-l)*f,g=(2-l)*d,h=l*d,h/=g<=1?g:2-g,h=h||0,v/=2,[c,h*100,v*100]},n.hwb.rgb=function(u){var c=u[0]/360,l=u[1]/100,f=u[2]/100,d=l+f,g,h,v,p;d>1&&(l/=d,f/=d),g=Math.floor(6*c),h=1-f,v=6*c-g,(g&1)!==0&&(v=1-v),p=l+v*(h-l);var y,w,m;switch(g){default:case 6:case 0:y=h,w=p,m=l;break;case 1:y=p,w=h,m=l;break;case 2:y=l,w=h,m=p;break;case 3:y=l,w=p,m=h;break;case 4:y=p,w=l,m=h;break;case 5:y=h,w=l,m=p;break}return[y*255,w*255,m*255]},n.cmyk.rgb=function(u){var c=u[0]/100,l=u[1]/100,f=u[2]/100,d=u[3]/100,g,h,v;return g=1-Math.min(1,c*(1-d)+d),h=1-Math.min(1,l*(1-d)+d),v=1-Math.min(1,f*(1-d)+d),[g*255,h*255,v*255]},n.xyz.rgb=function(u){var c=u[0]/100,l=u[1]/100,f=u[2]/100,d,g,h;return d=c*3.2406+l*-1.5372+f*-.4986,g=c*-.9689+l*1.8758+f*.0415,h=c*.0557+l*-.204+f*1.057,d=d>.0031308?1.055*Math.pow(d,1/2.4)-.055:d*12.92,g=g>.0031308?1.055*Math.pow(g,1/2.4)-.055:g*12.92,h=h>.0031308?1.055*Math.pow(h,1/2.4)-.055:h*12.92,d=Math.min(Math.max(0,d),1),g=Math.min(Math.max(0,g),1),h=Math.min(Math.max(0,h),1),[d*255,g*255,h*255]},n.xyz.lab=function(u){var c=u[0],l=u[1],f=u[2],d,g,h;return c/=95.047,l/=100,f/=108.883,c=c>.008856?Math.pow(c,1/3):7.787*c+16/116,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,d=116*l-16,g=500*(c-l),h=200*(l-f),[d,g,h]},n.lab.xyz=function(u){var c=u[0],l=u[1],f=u[2],d,g,h;g=(c+16)/116,d=l/500+g,h=g-f/200;var v=Math.pow(g,3),p=Math.pow(d,3),y=Math.pow(h,3);return g=v>.008856?v:(g-16/116)/7.787,d=p>.008856?p:(d-16/116)/7.787,h=y>.008856?y:(h-16/116)/7.787,d*=95.047,g*=100,h*=108.883,[d,g,h]},n.lab.lch=function(u){var c=u[0],l=u[1],f=u[2],d,g,h;return d=Math.atan2(f,l),g=d*360/2/Math.PI,g<0&&(g+=360),h=Math.sqrt(l*l+f*f),[c,h,g]},n.lch.lab=function(u){var c=u[0],l=u[1],f=u[2],d,g,h;return h=f/360*2*Math.PI,d=l*Math.cos(h),g=l*Math.sin(h),[c,d,g]},n.rgb.ansi16=function(u){var c=u[0],l=u[1],f=u[2],d=1 in arguments?arguments[1]:n.rgb.hsv(u)[2];if(d=Math.round(d/50),d===0)return 30;var g=30+(Math.round(f/255)<<2|Math.round(l/255)<<1|Math.round(c/255));return d===2&&(g+=60),g},n.hsv.ansi16=function(u){return n.rgb.ansi16(n.hsv.rgb(u),u[2])},n.rgb.ansi256=function(u){var c=u[0],l=u[1],f=u[2];if(c===l&&l===f)return c<8?16:c>248?231:Math.round((c-8)/247*24)+232;var d=16+36*Math.round(c/255*5)+6*Math.round(l/255*5)+Math.round(f/255*5);return d},n.ansi16.rgb=function(u){var c=u%10;if(c===0||c===7)return u>50&&(c+=3.5),c=c/10.5*255,[c,c,c];var l=(~~(u>50)+1)*.5,f=(c&1)*l*255,d=(c>>1&1)*l*255,g=(c>>2&1)*l*255;return[f,d,g]},n.ansi256.rgb=function(u){if(u>=232){var c=(u-232)*10+8;return[c,c,c]}u-=16;var l,f=Math.floor(u/36)/5*255,d=Math.floor((l=u%36)/6)/5*255,g=l%6/5*255;return[f,d,g]},n.rgb.hex=function(u){var c=((Math.round(u[0])&255)<<16)+((Math.round(u[1])&255)<<8)+(Math.round(u[2])&255),l=c.toString(16).toUpperCase();return"000000".substring(l.length)+l},n.hex.rgb=function(u){var c=u.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!c)return[0,0,0];var l=c[0];c[0].length===3&&(l=l.split("").map(function(v){return v+v}).join(""));var f=parseInt(l,16),d=f>>16&255,g=f>>8&255,h=f&255;return[d,g,h]},n.rgb.hcg=function(u){var c=u[0]/255,l=u[1]/255,f=u[2]/255,d=Math.max(Math.max(c,l),f),g=Math.min(Math.min(c,l),f),h=d-g,v,p;return h<1?v=g/(1-h):v=0,h<=0?p=0:d===c?p=(l-f)/h%6:d===l?p=2+(f-c)/h:p=4+(c-l)/h+4,p/=6,p%=1,[p*360,h*100,v*100]},n.hsl.hcg=function(u){var c=u[1]/100,l=u[2]/100,f=1,d=0;return l<.5?f=2*c*l:f=2*c*(1-l),f<1&&(d=(l-.5*f)/(1-f)),[u[0],f*100,d*100]},n.hsv.hcg=function(u){var c=u[1]/100,l=u[2]/100,f=c*l,d=0;return f<1&&(d=(l-f)/(1-f)),[u[0],f*100,d*100]},n.hcg.rgb=function(u){var c=u[0]/360,l=u[1]/100,f=u[2]/100;if(l===0)return[f*255,f*255,f*255];var d=[0,0,0],g=c%1*6,h=g%1,v=1-h,p=0;switch(Math.floor(g)){case 0:d[0]=1,d[1]=h,d[2]=0;break;case 1:d[0]=v,d[1]=1,d[2]=0;break;case 2:d[0]=0,d[1]=1,d[2]=h;break;case 3:d[0]=0,d[1]=v,d[2]=1;break;case 4:d[0]=h,d[1]=0,d[2]=1;break;default:d[0]=1,d[1]=0,d[2]=v}return p=(1-l)*f,[(l*d[0]+p)*255,(l*d[1]+p)*255,(l*d[2]+p)*255]},n.hcg.hsv=function(u){var c=u[1]/100,l=u[2]/100,f=c+l*(1-c),d=0;return f>0&&(d=c/f),[u[0],d*100,f*100]},n.hcg.hsl=function(u){var c=u[1]/100,l=u[2]/100,f=l*(1-c)+.5*c,d=0;return f>0&&f<.5?d=c/(2*f):f>=.5&&f<1&&(d=c/(2*(1-f))),[u[0],d*100,f*100]},n.hcg.hwb=function(u){var c=u[1]/100,l=u[2]/100,f=c+l*(1-c);return[u[0],(f-c)*100,(1-f)*100]},n.hwb.hcg=function(u){var c=u[1]/100,l=u[2]/100,f=1-l,d=f-c,g=0;return d<1&&(g=(f-d)/(1-d)),[u[0],d*100,g*100]},n.apple.rgb=function(u){return[u[0]/65535*255,u[1]/65535*255,u[2]/65535*255]},n.rgb.apple=function(u){return[u[0]/255*65535,u[1]/255*65535,u[2]/255*65535]},n.gray.rgb=function(u){return[u[0]/100*255,u[0]/100*255,u[0]/100*255]},n.gray.hsl=n.gray.hsv=function(u){return[0,0,u[0]]},n.gray.hwb=function(u){return[0,100,u[0]]},n.gray.cmyk=function(u){return[0,0,0,u[0]]},n.gray.lab=function(u){return[u[0],0,0]},n.gray.hex=function(u){var c=Math.round(u[0]/100*255)&255,l=(c<<16)+(c<<8)+c,f=l.toString(16).toUpperCase();return"000000".substring(f.length)+f},n.rgb.gray=function(u){var c=(u[0]+u[1]+u[2])/3;return[c/255*100]},Gd.exports}var Yd,nE;function cM(){if(nE)return Yd;nE=1;var e=rE();function t(){for(var a={},o=Object.keys(e),s=o.length,u=0;u<s;u++)a[o[u]]={distance:-1,parent:null};return a}function r(a){var o=t(),s=[a];for(o[a].distance=0;s.length;)for(var u=s.pop(),c=Object.keys(e[u]),l=c.length,f=0;f<l;f++){var d=c[f],g=o[d];g.distance===-1&&(g.distance=o[u].distance+1,g.parent=u,s.unshift(d))}return o}function n(a,o){return function(s){return o(a(s))}}function i(a,o){for(var s=[o[a].parent,a],u=e[o[a].parent][a],c=o[a].parent;o[c].parent;)s.unshift(o[c].parent),u=n(e[o[c].parent][c],u),c=o[c].parent;return u.conversion=s,u}return Yd=function(a){for(var o=r(a),s={},u=Object.keys(o),c=u.length,l=0;l<c;l++){var f=u[l],d=o[f];d.parent!==null&&(s[f]=i(f,o))}return s},Yd}var Wd,iE;function lM(){if(iE)return Wd;iE=1;var e=rE(),t=cM(),r={},n=Object.keys(e);function i(o){var s=function(u){return u==null?u:(arguments.length>1&&(u=Array.prototype.slice.call(arguments)),o(u))};return"conversion"in o&&(s.conversion=o.conversion),s}function a(o){var s=function(u){if(u==null)return u;arguments.length>1&&(u=Array.prototype.slice.call(arguments));var c=o(u);if(typeof c=="object")for(var l=c.length,f=0;f<l;f++)c[f]=Math.round(c[f]);return c};return"conversion"in o&&(s.conversion=o.conversion),s}return n.forEach(function(o){r[o]={},Object.defineProperty(r[o],"channels",{value:e[o].channels}),Object.defineProperty(r[o],"labels",{value:e[o].labels});var s=t(o),u=Object.keys(s);u.forEach(function(c){var l=s[c];r[o][c]=a(l),r[o][c].raw=i(l)})}),Wd=r,Wd}var zd,aE;function fM(){if(aE)return zd;aE=1;var e=sM(),t=lM(),r=[].slice,n=["keyword","gray","hex"],i={};Object.keys(t).forEach(function(g){i[r.call(t[g].labels).sort().join("")]=g});var a={};function o(g,h){if(!(this instanceof o))return new o(g,h);if(h&&h in n&&(h=null),h&&!(h in t))throw new Error("Unknown model: "+h);var v,p;if(g==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(g instanceof o)this.model=g.model,this.color=g.color.slice(),this.valpha=g.valpha;else if(typeof g=="string"){var y=e.get(g);if(y===null)throw new Error("Unable to parse color from string: "+g);this.model=y.model,p=t[this.model].channels,this.color=y.value.slice(0,p),this.valpha=typeof y.value[p]=="number"?y.value[p]:1}else if(g.length){this.model=h||"rgb",p=t[this.model].channels;var w=r.call(g,0,p);this.color=d(w,p),this.valpha=typeof g[p]=="number"?g[p]:1}else if(typeof g=="number")g&=16777215,this.model="rgb",this.color=[g>>16&255,g>>8&255,g&255],this.valpha=1;else{this.valpha=1;var m=Object.keys(g);"alpha"in g&&(m.splice(m.indexOf("alpha"),1),this.valpha=typeof g.alpha=="number"?g.alpha:0);var S=m.sort().join("");if(!(S in i))throw new Error("Unable to parse color from object: "+JSON.stringify(g));this.model=i[S];var A=t[this.model].labels,I=[];for(v=0;v<A.length;v++)I.push(g[A[v]]);this.color=d(I)}if(a[this.model])for(p=t[this.model].channels,v=0;v<p;v++){var N=a[this.model][v];N&&(this.color[v]=N(this.color[v]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}o.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(g){var h=this.model in e.to?this:this.rgb();h=h.round(typeof g=="number"?g:1);var v=h.valpha===1?h.color:h.color.concat(this.valpha);return e.to[h.model](v)},percentString:function(g){var h=this.rgb().round(typeof g=="number"?g:1),v=h.valpha===1?h.color:h.color.concat(this.valpha);return e.to.rgb.percent(v)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var g={},h=t[this.model].channels,v=t[this.model].labels,p=0;p<h;p++)g[v[p]]=this.color[p];return this.valpha!==1&&(g.alpha=this.valpha),g},unitArray:function(){var g=this.rgb().color;return g[0]/=255,g[1]/=255,g[2]/=255,this.valpha!==1&&g.push(this.valpha),g},unitObject:function(){var g=this.rgb().object();return g.r/=255,g.g/=255,g.b/=255,this.valpha!==1&&(g.alpha=this.valpha),g},round:function(g){return g=Math.max(g||0,0),new o(this.color.map(u(g)).concat(this.valpha),this.model)},alpha:function(g){return arguments.length?new o(this.color.concat(Math.max(0,Math.min(1,g))),this.model):this.valpha},red:c("rgb",0,l(255)),green:c("rgb",1,l(255)),blue:c("rgb",2,l(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,function(g){return(g%360+360)%360}),saturationl:c("hsl",1,l(100)),lightness:c("hsl",2,l(100)),saturationv:c("hsv",1,l(100)),value:c("hsv",2,l(100)),chroma:c("hcg",1,l(100)),gray:c("hcg",2,l(100)),white:c("hwb",1,l(100)),wblack:c("hwb",2,l(100)),cyan:c("cmyk",0,l(100)),magenta:c("cmyk",1,l(100)),yellow:c("cmyk",2,l(100)),black:c("cmyk",3,l(100)),x:c("xyz",0,l(100)),y:c("xyz",1,l(100)),z:c("xyz",2,l(100)),l:c("lab",0,l(100)),a:c("lab",1),b:c("lab",2),keyword:function(g){return arguments.length?new o(g):t[this.model].keyword(this.color)},hex:function(g){return arguments.length?new o(g):e.to.hex(this.rgb().round().color)},rgbNumber:function(){var g=this.rgb().color;return(g[0]&255)<<16|(g[1]&255)<<8|g[2]&255},luminosity:function(){for(var g=this.rgb().color,h=[],v=0;v<g.length;v++){var p=g[v]/255;h[v]=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4)}return .2126*h[0]+.7152*h[1]+.0722*h[2]},contrast:function(g){var h=this.luminosity(),v=g.luminosity();return h>v?(h+.05)/(v+.05):(v+.05)/(h+.05)},level:function(g){var h=this.contrast(g);return h>=7.1?"AAA":h>=4.5?"AA":""},isDark:function(){var g=this.rgb().color,h=(g[0]*299+g[1]*587+g[2]*114)/1e3;return h<128},isLight:function(){return!this.isDark()},negate:function(){for(var g=this.rgb(),h=0;h<3;h++)g.color[h]=255-g.color[h];return g},lighten:function(g){var h=this.hsl();return h.color[2]+=h.color[2]*g,h},darken:function(g){var h=this.hsl();return h.color[2]-=h.color[2]*g,h},saturate:function(g){var h=this.hsl();return h.color[1]+=h.color[1]*g,h},desaturate:function(g){var h=this.hsl();return h.color[1]-=h.color[1]*g,h},whiten:function(g){var h=this.hwb();return h.color[1]+=h.color[1]*g,h},blacken:function(g){var h=this.hwb();return h.color[2]+=h.color[2]*g,h},grayscale:function(){var g=this.rgb().color,h=g[0]*.3+g[1]*.59+g[2]*.11;return o.rgb(h,h,h)},fade:function(g){return this.alpha(this.valpha-this.valpha*g)},opaquer:function(g){return this.alpha(this.valpha+this.valpha*g)},rotate:function(g){var h=this.hsl(),v=h.color[0];return v=(v+g)%360,v=v<0?360+v:v,h.color[0]=v,h},mix:function(g,h){if(!g||!g.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof g);var v=g.rgb(),p=this.rgb(),y=h===void 0?.5:h,w=2*y-1,m=v.alpha()-p.alpha(),S=((w*m===-1?w:(w+m)/(1+w*m))+1)/2,A=1-S;return o.rgb(S*v.red()+A*p.red(),S*v.green()+A*p.green(),S*v.blue()+A*p.blue(),v.alpha()*y+p.alpha()*(1-y))}},Object.keys(t).forEach(function(g){if(n.indexOf(g)===-1){var h=t[g].channels;o.prototype[g]=function(){if(this.model===g)return new o(this);if(arguments.length)return new o(arguments,g);var v=typeof arguments[h]=="number"?h:this.valpha;return new o(f(t[this.model][g].raw(this.color)).concat(v),g)},o[g]=function(v){return typeof v=="number"&&(v=d(r.call(arguments),h)),new o(v,g)}}});function s(g,h){return Number(g.toFixed(h))}function u(g){return function(h){return s(h,g)}}function c(g,h,v){return g=Array.isArray(g)?g:[g],g.forEach(function(p){(a[p]||(a[p]=[]))[h]=v}),g=g[0],function(p){var y;return arguments.length?(v&&(p=v(p)),y=this[g](),y.color[h]=p,y):(y=this[g]().color[h],v&&(y=v(y)),y)}}function l(g){return function(h){return Math.max(0,Math.min(g,h))}}function f(g){return Array.isArray(g)?g:[g]}function d(g,h){for(var v=0;v<h;v++)typeof g[v]!="number"&&(g[v]=0);return g}return zd=o,zd}var Qd,oE;function dM(){return oE||(oE=1,Qd=function(t){for(var r=0,n=0;r<t.length;n=t.charCodeAt(r++)+((n<<5)-n));var i=Math.floor(Math.abs(Math.sin(n)*1e4%1*16777216)).toString(16);return"#"+Array(6-i.length+1).join("0")+i}),Qd}var Xd,sE;function hM(){if(sE)return Xd;sE=1;var e=fM(),t=dM();return Xd=function(n,i){var a=n.split(i||":"),o=t(a[0]);if(!a.length)return o;for(var s=0,u=a.length-1;s<u;s++)o=e(o).mix(e(t(a[s+1]))).saturate(1).hex();return o},Xd}var Jd,uE;function pM(){if(uE)return Jd;uE=1;var e=hM();return Jd=function(r,n){var i=n.namespace;if(n.colors===!1)return r[0]=i+": "+r[0],r;var a=e(i);return r[0]="%c"+i+":%c "+r[0],r.splice(1,0,"color:"+a,"color:inherit"),r},Jd}var Zd,cE;function gM(){return cE||(cE=1,Zd=function(t,r){if(!r)return!1;for(var n=r.split(/[\s,]+/),i=0;i<n.length;i++){if(r=n[i].replace("*",".*?"),r.charAt(0)==="-"){if(new RegExp("^"+r.substr(1)+"$").test(t))return!1;continue}if(new RegExp("^"+r+"$").test(t))return!0}return!1}),Zd}var eh,lE;function fE(){if(lE)return eh;lE=1;var e=gM();return eh=function(r){return function(i){try{return e(i,r())}catch{}return!1}},eh}var th,dE;function yM(){if(dE)return th;dE=1;var e=fE();return th=e(function(){return localStorage.getItem("debug")||localStorage.getItem("diagnostics")}),th}var rh,hE;function vM(){if(hE)return rh;hE=1;var e=fE();return rh=e(function(){return/(debug|diagnostics)=([^&]+)/i.exec(window.location.hash)[2]}),rh}var nh,pE;function mM(){return pE||(pE=1,nh=function(e,t){try{Function.prototype.apply.call(console.log,console,t)}catch{}}),nh}var ih,gE;function EM(){if(gE)return ih;gE=1;var e=W1(),t=e(function r(n,i){return i=i||{},i.namespace=n,i.prod=!1,i.dev=!0,!r.enabled(n)&&!(i.force||r.force)?r.nope(i):r.yep(i)});return t.modify(pM()),t.use(yM()),t.use(vM()),t.set(mM()),ih=t,ih}(function(e){process.env.NODE_ENV==="production"?e.exports=nM():e.exports=EM()})(ms);var ah={},yE;function bM(){if(yE)return ah;yE=1;var e=Da.Buffer,t=e.isEncoding||function(s){switch(s&&s.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(s){if(s&&!t(s))throw new Error("Unknown encoding: "+s)}var n=ah.StringDecoder=function(s){switch(this.encoding=(s||"utf8").toLowerCase().replace(/[-_]/,""),r(s),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:this.write=i;return}this.charBuffer=new e(6),this.charReceived=0,this.charLength=0};n.prototype.write=function(s){for(var u="";this.charLength;){var c=s.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:s.length;if(s.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived<this.charLength)return"";s=s.slice(c,s.length),u=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var f=u.charCodeAt(u.length-1);if(f>=55296&&f<=56319){this.charLength+=this.surrogateSize,u="";continue}if(this.charReceived=this.charLength=0,s.length===0)return u;break}this.detectIncompleteChar(s);var l=s.length;this.charLength&&(s.copy(this.charBuffer,0,s.length-this.charReceived,l),l-=this.charReceived),u+=s.toString(this.encoding,0,l);var l=u.length-1,f=u.charCodeAt(l);if(f>=55296&&f<=56319){var d=this.surrogateSize;return this.charLength+=d,this.charReceived+=d,this.charBuffer.copy(this.charBuffer,d,0,d),s.copy(this.charBuffer,0,0,d),u.substring(0,l)}return u},n.prototype.detectIncompleteChar=function(s){for(var u=s.length>=3?3:s.length;u>0;u--){var c=s[s.length-u];if(u==1&&c>>5==6){this.charLength=2;break}if(u<=2&&c>>4==14){this.charLength=3;break}if(u<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=u},n.prototype.end=function(s){var u="";if(s&&s.length&&(u=this.write(s)),this.charReceived){var c=this.charReceived,l=this.charBuffer,f=this.encoding;u+=l.slice(0,c).toString(f)}return u};function i(s){return s.toString(this.encoding)}function a(s){this.charReceived=s.length%2,this.charLength=this.charReceived?2:0}function o(s){this.charReceived=s.length%3,this.charLength=this.charReceived?3:0}return ah}var oh,vE;function _M(){if(vE)return oh;vE=1;var e=_e,t=bM(),r=t.StringDecoder,n=Bi.exports,i=n.Stream;function a(){}return oh=function(o,s){var u=Buffer.alloc(65536),c=new r("utf8"),l=new i,f="",d=0,g=0;return o.start===-1&&delete o.start,l.readable=!0,l.destroy=function(){l.destroyed=!0,l.emit("end"),l.emit("close")},e.open(o.file,"a+","0644",function(h,v){if(h){s?s(h):l.emit("error",h),l.destroy();return}(function p(){if(l.destroyed){e.close(v,a);return}return e.read(v,u,0,u.length,d,function(y,w){if(y){s?s(y):l.emit("error",y),l.destroy();return}if(!w)return f&&((o.start==null||g>o.start)&&(s?s(null,f):l.emit("line",f)),g++,f=""),setTimeout(p,1e3);var m=c.write(u.slice(0,w));s||l.emit("data",m),m=(f+m).split(/\n+/);for(var S=m.length-1,A=0;A<S;A++)(o.start==null||g>o.start)&&(s?s(null,m[A]):l.emit("line",m[A])),g++;return f=m[S],d+=w,p()})})()}),s?l.destroy:l},oh}var sh,mE;function SM(){if(mE)return sh;mE=1;function e(T){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(M){return typeof M}:function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},e(T)}function t(T,M){if(!(T instanceof M))throw new TypeError("Cannot call a class as a function")}function r(T,M){for(var P=0;P<M.length;P++){var L=M[P];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(T,L.key,L)}}function n(T,M,P){return M&&r(T.prototype,M),P&&r(T,P),Object.defineProperty(T,"prototype",{writable:!1}),T}function i(T,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");T.prototype=Object.create(M&&M.prototype,{constructor:{value:T,writable:!0,configurable:!0}}),Object.defineProperty(T,"prototype",{writable:!1}),M&&a(T,M)}function a(T,M){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(L,B){return L.__proto__=B,L},a(T,M)}function o(T){var M=c();return function(){var L=l(T),B;if(M){var X=l(this).constructor;B=Reflect.construct(L,arguments,X)}else B=L.apply(this,arguments);return s(this,B)}}function s(T,M){if(M&&(e(M)==="object"||typeof M=="function"))return M;if(M!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return u(T)}function u(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function c(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function l(T){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(P){return P.__proto__||Object.getPrototypeOf(P)},l(T)}var f=_e,d=_e,g=$O(),h=_e,v=ht,p=v.MESSAGE,y=Bi.exports,w=y.Stream,m=y.PassThrough,S=mn(),A=ms.exports("winston:file"),I=_e,N=_M();return sh=function(T){i(P,T);var M=o(P);function P(){var L,B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t(this,P),L=M.call(this,B),L.name=B.name||"file";function X(V){for(var k=arguments.length,$=new Array(k>1?k-1:0),G=1;G<k;G++)$[G-1]=arguments[G];$.slice(1).forEach(function(oe){if(B[oe])throw new Error("Cannot set ".concat(oe," and ").concat(V," together"))})}if(L._stream=new m,L._stream.setMaxListeners(30),L._onError=L._onError.bind(u(L)),B.filename||B.dirname)X("filename or dirname","stream"),L._basename=L.filename=B.filename?d.basename(B.filename):"winston.log",L.dirname=B.dirname||d.dirname(B.filename),L.options=B.options||{flags:"a"};else if(B.stream)console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream"),X("stream","filename","maxsize"),L._dest=L._stream.pipe(L._setupStream(B.stream)),L.dirname=d.dirname(L._dest.path);else throw new Error("Cannot log to file without filename or stream.");return L.maxsize=B.maxsize||null,L.rotationFormat=B.rotationFormat||!1,L.zippedArchive=B.zippedArchive||!1,L.maxFiles=B.maxFiles||null,L.eol=typeof B.eol=="string"?B.eol:I.EOL,L.tailable=B.tailable||!1,L._size=0,L._pendingSize=0,L._created=0,L._drain=!1,L._opening=!1,L._ending=!1,L.dirname&&L._createLogDirIfNotExist(L.dirname),L.open(),L}return n(P,[{key:"finishIfEnding",value:function(){var B=this;this._ending&&(this._opening?this.once("open",function(){B._stream.once("finish",function(){return B.emit("finish")}),setImmediate(function(){return B._stream.end()})}):(this._stream.once("finish",function(){return B.emit("finish")}),setImmediate(function(){return B._stream.end()})))}},{key:"log",value:function(B){var X=this,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){};if(this.silent)return V(),!0;if(this._drain){this._stream.once("drain",function(){X._drain=!1,X.log(B,V)});return}if(this._rotate){this._stream.once("rotate",function(){X._rotate=!1,X.log(B,V)});return}var k="".concat(B[p]).concat(this.eol),$=Buffer.byteLength(k);function G(){var se=this;this._size+=$,this._pendingSize-=$,A("logged %s %s",this._size,k),this.emit("logged",B),!this._opening&&(!this._needsNewFile()||(this._rotate=!0,this._endStream(function(){return se._rotateFile()})))}this._pendingSize+=$,this._opening&&!this.rotatedWhileOpening&&this._needsNewFile(this._size+this._pendingSize)&&(this.rotatedWhileOpening=!0);var oe=this._stream.write(k,G.bind(this));return oe?V():(this._drain=!0,this._stream.once("drain",function(){X._drain=!1,V()})),A("written",oe,this._drain),this.finishIfEnding(),oe}},{key:"query",value:function(B,X){typeof B=="function"&&(X=B,B={}),B=Ee(B);var V=d.join(this.dirname,this.filename),k="",$=[],G=0,oe=f.createReadStream(V,{encoding:"utf8"});oe.on("error",function(pe){if(oe.readable&&oe.destroy(),!!X)return pe.code!=="ENOENT"?X(pe):X(null,$)}),oe.on("data",function(pe){pe=(k+pe).split(/\n+/);for(var J=pe.length-1,ne=0;ne<J;ne++)(!B.start||G>=B.start)&&se(pe[ne]),G++;k=pe[J]}),oe.on("close",function(){k&&se(k,!0),B.order==="desc"&&($=$.reverse()),X&&X(null,$)});function se(pe,J){try{var ne=JSON.parse(pe);le(ne)&&de(ne)}catch(q){J||oe.emit("error",q)}}function de(pe){if(B.rows&&$.length>=B.rows&&B.order!=="desc"){oe.readable&&oe.destroy();return}B.fields&&(pe=B.fields.reduce(function(J,ne){return J[ne]=pe[ne],J},{})),B.order==="desc"&&$.length>=B.rows&&$.shift(),$.push(pe)}function le(pe){if(!!pe&&e(pe)==="object"){var J=new Date(pe.timestamp);if(!(B.from&&J<B.from||B.until&&J>B.until||B.level&&B.level!==pe.level))return!0}}function Ee(pe){return pe=pe||{},pe.rows=pe.rows||pe.limit||10,pe.start=pe.start||0,pe.until=pe.until||new Date,e(pe.until)!=="object"&&(pe.until=new Date(pe.until)),pe.from=pe.from||pe.until-24*60*60*1e3,e(pe.from)!=="object"&&(pe.from=new Date(pe.from)),pe.order=pe.order||"desc",pe}}},{key:"stream",value:function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=d.join(this.dirname,this.filename),V=new w,k={file:X,start:B.start};return V.destroy=N(k,function($,G){if($)return V.emit("error",$);try{V.emit("data",G),G=JSON.parse(G),V.emit("log",G)}catch(oe){V.emit("error",oe)}}),V}},{key:"open",value:function(){var B=this;!this.filename||this._opening||(this._opening=!0,this.stat(function(X,V){if(X)return B.emit("error",X);A("stat done: %s { size: %s }",B.filename,V),B._size=V,B._dest=B._createStream(B._stream),B._opening=!1,B.once("open",function(){B._stream.eventNames().includes("rotate")?B._stream.emit("rotate"):B._rotate=!1})}))}},{key:"stat",value:function(B){var X=this,V=this._getFile(),k=d.join(this.dirname,V);f.stat(k,function($,G){if($&&$.code==="ENOENT")return A("ENOENT\xA0ok",k),X.filename=V,B(null,0);if($)return A("err ".concat($.code," ").concat(k)),B($);if(!G||X._needsNewFile(G.size))return X._incFile(function(){return X.stat(B)});X.filename=V,B(null,G.size)})}},{key:"close",value:function(B){var X=this;!this._stream||this._stream.end(function(){B&&B(),X.emit("flush"),X.emit("closed")})}},{key:"_needsNewFile",value:function(B){return B=B||this._size,this.maxsize&&B>=this.maxsize}},{key:"_onError",value:function(B){this.emit("error",B)}},{key:"_setupStream",value:function(B){return B.on("error",this._onError),B}},{key:"_cleanupStream",value:function(B){return B.removeListener("error",this._onError),B}},{key:"_rotateFile",value:function(){var B=this;this._incFile(function(){return B.open()})}},{key:"_endStream",value:function(){var B=this,X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){};this._dest?(this._stream.unpipe(this._dest),this._dest.end(function(){B._cleanupStream(B._dest),X()})):X()}},{key:"_createStream",value:function(B){var X=this,V=d.join(this.dirname,this.filename);A("create stream start",V,this.options);var k=f.createWriteStream(V,this.options).on("error",function(G){return A(G)}).on("close",function(){return A("close",k.path,k.bytesWritten)}).on("open",function(){A("file open ok",V),X.emit("open",V),B.pipe(k),X.rotatedWhileOpening&&(X._stream=new m,X._stream.setMaxListeners(30),X._rotateFile(),X.rotatedWhileOpening=!1,X._cleanupStream(k),B.end())});if(A("create stream ok",V),this.zippedArchive){var $=h.createGzip();return $.pipe(k),$}return k}},{key:"_incFile",value:function(B){A("_incFile",this.filename);var X=d.extname(this._basename),V=d.basename(this._basename,X);this.tailable?this._checkMaxFilesTailable(X,V,B):(this._created+=1,this._checkMaxFilesIncrementing(X,V,B))}},{key:"_getFile",value:function(){var B=d.extname(this._basename),X=d.basename(this._basename,B),V=this.rotationFormat?this.rotationFormat():this._created,k=!this.tailable&&this._created?"".concat(X).concat(V).concat(B):"".concat(X).concat(B);return this.zippedArchive&&!this.tailable?"".concat(k,".gz"):k}},{key:"_checkMaxFilesIncrementing",value:function(B,X,V){if(!this.maxFiles||this._created<this.maxFiles)return setImmediate(V);var k=this._created-this.maxFiles,$=k!==0?k:"",G=this.zippedArchive?".gz":"",oe="".concat(X).concat($).concat(B).concat(G),se=d.join(this.dirname,oe);f.unlink(se,V)}},{key:"_checkMaxFilesTailable",value:function(B,X,V){var k=this,$=[];if(!!this.maxFiles){for(var G=this.zippedArchive?".gz":"",oe=this.maxFiles-1;oe>1;oe--)$.push(function(se,de){var le=this,Ee="".concat(X).concat(se-1).concat(B).concat(G),pe=d.join(this.dirname,Ee);f.exists(pe,function(J){if(!J)return de(null);Ee="".concat(X).concat(se).concat(B).concat(G),f.rename(pe,d.join(le.dirname,Ee),de)})}.bind(this,oe));g($,function(){f.rename(d.join(k.dirname,"".concat(X).concat(B)),d.join(k.dirname,"".concat(X,"1").concat(B).concat(G)),V)})}}},{key:"_createLogDirIfNotExist",value:function(B){f.existsSync(B)||f.mkdirSync(B,{recursive:!0})}}]),P}(S),sh}var uh,EE;function CM(){if(EE)return uh;EE=1;function e(S){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},e(S)}function t(S,A){var I=Object.keys(S);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(S);A&&(N=N.filter(function(T){return Object.getOwnPropertyDescriptor(S,T).enumerable})),I.push.apply(I,N)}return I}function r(S){for(var A=1;A<arguments.length;A++){var I=arguments[A]!=null?arguments[A]:{};A%2?t(Object(I),!0).forEach(function(N){n(S,N,I[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(S,Object.getOwnPropertyDescriptors(I)):t(Object(I)).forEach(function(N){Object.defineProperty(S,N,Object.getOwnPropertyDescriptor(I,N))})}return S}function n(S,A,I){return A in S?Object.defineProperty(S,A,{value:I,enumerable:!0,configurable:!0,writable:!0}):S[A]=I,S}function i(S,A){if(!(S instanceof A))throw new TypeError("Cannot call a class as a function")}function a(S,A){for(var I=0;I<A.length;I++){var N=A[I];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(S,N.key,N)}}function o(S,A,I){return A&&a(S.prototype,A),I&&a(S,I),Object.defineProperty(S,"prototype",{writable:!1}),S}function s(S,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");S.prototype=Object.create(A&&A.prototype,{constructor:{value:S,writable:!0,configurable:!0}}),Object.defineProperty(S,"prototype",{writable:!1}),A&&u(S,A)}function u(S,A){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,T){return N.__proto__=T,N},u(S,A)}function c(S){var A=d();return function(){var N=g(S),T;if(A){var M=g(this).constructor;T=Reflect.construct(N,arguments,M)}else T=N.apply(this,arguments);return l(this,T)}}function l(S,A){if(A&&(e(A)==="object"||typeof A=="function"))return A;if(A!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(S)}function f(S){if(S===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S}function d(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function g(S){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(I){return I.__proto__||Object.getPrototypeOf(I)},g(S)}var h=_e,v=_e,p=Bi.exports,y=p.Stream,w=mn(),m=Oi.exports;return uh=function(S){s(I,S);var A=c(I);function I(){var N,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return i(this,I),N=A.call(this,T),N.options=T,N.name=T.name||"http",N.ssl=!!T.ssl,N.host=T.host||"localhost",N.port=T.port,N.auth=T.auth,N.path=T.path||"",N.agent=T.agent,N.headers=T.headers||{},N.headers["content-type"]="application/json",N.batch=T.batch||!1,N.batchInterval=T.batchInterval||5e3,N.batchCount=T.batchCount||10,N.batchOptions=[],N.batchTimeoutID=-1,N.batchCallback={},N.port||(N.port=N.ssl?443:80),N}return o(I,[{key:"log",value:function(T,M){var P=this;this._request(T,function(L,B){B&&B.statusCode!==200&&(L=new Error("Invalid HTTP Status Code: ".concat(B.statusCode))),L?P.emit("warn",L):P.emit("logged",T)}),M&&setImmediate(M)}},{key:"query",value:function(T,M){typeof T=="function"&&(M=T,T={}),T={method:"query",params:this.normalizeQuery(T)},T.params.path&&(T.path=T.params.path,delete T.params.path),T.params.auth&&(T.auth=T.params.auth,delete T.params.auth),this._request(T,function(P,L,B){if(L&&L.statusCode!==200&&(P=new Error("Invalid HTTP Status Code: ".concat(L.statusCode))),P)return M(P);if(typeof B=="string")try{B=JSON.parse(B)}catch(X){return M(X)}M(null,B)})}},{key:"stream",value:function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},M=new y;T={method:"stream",params:T},T.params.path&&(T.path=T.params.path,delete T.params.path),T.params.auth&&(T.auth=T.params.auth,delete T.params.auth);var P="",L=this._request(T);return M.destroy=function(){return L.destroy()},L.on("data",function(B){B=(P+B).split(/\n+/);for(var X=B.length-1,V=0;V<X;V++)try{M.emit("log",JSON.parse(B[V]))}catch(k){M.emit("error",k)}P=B[X]}),L.on("error",function(B){return M.emit("error",B)}),M}},{key:"_request",value:function(T,M){T=T||{};var P=T.auth||this.auth,L=T.path||this.path||"";delete T.auth,delete T.path,this.batch?this._doBatch(T,M,P,L):this._doRequest(T,M,P,L)}},{key:"_doBatch",value:function(T,M,P,L){if(this.batchOptions.push(T),this.batchOptions.length===1){var B=this;this.batchCallback=M,this.batchTimeoutID=setTimeout(function(){B.batchTimeoutID=-1,B._doBatchRequest(B.batchCallback,P,L)},this.batchInterval)}this.batchOptions.length===this.batchCount&&this._doBatchRequest(this.batchCallback,P,L)}},{key:"_doBatchRequest",value:function(T,M,P){this.batchTimeoutID>0&&(clearTimeout(this.batchTimeoutID),this.batchTimeoutID=-1);var L=this.batchOptions.slice();this.batchOptions=[],this._doRequest(L,T,M,P)}},{key:"_doRequest",value:function(T,M,P,L){var B=Object.assign({},this.headers);P&&P.bearer&&(B.Authorization="Bearer ".concat(P.bearer));var X=(this.ssl?v:h).request(r(r({},this.options),{},{method:"POST",host:this.host,port:this.port,path:"/".concat(L.replace(/^\//,"")),headers:B,auth:P&&P.username&&P.password?"".concat(P.username,":").concat(P.password):"",agent:this.agent}));X.on("error",M),X.on("response",function(V){return V.on("end",function(){return M(null,V)}).resume()}),X.end(Buffer.from(m(T,this.options.replacer),"utf8"))}}]),I}(w),uh}const tn=e=>e!==null&&typeof e=="object"&&typeof e.pipe=="function";tn.writable=e=>tn(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object",tn.readable=e=>tn(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object",tn.duplex=e=>tn.writable(e)&&tn.readable(e),tn.transform=e=>tn.duplex(e)&&typeof e._transform=="function";var bE=tn,ch,_E;function wM(){if(_E)return ch;_E=1;function e(p){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},e(p)}function t(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}function r(p,y){for(var w=0;w<y.length;w++){var m=y[w];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(p,m.key,m)}}function n(p,y,w){return y&&r(p.prototype,y),w&&r(p,w),Object.defineProperty(p,"prototype",{writable:!1}),p}function i(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(y&&y.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),Object.defineProperty(p,"prototype",{writable:!1}),y&&a(p,y)}function a(p,y){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,S){return m.__proto__=S,m},a(p,y)}function o(p){var y=c();return function(){var m=l(p),S;if(y){var A=l(this).constructor;S=Reflect.construct(m,arguments,A)}else S=m.apply(this,arguments);return s(this,S)}}function s(p,y){if(y&&(e(y)==="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return u(p)}function u(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function c(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function l(p){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(w){return w.__proto__||Object.getPrototypeOf(w)},l(p)}var f=bE,d=ht,g=d.MESSAGE,h=_e,v=mn();return ch=function(p){i(w,p);var y=o(w);function w(){var m,S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(t(this,w),m=y.call(this,S),!S.stream||!f(S.stream))throw new Error("options.stream is required.");return m._stream=S.stream,m._stream.setMaxListeners(1/0),m.isObjectMode=S.stream._writableState.objectMode,m.eol=typeof S.eol=="string"?S.eol:h.EOL,m}return n(w,[{key:"log",value:function(S,A){var I=this;if(setImmediate(function(){return I.emit("logged",S)}),this.isObjectMode){this._stream.write(S),A&&A();return}this._stream.write("".concat(S[g]).concat(this.eol)),A&&A()}}]),w}(v),ch}(function(e){Object.defineProperty(e,"Console",{configurable:!0,enumerable:!0,get:function(){return PO()}}),Object.defineProperty(e,"File",{configurable:!0,enumerable:!0,get:function(){return SM()}}),Object.defineProperty(e,"Http",{configurable:!0,enumerable:!0,get:function(){return CM()}}),Object.defineProperty(e,"Stream",{configurable:!0,enumerable:!0,get:function(){return wM()}})})(f1);var Di={},sc=ju,TM=ht,lh=TM.configs;Di.cli=sc.levels(lh.cli),Di.npm=sc.levels(lh.npm),Di.syslog=sc.levels(lh.syslog),Di.addColors=sc.levels;var Es={exports:{}},fh={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=ps.exports,n=p(r),i=ys.exports,a=p(i),o=rc.exports,s=p(o),u=nc.exports,c=p(u),l=ic.exports,f=p(l),d=Ua(),g=p(d),h=Ni.exports,v=p(h);function p(S){return S&&S.__esModule?S:{default:S}}function y(S,A,I){I=(0,c.default)(I);var N=0,T=0,{length:M}=S,P=!1;M===0&&I(null);function L(B,X){B===!1&&(P=!0),P!==!0&&(B?I(B):(++T===M||X===a.default)&&I(null))}for(;N<M;N++)A(S[N],N,(0,f.default)(L))}function w(S,A,I){return(0,s.default)(S,1/0,A,I)}function m(S,A,I){var N=(0,n.default)(S)?y:w;return N(S,(0,g.default)(A),I)}t.default=(0,v.default)(m,3),e.exports=t.default})(fh,fh.exports);var dh={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){return(i,a,o)=>n(i,o)}e.exports=t.default})(dh,dh.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fh.exports,n=l(r),i=dh.exports,a=l(i),o=Ua(),s=l(o),u=Ni.exports,c=l(u);function l(d){return d&&d.__esModule?d:{default:d}}function f(d,g,h){return(0,n.default)(d,(0,a.default)((0,s.default)(g)),h)}t.default=(0,c.default)(f,3),e.exports=t.default}(Es,Es.exports);var AM=Object.prototype.toString,xM=function(t){if(typeof t.displayName=="string"&&t.constructor.name)return t.displayName;if(typeof t.name=="string"&&t.name)return t.name;if(typeof t=="object"&&t.constructor&&typeof t.constructor.name=="string")return t.constructor.name;var r=t.toString(),n=AM.call(t).slice(8,-1);return n==="Function"?r=r.substring(r.indexOf("(")+1,r.indexOf(")")):r=n,r||"anonymous"},RM=xM,SE=function(t){var r=0,n;function i(){return r||(r=1,n=t.apply(this,arguments),t=null),n}return i.displayName=RM(t),i},hh={};(function(e){e.get=function(i){var a=Error.stackTraceLimit;Error.stackTraceLimit=1/0;var o={},s=Error.prepareStackTrace;Error.prepareStackTrace=function(c,l){return l},Error.captureStackTrace(o,i||e.get);var u=o.stack;return Error.prepareStackTrace=s,Error.stackTraceLimit=a,u},e.parse=function(i){if(!i.stack)return[];var a=this,o=i.stack.split(`
|
|
63
|
-
`).slice(1);return o.map(function(s){if(s.match(/^\s*[-]{4,}$/))return a._createParsedCallSite({fileName:s,lineNumber:null,functionName:null,typeName:null,methodName:null,columnNumber:null,native:null});var u=s.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);if(!!u){var c=null,l=null,f=null,d=null,g=null,h=u[5]==="native";if(u[1]){f=u[1];var v=f.lastIndexOf(".");if(f[v-1]=="."&&v--,v>0){c=f.substr(0,v),l=f.substr(v+1);var p=c.indexOf(".Module");p>0&&(f=f.substr(p+1),c=c.substr(0,p))}d=null}l&&(d=c,g=l),l==="<anonymous>"&&(g=null,f=null);var y={fileName:u[2]||null,lineNumber:parseInt(u[3],10)||null,functionName:f,typeName:d,methodName:g,columnNumber:parseInt(u[4],10)||null,native:h};return a._createParsedCallSite(y)}}).filter(function(s){return!!s})};function t(i){for(var a in i)this[a]=i[a]}var r=["this","typeName","functionName","methodName","fileName","lineNumber","columnNumber","function","evalOrigin"],n=["topLevel","eval","native","constructor"];r.forEach(function(i){t.prototype[i]=null,t.prototype["get"+i[0].toUpperCase()+i.substr(1)]=function(){return this[i]}}),n.forEach(function(i){t.prototype[i]=!1,t.prototype["is"+i[0].toUpperCase()+i.substr(1)]=function(){return this[i]}}),e._createParsedCallSite=function(i){return new t(i)}})(hh);function ph(e){return ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ph(e)}function IM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function OM(e,t,r){return t&&CE(e.prototype,t),r&&CE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function MM(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&gh(e,t)}function gh(e,t){return gh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},gh(e,t)}function LM(e){var t=BM();return function(){var n=uc(e),i;if(t){var a=uc(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return PM(this,i)}}function PM(e,t){if(t&&(ph(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return NM(e)}function NM(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function BM(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function uc(e){return uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},uc(e)}var DM=Bi.exports,FM=DM.Writable,wE=function(e){MM(r,e);var t=LM(r);function r(n){var i;if(IM(this,r),i=t.call(this,{objectMode:!0}),!n)throw new Error("ExceptionStream requires a TransportStream instance.");return i.handleExceptions=!0,i.transport=n,i}return OM(r,[{key:"_write",value:function(i,a,o){return i.exception?this.transport.log(i,o):(o(),!0)}}]),r}(FM);function kM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function UM(e,t,r){return t&&TE(e.prototype,t),r&&TE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var AE=_e,$M=Es.exports,yh=ms.exports("winston:exception"),jM=SE,xE=hh,KM=wE,RE=function(){function e(t){if(kM(this,e),!t)throw new Error("Logger is required to handle exceptions");this.logger=t,this.handlers=new Map}return UM(e,[{key:"handle",value:function(){for(var r=this,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];i.forEach(function(o){if(Array.isArray(o))return o.forEach(function(s){return r._addHandler(s)});r._addHandler(o)}),this.catcher||(this.catcher=this._uncaughtException.bind(this),process.on("uncaughtException",this.catcher))}},{key:"unhandle",value:function(){var r=this;this.catcher&&(process.removeListener("uncaughtException",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(function(n){return r.logger.unpipe(n)}))}},{key:"getAllInfo",value:function(r){var n=r.message;return!n&&typeof r=="string"&&(n=r),{error:r,level:"error",message:["uncaughtException: ".concat(n||"(no error message)"),r.stack||" No stack trace"].join(`
|
|
64
|
-
`),stack:r.stack,exception:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(r)}}},{key:"getProcessInfo",value:function(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}},{key:"getOsInfo",value:function(){return{loadavg:AE.loadavg(),uptime:AE.uptime()}}},{key:"getTrace",value:function(r){var n=r?xE.parse(r):xE.get();return n.map(function(i){return{column:i.getColumnNumber(),file:i.getFileName(),function:i.getFunctionName(),line:i.getLineNumber(),method:i.getMethodName(),native:i.isNative()}})}},{key:"_addHandler",value:function(r){if(!this.handlers.has(r)){r.handleExceptions=!0;var n=new KM(r);this.handlers.set(r,n),this.logger.pipe(n)}}},{key:"_uncaughtException",value:function(r){var n=this.getAllInfo(r),i=this._getExceptionHandlers(),a=typeof this.logger.exitOnError=="function"?this.logger.exitOnError(r):this.logger.exitOnError,o;!i.length&&a&&(console.warn("winston: exitOnError cannot be true with no exception handlers."),console.warn("winston: not exiting process."),a=!1);function s(){yh("doExit",a),yh("process._exiting",process._exiting),a&&!process._exiting&&(o&&clearTimeout(o),process.exit(1))}if(!i||i.length===0)return process.nextTick(s);$M(i,function(u,c){var l=jM(c),f=u.transport||u;function d(g){return function(){yh(g),l()}}f._ending=!0,f.once("finish",d("finished")),f.once("error",d("error"))},function(){return a&&s()}),this.logger.log(n),a&&(o=setTimeout(s,3e3))}},{key:"_getExceptionHandlers",value:function(){return this.logger.transports.filter(function(r){var n=r.transport||r;return n.handleExceptions})}}]),e}();function qM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function IE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function VM(e,t,r){return t&&IE(e.prototype,t),r&&IE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var OE=_e,GM=Es.exports,vh=ms.exports("winston:rejection"),HM=SE,ME=hh,YM=wE,LE=function(){function e(t){if(qM(this,e),!t)throw new Error("Logger is required to handle rejections");this.logger=t,this.handlers=new Map}return VM(e,[{key:"handle",value:function(){for(var r=this,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];i.forEach(function(o){if(Array.isArray(o))return o.forEach(function(s){return r._addHandler(s)});r._addHandler(o)}),this.catcher||(this.catcher=this._unhandledRejection.bind(this),process.on("unhandledRejection",this.catcher))}},{key:"unhandle",value:function(){var r=this;this.catcher&&(process.removeListener("unhandledRejection",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(function(n){return r.logger.unpipe(n)}))}},{key:"getAllInfo",value:function(r){var n=null;return r&&(n=typeof r=="string"?r:r.message),{error:r,level:"error",message:["unhandledRejection: ".concat(n||"(no error message)"),r&&r.stack||" No stack trace"].join(`
|
|
65
|
-
`),stack:r&&r.stack,exception:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(r)}}},{key:"getProcessInfo",value:function(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}},{key:"getOsInfo",value:function(){return{loadavg:OE.loadavg(),uptime:OE.uptime()}}},{key:"getTrace",value:function(r){var n=r?ME.parse(r):ME.get();return n.map(function(i){return{column:i.getColumnNumber(),file:i.getFileName(),function:i.getFunctionName(),line:i.getLineNumber(),method:i.getMethodName(),native:i.isNative()}})}},{key:"_addHandler",value:function(r){if(!this.handlers.has(r)){r.handleRejections=!0;var n=new YM(r);this.handlers.set(r,n),this.logger.pipe(n)}}},{key:"_unhandledRejection",value:function(r){var n=this.getAllInfo(r),i=this._getRejectionHandlers(),a=typeof this.logger.exitOnError=="function"?this.logger.exitOnError(r):this.logger.exitOnError,o;!i.length&&a&&(console.warn("winston: exitOnError cannot be true with no rejection handlers."),console.warn("winston: not exiting process."),a=!1);function s(){vh("doExit",a),vh("process._exiting",process._exiting),a&&!process._exiting&&(o&&clearTimeout(o),process.exit(1))}if(!i||i.length===0)return process.nextTick(s);GM(i,function(u,c){var l=HM(c),f=u.transport||u;function d(g){return function(){vh(g),l()}}f._ending=!0,f.once("finish",d("finished")),f.once("error",d("error"))},function(){return a&&s()}),this.logger.log(n),a&&(o=setTimeout(s,3e3))}},{key:"_getRejectionHandlers",value:function(){return this.logger.transports.filter(function(r){var n=r.transport||r;return n.handleRejections})}}]),e}(),PE={exports:{}};const WM=_e,{LEVEL:mh}=ht,NE=mn(),bs=PE.exports=function(t={}){if(NE.call(this,t),!t.transport||typeof t.transport.log!="function")throw new Error("Invalid transport, must be an object with a log method.");this.transport=t.transport,this.level=this.level||t.transport.level,this.handleExceptions=this.handleExceptions||t.transport.handleExceptions,this._deprecated();function r(n){this.emit("error",n,this.transport)}this.transport.__winstonError||(this.transport.__winstonError=r.bind(this),this.transport.on("error",this.transport.__winstonError))};WM.inherits(bs,NE),bs.prototype._write=function(t,r,n){if(this.silent||t.exception===!0&&!this.handleExceptions)return n(null);(!this.level||this.levels[this.level]>=this.levels[t[mh]])&&this.transport.log(t[mh],t.message,t,this._nop),n(null)},bs.prototype._writev=function(t,r){for(let n=0;n<t.length;n++)this._accept(t[n])&&(this.transport.log(t[n].chunk[mh],t[n].chunk.message,t[n].chunk,this._nop),t[n].callback());return r(null)},bs.prototype._deprecated=function(){console.error([`${this.transport.name} is a legacy winston transport. Consider upgrading: `,"- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md"].join(`
|
|
66
|
-
`))},bs.prototype.close=function(){this.transport.close&&this.transport.close(),this.transport.__winstonError&&(this.transport.removeListener("error",this.transport.__winstonError),this.transport.__winstonError=null)};function Eh(e){return Eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eh(e)}function zM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function BE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function QM(e,t,r){return t&&BE(e.prototype,t),r&&BE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var XM=function(){function e(t){if(zM(this,e),!t)throw new Error("Logger is required for profiling.");this.logger=t,this.start=Date.now()}return QM(e,[{key:"done",value:function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];typeof n[n.length-1]=="function"&&(console.warn("Callback function no longer supported as of winston@3.0.0"),n.pop());var a=Eh(n[n.length-1])==="object"?n.pop():{};return a.level=a.level||"info",a.durationMs=Date.now()-this.start,this.logger.write(a)}}]),e}(),bh,DE;function JM(){if(DE)return bh;DE=1;class e extends Error{constructor(r){super(`Format functions must be synchronous taking a two arguments: (info, opts)
|
|
67
|
-
Found: ${r.toString().split(`
|
|
68
|
-
`)[0]}
|
|
69
|
-
`),Error.captureStackTrace(this,e)}}return bh=t=>{if(t.length>2)throw new e(t);function r(i={}){this.options=i}r.prototype.transform=t;function n(i){return new r(i)}return n.Format=r,n},bh}var _h,FE;function ZM(){if(FE)return _h;FE=1;const e=JM(),{MESSAGE:t}=ht,r=Oi.exports;function n(i,a){return typeof a=="bigint"?a.toString():a}return _h=e((i,a)=>{const o=r.configure(a);return i[t]=o(i,a.replacer||n,a.space),i}),_h}function $r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $a(e){return $a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$a(e)}function eL(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function tL(e,t,r){return t&&kE(e.prototype,t),r&&kE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function rL(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Sh(e,t)}function Sh(e,t){return Sh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Sh(e,t)}function nL(e){var t=oL();return function(){var n=cc(e),i;if(t){var a=cc(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return iL(this,i)}}function iL(e,t){if(t&&($a(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aL(e)}function aL(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oL(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function cc(e){return cc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},cc(e)}var UE=Bi.exports,sL=UE.Stream,uL=UE.Transform,$E=Es.exports,jE=ht,rn=jE.LEVEL,KE=jE.SPLAT,qE=bE,cL=RE,lL=LE,fL=PE.exports,dL=XM,hL=vd,pL=hL.warn,gL=Di,yL=/%[scdjifoO%]/g,VE=function(e){rL(r,e);var t=nL(r);function r(n){var i;return eL(this,r),i=t.call(this,{objectMode:!0}),i.configure(n),i}return tL(r,[{key:"child",value:function(i){var a=this;return Object.create(a,{write:{value:function(s){var u=Object.assign({},i,s);s instanceof Error&&(u.stack=s.stack,u.message=s.message),a.write(u)}}})}},{key:"configure",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=a.silent,s=a.format,u=a.defaultMeta,c=a.levels,l=a.level,f=l===void 0?"info":l,d=a.exitOnError,g=d===void 0?!0:d,h=a.transports,v=a.colors,p=a.emitErrs,y=a.formatters,w=a.padLevels,m=a.rewriters,S=a.stripColors,A=a.exceptionHandlers,I=a.rejectionHandlers;if(this.transports.length&&this.clear(),this.silent=o,this.format=s||this.format||ZM()(),this.defaultMeta=u||null,this.levels=c||this.levels||gL.npm.levels,this.level=f,this.exceptions&&this.exceptions.unhandle(),this.rejections&&this.rejections.unhandle(),this.exceptions=new cL(this),this.rejections=new lL(this),this.profilers={},this.exitOnError=g,h&&(h=Array.isArray(h)?h:[h],h.forEach(function(N){return i.add(N)})),v||p||y||w||m||S)throw new Error(["{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.","Use a custom winston.format(function) instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join(`
|
|
70
|
-
`));A&&this.exceptions.handle(A),I&&this.rejections.handle(I)}},{key:"isLevelEnabled",value:function(i){var a=this,o=Ch(this.levels,i);if(o===null)return!1;var s=Ch(this.levels,this.level);if(s===null)return!1;if(!this.transports||this.transports.length===0)return s>=o;var u=this.transports.findIndex(function(c){var l=Ch(a.levels,c.level);return l===null&&(l=s),l>=o});return u!==-1}},{key:"log",value:function(i,a){for(var o,s=arguments.length,u=new Array(s>2?s-2:0),c=2;c<s;c++)u[c-2]=arguments[c];if(arguments.length===1)return i[rn]=i.level,this._addDefaultMeta(i),this.write(i),this;if(arguments.length===2){var l;return a&&$a(a)==="object"?(a[rn]=a.level=i,this._addDefaultMeta(a),this.write(a),this):(a=(l={},$r(l,rn,i),$r(l,"level",i),$r(l,"message",a),l),this._addDefaultMeta(a),this.write(a),this)}var f=u[0];if($a(f)==="object"&&f!==null){var d=a&&a.match&&a.match(yL);if(!d){var g,h=Object.assign({},this.defaultMeta,f,(g={},$r(g,rn,i),$r(g,KE,u),$r(g,"level",i),$r(g,"message",a),g));return f.message&&(h.message="".concat(h.message," ").concat(f.message)),f.stack&&(h.stack=f.stack),this.write(h),this}}return this.write(Object.assign({},this.defaultMeta,(o={},$r(o,rn,i),$r(o,KE,u),$r(o,"level",i),$r(o,"message",a),o))),this}},{key:"_transform",value:function(i,a,o){if(this.silent)return o();i[rn]||(i[rn]=i.level),!this.levels[i[rn]]&&this.levels[i[rn]]!==0&&console.error("[winston] Unknown logger level: %s",i[rn]),this._readableState.pipes||console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",i);try{this.push(this.format.transform(i,this.format.options))}finally{this._writableState.sync=!1,o()}}},{key:"_final",value:function(i){var a=this.transports.slice();$E(a,function(o,s){if(!o||o.finished)return setImmediate(s);o.once("finish",s),o.end()},i)}},{key:"add",value:function(i){var a=!qE(i)||i.log.length>2?new fL({transport:i}):i;if(!a._writableState||!a._writableState.objectMode)throw new Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.");return this._onEvent("error",a),this._onEvent("warn",a),this.pipe(a),i.handleExceptions&&this.exceptions.handle(),i.handleRejections&&this.rejections.handle(),this}},{key:"remove",value:function(i){if(!i)return this;var a=i;return(!qE(i)||i.log.length>2)&&(a=this.transports.filter(function(o){return o.transport===i})[0]),a&&this.unpipe(a),this}},{key:"clear",value:function(){return this.unpipe(),this}},{key:"close",value:function(){return this.exceptions.unhandle(),this.rejections.unhandle(),this.clear(),this.emit("close"),this}},{key:"setLevels",value:function(){pL.deprecated("setLevels")}},{key:"query",value:function(i,a){typeof i=="function"&&(a=i,i={}),i=i||{};var o={},s=Object.assign({},i.query||{});function u(l,f){i.query&&typeof l.formatQuery=="function"&&(i.query=l.formatQuery(s)),l.query(i,function(d,g){if(d)return f(d);typeof l.formatResults=="function"&&(g=l.formatResults(g,i.format)),f(null,g)})}function c(l,f){u(l,function(d,g){f&&(g=d||g,g&&(o[l.name]=g),f()),f=null})}$E(this.transports.filter(function(l){return!!l.query}),c,function(){return a(null,o)})}},{key:"stream",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=new sL,o=[];return a._streams=o,a.destroy=function(){for(var s=o.length;s--;)o[s].destroy()},this.transports.filter(function(s){return!!s.stream}).forEach(function(s){var u=s.stream(i);!u||(o.push(u),u.on("log",function(c){c.transport=c.transport||[],c.transport.push(s.name),a.emit("log",c)}),u.on("error",function(c){c.transport=c.transport||[],c.transport.push(s.name),a.emit("error",c)}))}),a}},{key:"startTimer",value:function(){return new dL(this)}},{key:"profile",value:function(i){var a=Date.now();if(this.profilers[i]){var o=this.profilers[i];delete this.profilers[i];for(var s=arguments.length,u=new Array(s>1?s-1:0),c=1;c<s;c++)u[c-1]=arguments[c];typeof u[u.length-2]=="function"&&(console.warn("Callback function no longer supported as of winston@3.0.0"),u.pop());var l=$a(u[u.length-1])==="object"?u.pop():{};return l.level=l.level||"info",l.durationMs=a-o,l.message=l.message||i,this.write(l)}return this.profilers[i]=a,this}},{key:"handleExceptions",value:function(){var i;console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()"),(i=this.exceptions).handle.apply(i,arguments)}},{key:"unhandleExceptions",value:function(){var i;console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()"),(i=this.exceptions).unhandle.apply(i,arguments)}},{key:"cli",value:function(){throw new Error(["Logger.cli() was removed in winston@3.0.0","Use a custom winston.formats.cli() instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join(`
|
|
71
|
-
`))}},{key:"_onEvent",value:function(i,a){function o(s){i==="error"&&!this.transports.includes(a)&&this.add(a),this.emit(i,s,a)}a["__winston"+i]||(a["__winston"+i]=o.bind(this),a.on(i,a["__winston"+i]))}},{key:"_addDefaultMeta",value:function(i){this.defaultMeta&&Object.assign(i,this.defaultMeta)}}]),r}(uL);function Ch(e,t){var r=e[t];return!r&&r!==0?null:r}Object.defineProperty(VE.prototype,"transports",{configurable:!1,enumerable:!0,get:function(){var t=this._readableState.pipes;return Array.isArray(t)?t:[t].filter(Boolean)}});var vL=VE;function wh(e){return wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wh(e)}function GE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mL(e,t,r){return t&&GE(e.prototype,t),r&&GE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function EL(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bL(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Th(e,t)}function Th(e,t){return Th=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Th(e,t)}function _L(e){var t=wL();return function(){var n=lc(e),i;if(t){var a=lc(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return SL(this,i)}}function SL(e,t){if(t&&(wh(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return CL(e)}function CL(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wL(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function lc(e){return lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},lc(e)}var TL=ht,AL=TL.LEVEL,xL=Di,RL=vL,IL=ms.exports("winston:create-logger");function OL(e){return"is"+e.charAt(0).toUpperCase()+e.slice(1)+"Enabled"}var HE=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.levels=e.levels||xL.npm.levels;var t=function(n){bL(a,n);var i=_L(a);function a(o){return EL(this,a),i.call(this,o)}return mL(a)}(RL),r=new t(e);return Object.keys(e.levels).forEach(function(n){if(IL('Define prototype method for "%s"',n),n==="log"){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}t.prototype[n]=function(){for(var i=this||r,a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];if(o.length===1){var u=o[0],c=u&&u.message&&u||{message:u};return c.level=c[AL]=n,i._addDefaultMeta(c),i.write(c),this||r}return o.length===0?(i.log(n,""),i):i.log.apply(i,[n].concat(o))},t.prototype[OL(n)]=function(){return(this||r).isLevelEnabled(n)}}),r};function ML(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function LL(e,t,r){return t&&YE(e.prototype,t),r&&YE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var PL=HE,NL=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ML(this,e),this.loggers=new Map,this.options=t}return LL(e,[{key:"add",value:function(r,n){var i=this;if(!this.loggers.has(r)){n=Object.assign({},n||this.options);var a=n.transports||this.options.transports;n.transports=a?a.slice():[];var o=PL(n);o.on("close",function(){return i._delete(r)}),this.loggers.set(r,o)}return this.loggers.get(r)}},{key:"get",value:function(r,n){return this.add(r,n)}},{key:"has",value:function(r){return!!this.loggers.has(r)}},{key:"close",value:function(r){var n=this;if(r)return this._removeLogger(r);this.loggers.forEach(function(i,a){return n._removeLogger(a)})}},{key:"_removeLogger",value:function(r){if(!!this.loggers.has(r)){var n=this.loggers.get(r);n.close(),this._delete(r)}}},{key:"_delete",value:function(r){this.loggers.delete(r)}}]),e}();(function(e){var t=ju,r=vd,n=r.warn;e.version=iO.version,e.transports=f1,e.config=Di,e.addColors=t.levels,e.format=t.format,e.createLogger=HE,e.ExceptionHandler=RE,e.RejectionHandler=LE,e.Container=NL,e.Transport=mn(),e.loggers=new e.Container;var i=e.createLogger();Object.keys(e.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(function(a){return e[a]=function(){return i[a].apply(i,arguments)}}),Object.defineProperty(e,"level",{get:function(){return i.level},set:function(o){i.level=o}}),Object.defineProperty(e,"exceptions",{get:function(){return i.exceptions}}),["exitOnError"].forEach(function(a){Object.defineProperty(e,a,{get:function(){return i[a]},set:function(s){i[a]=s}})}),Object.defineProperty(e,"default",{get:function(){return{exceptionHandlers:i.exceptionHandlers,rejectionHandlers:i.rejectionHandlers,transports:i.transports}}}),n.deprecated(e,"setLevels"),n.forFunctions(e,"useFormat",["cli"]),n.forProperties(e,"useFormat",["padLevels","stripColors"]),n.forFunctions(e,"deprecated",["addRewriter","addFilter","clone","extend"]),n.forProperties(e,"deprecated",["emitErrs","levelLength"]),n.moved(e,"createLogger","Logger")})(cs);var fc={},WE={exports:{}};(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,a){function o(c,l){if(!i[c]){if(!n[c]){var f=typeof Tr=="function"&&Tr;if(!l&&f)return f(c,!0);if(s)return s(c,!0);throw new Error("Cannot find module '"+c+"'")}l=i[c]={exports:{}},n[c][0].call(l.exports,function(d){var g=n[c][1][d];return o(g||d)},l,l.exports,r,n,i,a)}return i[c].exports}for(var s=typeof Tr=="function"&&Tr,u=0;u<a.length;u++)o(a[u]);return o}({1:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){var h=r("crypto");function v(I,N){N=w(I,N);var T;return(T=N.algorithm!=="passthrough"?h.createHash(N.algorithm):new A).write===void 0&&(T.write=T.update,T.end=T.update),S(N,T).dispatch(I),T.update||T.end(""),T.digest?T.digest(N.encoding==="buffer"?void 0:N.encoding):(I=T.read(),N.encoding!=="buffer"?I.toString(N.encoding):I)}(i=n.exports=v).sha1=function(I){return v(I)},i.keys=function(I){return v(I,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},i.MD5=function(I){return v(I,{algorithm:"md5",encoding:"hex"})},i.keysMD5=function(I){return v(I,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=h.getHashes?h.getHashes().slice():["sha1","md5"],y=(p.push("passthrough"),["buffer","hex","binary","base64"]);function w(I,N){var T={};if(T.algorithm=(N=N||{}).algorithm||"sha1",T.encoding=N.encoding||"hex",T.excludeValues=!!N.excludeValues,T.algorithm=T.algorithm.toLowerCase(),T.encoding=T.encoding.toLowerCase(),T.ignoreUnknown=N.ignoreUnknown===!0,T.respectType=N.respectType!==!1,T.respectFunctionNames=N.respectFunctionNames!==!1,T.respectFunctionProperties=N.respectFunctionProperties!==!1,T.unorderedArrays=N.unorderedArrays===!0,T.unorderedSets=N.unorderedSets!==!1,T.unorderedObjects=N.unorderedObjects!==!1,T.replacer=N.replacer||void 0,T.excludeKeys=N.excludeKeys||void 0,I===void 0)throw new Error("Object argument required.");for(var M=0;M<p.length;++M)p[M].toLowerCase()===T.algorithm.toLowerCase()&&(T.algorithm=p[M]);if(p.indexOf(T.algorithm)===-1)throw new Error('Algorithm "'+T.algorithm+'" not supported. supported values: '+p.join(", "));if(y.indexOf(T.encoding)===-1&&T.algorithm!=="passthrough")throw new Error('Encoding "'+T.encoding+'" not supported. supported values: '+y.join(", "));return T}function m(I){if(typeof I=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(I))!=null}function S(I,N,T){T=T||[];function M(P){return N.update?N.update(P,"utf8"):N.write(P,"utf8")}return{dispatch:function(P){return this["_"+((P=I.replacer?I.replacer(P):P)===null?"null":typeof P)](P)},_object:function(P){var L,B=Object.prototype.toString.call(P),X=/\[object (.*)\]/i.exec(B);if(X=(X=X?X[1]:"unknown:["+B+"]").toLowerCase(),0<=(B=T.indexOf(P)))return this.dispatch("[CIRCULAR:"+B+"]");if(T.push(P),s!==void 0&&s.isBuffer&&s.isBuffer(P))return M("buffer:"),M(P);if(X==="object"||X==="function"||X==="asyncfunction")return B=Object.keys(P),I.unorderedObjects&&(B=B.sort()),I.respectType===!1||m(P)||B.splice(0,0,"prototype","__proto__","constructor"),I.excludeKeys&&(B=B.filter(function(V){return!I.excludeKeys(V)})),M("object:"+B.length+":"),L=this,B.forEach(function(V){L.dispatch(V),M(":"),I.excludeValues||L.dispatch(P[V]),M(",")});if(!this["_"+X]){if(I.ignoreUnknown)return M("["+X+"]");throw new Error('Unknown object type "'+X+'"')}this["_"+X](P)},_array:function(P,V){V=V!==void 0?V:I.unorderedArrays!==!1;var B=this;if(M("array:"+P.length+":"),!V||P.length<=1)return P.forEach(function(k){return B.dispatch(k)});var X=[],V=P.map(function(k){var $=new A,G=T.slice();return S(I,$,G).dispatch(k),X=X.concat(G.slice(T.length)),$.read().toString()});return T=T.concat(X),V.sort(),this._array(V,!1)},_date:function(P){return M("date:"+P.toJSON())},_symbol:function(P){return M("symbol:"+P.toString())},_error:function(P){return M("error:"+P.toString())},_boolean:function(P){return M("bool:"+P.toString())},_string:function(P){M("string:"+P.length+":"),M(P.toString())},_function:function(P){M("fn:"),m(P)?this.dispatch("[native]"):this.dispatch(P.toString()),I.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(P.name)),I.respectFunctionProperties&&this._object(P)},_number:function(P){return M("number:"+P.toString())},_xml:function(P){return M("xml:"+P.toString())},_null:function(){return M("Null")},_undefined:function(){return M("Undefined")},_regexp:function(P){return M("regex:"+P.toString())},_uint8array:function(P){return M("uint8array:"),this.dispatch(Array.prototype.slice.call(P))},_uint8clampedarray:function(P){return M("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(P))},_int8array:function(P){return M("int8array:"),this.dispatch(Array.prototype.slice.call(P))},_uint16array:function(P){return M("uint16array:"),this.dispatch(Array.prototype.slice.call(P))},_int16array:function(P){return M("int16array:"),this.dispatch(Array.prototype.slice.call(P))},_uint32array:function(P){return M("uint32array:"),this.dispatch(Array.prototype.slice.call(P))},_int32array:function(P){return M("int32array:"),this.dispatch(Array.prototype.slice.call(P))},_float32array:function(P){return M("float32array:"),this.dispatch(Array.prototype.slice.call(P))},_float64array:function(P){return M("float64array:"),this.dispatch(Array.prototype.slice.call(P))},_arraybuffer:function(P){return M("arraybuffer:"),this.dispatch(new Uint8Array(P))},_url:function(P){return M("url:"+P.toString())},_map:function(P){return M("map:"),P=Array.from(P),this._array(P,I.unorderedSets!==!1)},_set:function(P){return M("set:"),P=Array.from(P),this._array(P,I.unorderedSets!==!1)},_file:function(P){return M("file:"),this.dispatch([P.name,P.size,P.type,P.lastModfied])},_blob:function(){if(I.ignoreUnknown)return M("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
72
|
-
(see https://github.com/puleos/object-hash/issues/26)
|
|
73
|
-
Use "options.replacer" or "options.ignoreUnknown"
|
|
74
|
-
`)},_domwindow:function(){return M("domwindow")},_bigint:function(P){return M("bigint:"+P.toString())},_process:function(){return M("process")},_timer:function(){return M("timer")},_pipe:function(){return M("pipe")},_tcp:function(){return M("tcp")},_udp:function(){return M("udp")},_tty:function(){return M("tty")},_statwatcher:function(){return M("statwatcher")},_securecontext:function(){return M("securecontext")},_connection:function(){return M("connection")},_zlib:function(){return M("zlib")},_context:function(){return M("context")},_nodescript:function(){return M("nodescript")},_httpparser:function(){return M("httpparser")},_dataview:function(){return M("dataview")},_signal:function(){return M("signal")},_fsevent:function(){return M("fsevent")},_tlswrap:function(){return M("tlswrap")}}}function A(){return{buf:"",write:function(I){this.buf+=I},end:function(I){this.buf+=I},read:function(){return this.buf}}}i.writeToStream=function(I,N,T){return T===void 0&&(T=N,N={}),S(N=w(I,N),T).dispatch(I)}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){(function(h){var v=typeof Uint8Array<"u"?Uint8Array:Array,p="+".charCodeAt(0),y="/".charCodeAt(0),w="0".charCodeAt(0),m="a".charCodeAt(0),S="A".charCodeAt(0),A="-".charCodeAt(0),I="_".charCodeAt(0);function N(T){return T=T.charCodeAt(0),T===p||T===A?62:T===y||T===I?63:T<w?-1:T<w+10?T-w+26+26:T<S+26?T-S:T<m+26?T-m+26:void 0}h.toByteArray=function(T){var M,P;if(0<T.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var L=T.length,L=T.charAt(L-2)==="="?2:T.charAt(L-1)==="="?1:0,B=new v(3*T.length/4-L),X=0<L?T.length-4:T.length,V=0;function k($){B[V++]=$}for(M=0;M<X;M+=4,0)k((16711680&(P=N(T.charAt(M))<<18|N(T.charAt(M+1))<<12|N(T.charAt(M+2))<<6|N(T.charAt(M+3))))>>16),k((65280&P)>>8),k(255&P);return L==2?k(255&(P=N(T.charAt(M))<<2|N(T.charAt(M+1))>>4)):L==1&&(k((P=N(T.charAt(M))<<10|N(T.charAt(M+1))<<4|N(T.charAt(M+2))>>2)>>8&255),k(255&P)),B},h.fromByteArray=function(T){var M,P,L,B,X=T.length%3,V="";function k($){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt($)}for(M=0,L=T.length-X;M<L;M+=3)P=(T[M]<<16)+(T[M+1]<<8)+T[M+2],V+=k((B=P)>>18&63)+k(B>>12&63)+k(B>>6&63)+k(63&B);switch(X){case 1:V=(V+=k((P=T[T.length-1])>>2))+k(P<<4&63)+"==";break;case 2:V=(V=(V+=k((P=(T[T.length-2]<<8)+T[T.length-1])>>10))+k(P>>4&63))+k(P<<2&63)+"="}return V}})(i===void 0?this.base64js={}:i)}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(r,n,i){(function(a,o,p,u,c,l,f,d,g){var h=r("base64-js"),v=r("ieee754");function p(_,x,E){if(!(this instanceof p))return new p(_,x,E);var R,K,Q,he,Ce=typeof _;if(x==="base64"&&Ce=="string")for(_=(he=_).trim?he.trim():he.replace(/^\s+|\s+$/g,"");_.length%4!=0;)_+="=";if(Ce=="number")R=oe(_);else if(Ce=="string")R=p.byteLength(_,x);else{if(Ce!="object")throw new Error("First argument needs to be a number, array or string.");R=oe(_.length)}if(p._useTypedArrays?K=p._augment(new Uint8Array(R)):((K=this).length=R,K._isBuffer=!0),p._useTypedArrays&&typeof _.byteLength=="number")K._set(_);else if(se(he=_)||p.isBuffer(he)||he&&typeof he=="object"&&typeof he.length=="number")for(Q=0;Q<R;Q++)p.isBuffer(_)?K[Q]=_.readUInt8(Q):K[Q]=_[Q];else if(Ce=="string")K.write(_,0,x);else if(Ce=="number"&&!p._useTypedArrays&&!E)for(Q=0;Q<R;Q++)K[Q]=0;return K}function y(_,x,E,R){return p._charsWritten=pe(function(K){for(var Q=[],he=0;he<K.length;he++)Q.push(255&K.charCodeAt(he));return Q}(x),_,E,R)}function w(_,x,E,R){return p._charsWritten=pe(function(K){for(var Q,he,Ce=[],Me=0;Me<K.length;Me++)he=K.charCodeAt(Me),Q=he>>8,he=he%256,Ce.push(he),Ce.push(Q);return Ce}(x),_,E,R)}function m(_,x,E){var R="";E=Math.min(_.length,E);for(var K=x;K<E;K++)R+=String.fromCharCode(_[K]);return R}function S(_,x,E,Q){Q||(W(typeof E=="boolean","missing or invalid endian"),W(x!=null,"missing offset"),W(x+1<_.length,"Trying to read beyond buffer length"));var K,Q=_.length;if(!(Q<=x))return E?(K=_[x],x+1<Q&&(K|=_[x+1]<<8)):(K=_[x]<<8,x+1<Q&&(K|=_[x+1])),K}function A(_,x,E,Q){Q||(W(typeof E=="boolean","missing or invalid endian"),W(x!=null,"missing offset"),W(x+3<_.length,"Trying to read beyond buffer length"));var K,Q=_.length;if(!(Q<=x))return E?(x+2<Q&&(K=_[x+2]<<16),x+1<Q&&(K|=_[x+1]<<8),K|=_[x],x+3<Q&&(K+=_[x+3]<<24>>>0)):(x+1<Q&&(K=_[x+1]<<16),x+2<Q&&(K|=_[x+2]<<8),x+3<Q&&(K|=_[x+3]),K+=_[x]<<24>>>0),K}function I(_,x,E,R){if(R||(W(typeof E=="boolean","missing or invalid endian"),W(x!=null,"missing offset"),W(x+1<_.length,"Trying to read beyond buffer length")),!(_.length<=x))return R=S(_,x,E,!0),32768&R?-1*(65535-R+1):R}function N(_,x,E,R){if(R||(W(typeof E=="boolean","missing or invalid endian"),W(x!=null,"missing offset"),W(x+3<_.length,"Trying to read beyond buffer length")),!(_.length<=x))return R=A(_,x,E,!0),2147483648&R?-1*(4294967295-R+1):R}function T(_,x,E,R){return R||(W(typeof E=="boolean","missing or invalid endian"),W(x+3<_.length,"Trying to read beyond buffer length")),v.read(_,x,E,23,4)}function M(_,x,E,R){return R||(W(typeof E=="boolean","missing or invalid endian"),W(x+7<_.length,"Trying to read beyond buffer length")),v.read(_,x,E,52,8)}function P(_,x,E,R,K){if(K||(W(x!=null,"missing value"),W(typeof R=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+1<_.length,"trying to write beyond buffer length"),ne(x,65535)),K=_.length,!(K<=E))for(var Q=0,he=Math.min(K-E,2);Q<he;Q++)_[E+Q]=(x&255<<8*(R?Q:1-Q))>>>8*(R?Q:1-Q)}function L(_,x,E,R,K){if(K||(W(x!=null,"missing value"),W(typeof R=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+3<_.length,"trying to write beyond buffer length"),ne(x,4294967295)),K=_.length,!(K<=E))for(var Q=0,he=Math.min(K-E,4);Q<he;Q++)_[E+Q]=x>>>8*(R?Q:3-Q)&255}function B(_,x,E,R,K){K||(W(x!=null,"missing value"),W(typeof R=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+1<_.length,"Trying to write beyond buffer length"),q(x,32767,-32768)),_.length<=E||P(_,0<=x?x:65535+x+1,E,R,K)}function X(_,x,E,R,K){K||(W(x!=null,"missing value"),W(typeof R=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+3<_.length,"Trying to write beyond buffer length"),q(x,2147483647,-2147483648)),_.length<=E||L(_,0<=x?x:4294967295+x+1,E,R,K)}function V(_,x,E,R,K){K||(W(x!=null,"missing value"),W(typeof R=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+3<_.length,"Trying to write beyond buffer length"),z(x,34028234663852886e22,-34028234663852886e22)),_.length<=E||v.write(_,x,E,R,23,4)}function k(_,x,E,R,K){K||(W(x!=null,"missing value"),W(typeof R=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+7<_.length,"Trying to write beyond buffer length"),z(x,17976931348623157e292,-17976931348623157e292)),_.length<=E||v.write(_,x,E,R,52,8)}i.Buffer=p,i.SlowBuffer=p,i.INSPECT_MAX_BYTES=50,p.poolSize=8192,p._useTypedArrays=function(){try{var _=new ArrayBuffer(0),x=new Uint8Array(_);return x.foo=function(){return 42},x.foo()===42&&typeof x.subarray=="function"}catch{return!1}}(),p.isEncoding=function(_){switch(String(_).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.isBuffer=function(_){return!(_==null||!_._isBuffer)},p.byteLength=function(_,x){var E;switch(_+="",x||"utf8"){case"hex":E=_.length/2;break;case"utf8":case"utf-8":E=le(_).length;break;case"ascii":case"binary":case"raw":E=_.length;break;case"base64":E=Ee(_).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":E=2*_.length;break;default:throw new Error("Unknown encoding")}return E},p.concat=function(_,x){if(W(se(_),`Usage: Buffer.concat(list, [totalLength])
|
|
75
|
-
list should be an Array.`),_.length===0)return new p(0);if(_.length===1)return _[0];if(typeof x!="number")for(K=x=0;K<_.length;K++)x+=_[K].length;for(var E=new p(x),R=0,K=0;K<_.length;K++){var Q=_[K];Q.copy(E,R),R+=Q.length}return E},p.prototype.write=function(_,x,E,R){isFinite(x)?isFinite(E)||(R=E,E=void 0):(Me=R,R=x,x=E,E=Me),x=Number(x)||0;var K,Q,he,Ce,Me=this.length-x;switch((!E||Me<(E=Number(E)))&&(E=Me),R=String(R||"utf8").toLowerCase()){case"hex":K=function(vt,lt,mt,nt){mt=Number(mt)||0;var We=vt.length-mt;(!nt||We<(nt=Number(nt)))&&(nt=We),W((We=lt.length)%2==0,"Invalid hex string"),We/2<nt&&(nt=We/2);for(var Pt=0;Pt<nt;Pt++){var re=parseInt(lt.substr(2*Pt,2),16);W(!isNaN(re),"Invalid hex string"),vt[mt+Pt]=re}return p._charsWritten=2*Pt,Pt}(this,_,x,E);break;case"utf8":case"utf-8":Q=this,he=x,Ce=E,K=p._charsWritten=pe(le(_),Q,he,Ce);break;case"ascii":case"binary":K=y(this,_,x,E);break;case"base64":Q=this,he=x,Ce=E,K=p._charsWritten=pe(Ee(_),Q,he,Ce);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":K=w(this,_,x,E);break;default:throw new Error("Unknown encoding")}return K},p.prototype.toString=function(_,x,E){var R,K,Q,he,Ce=this;if(_=String(_||"utf8").toLowerCase(),x=Number(x)||0,(E=E!==void 0?Number(E):Ce.length)===x)return"";switch(_){case"hex":R=function(Me,vt,lt){var mt=Me.length;(!vt||vt<0)&&(vt=0),(!lt||lt<0||mt<lt)&&(lt=mt);for(var nt="",We=vt;We<lt;We++)nt+=de(Me[We]);return nt}(Ce,x,E);break;case"utf8":case"utf-8":R=function(Me,vt,lt){var mt="",nt="";lt=Math.min(Me.length,lt);for(var We=vt;We<lt;We++)Me[We]<=127?(mt+=J(nt)+String.fromCharCode(Me[We]),nt=""):nt+="%"+Me[We].toString(16);return mt+J(nt)}(Ce,x,E);break;case"ascii":case"binary":R=m(Ce,x,E);break;case"base64":K=Ce,he=E,R=(Q=x)===0&&he===K.length?h.fromByteArray(K):h.fromByteArray(K.slice(Q,he));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":R=function(Me,vt,lt){for(var mt=Me.slice(vt,lt),nt="",We=0;We<mt.length;We+=2)nt+=String.fromCharCode(mt[We]+256*mt[We+1]);return nt}(Ce,x,E);break;default:throw new Error("Unknown encoding")}return R},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},p.prototype.copy=function(_,x,E,R){if(x=x||0,(R=R||R===0?R:this.length)!==(E=E||0)&&_.length!==0&&this.length!==0){W(E<=R,"sourceEnd < sourceStart"),W(0<=x&&x<_.length,"targetStart out of bounds"),W(0<=E&&E<this.length,"sourceStart out of bounds"),W(0<=R&&R<=this.length,"sourceEnd out of bounds"),R>this.length&&(R=this.length);var K=(R=_.length-x<R-E?_.length-x+E:R)-E;if(K<100||!p._useTypedArrays)for(var Q=0;Q<K;Q++)_[Q+x]=this[Q+E];else _._set(this.subarray(E,E+K),x)}},p.prototype.slice=function(_,x){var E=this.length;if(_=G(_,E,0),x=G(x,E,E),p._useTypedArrays)return p._augment(this.subarray(_,x));for(var R=x-_,K=new p(R,void 0,!0),Q=0;Q<R;Q++)K[Q]=this[Q+_];return K},p.prototype.get=function(_){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(_)},p.prototype.set=function(_,x){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(_,x)},p.prototype.readUInt8=function(_,x){if(x||(W(_!=null,"missing offset"),W(_<this.length,"Trying to read beyond buffer length")),!(_>=this.length))return this[_]},p.prototype.readUInt16LE=function(_,x){return S(this,_,!0,x)},p.prototype.readUInt16BE=function(_,x){return S(this,_,!1,x)},p.prototype.readUInt32LE=function(_,x){return A(this,_,!0,x)},p.prototype.readUInt32BE=function(_,x){return A(this,_,!1,x)},p.prototype.readInt8=function(_,x){if(x||(W(_!=null,"missing offset"),W(_<this.length,"Trying to read beyond buffer length")),!(_>=this.length))return 128&this[_]?-1*(255-this[_]+1):this[_]},p.prototype.readInt16LE=function(_,x){return I(this,_,!0,x)},p.prototype.readInt16BE=function(_,x){return I(this,_,!1,x)},p.prototype.readInt32LE=function(_,x){return N(this,_,!0,x)},p.prototype.readInt32BE=function(_,x){return N(this,_,!1,x)},p.prototype.readFloatLE=function(_,x){return T(this,_,!0,x)},p.prototype.readFloatBE=function(_,x){return T(this,_,!1,x)},p.prototype.readDoubleLE=function(_,x){return M(this,_,!0,x)},p.prototype.readDoubleBE=function(_,x){return M(this,_,!1,x)},p.prototype.writeUInt8=function(_,x,E){E||(W(_!=null,"missing value"),W(x!=null,"missing offset"),W(x<this.length,"trying to write beyond buffer length"),ne(_,255)),x>=this.length||(this[x]=_)},p.prototype.writeUInt16LE=function(_,x,E){P(this,_,x,!0,E)},p.prototype.writeUInt16BE=function(_,x,E){P(this,_,x,!1,E)},p.prototype.writeUInt32LE=function(_,x,E){L(this,_,x,!0,E)},p.prototype.writeUInt32BE=function(_,x,E){L(this,_,x,!1,E)},p.prototype.writeInt8=function(_,x,E){E||(W(_!=null,"missing value"),W(x!=null,"missing offset"),W(x<this.length,"Trying to write beyond buffer length"),q(_,127,-128)),x>=this.length||(0<=_?this.writeUInt8(_,x,E):this.writeUInt8(255+_+1,x,E))},p.prototype.writeInt16LE=function(_,x,E){B(this,_,x,!0,E)},p.prototype.writeInt16BE=function(_,x,E){B(this,_,x,!1,E)},p.prototype.writeInt32LE=function(_,x,E){X(this,_,x,!0,E)},p.prototype.writeInt32BE=function(_,x,E){X(this,_,x,!1,E)},p.prototype.writeFloatLE=function(_,x,E){V(this,_,x,!0,E)},p.prototype.writeFloatBE=function(_,x,E){V(this,_,x,!1,E)},p.prototype.writeDoubleLE=function(_,x,E){k(this,_,x,!0,E)},p.prototype.writeDoubleBE=function(_,x,E){k(this,_,x,!1,E)},p.prototype.fill=function(_,x,E){if(x=x||0,E=E||this.length,W(typeof(_=typeof(_=_||0)=="string"?_.charCodeAt(0):_)=="number"&&!isNaN(_),"value is not a number"),W(x<=E,"end < start"),E!==x&&this.length!==0){W(0<=x&&x<this.length,"start out of bounds"),W(0<=E&&E<=this.length,"end out of bounds");for(var R=x;R<E;R++)this[R]=_}},p.prototype.inspect=function(){for(var _=[],x=this.length,E=0;E<x;E++)if(_[E]=de(this[E]),E===i.INSPECT_MAX_BYTES){_[E+1]="...";break}return"<Buffer "+_.join(" ")+">"},p.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(p._useTypedArrays)return new p(this).buffer;for(var _=new Uint8Array(this.length),x=0,E=_.length;x<E;x+=1)_[x]=this[x];return _.buffer};var $=p.prototype;function G(_,x,E){return typeof _!="number"?E:x<=(_=~~_)?x:0<=_||0<=(_+=x)?_:0}function oe(_){return(_=~~Math.ceil(+_))<0?0:_}function se(_){return(Array.isArray||function(x){return Object.prototype.toString.call(x)==="[object Array]"})(_)}function de(_){return _<16?"0"+_.toString(16):_.toString(16)}function le(_){for(var x=[],E=0;E<_.length;E++){var R=_.charCodeAt(E);if(R<=127)x.push(_.charCodeAt(E));else for(var K=E,Q=(55296<=R&&R<=57343&&E++,encodeURIComponent(_.slice(K,E+1)).substr(1).split("%")),he=0;he<Q.length;he++)x.push(parseInt(Q[he],16))}return x}function Ee(_){return h.toByteArray(_)}function pe(_,x,E,R){for(var K=0;K<R&&!(K+E>=x.length||K>=_.length);K++)x[K+E]=_[K];return K}function J(_){try{return decodeURIComponent(_)}catch{return String.fromCharCode(65533)}}function ne(_,x){W(typeof _=="number","cannot write a non-number as a number"),W(0<=_,"specified a negative value for writing an unsigned value"),W(_<=x,"value is larger than maximum value for type"),W(Math.floor(_)===_,"value has a fractional component")}function q(_,x,E){W(typeof _=="number","cannot write a non-number as a number"),W(_<=x,"value larger than maximum allowed value"),W(E<=_,"value smaller than minimum allowed value"),W(Math.floor(_)===_,"value has a fractional component")}function z(_,x,E){W(typeof _=="number","cannot write a non-number as a number"),W(_<=x,"value larger than maximum allowed value"),W(E<=_,"value smaller than minimum allowed value")}function W(_,x){if(!_)throw new Error(x||"Failed assertion")}p._augment=function(_){return _._isBuffer=!0,_._get=_.get,_._set=_.set,_.get=$.get,_.set=$.set,_.write=$.write,_.toString=$.toString,_.toLocaleString=$.toString,_.toJSON=$.toJSON,_.copy=$.copy,_.slice=$.slice,_.readUInt8=$.readUInt8,_.readUInt16LE=$.readUInt16LE,_.readUInt16BE=$.readUInt16BE,_.readUInt32LE=$.readUInt32LE,_.readUInt32BE=$.readUInt32BE,_.readInt8=$.readInt8,_.readInt16LE=$.readInt16LE,_.readInt16BE=$.readInt16BE,_.readInt32LE=$.readInt32LE,_.readInt32BE=$.readInt32BE,_.readFloatLE=$.readFloatLE,_.readFloatBE=$.readFloatBE,_.readDoubleLE=$.readDoubleLE,_.readDoubleBE=$.readDoubleBE,_.writeUInt8=$.writeUInt8,_.writeUInt16LE=$.writeUInt16LE,_.writeUInt16BE=$.writeUInt16BE,_.writeUInt32LE=$.writeUInt32LE,_.writeUInt32BE=$.writeUInt32BE,_.writeInt8=$.writeInt8,_.writeInt16LE=$.writeInt16LE,_.writeInt16BE=$.writeInt16BE,_.writeInt32LE=$.writeInt32LE,_.writeInt32BE=$.writeInt32BE,_.writeFloatLE=$.writeFloatLE,_.writeFloatBE=$.writeFloatBE,_.writeDoubleLE=$.writeDoubleLE,_.writeDoubleBE=$.writeDoubleBE,_.fill=$.fill,_.inspect=$.inspect,_.toArrayBuffer=$.toArrayBuffer,_}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(r,n,i){(function(a,o,h,u,c,l,f,d,g){var h=r("buffer").Buffer,v=4,p=new h(v);p.fill(0),n.exports={hash:function(y,w,m,S){for(var A=w(function(P,L){P.length%v!=0&&(B=P.length+(v-P.length%v),P=h.concat([P,p],B));for(var B,X=[],V=L?P.readInt32BE:P.readInt32LE,k=0;k<P.length;k+=v)X.push(V.call(P,k));return X}(y=h.isBuffer(y)?y:new h(y),S),8*y.length),w=S,I=new h(m),N=w?I.writeInt32BE:I.writeInt32LE,T=0;T<A.length;T++)N.call(I,A[T],4*T,!0);return I}}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(r,n,i){(function(a,o,h,u,c,l,f,d,g){var h=r("buffer").Buffer,v=r("./sha"),p=r("./sha256"),y=r("./rng"),w={sha1:v,sha256:p,md5:r("./md5")},m=64,S=new h(m);function A(P,L){var B=w[P=P||"sha1"],X=[];return B||I("algorithm:",P,"is not yet supported"),{update:function(V){return h.isBuffer(V)||(V=new h(V)),X.push(V),V.length,this},digest:function(V){var k=h.concat(X),k=L?function($,G,oe){h.isBuffer(G)||(G=new h(G)),h.isBuffer(oe)||(oe=new h(oe)),G.length>m?G=$(G):G.length<m&&(G=h.concat([G,S],m));for(var se=new h(m),de=new h(m),le=0;le<m;le++)se[le]=54^G[le],de[le]=92^G[le];return oe=$(h.concat([se,oe])),$(h.concat([de,oe]))}(B,L,k):B(k);return X=null,V?k.toString(V):k}}}function I(){var P=[].slice.call(arguments).join(" ");throw new Error([P,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
76
|
-
`))}S.fill(0),i.createHash=function(P){return A(P)},i.createHmac=A,i.randomBytes=function(P,L){if(!L||!L.call)return new h(y(P));try{L.call(this,void 0,new h(y(P)))}catch(B){L(B)}};var N,T=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],M=function(P){i[P]=function(){I("sorry,",P,"is not implemented yet")}};for(N in T)M(T[N])}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){var h=r("./helpers");function v(I,N){I[N>>5]|=128<<N%32,I[14+(N+64>>>9<<4)]=N;for(var T=1732584193,M=-271733879,P=-1732584194,L=271733878,B=0;B<I.length;B+=16){var X=T,V=M,k=P,$=L,T=y(T,M,P,L,I[B+0],7,-680876936),L=y(L,T,M,P,I[B+1],12,-389564586),P=y(P,L,T,M,I[B+2],17,606105819),M=y(M,P,L,T,I[B+3],22,-1044525330);T=y(T,M,P,L,I[B+4],7,-176418897),L=y(L,T,M,P,I[B+5],12,1200080426),P=y(P,L,T,M,I[B+6],17,-1473231341),M=y(M,P,L,T,I[B+7],22,-45705983),T=y(T,M,P,L,I[B+8],7,1770035416),L=y(L,T,M,P,I[B+9],12,-1958414417),P=y(P,L,T,M,I[B+10],17,-42063),M=y(M,P,L,T,I[B+11],22,-1990404162),T=y(T,M,P,L,I[B+12],7,1804603682),L=y(L,T,M,P,I[B+13],12,-40341101),P=y(P,L,T,M,I[B+14],17,-1502002290),T=w(T,M=y(M,P,L,T,I[B+15],22,1236535329),P,L,I[B+1],5,-165796510),L=w(L,T,M,P,I[B+6],9,-1069501632),P=w(P,L,T,M,I[B+11],14,643717713),M=w(M,P,L,T,I[B+0],20,-373897302),T=w(T,M,P,L,I[B+5],5,-701558691),L=w(L,T,M,P,I[B+10],9,38016083),P=w(P,L,T,M,I[B+15],14,-660478335),M=w(M,P,L,T,I[B+4],20,-405537848),T=w(T,M,P,L,I[B+9],5,568446438),L=w(L,T,M,P,I[B+14],9,-1019803690),P=w(P,L,T,M,I[B+3],14,-187363961),M=w(M,P,L,T,I[B+8],20,1163531501),T=w(T,M,P,L,I[B+13],5,-1444681467),L=w(L,T,M,P,I[B+2],9,-51403784),P=w(P,L,T,M,I[B+7],14,1735328473),T=m(T,M=w(M,P,L,T,I[B+12],20,-1926607734),P,L,I[B+5],4,-378558),L=m(L,T,M,P,I[B+8],11,-2022574463),P=m(P,L,T,M,I[B+11],16,1839030562),M=m(M,P,L,T,I[B+14],23,-35309556),T=m(T,M,P,L,I[B+1],4,-1530992060),L=m(L,T,M,P,I[B+4],11,1272893353),P=m(P,L,T,M,I[B+7],16,-155497632),M=m(M,P,L,T,I[B+10],23,-1094730640),T=m(T,M,P,L,I[B+13],4,681279174),L=m(L,T,M,P,I[B+0],11,-358537222),P=m(P,L,T,M,I[B+3],16,-722521979),M=m(M,P,L,T,I[B+6],23,76029189),T=m(T,M,P,L,I[B+9],4,-640364487),L=m(L,T,M,P,I[B+12],11,-421815835),P=m(P,L,T,M,I[B+15],16,530742520),T=S(T,M=m(M,P,L,T,I[B+2],23,-995338651),P,L,I[B+0],6,-198630844),L=S(L,T,M,P,I[B+7],10,1126891415),P=S(P,L,T,M,I[B+14],15,-1416354905),M=S(M,P,L,T,I[B+5],21,-57434055),T=S(T,M,P,L,I[B+12],6,1700485571),L=S(L,T,M,P,I[B+3],10,-1894986606),P=S(P,L,T,M,I[B+10],15,-1051523),M=S(M,P,L,T,I[B+1],21,-2054922799),T=S(T,M,P,L,I[B+8],6,1873313359),L=S(L,T,M,P,I[B+15],10,-30611744),P=S(P,L,T,M,I[B+6],15,-1560198380),M=S(M,P,L,T,I[B+13],21,1309151649),T=S(T,M,P,L,I[B+4],6,-145523070),L=S(L,T,M,P,I[B+11],10,-1120210379),P=S(P,L,T,M,I[B+2],15,718787259),M=S(M,P,L,T,I[B+9],21,-343485551),T=A(T,X),M=A(M,V),P=A(P,k),L=A(L,$)}return Array(T,M,P,L)}function p(I,N,T,M,P,L){return A((N=A(A(N,I),A(M,L)))<<P|N>>>32-P,T)}function y(I,N,T,M,P,L,B){return p(N&T|~N&M,I,N,P,L,B)}function w(I,N,T,M,P,L,B){return p(N&M|T&~M,I,N,P,L,B)}function m(I,N,T,M,P,L,B){return p(N^T^M,I,N,P,L,B)}function S(I,N,T,M,P,L,B){return p(T^(N|~M),I,N,P,L,B)}function A(I,N){var T=(65535&I)+(65535&N);return(I>>16)+(N>>16)+(T>>16)<<16|65535&T}n.exports=function(I){return h.hash(I,v,16)}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){n.exports=function(h){for(var v,p=new Array(h),y=0;y<h;y++)(3&y)==0&&(v=4294967296*Math.random()),p[y]=v>>>((3&y)<<3)&255;return p}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){var h=r("./helpers");function v(w,m){w[m>>5]|=128<<24-m%32,w[15+(m+64>>9<<4)]=m;for(var S,A,I,N=Array(80),T=1732584193,M=-271733879,P=-1732584194,L=271733878,B=-1009589776,X=0;X<w.length;X+=16){for(var V=T,k=M,$=P,G=L,oe=B,se=0;se<80;se++){N[se]=se<16?w[X+se]:y(N[se-3]^N[se-8]^N[se-14]^N[se-16],1);var de=p(p(y(T,5),(de=M,A=P,I=L,(S=se)<20?de&A|~de&I:!(S<40)&&S<60?de&A|de&I|A&I:de^A^I)),p(p(B,N[se]),(S=se)<20?1518500249:S<40?1859775393:S<60?-1894007588:-899497514)),B=L,L=P,P=y(M,30),M=T,T=de}T=p(T,V),M=p(M,k),P=p(P,$),L=p(L,G),B=p(B,oe)}return Array(T,M,P,L,B)}function p(w,m){var S=(65535&w)+(65535&m);return(w>>16)+(m>>16)+(S>>16)<<16|65535&S}function y(w,m){return w<<m|w>>>32-m}n.exports=function(w){return h.hash(w,v,20,!0)}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){function h(m,S){var A=(65535&m)+(65535&S);return(m>>16)+(S>>16)+(A>>16)<<16|65535&A}function v(m,S){var A,I=new Array(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),N=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),T=new Array(64);m[S>>5]|=128<<24-S%32,m[15+(S+64>>9<<4)]=S;for(var M,P,L=0;L<m.length;L+=16){for(var B=N[0],X=N[1],V=N[2],k=N[3],$=N[4],G=N[5],oe=N[6],se=N[7],de=0;de<64;de++)T[de]=de<16?m[de+L]:h(h(h((P=T[de-2],y(P,17)^y(P,19)^w(P,10)),T[de-7]),(P=T[de-15],y(P,7)^y(P,18)^w(P,3))),T[de-16]),A=h(h(h(h(se,y(P=$,6)^y(P,11)^y(P,25)),$&G^~$&oe),I[de]),T[de]),M=h(y(M=B,2)^y(M,13)^y(M,22),B&X^B&V^X&V),se=oe,oe=G,G=$,$=h(k,A),k=V,V=X,X=B,B=h(A,M);N[0]=h(B,N[0]),N[1]=h(X,N[1]),N[2]=h(V,N[2]),N[3]=h(k,N[3]),N[4]=h($,N[4]),N[5]=h(G,N[5]),N[6]=h(oe,N[6]),N[7]=h(se,N[7])}return N}var p=r("./helpers"),y=function(m,S){return m>>>S|m<<32-S},w=function(m,S){return m>>>S};n.exports=function(m){return p.hash(m,v,32,!0)}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){i.read=function(h,v,p,y,L){var m,S,A=8*L-y-1,I=(1<<A)-1,N=I>>1,T=-7,M=p?L-1:0,P=p?-1:1,L=h[v+M];for(M+=P,m=L&(1<<-T)-1,L>>=-T,T+=A;0<T;m=256*m+h[v+M],M+=P,T-=8);for(S=m&(1<<-T)-1,m>>=-T,T+=y;0<T;S=256*S+h[v+M],M+=P,T-=8);if(m===0)m=1-N;else{if(m===I)return S?NaN:1/0*(L?-1:1);S+=Math.pow(2,y),m-=N}return(L?-1:1)*S*Math.pow(2,m-y)},i.write=function(h,v,p,y,w,B){var S,A,I=8*B-w-1,N=(1<<I)-1,T=N>>1,M=w===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=y?0:B-1,L=y?1:-1,B=v<0||v===0&&1/v<0?1:0;for(v=Math.abs(v),isNaN(v)||v===1/0?(A=isNaN(v)?1:0,S=N):(S=Math.floor(Math.log(v)/Math.LN2),v*(y=Math.pow(2,-S))<1&&(S--,y*=2),2<=(v+=1<=S+T?M/y:M*Math.pow(2,1-T))*y&&(S++,y/=2),N<=S+T?(A=0,S=N):1<=S+T?(A=(v*y-1)*Math.pow(2,w),S+=T):(A=v*Math.pow(2,T-1)*Math.pow(2,w),S=0));8<=w;h[p+P]=255&A,P+=L,A/=256,w-=8);for(S=S<<w|A,I+=w;0<I;h[p+P]=255&S,P+=L,S/=256,I-=8);h[p+P-L]|=128*B}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(r,n,i){(function(a,o,s,u,c,l,f,d,g){var h,v,p;function y(){}(a=n.exports={}).nextTick=(v=typeof window<"u"&&window.setImmediate,p=typeof window<"u"&&window.postMessage&&window.addEventListener,v?function(w){return window.setImmediate(w)}:p?(h=[],window.addEventListener("message",function(w){var m=w.source;m!==window&&m!==null||w.data!=="process-tick"||(w.stopPropagation(),0<h.length&&h.shift()())},!0),function(w){h.push(w),window.postMessage("process-tick","*")}):function(w){setTimeout(w,0)}),a.title="browser",a.browser=!0,a.env={},a.argv=[],a.on=y,a.addListener=y,a.once=y,a.off=y,a.removeListener=y,a.removeAllListeners=y,a.emit=y,a.binding=function(w){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(w){throw new Error("process.chdir is not supported")}}).call(this,r("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},r("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})})(WE);var dc={},zE={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(me,function(){var r="minute",n=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g;return function(a,o,s){var u=o.prototype;s.utc=function(v){var p={date:v,utc:!0,args:arguments};return new o(p)},u.utc=function(v){var p=s(this.toDate(),{locale:this.$L,utc:!0});return v?p.add(this.utcOffset(),r):p},u.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var c=u.parse;u.parse=function(v){v.utc&&(this.$u=!0),this.$utils().u(v.$offset)||(this.$offset=v.$offset),c.call(this,v)};var l=u.init;u.init=function(){if(this.$u){var v=this.$d;this.$y=v.getUTCFullYear(),this.$M=v.getUTCMonth(),this.$D=v.getUTCDate(),this.$W=v.getUTCDay(),this.$H=v.getUTCHours(),this.$m=v.getUTCMinutes(),this.$s=v.getUTCSeconds(),this.$ms=v.getUTCMilliseconds()}else l.call(this)};var f=u.utcOffset;u.utcOffset=function(v,p){var y=this.$utils().u;if(y(v))return this.$u?0:y(this.$offset)?f.call(this):this.$offset;if(typeof v=="string"&&(v=function(A){A===void 0&&(A="");var I=A.match(n);if(!I)return null;var N=(""+I[0]).match(i)||["-",0,0],T=N[0],M=60*+N[1]+ +N[2];return M===0?0:T==="+"?M:-M}(v),v===null))return this;var w=Math.abs(v)<=16?60*v:v,m=this;if(p)return m.$offset=w,m.$u=v===0,m;if(v!==0){var S=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(m=this.local().add(w+S,r)).$offset=w,m.$x.$localOffset=S}else m=this.utc();return m};var d=u.format;u.format=function(v){var p=v||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,p)},u.valueOf=function(){var v=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*v},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var g=u.toDate;u.toDate=function(v){return v==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():g.call(this)};var h=u.diff;u.diff=function(v,p,y){if(v&&this.$u===v.$u)return h.call(this,v,p,y);var w=this.local(),m=s(v).local();return h.call(w,m,p,y)}}})})(zE);var Er={};Object.defineProperty(Er,"__esModule",{value:!0}),Er.assertConditionTruthy=Er.assertEmptyAndThrow=Er.formatJsonLogName=Er.formatLevel=Er.debounce=void 0;function BL(e,t,r){let n,i,a,o,s;t==null&&(t=100);function u(){const l=Date.now()-o;l<t&&l>=0?n=setTimeout(u,t-l):(n=null,r||(s=e.apply(a,i),a=i=null))}const c=(...l)=>{a=this,o=Date.now();const f=r&&!n;return n||(n=setTimeout(u,t)),f&&(s=e.apply(a,l),a=l=null),s};return c.clear=()=>{n&&(clearTimeout(n),n=null)},c.flush=()=>{n&&(s=e.apply(a,i),a=i=null,clearTimeout(n),n=null)},c}Er.debounce=BL;function DL(e){return e.toLowerCase()}Er.formatLevel=DL;function FL(e){return e==null?e:/\.log$/.test(e)?e.replace(".log",".json.log"):/\.$/.test(e)?e+"json.log":e+".json.log"}Er.formatJsonLogName=FL;function kL(e,t){if(e==null)throw new Error(t)}Er.assertEmptyAndThrow=kL;function UL(...e){if(e&&e.length){for(const t of e)if(t===!0)return!1}return!0}Er.assertConditionTruthy=UL,Object.defineProperty(dc,"__esModule",{value:!0}),dc.FileStreamRotator=void 0;const Yt=_e,Wn=_e,QE=_e,$L=Ra.exports,XE=_e,zn=Xs.default,jL=zE.exports,KL=_e,qL=Er,Qn=(0,XE.debuglog)("midway-logger"),JE=["daily","test","s","m","h","custom"],ZE="YYYYMMDDHHmm";zn.extend(jL);const VL=function(e,t){if(typeof t=="number"){switch(e){case"s":case"m":if(t<0||t>60)return!1;break;case"h":if(t<0||t>24)return!1;break}return{type:e,digit:t}}},GL=function(e){switch(e){case"custom":case"daily":return{type:e,digit:void 0};case"test":return{type:e,digit:0}}return!1};function eb(e){if(e.hash===QE.createHash(e.hashType).update(e.name+"LOG_FILE"+e.date).digest("hex"))try{Yt.existsSync(e.name)&&Yt.unlinkSync(e.name)}catch{Qn(new Date().toLocaleString(),"[FileStreamRotator] Could not remove old log file: ",e.name)}}function HL(e,t){const r=t||"current.log",n=Wn.dirname(e),i=Wn.basename(e),a=n+"/"+r;try{Yt.lstatSync(a).isSymbolicLink()&&(Yt.unlinkSync(a),Yt.symlinkSync(i,a))}catch(o){if(o&&o.code==="ENOENT")try{Yt.symlinkSync(i,a)}catch{Qn(new Date().toLocaleString(),"[FileStreamRotator] Could not create symlink file: ",a," -> ",i)}}}const Ah=function(e){Wn.dirname(e).split(Wn.sep).reduce((r,n)=>{if(r+=n+Wn.sep,!Yt.existsSync(r))try{Yt.mkdirSync(r)}catch(i){if(i.code!=="EEXIST")throw i}return r},"")};function tb(e,t){e.on("close",()=>{t.emit("close")}),e.on("finish",()=>{t.emit("finish")}),e.on("error",r=>{t.emit("error",r)}),e.on("open",r=>{t.emit("open",r)})}class YL{getFrequency(t){const r=t.toLowerCase().match(/^(\d+)([smh])$/);if(r)return VL(r[2],parseInt(r[1]));const n=GL(t);return n||!1}parseFileSize(t){if(t&&typeof t=="string"){const r=t.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);if(r)switch(r[2]){case"k":return r[1]*1024;case"m":return r[1]*1024*1024;case"g":return r[1]*1024*1024*1024}}return null}getDate(t,r,n){r=r||ZE;const i=n?zn.utc():zn().local();if(t&&JE.indexOf(t.type)!==-1)switch(t.type){case"s":const a=Math.floor(i.second()/t.digit)*t.digit;return i.second(a).format(r);case"m":const o=Math.floor(i.minute()/t.digit)*t.digit;return i.minute(o).format(r);case"h":const s=Math.floor(i.hour()/t.digit)*t.digit;return i.hour(s).format(r);case"daily":case"custom":case"test":return i.format(r)}return i.format(r)}setAuditLog(t,r,n){let i=null;if(t){const a=t.toString().substr(-1),o=t.toString().match(/^(\d+)/);if(Number(o[1])>0){const s=Wn.dirname(n.replace(/%DATE%.+/,"_filename"));try{if(r){const u=Wn.resolve(r);i=JSON.parse(Yt.readFileSync(u,{encoding:"utf-8"}))}else{const u=Wn.resolve(s+"/.audit.json");i=JSON.parse(Yt.readFileSync(u,{encoding:"utf-8"}))}}catch(u){if(u.code!=="ENOENT")return null;i={keep:{days:!1,amount:Number(o[1])},auditLog:r||s+"/.audit.json",files:[]}}i.keep={days:a==="d",amount:Number(o[1])}}}return i}writeAuditLog(t){try{Ah(t.auditLog),Yt.writeFileSync(t.auditLog,JSON.stringify(t,null,2))}catch(r){Qn(new Date().toLocaleString(),"[FileStreamRotator] Failed to store log audit at:",t.auditLog,"Error:",r)}}addLogToAudit(t,r,n){if(r&&r.files){if(r.files.findIndex(o=>o.name===t)!==-1)return r;const a=Date.now();if(r.files.push({date:a,name:t,hash:QE.createHash(r.hashType).update(t+"LOG_FILE"+a).digest("hex")}),r.keep.days){const o=zn().subtract(r.keep.amount,"days").valueOf(),s=r.files.filter(u=>u.date>o?!0:(u.hashType=r.hashType,eb(u),n.emit("logRemoved",u),!1));r.files=s}else{const o=r.files.splice(-r.keep.amount);r.files.length>0&&r.files.filter(s=>(s.hashType=r.hashType,eb(s),n.emit("logRemoved",s),!1)),r.files=o}this.writeAuditLog(r)}return r}getStream(t){let r=null,n=null;KL(t.filename,"options.filename must be supplied"),t.frequency&&(r=this.getFrequency(t.frequency));const i=this.setAuditLog(t.max_logs,t.audit_file,t.filename);i!=null&&(i.hashType=t.audit_hash_type!==void 0?t.audit_hash_type:"md5");let a=null,o=0,s=0;t.size&&(a=this.parseFileSize(t.size));let u=t.date_format||ZE;r&&r.type==="daily"&&(t.date_format||(u="YYYY-MM-DD"),(zn().format(u)!==zn().endOf("day").format(u)||zn().format(u)===zn().add(1,"day").format(u))&&(Qn(new Date().toLocaleString(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day"),r.type="custom")),r&&(n=t.frequency?this.getDate(r,u,t.utc):""),t.create_symlink=t.create_symlink||!1,t.extension=t.extension||"";const c=t.filename;let l=null,f=c+(n?"."+n:"");if(c.match(/%DATE%/)&&(f=c.replace(/%DATE%/g,n||this.getDate(null,u,t.utc))),a){let h=null,v=f;if(i&&i.files&&i.files instanceof Array&&i.files.length>0){const p=i.files[i.files.length-1].name;if(p.match(v)){const y=p.match(v+"\\.(\\d+)");y&&(v=p,o=y[1])}}for(o===0&&v===f&&(v+=t.extension);Yt.existsSync(v);)h=v,o++,v=f+"."+o+t.extension;if(h){const p=Yt.statSync(h);p.size<a&&(v=h,o--,s=p.size)}f=v}else f+=t.extension;Qn(new Date().toLocaleString(),"[FileStreamRotator] Logging to: ",f),Ah(f);const d=t.file_options||{flags:"a"};let g=Yt.createWriteStream(f,d);if(n&&r&&JE.indexOf(r.type)>-1||a>0){Qn(new Date().toLocaleString(),"[FileStreamRotator] Rotating file: ",r?r.type:"",a?"size: "+a:"");const h=new $L;h.auditLog=i,h.end=(...p)=>{g.end(...p),v.clear()},tb(g,h),h.on("new",p=>{h.auditLog=this.addLogToAudit(p,h.auditLog,h),t.create_symlink&&HL(p,t.symlink_name)});const v=(0,qL.debounce)(()=>{let p=!1;try{const y=Yt.statSync(f);y.size>s&&(s=y.size)}catch{p=!0}return p},1e3);return h.write=(p,y)=>{const w=v(),m=r?this.getDate(r,u,t.utc):n;if(w||n&&m!==n||a&&s>a){let S=c+(n&&r?"."+m:"");c.match(/%DATE%/)&&n&&(S=c.replace(/%DATE%/g,m)),a&&s>a?(o++,S+="."+o+t.extension):(o=0,S+=t.extension),s=0,Qn(new Date().toLocaleString(),(0,XE.format)("[FileStreamRotator] Changing logs from %s to %s",f,S)),n=m,l=f,f=S,t.end_stream===!0?g.end():g.destroy(),Ah(f),g=Yt.createWriteStream(S,d),h.emit("new",S),h.emit("rotate",l,S),tb(g,h)}g.write(p,y),s+=Buffer.byteLength(p,y)},process.nextTick(()=>{h.emit("new",f)}),h.emit("new",f),h}else return Qn(new Date().toLocaleString(),"[FileStreamRotator] File won't be rotated: ",t.frequency,t.size),process.nextTick(()=>{g.emit("new",f)}),g}}dc.FileStreamRotator=YL,Object.defineProperty(fc,"__esModule",{value:!0}),fc.DailyRotateFileTransport=void 0;const Xn=_e,WL=_e,hc=_e,zL=_e,QL=WE.exports,XL=ht,JL=_e,ZL=mn(),eP=dc,tP={json:!1,colorize:!1,eol:WL.EOL,logstash:null,prettyPrint:!1,label:null,stringify:!1,depth:null,showLevel:!0,timestamp:function(){return new Date().toISOString()}},rP=function(){};function nP(e){return!/["<>|:*?\\/\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/g.test(e)}function iP(e){return!/["<>|\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/g.test(e)}function aP(e){if(e&&typeof e=="string"){if(e.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/))return e}else if(e&&Number.isInteger(e)){const t=Math.round(e/1024);return t===0?"1k":t+"k"}return null}function oP(e,...t){Array.prototype.slice.call(t,1).forEach(r=>{if(e[r])throw new Error("Cannot set "+r+" and "+t[0]+" together")})}class sP extends ZL{constructor(t={}){if(super(t),this.name="dailyRotateFile",this.options=Object.assign({},tP,t),t.stream)oP(t,"stream","filename","maxsize"),this.logStream=new JL.PassThrough,this.logStream.pipe(t.stream);else{if(this.filename=t.filename?hc.basename(t.filename):"winston.log",this.dirname=t.dirname||hc.dirname(t.filename),!nP(this.filename)||!iP(this.dirname))throw new Error("Your path or filename contain an invalid character.");const r=new eP.FileStreamRotator;this.logStream=r.getStream({filename:hc.join(this.dirname,this.filename),frequency:t.frequency?t.frequency:"custom",date_format:t.datePattern?t.datePattern:"YYYY-MM-DD",size:aP(t.maxSize),max_logs:t.maxFiles,end_stream:!0,audit_file:t.auditFile?t.auditFile:hc.join(t.auditFileDir||this.dirname,"."+QL(t)+"-audit.json"),file_options:t.options?t.options:{flags:"a"},utc:t.utc?t.utc:!1,extension:t.extension?t.extension:"",create_symlink:t.createSymlink?t.createSymlink:!1,symlink_name:t.symlinkName?t.symlinkName:"current.log"}),this.logStream.on("new",n=>{this.emit("new",n)}),this.logStream.on("rotate",(n,i)=>{this.emit("rotate",n,i)}),this.logStream.on("logRemoved",n=>{if(t.zippedArchive){const i=n.name+".gz";if(Xn.existsSync(i)){try{Xn.unlinkSync(i)}catch{}this.emit("logRemoved",i);return}}this.emit("logRemoved",n.name)}),t.zippedArchive&&this.logStream.on("rotate",n=>{const i=Xn.existsSync(n),a=Xn.existsSync(n+".gz");if(!i||a)return;const o=zL.createGzip(),s=Xn.createReadStream(n),u=Xn.createWriteStream(n+".gz");s.pipe(o).pipe(u).on("finish",()=>{Xn.existsSync(n)&&Xn.unlinkSync(n),this.emit("archive",n+".gz")})})}}log(t,r){r=r||rP,this.logStream.write(t[XL.MESSAGE]+this.options.eol),this.emit("logged",t),r(null,!0)}close(){this.logStream&&(this.logStream.end(()=>{this.emit("finish")}),this.logStream=null)}}fc.DailyRotateFileTransport=sP;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.EmptyTransport=Jn.DelegateTransport=void 0;const rb=mn();class uP extends rb{constructor(t){super(),this.options=t}log(t,r){var n;(n=this.options.delegateLogger[t.level])===null||n===void 0||n.call(this.options.delegateLogger,t.message),r()}}Jn.DelegateTransport=uP;class cP extends rb{log(t,r){r()}}Jn.EmptyTransport=cP;var bn={},Fi={};Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.ORIGIN_ERROR=Fi.ORIGIN_ARGS=void 0,Fi.ORIGIN_ARGS=Symbol("origin_args"),Fi.ORIGIN_ERROR=Symbol("origin_error"),Object.defineProperty(bn,"__esModule",{value:!0}),bn.customJSON=bn.displayLabels=bn.displayCommonMessage=void 0;const xh=cs,Zn=Fi;function jr(e,t){t in e&&delete e[t]}bn.displayCommonMessage=(0,xh.format)((e,t)=>{var r,n;return e.pid||(e.pid=process.pid),e[Zn.ORIGIN_ERROR]&&(e.originError=e[Zn.ORIGIN_ERROR]),e[Zn.ORIGIN_ARGS]&&(e.originArgs=e[Zn.ORIGIN_ARGS]),e.ignoreFormat||(e.ignoreFormat=!1),e.ctx||(e.ctx=null),e.format||(e.format=null),e.LEVEL||(e.LEVEL=e.level.toUpperCase()),e.defaultLabel||(e.defaultLabel=t.defaultLabel||((r=t.target)===null||r===void 0?void 0:r.getDefaultLabel())||""),Object.assign(e,t.defaultMeta||((n=t.target)===null||n===void 0?void 0:n.getDefaultMeta())||{})});function lP(e,...t){if(t.length===0)return"";{const r=t.filter(n=>!!n);return r.length===0?"":`[${r.join(e)}] `}}bn.displayLabels=(0,xh.format)((e,t)=>(t.labelSplit=t.labelSplit||":",e.labelText=lP(t.labelSplit,e.defaultLabel,...[].concat(e.label)),e)),bn.customJSON=(0,xh.format)((e,t)=>{var r,n,i,a;const o={};e[Zn.ORIGIN_ERROR]&&(o.originError=e[Zn.ORIGIN_ERROR]),jr(e,"originError"),e[Zn.ORIGIN_ARGS]&&(o.originArgs=e[Zn.ORIGIN_ARGS]),jr(e,"originArgs"),o.ignoreFormat=(r=e.ignoreFormat)!==null&&r!==void 0?r:!1,jr(e,"ignoreFormat"),o.ctx=(n=e.ctx)!==null&&n!==void 0?n:null,jr(e,"ctx"),jr(e,"format"),o.LEVEL=(i=e.LEVEL)!==null&&i!==void 0?i:e.level.toUpperCase(),jr(e,"LEVEL"),o.level=e.level,e.level=o.LEVEL,o.pid=e.pid,jr(e,"pid"),jr(e,"label"),jr(e,"labelText"),jr(e,"defaultLabel");const s=e.jsonFormat||t.jsonFormat;return jr(e,"jsonFormat"),s&&(a=s(e,o))!==null&&a!==void 0?a:e});var pc={};Object.defineProperty(pc,"__esModule",{value:!0}),pc.WinstonLogger=void 0;const fP=(0,cs.createLogger)().constructor;class dP extends fP{constructor(t){super(t)}}pc.WinstonLogger=dP;var gc={},ja={};Object.defineProperty(ja,"__esModule",{value:!0}),ja.MidwayContextLogger=void 0;class hP{constructor(t,r,n={}){this.ctx=t,this.appLogger=r,this.options=n,"getParentLogger"in this.appLogger&&(this.appLogger=this.appLogger.getParentLogger())}log(...t){["debug","info","warn","error"].includes(t[0])||t.unshift("info"),this.transformLog("log",t)}debug(...t){this.transformLog("debug",t)}info(...t){this.transformLog("info",t)}warn(...t){this.transformLog("warn",t)}error(...t){this.transformLog("error",t)}getContext(){return this.ctx}transformLog(t,r){return this.appLogger[t].apply(this.appLogger,[...r,{label:this.formatContextLabel(),ctx:this.ctx,format:this.options.contextFormat,jsonFormat:this.options.jsonFormat}])}formatContextLabel(){return""}}ja.MidwayContextLogger=hP,Object.defineProperty(gc,"__esModule",{value:!0}),gc.MidwayChildLogger=void 0;const pP=ja;class gP{constructor(t,r){this.parentLogger=t,this.options=r}getConsoleLevel(){return this.parentLogger.getConsoleLevel()}getFileLevel(){return this.parentLogger.getFileLevel()}write(...t){return this.parentLogger.write(...t)}debug(...t){this.transformLog("debug",t)}info(...t){this.transformLog("info",t)}warn(...t){this.transformLog("warn",t)}error(...t){this.transformLog("error",t)}getParentLogger(){return this.parentLogger}getLoggerOptions(){return this.options}createContextLogger(t,r={}){return new pP.MidwayContextLogger(t,this,{...this.getLoggerOptions(),...r})}transformLog(t,r){return this.parentLogger[t].apply(this.parentLogger,[...r,{format:this.options.format,jsonFormat:this.options.jsonFormat}])}}gc.MidwayChildLogger=gP,Object.defineProperty(qn,"__esModule",{value:!0}),qn.MidwayBaseLogger=qn.isPlainObject=void 0;const _n=cs,Rh=fc,yP=Jn,Ih=bn,yc=_e,ei=_e,nb=_e,ib=Fi,vP=pc,Ir=Er,mP=gc,EP=ja,bP=yc.platform()==="win32";function ab(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}qn.isPlainObject=ab;const _P={none:0,error:1,trace:2,warn:3,info:4,verbose:5,debug:6,silly:7,all:8};function Oh(...e){for(let t=0;t<=e.length;t++)if(e[t]!==void 0)return e[t];return null}class SP extends vP.WinstonLogger{constructor(t={}){var r;super(Object.assign(t,{levels:_P})),this.defaultMetadata={},this.customInfoHandler=n=>n,this.defaultPrintFormat=n=>`${n.timestamp} ${n.LEVEL} ${n.pid} ${n.labelText}${n.message}`,bP&&(t.disableErrorSymlink=!0,t.disableFileSymlink=!0),this.loggerOptions=t,this.loggerOptions.defaultLabel&&(this.defaultLabel=this.loggerOptions.defaultLabel),this.loggerOptions.defaultMeta&&(this.defaultMetadata=this.loggerOptions.defaultMeta),this.configure({format:this.getDefaultFormat(),exitOnError:!1}),t.enableConsole!==!1&&t.disableConsole!==!0&&this.enableConsole(),t.dir=t.dir||process.cwd(),t.auditFileDir&&!(0,ei.isAbsolute)(t.auditFileDir)&&(t.auditFileDir=(0,ei.join)(t.dir,t.auditFileDir)),t.enableFile!==!1&&t.disableFile!==!0&&((0,Ir.assertEmptyAndThrow)(t.fileLogName,"[logger]: Please set fileLogName when enable file log"),(0,ei.isAbsolute)(t.fileLogName)&&(t.dir=(0,ei.dirname)(t.fileLogName),t.fileLogName=(0,ei.basename)(t.fileLogName)),this.enableFile()),t.enableError!==!1&&t.disableError!==!0&&(t.errorLogName=t.errorLogName||"common-error.log",(0,ei.isAbsolute)(t.errorLogName)&&(t.errorDir=(0,ei.dirname)(t.errorLogName),t.errorLogName=(0,ei.basename)(t.errorLogName)),this.enableError()),t.enableJSON===!0&&(t.jsonLogName=(r=t.jsonLogName)!==null&&r!==void 0?r:(0,Ir.formatJsonLogName)(t.fileLogName),(0,Ir.assertEmptyAndThrow)(t.jsonLogName,"[logger]: Please set jsonLogName when enable output json"),this.enableJSON()),this.add(new yP.EmptyTransport)}log(t,...r){const n=[...r];let i,a;r.length>1&&ab(r[r.length-1])?i=r.pop():i={};const o=r.pop();return o instanceof Error?(a=nb.format(...r,o),i[ib.ORIGIN_ERROR]=o):a=nb.format(...r,o),i[ib.ORIGIN_ARGS]=n,super.log(t,a,i)}disableConsole(){this.remove(this.consoleTransport)}enableConsole(){this.consoleTransport||(this.consoleTransport=new _n.transports.Console({level:(0,Ir.formatLevel)(this.loggerOptions.consoleLevel||this.loggerOptions.level||"silly"),format:process.env.MIDWAY_LOGGER_DISABLE_COLORS!=="true"?_n.format.combine(this.getDefaultPrint(),_n.format.colorize({all:!0,colors:{none:"reset",error:"red",trace:"reset",warn:"yellow",info:"reset",verbose:"reset",debug:"blue",silly:"reset",all:"reset"}})):this.getDefaultPrint()})),this.add(this.consoleTransport)}disableFile(){this.remove(this.fileTransport)}enableFile(){this.fileTransport||(this.fileTransport=new Rh.DailyRotateFileTransport({dirname:this.loggerOptions.dir,filename:this.loggerOptions.fileLogName,datePattern:this.loggerOptions.fileDatePattern||this.loggerOptions.datePattern||"YYYY-MM-DD",level:(0,Ir.formatLevel)(this.loggerOptions.fileLevel||this.loggerOptions.level||"silly"),createSymlink:(0,Ir.assertConditionTruthy)(this.loggerOptions.disableFileSymlink,this.loggerOptions.disableSymlink),symlinkName:this.loggerOptions.fileLogName,maxSize:Oh(this.loggerOptions.fileMaxSize,this.loggerOptions.maxSize,"200m"),maxFiles:this.loggerOptions.fileMaxFiles||this.loggerOptions.maxFiles||"31d",eol:this.loggerOptions.eol||yc.EOL,zippedArchive:this.loggerOptions.fileZippedArchive||this.loggerOptions.zippedArchive,format:this.getDefaultPrint(),auditFileDir:this.loggerOptions.auditFileDir})),this.add(this.fileTransport)}disableError(){this.remove(this.errTransport)}enableError(){this.errTransport||(this.errTransport=new Rh.DailyRotateFileTransport({dirname:this.loggerOptions.errorDir||this.loggerOptions.dir,filename:this.loggerOptions.errorLogName,datePattern:this.loggerOptions.errDatePattern||this.loggerOptions.datePattern||"YYYY-MM-DD",level:"error",createSymlink:(0,Ir.assertConditionTruthy)(this.loggerOptions.disableErrorSymlink,this.loggerOptions.disableSymlink),symlinkName:this.loggerOptions.errorLogName,maxSize:Oh(this.loggerOptions.errMaxSize,this.loggerOptions.maxSize,"200m"),maxFiles:this.loggerOptions.errMaxFiles||this.loggerOptions.maxFiles||"31d",eol:this.loggerOptions.eol||yc.EOL,zippedArchive:this.loggerOptions.errZippedArchive||this.loggerOptions.zippedArchive,format:this.getDefaultPrint(),auditFileDir:this.loggerOptions.auditFileDir})),this.add(this.errTransport)}enableJSON(){this.jsonTransport||(this.jsonTransport=new Rh.DailyRotateFileTransport({format:_n.format.combine((0,Ih.customJSON)({jsonFormat:this.loggerOptions.jsonFormat}),_n.format.json()),dirname:this.loggerOptions.jsonDir||this.loggerOptions.dir,filename:this.loggerOptions.jsonLogName,datePattern:this.loggerOptions.jsonDatePattern||this.loggerOptions.datePattern||"YYYY-MM-DD",level:(0,Ir.formatLevel)(this.loggerOptions.jsonLevel||this.loggerOptions.level||"silly"),createSymlink:(0,Ir.assertConditionTruthy)(this.loggerOptions.disableJSONSymlink,this.loggerOptions.disableSymlink),symlinkName:this.loggerOptions.jsonLogName,maxSize:Oh(this.loggerOptions.jsonMaxSize,this.loggerOptions.maxSize,"200m"),maxFiles:this.loggerOptions.jsonMaxFiles||this.loggerOptions.maxFiles||"31d",eol:this.loggerOptions.jsonEol||yc.EOL,zippedArchive:this.loggerOptions.jsonZippedArchive||this.loggerOptions.zippedArchive,auditFileDir:this.loggerOptions.auditFileDir})),this.add(this.jsonTransport)}isEnableFile(){return!!this.fileTransport}isEnableConsole(){return!!this.consoleTransport}isEnableError(){return!!this.errTransport}getConsoleLevel(){return this.consoleTransport.level}getFileLevel(){return this.fileTransport.level}updateLevel(t){this.level=(0,Ir.formatLevel)(t),this.consoleTransport.level=t,this.fileTransport.level=t}updateFileLevel(t){this.fileTransport.level=(0,Ir.formatLevel)(t)}updateConsoleLevel(t){this.consoleTransport.level=(0,Ir.formatLevel)(t)}updateDefaultLabel(t){this.defaultLabel=t}updateDefaultMeta(t){this.defaultMetadata=t}updateTransformableInfo(t){this.customInfoHandler=t}getDefaultFormat(){return _n.format.combine(_n.format.timestamp({format:"YYYY-MM-DD HH:mm:ss,SSS"}),_n.format.splat(),(0,Ih.displayCommonMessage)({target:this}),(0,Ih.displayLabels)())}getDefaultPrint(){return _n.format.printf(t=>{if(t.ignoreFormat)return t.message;const r=this.customInfoHandler(t);return(r.format||this.loggerOptions.format||this.loggerOptions.printFormat||this.defaultPrintFormat)(r||t)})}getDefaultLabel(){return this.defaultLabel}getDefaultMeta(){return this.defaultMetadata}write(...t){return t.length===1&&typeof t[0]!="object"||!t[0].level?super.log.apply(this,["trace",...t,{ignoreFormat:!0}]):super.write.apply(this,t)}add(t){return super.add(t)}remove(t){return super.remove(t)}close(){return super.close()}debug(...t){this.log("debug",...t)}info(...t){this.log("info",...t)}warn(...t){this.log("warn",...t)}error(...t){this.log("error",...t)}verbose(...t){this.log("verbose",...t)}silly(...t){this.log("silly",...t)}getLoggerOptions(){return this.loggerOptions}createChildLogger(t={}){return new mP.MidwayChildLogger(this,{...this.getLoggerOptions(),...t})}createContextLogger(t,r={}){return new EP.MidwayContextLogger(t,this,{...this.getLoggerOptions(),...r})}}qn.MidwayBaseLogger=SP,Object.defineProperty(us,"__esModule",{value:!0}),us.MidwayLoggerContainer=void 0;const CP=qn,wP=_e.debuglog("midway:debug"),ob={disableConsole:["isEnableConsole","enableConsole"],disableFile:["isEnableFile","enableFile"],disableError:["isEnableError","enableError"],updateLevel:["getLevel","updateLevel"],updateConsoleLevel:["getConsoleLevel","updateConsoleLevel"],updateFileLevel:["getFileLevel","updateFileLevel"]};class TP extends Map{constructor(t={}){super(),this.loggerOriginData={},this.containerLoggerData={},this.aliasMap=new Map,this.containerOptions=t}createLogger(t,r){if(!this.has(t)){wP('[logger]: Create logger "%s" with options %j',t,r);const n=new CP.MidwayBaseLogger(Object.assign(r,this.containerOptions));return r.aliasName&&this.aliasMap.set(r.aliasName,t),this.syncOriginStatus(t,n),this.addLogger(t,n),this.set(t,n),n}return this.getLogger(t)}addLogger(t,r,n=!0){if(!n||!this.has(t))this.get(t)!==r&&(r.on&&(this.syncOriginStatus(t,r),r.on("close",()=>this.delete(t))),this.set(t,r));else throw new Error(`logger id ${t} has duplicate`);return this.get(t)}getLogger(t){return this.get(t)}removeLogger(t){const r=this.get(t);r==null||r.close(),this.delete(t),delete this.loggerOriginData[t]}get(t){var r;return super.get((r=this.aliasMap.get(t))!==null&&r!==void 0?r:t)}close(t){if(t)return this.removeLogger(t);Array.from(this.keys()).forEach(r=>this.removeLogger(r))}updateContainerOption(t){this.containerOptions=Object.assign(this.containerOptions,t)}reset(){this.close(),this.containerOptions={},this.loggerOriginData={}}setLoggerOriginData(t,r,n,i){!r||(this.loggerOriginData[t]=this.loggerOriginData[t]||{},r[n]&&(this.loggerOriginData[t][n]=r[ob[n][0]].call(r),r[n].call(r,i)))}syncOriginStatus(t,r){Object.keys(this.containerLoggerData).forEach(n=>{this.setLoggerOriginData(t,r,n,this.containerLoggerData[n])})}disableConsole(){this.containerLoggerData.disableConsole=!0,Array.from(this.keys()).forEach(t=>{const r=this.get(t);this.setLoggerOriginData(t,r,"disableConsole")})}disableFile(){this.containerLoggerData.disableFile=!0,Array.from(this.keys()).forEach(t=>{const r=this.get(t);this.setLoggerOriginData(t,r,"disableFile")})}disableError(){this.containerLoggerData.disableError=!0,Array.from(this.keys()).forEach(t=>{const r=this.get(t);this.setLoggerOriginData(t,r,"disableError")})}updateLevel(t){this.containerLoggerData.updateLevel=t,Array.from(this.keys()).forEach(r=>{const n=this.get(r);this.setLoggerOriginData(r,n,"updateLevel",t)})}updateConsoleLevel(t){this.containerLoggerData.updateConsoleLevel=t,Array.from(this.keys()).forEach(r=>{const n=this.get(r);this.setLoggerOriginData(r,n,"updateConsoleLevel",t)})}updateFileLevel(t){this.containerLoggerData.updateFileLevel=t,Array.from(this.keys()).forEach(r=>{const n=this.get(r);this.setLoggerOriginData(r,n,"updateFileLevel",t)})}restore(){Array.from(Object.keys(this.loggerOriginData)).forEach(t=>{const r=this.get(t);for(const n in this.loggerOriginData[t])this.loggerOriginData[t][n]&&r[ob[n][1]].call(r,this.loggerOriginData[t][n])}),this.loggerOriginData={},this.containerLoggerData={}}}us.MidwayLoggerContainer=TP;var sb={};Object.defineProperty(sb,"__esModule",{value:!0});var vc={};Object.defineProperty(vc,"__esModule",{value:!0}),vc.MidwayDelegateLogger=void 0;const AP=qn,xP=Jn;class RP extends AP.MidwayBaseLogger{constructor(t){super({disableConsole:!0,disableFile:!0,disableError:!0}),this.add(new xP.DelegateTransport({delegateLogger:t.delegateLogger}))}}vc.MidwayDelegateLogger=RP,function(e){var t=me&&me.__createBinding||(Object.create?function(h,v,p,y){y===void 0&&(y=p);var w=Object.getOwnPropertyDescriptor(v,p);(!w||("get"in w?!v.__esModule:w.writable||w.configurable))&&(w={enumerable:!0,get:function(){return v[p]}}),Object.defineProperty(h,y,w)}:function(h,v,p,y){y===void 0&&(y=p),h[y]=v[p]}),r=me&&me.__exportStar||function(h,v){for(var p in h)p!=="default"&&!Object.prototype.hasOwnProperty.call(v,p)&&t(v,h,p)};Object.defineProperty(e,"__esModule",{value:!0}),e.clearAllLoggers=e.createFileLogger=e.createConsoleLogger=e.createLogger=e.loggers=e.MidwayLoggerContainer=e.MidwayContextLogger=e.MidwayDelegateLogger=e.MidwayBaseLogger=e.displayLabels=e.displayCommonMessage=e.transports=e.format=void 0;const n=us;var i=cs;Object.defineProperty(e,"format",{enumerable:!0,get:function(){return i.format}}),Object.defineProperty(e,"transports",{enumerable:!0,get:function(){return i.transports}});var a=bn;Object.defineProperty(e,"displayCommonMessage",{enumerable:!0,get:function(){return a.displayCommonMessage}}),Object.defineProperty(e,"displayLabels",{enumerable:!0,get:function(){return a.displayLabels}}),r(sb,e),r(Jn,e);var o=qn;Object.defineProperty(e,"MidwayBaseLogger",{enumerable:!0,get:function(){return o.MidwayBaseLogger}});var s=vc;Object.defineProperty(e,"MidwayDelegateLogger",{enumerable:!0,get:function(){return s.MidwayDelegateLogger}});var u=ja;Object.defineProperty(e,"MidwayContextLogger",{enumerable:!0,get:function(){return u.MidwayContextLogger}});var c=us;Object.defineProperty(e,"MidwayLoggerContainer",{enumerable:!0,get:function(){return c.MidwayLoggerContainer}}),e.loggers=new n.MidwayLoggerContainer;const l=(h,v={})=>e.loggers.createLogger(h,v);e.createLogger=l;const f=(h,v={})=>e.loggers.createLogger(h,Object.assign(v,{disableError:!0,disableFile:!0}));e.createConsoleLogger=f;const d=(h,v={})=>e.loggers.createLogger(h,Object.assign(v,{disableConsole:!0,disableError:!0}));e.createFileLogger=d;const g=()=>{e.loggers.reset()};e.clearAllLoggers=g}(ym);var Mh=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},_s=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(Oa,"__esModule",{value:!0}),Oa.MidwayLoggerService=void 0;const mc=Pe(),IP=yn,OP=ss,MP=Ke,LP=ym;let Ss=class extends OP.ServiceFactory{constructor(t,r={}){super(),this.applicationContext=t,this.globalOptions=r,this.lazyLoggerConfigMap=new Map}init(){var t;this.loggerFactory=this.globalOptions.loggerFactory||LP.loggers,this.initClients(this.configService.getConfiguration("midwayLogger")),(t=this.applicationContext)===null||t===void 0||t.registerObject("logger",this.getLogger("appLogger"))}createClient(t,r){t.lazyLoad?(delete t.lazyLoad,this.lazyLoggerConfigMap.set(r,t)):this.loggerFactory.createLogger(r,t)}getName(){return"logger"}createLogger(t,r){return this.loggerFactory.createLogger(t,r)}getLogger(t){const r=this.loggerFactory.getLogger(t);return r||(this.lazyLoggerConfigMap.has(t)&&(this.createClient(this.lazyLoggerConfigMap.get(t),t),this.lazyLoggerConfigMap.delete(t)),this.loggerFactory.getLogger(t))}getCurrentLoggerFactory(){return this.loggerFactory}};Mh([(0,mc.Inject)(),_s("design:type",IP.MidwayConfigService)],Ss.prototype,"configService",void 0),Mh([(0,mc.Init)(),_s("design:type",Function),_s("design:paramtypes",[]),_s("design:returntype",void 0)],Ss.prototype,"init",null),Ss=Mh([(0,mc.Provide)(),(0,mc.Scope)(MP.ScopeEnum.Singleton),_s("design:paramtypes",[Object,Object])],Ss),Oa.MidwayLoggerService=Ss;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.ContextMiddlewareManager=void 0;class PP extends Array{insertFirst(t){Array.isArray(t)?this.unshift(...t):this.unshift(t)}insertLast(t){Array.isArray(t)?this.push(...t):this.push(t)}insertBefore(t,r){typeof r!="number"&&(r=this.findItemIndex(r)),Array.isArray(t)?this.splice(r,0,...t):this.splice(r,0,t)}insertAfter(t,r){typeof r!="number"&&(r=this.findItemIndex(r)),Array.isArray(t)?this.splice(r+1,0,...t):this.splice(r+1,0,t)}findAndInsertAfter(t,r){if(t=this.findItem(t),r=this.findItem(r),!(!t||!r||t===r)&&r){const n=this.remove(t);n&&this.insertAfter(n,r)}}findAndInsertBefore(t,r){if(t=this.findItem(t),r=this.findItem(r),!(!t||!r||t===r)&&r){const n=this.remove(t);n&&this.insertBefore(n,r)}}findAndInsertFirst(t){const r=this.remove(t);r&&this.insertFirst(r)}findAndInsertLast(t){const r=this.remove(t);r&&this.insertLast(r)}findItemIndex(t){return typeof t=="number"?t:typeof t=="string"?this.findIndex(r=>this.getMiddlewareName(r)===t):this.findIndex(r=>r===t)}findItem(t){if(typeof t=="number"){if(t>=0&&t<=this.length-1)return this[t]}else return typeof t=="string"?this.find(r=>this.getMiddlewareName(r)===t):t}getMiddlewareName(t){var r,n;return(n=(r=t.getName&&t.getName())!==null&&r!==void 0?r:t._name)!==null&&n!==void 0?n:t.name}remove(t){if(typeof t=="number"&&t!==-1)return this.splice(t,1)[0];{const r=this.findItemIndex(t);if(r!==-1)return this.splice(r,1)[0]}}push(...t){return t.forEach(r=>{typeof r!="string"&&!this.getMiddlewareName(r)&&(r._name="anonymous")}),super.push(...t)}unshift(...t){return t.forEach(r=>{typeof r!="string"&&!this.getMiddlewareName(r)&&(r._name="anonymous")}),super.unshift(...t)}getNames(){return this.map(t=>this.getMiddlewareName(t))}}Cs.ContextMiddlewareManager=PP;var Ka={},NP=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},BP=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.MidwayMiddlewareService=void 0;const ub=Pe(),DP=Ke,Ec=Gt,cb=zt.exports,FP=Ne,bc=(0,_e.debuglog)("midway:debug");let Lh=class{constructor(t){this.applicationContext=t}async compose(t,r,n){if(!Array.isArray(t))throw new Ec.MidwayParameterError("Middleware stack must be an array");const i=[];for(let o of t)if(FP.Types.isClass(o)||typeof o=="string"){if(typeof o=="string"&&!this.applicationContext.hasDefinition(o))throw new Ec.MidwayCommonError(`Middleware definition of "${o}" not found in midway container`);const s=await this.applicationContext.getAsync(o);if(s){if(o=await s.resolve(r),!o)continue;if(!s.match&&!s.ignore)o.name||(o._name=s.constructor.name),i.push(o);else{const u=o,c=(0,cb.pathMatching)({match:s.match,ignore:s.ignore,thisResolver:s});o=(l,f,d)=>c(l)?u(l,f,d):f(),o._name=s.constructor.name,i.push(o)}}else throw new Ec.MidwayCommonError("Middleware must have resolve method!")}else i.push(o);const a=(o,s)=>{const u=(0,cb.isIncludeProperty)(o,"body");let c=-1;return l(0);function l(f){if(f<=c)return Promise.reject(new Ec.MidwayCommonError("next() called multiple times"));c=f;let d=i[f];if(f===i.length&&(d=s),!d)return Promise.resolve();const g=`${n?`${n}.`:""}${c} ${d._name||d.name||"anonymous"}`,h=Date.now();bc(`[middleware]: in ${g} +0`);try{return u?Promise.resolve(d(o,l.bind(null,f+1),{index:c})).then(v=>(v!==void 0?o.body=v:o.body!==void 0&&(v=o.body),bc(`[middleware]: out ${g} +${Date.now()-h} with body`),v)):Promise.resolve(d(o,l.bind(null,f+1),{index:c})).then(v=>(bc(`[middleware]: out ${g} +${Date.now()-h}`),v))}catch(v){return bc(`[middleware]: out ${g} +${Date.now()-h} with err ${v.message}`),Promise.reject(v)}}};return n&&(a._name=n),a}};Lh=NP([(0,ub.Provide)(),(0,ub.Scope)(DP.ScopeEnum.Singleton),BP("design:paramtypes",[Object])],Lh),Ka.MidwayMiddlewareService=Lh;var ws={};Object.defineProperty(ws,"__esModule",{value:!0}),ws.FilterManager=void 0;const ti=Pe(),kP=zt.exports;class UP{constructor(){this.errFilterList=[],this.successFilterList=[],this.exceptionMap=new WeakMap,this.defaultErrFilter=void 0,this.matchFnList=[],this.protoMatchList=[]}useFilter(t){Array.isArray(t)||(t=[t]);for(const r of t)(0,ti.getClassMetadata)(ti.CATCH_KEY,r)&&this.errFilterList.push(r),(0,ti.getClassMetadata)(ti.MATCH_KEY,r)&&this.successFilterList.push(r)}async init(t){for(const r of this.errFilterList){const n=await t.getAsync(r),i=(0,ti.getClassMetadata)(ti.CATCH_KEY,r);if(i&&i.catchTargets){i.catchOptions=i.catchOptions||{};for(const a of i.catchTargets)this.exceptionMap.set(a,{filter:n,catchOptions:i.catchOptions}),i.catchOptions.matchPrototype&&this.protoMatchList.push(o=>o instanceof a?a:!1)}else this.defaultErrFilter=n}for(const r of this.successFilterList){const n=await t.getAsync(r),i=(0,ti.getClassMetadata)(ti.MATCH_KEY,r);i&&i.matchPattern&&this.matchFnList.push({matchFn:(0,kP.toPathMatch)(i.matchPattern),target:n})}}async runErrorFilter(t,r,n,i){let a,o,s=!1;if(this.exceptionMap.has(t.constructor)&&(s=!0,a=await this.exceptionMap.get(t.constructor).filter.catch(t,r,n,i)),!s&&this.protoMatchList.length){let u;for(const c of this.protoMatchList)if(u=c(t),u)break;u&&(s=!0,a=await this.exceptionMap.get(u).filter.catch(t,r,n,i))}return!s&&this.defaultErrFilter&&(s=!0,a=await this.defaultErrFilter.catch(t,r,n,i)),s||(o=t),{result:a,error:o}}async runResultFilter(t,r,n,i){let a=t;for(const o of this.matchFnList)o.matchFn(r,n)&&(a=await o.target.match(a,r,n,i));return{result:a,error:void 0}}}ws.FilterManager=UP;var qa={},Ph=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},ki=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Va;Object.defineProperty(qa,"__esModule",{value:!0}),qa.MidwayMockService=void 0;const $P=Ke,Ga=Pe();let Ha=Va=class{constructor(t){this.applicationContext=t,this.mocks=[],this.contextMocks=[],this.cache=new Map,this.simulatorList=[]}async init(){if(Va.prepareMocks.length>0){for(const t of Va.prepareMocks)this.mockProperty(t.obj,t.key,t.value);Va.prepareMocks=[]}}static mockClassProperty(t,r,n){this.mockProperty(t.prototype,r,n)}static mockProperty(t,r,n){this.prepareMocks.push({obj:t,key:r,value:n})}mockClassProperty(t,r,n){return this.mockProperty(t.prototype,r,n)}mockProperty(t,r,n){const i=t.hasOwnProperty(r);this.mocks.push({obj:t,key:r,descriptor:Object.getOwnPropertyDescriptor(t,r),hasOwnProperty:i}),i&&delete t[r];let a=this.cache.get(t);a||(a=new Set,this.cache.set(t,a)),a.add(r);const o=this.overridePropertyDescriptor(n);Object.defineProperty(t,r,o)}mockContext(t,r,n){this.contextMocks.push({app:t,key:r,value:n})}restore(){for(let t=this.mocks.length-1;t>=0;t--){const r=this.mocks[t];r.hasOwnProperty?Object.defineProperty(r.obj,r.key,r.descriptor):delete r.obj[r.key]}this.mocks=[],this.contextMocks=[],this.cache.clear(),this.simulatorList=[],Va.prepareMocks=[]}isMocked(t,r){const n=this.cache.get(t);return n?n.has(r):!1}applyContextMocks(t,r){if(this.contextMocks.length>0){for(const n of this.contextMocks)if(n.app===t){const i=this.overridePropertyDescriptor(n.value);typeof n.key=="string"?Object.defineProperty(r,n.key,i):n.key(r)}}}getContextMocksSize(){return this.contextMocks.length}overridePropertyDescriptor(t){const r={configurable:!0,enumerable:!0};return t&&(t.get||t.set)?(r.get=t.get,r.set=t.set):(r.value=t,r.writable=!0),r}async initSimulation(){const t=(0,Ga.listModule)(Ga.MOCK_KEY);for(const r of t){const n=await this.applicationContext.getAsync(r);await n.enableCondition()&&this.simulatorList.push(n)}}async runSimulatorSetup(){var t;for(const r of this.simulatorList)await((t=r.setup)===null||t===void 0?void 0:t.call(r))}async runSimulatorTearDown(){var t;for(let r=this.simulatorList.length-1;r>=0;r--){const n=this.simulatorList[r];await((t=n.tearDown)===null||t===void 0?void 0:t.call(n))}}async runSimulatorAppSetup(t){var r;for(const n of this.simulatorList)await((r=n.appSetup)===null||r===void 0?void 0:r.call(n,t))}async runSimulatorAppTearDown(t){var r;for(let n=this.simulatorList.length-1;n>=0;n--){const i=this.simulatorList[n];await((r=i.appTearDown)===null||r===void 0?void 0:r.call(i,t))}}async runSimulatorContextSetup(t,r){var n;for(const i of this.simulatorList)await((n=i.contextSetup)===null||n===void 0?void 0:n.call(i,t,r))}async runSimulatorContextTearDown(t,r){var n;for(let i=this.simulatorList.length-1;i>=0;i--){const a=this.simulatorList[i];await((n=a==null?void 0:a.contextTearDown)===null||n===void 0?void 0:n.call(a,t,r))}}};Ha.prepareMocks=[],Ph([(0,Ga.Init)(),ki("design:type",Function),ki("design:paramtypes",[]),ki("design:returntype",Promise)],Ha.prototype,"init",null),Ph([(0,Ga.Destroy)(),ki("design:type",Function),ki("design:paramtypes",[]),ki("design:returntype",void 0)],Ha.prototype,"restore",null),Ha=Va=Ph([(0,Ga.Provide)(),(0,Ga.Scope)($P.ScopeEnum.Singleton),ki("design:paramtypes",[Object])],Ha),qa.MidwayMockService=Ha;var Nh={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NoopContextManager=e.ASYNC_ROOT_CONTEXT=void 0;class t{constructor(i){const a=this;a._currentContext=i?new Map(i):new Map,a.getValue=o=>a._currentContext.get(o),a.setValue=(o,s)=>{const u=new t(a._currentContext);return u._currentContext.set(o,s),u},a.deleteValue=o=>{const s=new t(a._currentContext);return s._currentContext.delete(o),s}}}e.ASYNC_ROOT_CONTEXT=new t;class r{active(){return e.ASYNC_ROOT_CONTEXT}with(i,a,o,...s){return a.call(o,...s)}bind(i,a){return a}enable(){return this}disable(){return this}}e.NoopContextManager=r})(Nh);var _c={};Object.defineProperty(_c,"__esModule",{value:!0}),_c.GuardManager=void 0;const Sc=Pe();class jP extends Array{addGlobalGuard(t){Array.isArray(t)?this.push(...t):this.push(t)}async runGuard(t,r,n){for(const o of this)if(!await(await t.requestContext.getAsync(o)).canActivate(t,r,n))return!1;const i=(0,Sc.getClassMetadata)(Sc.GUARD_KEY,r);if(i){for(const o of i)if(!await(await t.requestContext.getAsync(o)).canActivate(t,r,n))return!1}const a=(0,Sc.getPropertyMetadata)(Sc.GUARD_KEY,r,n);if(a){for(const o of a)if(!await(await t.requestContext.getAsync(o)).canActivate(t,r,n))return!1}return!0}}_c.GuardManager=jP;var ri=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Or=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(os,"__esModule",{value:!0}),os.BaseFramework=void 0;const KP=Ke,Ya=ze,ni=Pe(),qP=as,VP=Ii,GP=yn,HP=Ta,YP=Oa,WP=Cs,zP=Ka,QP=ws,XP=qa,JP=_e,Bh=Nh,ZP=_c,eN=JP.debuglog("midway:debug");class Sn{constructor(t){this.applicationContext=t,this.defaultContext={},this.middlewareManager=this.createMiddlewareManager(),this.filterManager=this.createFilterManager(),this.guardManager=this.createGuardManager(),this.composeMiddleware=null}async init(){var t,r;return this.configurationOptions=(t=this.configure())!==null&&t!==void 0?t:{},this.contextLoggerApplyLogger=(r=this.configurationOptions.contextLoggerApplyLogger)!==null&&r!==void 0?r:"appLogger",this.contextLoggerFormat=this.configurationOptions.contextLoggerFormat,this.logger=this.loggerService.getLogger("coreLogger"),this.appLogger=this.loggerService.getLogger("appLogger"),this}isEnable(){return!0}async initialize(t){this.bootstrapOptions=t,await this.beforeContainerInitialize(t),await this.containerInitialize(t),await this.afterContainerInitialize(t),await this.containerDirectoryLoad(t),await this.afterContainerDirectoryLoad(t),await this.applicationInitialize(t),await this.containerReady(t),await this.afterContainerReady(t),await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(t){}async containerDirectoryLoad(t){}async containerReady(t){this.app.getApplicationContext||this.defineApplicationProperties()}getApplicationContext(){return this.applicationContext}getConfiguration(t){return this.configService.getConfiguration(t)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(t,r){const n=this.getLogger(r!=null?r:this.contextLoggerApplyLogger);if(r){let i=t.getAttr(Ya.REQUEST_CTX_LOGGER_CACHE_KEY);if(i||(i=new Map,t.setAttr(Ya.REQUEST_CTX_LOGGER_CACHE_KEY,i)),r||(r="appLogger"),i.has(r))return i.get(r);const a=n.createContextLogger(t,{contextFormat:this.contextLoggerFormat});return i.set(r,a),a}else return t._logger||(t._logger=n.createContextLogger(t,{contextFormat:this.contextLoggerFormat})),t._logger}async stop(){await this.mockService.runSimulatorAppTearDown(this.app),await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(t={},r=[]){const n={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:i=>this.getConfiguration(i),getFrameworkType:()=>{if(this.getFrameworkType)return this.getFrameworkType()},getProcessType:()=>KP.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:i=>this.getLogger(i),createLogger:(i,a={})=>this.createLogger(i,a),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:i=>{const a=i||Object.create(this.defaultContext);return a.startTime||(a.startTime=Date.now()),a.logger||(a.logger=this.createContextLogger(a)),a.requestContext||(a.requestContext=new qP.MidwayRequestContainer(a,this.getApplicationContext()),a.requestContext.ready()),a.getLogger||(a.getLogger=o=>this.createContextLogger(a,o)),a.setAttr=(o,s)=>{a.requestContext.setAttr(o,s)},a.getAttr=o=>a.requestContext.getAttr(o),a},addConfigObject:i=>{this.configService.addObject(i)},setAttr:(i,a)=>{this.getApplicationContext().setAttr(i,a)},getAttr:i=>this.getApplicationContext().getAttr(i),useMiddleware:i=>this.useMiddleware(i),getMiddleware:()=>this.getMiddleware(),useFilter:i=>this.useFilter(i),useGuard:i=>this.useGuard(i),getNamespace:()=>this.getNamespace()};for(const i of r)delete n[i];Object.assign(this.app,n,t)}async beforeStop(){}async beforeContainerInitialize(t){}async afterContainerInitialize(t){}async afterContainerDirectoryLoad(t){}async afterContainerReady(t){}async applyMiddleware(t){var r;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(Ya.ASYNC_CONTEXT_MANAGER_KEY)){const n=this.configService.getConfiguration("asyncContextManager.enable")||!1,i=n?((r=this.bootstrapOptions)===null||r===void 0?void 0:r.asyncContextManager)||new Bh.NoopContextManager:new Bh.NoopContextManager;n&&i.enable(),this.applicationContext.registerObject(Ya.ASYNC_CONTEXT_MANAGER_KEY,i)}this.middlewareManager.insertFirst(async(n,i)=>{const a=Bh.ASYNC_ROOT_CONTEXT.setValue(Ya.ASYNC_CONTEXT_KEY,n);return await this.applicationContext.get(Ya.ASYNC_CONTEXT_MANAGER_KEY).with(a,async()=>{await this.mockService.runSimulatorContextSetup(n,this.app),this.mockService.applyContextMocks(this.app,n);let s;try{const u=await i();s=await this.filterManager.runResultFilter(u,n)}catch(u){s=await this.filterManager.runErrorFilter(u,n)}finally{await this.mockService.runSimulatorContextTearDown(n,this.app)}if(s.error)throw s.error;return s.result})}),eN(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`),this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app),await this.filterManager.init(this.applicationContext)}return t?(t=Array.isArray(t)?t:[t],await this.middlewareService.compose([this.composeMiddleware,...t],this.app)):this.composeMiddleware}getLogger(t){var r;return(r=this.loggerService.getLogger(t))!==null&&r!==void 0?r:this.appLogger}getCoreLogger(){return this.logger}createLogger(t,r={}){return this.loggerService.createLogger(t,r)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(t){this.middlewareManager.insertLast(t)}getMiddleware(){return this.middlewareManager}useFilter(t){return this.filterManager.useFilter(t)}useGuard(t){return this.guardManager.addGlobalGuard(t)}async runGuard(t,r,n){return this.guardManager.runGuard(t,r,n)}createMiddlewareManager(){return new WP.ContextMiddlewareManager}createFilterManager(){return new QP.FilterManager}createGuardManager(){return new ZP.GuardManager}setNamespace(t){this.namespace=t}getNamespace(){return this.namespace}}ri([(0,ni.Inject)(),Or("design:type",YP.MidwayLoggerService)],Sn.prototype,"loggerService",void 0),ri([(0,ni.Inject)(),Or("design:type",VP.MidwayEnvironmentService)],Sn.prototype,"environmentService",void 0),ri([(0,ni.Inject)(),Or("design:type",GP.MidwayConfigService)],Sn.prototype,"configService",void 0),ri([(0,ni.Inject)(),Or("design:type",HP.MidwayInformationService)],Sn.prototype,"informationService",void 0),ri([(0,ni.Inject)(),Or("design:type",zP.MidwayMiddlewareService)],Sn.prototype,"middlewareService",void 0),ri([(0,ni.Inject)(),Or("design:type",XP.MidwayMockService)],Sn.prototype,"mockService",void 0),ri([(0,ni.Init)(),Or("design:type",Function),Or("design:paramtypes",[]),Or("design:returntype",Promise)],Sn.prototype,"init",null),ri([(0,ni.Destroy)(),Or("design:type",Function),Or("design:paramtypes",[]),Or("design:returntype",Promise)],Sn.prototype,"stop",null),os.BaseFramework=Sn;var Cc={};Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.providerWrapper=void 0;const tN=ze;function rN(e){for(const t of e)Object.defineProperty(t.provider,tN.FUNCTION_INJECT_KEY,{value:t,writable:!1})}Cc.providerWrapper=rN;var Ts={},Ui={};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.MidwayPipelineService=Ui.PipelineContext=void 0;const nN=Pe();class wc{constructor(t){this.info={current:null,currentName:null},this.data=new Map,this.args=t}get(t){return this.data.get(t)}set(t,r){this.data.set(t,r)}keys(){const t=[],r=this.data.keys();for(const n of r)t.push(n);return t}}Ui.PipelineContext=wc;class iN{constructor(t,r){this.applicationContext=t,this.valves=r}async parallel(t){const r=this.prepareParallelValves(t),n=await Promise.all(r);return this.packResult(n,!1)}async concat(t){const r=this.prepareParallelValves(t),n=await Promise.all(r);return this.packResult(n,!0)}async series(t){const r=this.mergeValves(t.valves),n=new wc(t.args),i={success:!0,result:null},a={},o={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let s=1;for(const u of r){o.prev=o.current,o.prevName=Wa(o.prev),o.current=u,o.currentName=Wa(o.current),s<r.length?(o.next=r[s],o.nextName=Wa(o.next)):(o.next=void 0,o.nextName=void 0),s+=1,n.info=o;try{const c=await this.applicationContext.getAsync(u),l=await c.invoke(n);let f=u;c.alias&&(f=c.alias),a[f]=l,o.prevValue=l}catch(c){return i.success=!1,i.error={valveName:typeof u=="string"?u:u.name,message:c.message,error:c},i}}return i.result=a,i}async concatSeries(t){const r=this.mergeValves(t.valves),n=new wc(t.args),i={success:!0,result:null},a=[],o={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let s=1;for(const u of r){o.prev=o.current,o.prevName=Wa(o.prev),o.current=u,o.currentName=Wa(o.current),s<r.length?(o.next=r[s],o.nextName=Wa(o.next)):(o.next=void 0,o.nextName=void 0),s+=1,n.info=o;try{const l=await(await this.applicationContext.getAsync(u)).invoke(n);a.push(l),o.prevValue=l}catch(c){return i.success=!1,i.error={valveName:typeof u=="string"?u:u.name,message:c.message,error:c},i}}return i.result=a,i}async waterfall(t){const r=await this.concatSeries(t);if(r.success){const n=r.result;r.result=n[n.length-1]}return r}mergeValves(t){let r=[];this.valves&&this.valves.length>0&&(r=this.valves);let n=[];if(t)for(const i of t)r.includes(i)&&n.push(i);else n=r;return n}prepareParallelValves(t){const r=this.mergeValves(t.valves),n=new wc(t.args);return r.map(async i=>{const a={valveName:i,dataKey:i,data:null};try{const o=await this.applicationContext.getAsync(i);o.alias&&(a.dataKey=o.alias),a.data=await o.invoke(n)}catch(o){a.error=o}return a})}packResult(t,r=!1){const n={success:!0,result:null};let i;r?i=[]:i={};for(const a of t){if(a.error)return n.success=!1,n.error={valveName:typeof a.valveName=="string"?a.valveName:a.valveName.name,message:a.error.message,error:a.error},n;r?i.push(a.data):i[a.dataKey]=a.data}return n.result=i,n}}Ui.MidwayPipelineService=iN;function Wa(e){return e?typeof e=="string"?e:(0,nN.getProviderName)(e):null}var As={},za={},Dh={exports:{}},Tc={};const aN=_e,nn="\\\\/",lb=`[^${nn}]`,Cn="\\.",oN="\\+",sN="\\?",Ac="\\/",uN="(?=.)",fb="[^/]",Fh=`(?:${Ac}|$)`,db=`(?:^|${Ac})`,kh=`${Cn}{1,2}${Fh}`,cN=`(?!${Cn})`,lN=`(?!${db}${kh})`,fN=`(?!${Cn}{0,1}${Fh})`,dN=`(?!${kh})`,hN=`[^.${Ac}]`,pN=`${fb}*?`,hb={DOT_LITERAL:Cn,PLUS_LITERAL:oN,QMARK_LITERAL:sN,SLASH_LITERAL:Ac,ONE_CHAR:uN,QMARK:fb,END_ANCHOR:Fh,DOTS_SLASH:kh,NO_DOT:cN,NO_DOTS:lN,NO_DOT_SLASH:fN,NO_DOTS_SLASH:dN,QMARK_NO_DOT:hN,STAR:pN,START_ANCHOR:db},gN={...hb,SLASH_LITERAL:`[${nn}]`,QMARK:lb,STAR:`${lb}*?`,DOTS_SLASH:`${Cn}{1,2}(?:[${nn}]|$)`,NO_DOT:`(?!${Cn})`,NO_DOTS:`(?!(?:^|[${nn}])${Cn}{1,2}(?:[${nn}]|$))`,NO_DOT_SLASH:`(?!${Cn}{0,1}(?:[${nn}]|$))`,NO_DOTS_SLASH:`(?!${Cn}{1,2}(?:[${nn}]|$))`,QMARK_NO_DOT:`[^.${nn}]`,START_ANCHOR:`(?:^|[${nn}])`,END_ANCHOR:`(?:[${nn}]|$)`},yN={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};var xc={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:yN,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:aN.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?gN:hb}};(function(e){const t=_e,r=process.platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:i,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:o}=xc;e.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),e.hasRegexChars=s=>a.test(s),e.isRegexChar=s=>s.length===1&&e.hasRegexChars(s),e.escapeRegex=s=>s.replace(o,"\\$1"),e.toPosixSlashes=s=>s.replace(n,"/"),e.removeBackslashes=s=>s.replace(i,u=>u==="\\"?"":u),e.supportsLookbehinds=()=>{const s=process.version.slice(1).split(".").map(Number);return s.length===3&&s[0]>=9||s[0]===8&&s[1]>=10},e.isWindows=s=>s&&typeof s.windows=="boolean"?s.windows:r===!0||t.sep==="\\",e.escapeLast=(s,u,c)=>{const l=s.lastIndexOf(u,c);return l===-1?s:s[l-1]==="\\"?e.escapeLast(s,u,l-1):`${s.slice(0,l)}\\${s.slice(l)}`},e.removePrefix=(s,u={})=>{let c=s;return c.startsWith("./")&&(c=c.slice(2),u.prefix="./"),c},e.wrapOutput=(s,u={},c={})=>{const l=c.contains?"":"^",f=c.contains?"":"$";let d=`${l}(?:${s})${f}`;return u.negated===!0&&(d=`(?:^(?!${d}).*$)`),d}})(Tc);const pb=Tc,{CHAR_ASTERISK:Uh,CHAR_AT:vN,CHAR_BACKWARD_SLASH:xs,CHAR_COMMA:mN,CHAR_DOT:$h,CHAR_EXCLAMATION_MARK:jh,CHAR_FORWARD_SLASH:gb,CHAR_LEFT_CURLY_BRACE:Kh,CHAR_LEFT_PARENTHESES:qh,CHAR_LEFT_SQUARE_BRACKET:EN,CHAR_PLUS:bN,CHAR_QUESTION_MARK:yb,CHAR_RIGHT_CURLY_BRACE:_N,CHAR_RIGHT_PARENTHESES:vb,CHAR_RIGHT_SQUARE_BRACKET:SN}=xc,mb=e=>e===gb||e===xs,Eb=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};var CN=(e,t)=>{const r=t||{},n=e.length-1,i=r.parts===!0||r.scanToEnd===!0,a=[],o=[],s=[];let u=e,c=-1,l=0,f=0,d=!1,g=!1,h=!1,v=!1,p=!1,y=!1,w=!1,m=!1,S=!1,A=!1,I=0,N,T,M={value:"",depth:0,isGlob:!1};const P=()=>c>=n,L=()=>u.charCodeAt(c+1),B=()=>(N=T,u.charCodeAt(++c));for(;c<n;){T=B();let G;if(T===xs){w=M.backslashes=!0,T=B(),T===Kh&&(y=!0);continue}if(y===!0||T===Kh){for(I++;P()!==!0&&(T=B());){if(T===xs){w=M.backslashes=!0,B();continue}if(T===Kh){I++;continue}if(y!==!0&&T===$h&&(T=B())===$h){if(d=M.isBrace=!0,h=M.isGlob=!0,A=!0,i===!0)continue;break}if(y!==!0&&T===mN){if(d=M.isBrace=!0,h=M.isGlob=!0,A=!0,i===!0)continue;break}if(T===_N&&(I--,I===0)){y=!1,d=M.isBrace=!0,A=!0;break}}if(i===!0)continue;break}if(T===gb){if(a.push(c),o.push(M),M={value:"",depth:0,isGlob:!1},A===!0)continue;if(N===$h&&c===l+1){l+=2;continue}f=c+1;continue}if(r.noext!==!0&&(T===bN||T===vN||T===Uh||T===yb||T===jh)===!0&&L()===qh){if(h=M.isGlob=!0,v=M.isExtglob=!0,A=!0,T===jh&&c===l&&(S=!0),i===!0){for(;P()!==!0&&(T=B());){if(T===xs){w=M.backslashes=!0,T=B();continue}if(T===vb){h=M.isGlob=!0,A=!0;break}}continue}break}if(T===Uh){if(N===Uh&&(p=M.isGlobstar=!0),h=M.isGlob=!0,A=!0,i===!0)continue;break}if(T===yb){if(h=M.isGlob=!0,A=!0,i===!0)continue;break}if(T===EN){for(;P()!==!0&&(G=B());){if(G===xs){w=M.backslashes=!0,B();continue}if(G===SN){g=M.isBracket=!0,h=M.isGlob=!0,A=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&T===jh&&c===l){m=M.negated=!0,l++;continue}if(r.noparen!==!0&&T===qh){if(h=M.isGlob=!0,i===!0){for(;P()!==!0&&(T=B());){if(T===qh){w=M.backslashes=!0,T=B();continue}if(T===vb){A=!0;break}}continue}break}if(h===!0){if(A=!0,i===!0)continue;break}}r.noext===!0&&(v=!1,h=!1);let X=u,V="",k="";l>0&&(V=u.slice(0,l),u=u.slice(l),f-=l),X&&h===!0&&f>0?(X=u.slice(0,f),k=u.slice(f)):h===!0?(X="",k=u):X=u,X&&X!==""&&X!=="/"&&X!==u&&mb(X.charCodeAt(X.length-1))&&(X=X.slice(0,-1)),r.unescape===!0&&(k&&(k=pb.removeBackslashes(k)),X&&w===!0&&(X=pb.removeBackslashes(X)));const $={prefix:V,input:e,start:l,base:X,glob:k,isBrace:d,isBracket:g,isGlob:h,isExtglob:v,isGlobstar:p,negated:m,negatedExtglob:S};if(r.tokens===!0&&($.maxDepth=0,mb(T)||o.push(M),$.tokens=o),r.parts===!0||r.tokens===!0){let G;for(let oe=0;oe<a.length;oe++){const se=G?G+1:l,de=a[oe],le=e.slice(se,de);r.tokens&&(oe===0&&l!==0?(o[oe].isPrefix=!0,o[oe].value=V):o[oe].value=le,Eb(o[oe]),$.maxDepth+=o[oe].depth),(oe!==0||le!=="")&&s.push(le),G=de}if(G&&G+1<e.length){const oe=e.slice(G+1);s.push(oe),r.tokens&&(o[o.length-1].value=oe,Eb(o[o.length-1]),$.maxDepth+=o[o.length-1].depth)}$.slashes=a,$.parts=s}return $};const Rc=xc,br=Tc,{MAX_LENGTH:Ic,POSIX_REGEX_SOURCE:wN,REGEX_NON_SPECIAL_CHARS:TN,REGEX_SPECIAL_CHARS_BACKREF:AN,REPLACEMENTS:bb}=Rc,xN=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch{return e.map(i=>br.escapeRegex(i)).join("..")}return r},Qa=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,Vh=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=bb[e]||e;const r={...t},n=typeof r.maxLength=="number"?Math.min(Ic,r.maxLength):Ic;let i=e.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);const a={type:"bos",value:"",output:r.prepend||""},o=[a],s=r.capture?"":"?:",u=br.isWindows(t),c=Rc.globChars(u),l=Rc.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:d,SLASH_LITERAL:g,ONE_CHAR:h,DOTS_SLASH:v,NO_DOT:p,NO_DOT_SLASH:y,NO_DOTS_SLASH:w,QMARK:m,QMARK_NO_DOT:S,STAR:A,START_ANCHOR:I}=c,N=_=>`(${s}(?:(?!${I}${_.dot?v:f}).)*?)`,T=r.dot?"":p,M=r.dot?m:S;let P=r.bash===!0?N(r):A;r.capture&&(P=`(${P})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);const L={input:e,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};e=br.removePrefix(e,L),i=e.length;const B=[],X=[],V=[];let k=a,$;const G=()=>L.index===i-1,oe=L.peek=(_=1)=>e[L.index+_],se=L.advance=()=>e[++L.index]||"",de=()=>e.slice(L.index+1),le=(_="",x=0)=>{L.consumed+=_,L.index+=x},Ee=_=>{L.output+=_.output!=null?_.output:_.value,le(_.value)},pe=()=>{let _=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)se(),L.start++,_++;return _%2===0?!1:(L.negated=!0,L.start++,!0)},J=_=>{L[_]++,V.push(_)},ne=_=>{L[_]--,V.pop()},q=_=>{if(k.type==="globstar"){const x=L.braces>0&&(_.type==="comma"||_.type==="brace"),E=_.extglob===!0||B.length&&(_.type==="pipe"||_.type==="paren");_.type!=="slash"&&_.type!=="paren"&&!x&&!E&&(L.output=L.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=P,L.output+=k.output)}if(B.length&&_.type!=="paren"&&(B[B.length-1].inner+=_.value),(_.value||_.output)&&Ee(_),k&&k.type==="text"&&_.type==="text"){k.value+=_.value,k.output=(k.output||"")+_.value;return}_.prev=k,o.push(_),k=_},z=(_,x)=>{const E={...l[x],conditions:1,inner:""};E.prev=k,E.parens=L.parens,E.output=L.output;const R=(r.capture?"(":"")+E.open;J("parens"),q({type:_,value:x,output:L.output?"":h}),q({type:"paren",extglob:!0,value:se(),output:R}),B.push(E)},W=_=>{let x=_.close+(r.capture?")":""),E;if(_.type==="negate"){let R=P;if(_.inner&&_.inner.length>1&&_.inner.includes("/")&&(R=N(r)),(R!==P||G()||/^\)+$/.test(de()))&&(x=_.close=`)$))${R}`),_.inner.includes("*")&&(E=de())&&/^\.[^\\/.]+$/.test(E)){const K=Vh(E,{...t,fastpaths:!1}).output;x=_.close=`)${K})${R})`}_.prev.type==="bos"&&(L.negatedExtglob=!0)}q({type:"paren",extglob:!0,value:$,output:x}),ne("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let _=!1,x=e.replace(AN,(E,R,K,Q,he,Ce)=>Q==="\\"?(_=!0,E):Q==="?"?R?R+Q+(he?m.repeat(he.length):""):Ce===0?M+(he?m.repeat(he.length):""):m.repeat(K.length):Q==="."?f.repeat(K.length):Q==="*"?R?R+Q+(he?P:""):P:R?E:`\\${E}`);return _===!0&&(r.unescape===!0?x=x.replace(/\\/g,""):x=x.replace(/\\+/g,E=>E.length%2===0?"\\\\":E?"\\":"")),x===e&&r.contains===!0?(L.output=e,L):(L.output=br.wrapOutput(x,L,t),L)}for(;!G();){if($=se(),$==="\0")continue;if($==="\\"){const E=oe();if(E==="/"&&r.bash!==!0||E==="."||E===";")continue;if(!E){$+="\\",q({type:"text",value:$});continue}const R=/^\\+/.exec(de());let K=0;if(R&&R[0].length>2&&(K=R[0].length,L.index+=K,K%2!==0&&($+="\\")),r.unescape===!0?$=se():$+=se(),L.brackets===0){q({type:"text",value:$});continue}}if(L.brackets>0&&($!=="]"||k.value==="["||k.value==="[^")){if(r.posix!==!1&&$===":"){const E=k.value.slice(1);if(E.includes("[")&&(k.posix=!0,E.includes(":"))){const R=k.value.lastIndexOf("["),K=k.value.slice(0,R),Q=k.value.slice(R+2),he=wN[Q];if(he){k.value=K+he,L.backtrack=!0,se(),!a.output&&o.indexOf(k)===1&&(a.output=h);continue}}}($==="["&&oe()!==":"||$==="-"&&oe()==="]")&&($=`\\${$}`),$==="]"&&(k.value==="["||k.value==="[^")&&($=`\\${$}`),r.posix===!0&&$==="!"&&k.value==="["&&($="^"),k.value+=$,Ee({value:$});continue}if(L.quotes===1&&$!=='"'){$=br.escapeRegex($),k.value+=$,Ee({value:$});continue}if($==='"'){L.quotes=L.quotes===1?0:1,r.keepQuotes===!0&&q({type:"text",value:$});continue}if($==="("){J("parens"),q({type:"paren",value:$});continue}if($===")"){if(L.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Qa("opening","("));const E=B[B.length-1];if(E&&L.parens===E.parens+1){W(B.pop());continue}q({type:"paren",value:$,output:L.parens?")":"\\)"}),ne("parens");continue}if($==="["){if(r.nobracket===!0||!de().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Qa("closing","]"));$=`\\${$}`}else J("brackets");q({type:"bracket",value:$});continue}if($==="]"){if(r.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){q({type:"text",value:$,output:`\\${$}`});continue}if(L.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Qa("opening","["));q({type:"text",value:$,output:`\\${$}`});continue}ne("brackets");const E=k.value.slice(1);if(k.posix!==!0&&E[0]==="^"&&!E.includes("/")&&($=`/${$}`),k.value+=$,Ee({value:$}),r.literalBrackets===!1||br.hasRegexChars(E))continue;const R=br.escapeRegex(k.value);if(L.output=L.output.slice(0,-k.value.length),r.literalBrackets===!0){L.output+=R,k.value=R;continue}k.value=`(${s}${R}|${k.value})`,L.output+=k.value;continue}if($==="{"&&r.nobrace!==!0){J("braces");const E={type:"brace",value:$,output:"(",outputIndex:L.output.length,tokensIndex:L.tokens.length};X.push(E),q(E);continue}if($==="}"){const E=X[X.length-1];if(r.nobrace===!0||!E){q({type:"text",value:$,output:$});continue}let R=")";if(E.dots===!0){const K=o.slice(),Q=[];for(let he=K.length-1;he>=0&&(o.pop(),K[he].type!=="brace");he--)K[he].type!=="dots"&&Q.unshift(K[he].value);R=xN(Q,r),L.backtrack=!0}if(E.comma!==!0&&E.dots!==!0){const K=L.output.slice(0,E.outputIndex),Q=L.tokens.slice(E.tokensIndex);E.value=E.output="\\{",$=R="\\}",L.output=K;for(const he of Q)L.output+=he.output||he.value}q({type:"brace",value:$,output:R}),ne("braces"),X.pop();continue}if($==="|"){B.length>0&&B[B.length-1].conditions++,q({type:"text",value:$});continue}if($===","){let E=$;const R=X[X.length-1];R&&V[V.length-1]==="braces"&&(R.comma=!0,E="|"),q({type:"comma",value:$,output:E});continue}if($==="/"){if(k.type==="dot"&&L.index===L.start+1){L.start=L.index+1,L.consumed="",L.output="",o.pop(),k=a;continue}q({type:"slash",value:$,output:g});continue}if($==="."){if(L.braces>0&&k.type==="dot"){k.value==="."&&(k.output=f);const E=X[X.length-1];k.type="dots",k.output+=$,k.value+=$,E.dots=!0;continue}if(L.braces+L.parens===0&&k.type!=="bos"&&k.type!=="slash"){q({type:"text",value:$,output:f});continue}q({type:"dot",value:$,output:f});continue}if($==="?"){if(!(k&&k.value==="(")&&r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){z("qmark",$);continue}if(k&&k.type==="paren"){const R=oe();let K=$;if(R==="<"&&!br.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(R)||R==="<"&&!/<([!=]|\w+>)/.test(de()))&&(K=`\\${$}`),q({type:"text",value:$,output:K});continue}if(r.dot!==!0&&(k.type==="slash"||k.type==="bos")){q({type:"qmark",value:$,output:S});continue}q({type:"qmark",value:$,output:m});continue}if($==="!"){if(r.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){z("negate",$);continue}if(r.nonegate!==!0&&L.index===0){pe();continue}}if($==="+"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){z("plus",$);continue}if(k&&k.value==="("||r.regex===!1){q({type:"plus",value:$,output:d});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||L.parens>0){q({type:"plus",value:$});continue}q({type:"plus",value:d});continue}if($==="@"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){q({type:"at",extglob:!0,value:$,output:""});continue}q({type:"text",value:$});continue}if($!=="*"){($==="$"||$==="^")&&($=`\\${$}`);const E=TN.exec(de());E&&($+=E[0],L.index+=E[0].length),q({type:"text",value:$});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=$,k.output=P,L.backtrack=!0,L.globstar=!0,le($);continue}let _=de();if(r.noextglob!==!0&&/^\([^?]/.test(_)){z("star",$);continue}if(k.type==="star"){if(r.noglobstar===!0){le($);continue}const E=k.prev,R=E.prev,K=E.type==="slash"||E.type==="bos",Q=R&&(R.type==="star"||R.type==="globstar");if(r.bash===!0&&(!K||_[0]&&_[0]!=="/")){q({type:"star",value:$,output:""});continue}const he=L.braces>0&&(E.type==="comma"||E.type==="brace"),Ce=B.length&&(E.type==="pipe"||E.type==="paren");if(!K&&E.type!=="paren"&&!he&&!Ce){q({type:"star",value:$,output:""});continue}for(;_.slice(0,3)==="/**";){const Me=e[L.index+4];if(Me&&Me!=="/")break;_=_.slice(3),le("/**",3)}if(E.type==="bos"&&G()){k.type="globstar",k.value+=$,k.output=N(r),L.output=k.output,L.globstar=!0,le($);continue}if(E.type==="slash"&&E.prev.type!=="bos"&&!Q&&G()){L.output=L.output.slice(0,-(E.output+k.output).length),E.output=`(?:${E.output}`,k.type="globstar",k.output=N(r)+(r.strictSlashes?")":"|$)"),k.value+=$,L.globstar=!0,L.output+=E.output+k.output,le($);continue}if(E.type==="slash"&&E.prev.type!=="bos"&&_[0]==="/"){const Me=_[1]!==void 0?"|$":"";L.output=L.output.slice(0,-(E.output+k.output).length),E.output=`(?:${E.output}`,k.type="globstar",k.output=`${N(r)}${g}|${g}${Me})`,k.value+=$,L.output+=E.output+k.output,L.globstar=!0,le($+se()),q({type:"slash",value:"/",output:""});continue}if(E.type==="bos"&&_[0]==="/"){k.type="globstar",k.value+=$,k.output=`(?:^|${g}|${N(r)}${g})`,L.output=k.output,L.globstar=!0,le($+se()),q({type:"slash",value:"/",output:""});continue}L.output=L.output.slice(0,-k.output.length),k.type="globstar",k.output=N(r),k.value+=$,L.output+=k.output,L.globstar=!0,le($);continue}const x={type:"star",value:$,output:P};if(r.bash===!0){x.output=".*?",(k.type==="bos"||k.type==="slash")&&(x.output=T+x.output),q(x);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&r.regex===!0){x.output=$,q(x);continue}(L.index===L.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(L.output+=y,k.output+=y):r.dot===!0?(L.output+=w,k.output+=w):(L.output+=T,k.output+=T),oe()!=="*"&&(L.output+=h,k.output+=h)),q(x)}for(;L.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Qa("closing","]"));L.output=br.escapeLast(L.output,"["),ne("brackets")}for(;L.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Qa("closing",")"));L.output=br.escapeLast(L.output,"("),ne("parens")}for(;L.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Qa("closing","}"));L.output=br.escapeLast(L.output,"{"),ne("braces")}if(r.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&q({type:"maybe_slash",value:"",output:`${g}?`}),L.backtrack===!0){L.output="";for(const _ of L.tokens)L.output+=_.output!=null?_.output:_.value,_.suffix&&(L.output+=_.suffix)}return L};Vh.fastpaths=(e,t)=>{const r={...t},n=typeof r.maxLength=="number"?Math.min(Ic,r.maxLength):Ic,i=e.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);e=bb[e]||e;const a=br.isWindows(t),{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:f,NO_DOTS_SLASH:d,STAR:g,START_ANCHOR:h}=Rc.globChars(a),v=r.dot?f:l,p=r.dot?d:l,y=r.capture?"":"?:",w={negated:!1,prefix:""};let m=r.bash===!0?".*?":g;r.capture&&(m=`(${m})`);const S=T=>T.noglobstar===!0?m:`(${y}(?:(?!${h}${T.dot?c:o}).)*?)`,A=T=>{switch(T){case"*":return`${v}${u}${m}`;case".*":return`${o}${u}${m}`;case"*.*":return`${v}${m}${o}${u}${m}`;case"*/*":return`${v}${m}${s}${u}${p}${m}`;case"**":return v+S(r);case"**/*":return`(?:${v}${S(r)}${s})?${p}${u}${m}`;case"**/*.*":return`(?:${v}${S(r)}${s})?${p}${m}${o}${u}${m}`;case"**/.*":return`(?:${v}${S(r)}${s})?${o}${u}${m}`;default:{const M=/^(.*?)\.(\w+)$/.exec(T);if(!M)return;const P=A(M[1]);return P?P+o+M[2]:void 0}}},I=br.removePrefix(e,w);let N=A(I);return N&&r.strictSlashes!==!0&&(N+=`${s}?`),N};var RN=Vh;const IN=_e,ON=CN,Gh=RN,Hh=Tc,MN=xc,LN=e=>e&&typeof e=="object"&&!Array.isArray(e),bt=(e,t,r=!1)=>{if(Array.isArray(e)){const l=e.map(d=>bt(d,t,r));return d=>{for(const g of l){const h=g(d);if(h)return h}return!1}}const n=LN(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},a=Hh.isWindows(t),o=n?bt.compileRe(e,t):bt.makeRe(e,t,!1,!0),s=o.state;delete o.state;let u=()=>!1;if(i.ignore){const l={...t,ignore:null,onMatch:null,onResult:null};u=bt(i.ignore,l,r)}const c=(l,f=!1)=>{const{isMatch:d,match:g,output:h}=bt.test(l,o,t,{glob:e,posix:a}),v={glob:e,state:s,regex:o,posix:a,input:l,output:h,match:g,isMatch:d};return typeof i.onResult=="function"&&i.onResult(v),d===!1?(v.isMatch=!1,f?v:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(v),v.isMatch=!1,f?v:!1):(typeof i.onMatch=="function"&&i.onMatch(v),f?v:!0)};return r&&(c.state=s),c};bt.test=(e,t,r,{glob:n,posix:i}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};const a=r||{},o=a.format||(i?Hh.toPosixSlashes:null);let s=e===n,u=s&&o?o(e):e;return s===!1&&(u=o?o(e):e,s=u===n),(s===!1||a.capture===!0)&&(a.matchBase===!0||a.basename===!0?s=bt.matchBase(e,t,r,i):s=t.exec(u)),{isMatch:Boolean(s),match:s,output:u}},bt.matchBase=(e,t,r,n=Hh.isWindows(r))=>(t instanceof RegExp?t:bt.makeRe(t,r)).test(IN.basename(e)),bt.isMatch=(e,t,r)=>bt(t,r)(e),bt.parse=(e,t)=>Array.isArray(e)?e.map(r=>bt.parse(r,t)):Gh(e,{...t,fastpaths:!1}),bt.scan=(e,t)=>ON(e,t),bt.compileRe=(e,t,r=!1,n=!1)=>{if(r===!0)return e.output;const i=t||{},a=i.contains?"":"^",o=i.contains?"":"$";let s=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(s=`^(?!${s}).*$`);const u=bt.toRegex(s,t);return n===!0&&(u.state=e),u},bt.makeRe=(e,t={},r=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(i.output=Gh.fastpaths(e,t)),i.output||(i=Gh(e,t)),bt.compileRe(i,t,r,n)},bt.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(r){if(t&&t.debug===!0)throw r;return/$^/}},bt.constants=MN;var PN=bt;(function(e){e.exports=PN})(Dh);var NN=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},BN=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(za,"__esModule",{value:!0}),za.MidwayAspectService=void 0;const DN=Dh.exports,FN=Ke,Xa=Pe(),kN=Ne;let Yh=class{constructor(t){this.applicationContext=t}async loadAspect(){const t=(0,Xa.listModule)(Xa.ASPECT_KEY);let r=[];for(const n of t){const i=(0,Xa.getClassMetadata)(Xa.ASPECT_KEY,n);r=r.concat(i.map(a=>(a.aspectModule=n,a)))}r.sort((n,i)=>(i.priority||0)-(n.priority||0));for(const n of r){const i=await this.applicationContext.getAsync(n.aspectModule);await this.addAspect(i,n)}}async addAspect(t,r){const n=r.aspectTarget,i=Object.getOwnPropertyNames(n.prototype),a=r.match?DN(r.match):()=>!0;for(const o of i){if(o==="constructor"||!a(o))continue;const s=Object.getOwnPropertyDescriptor(n.prototype,o);!s||s.writable===!1||this.interceptPrototypeMethod(n,o,t)}}interceptPrototypeMethod(t,r,n){const i=t.prototype[r];kN.Types.isAsyncFunction(t.prototype[r])?t.prototype[r]=async function(...a){var o,s,u;let c,l;const d={methodName:r,target:this,args:a,proceed:(...g)=>i.apply(this,g),proceedIsAsyncFunction:!0};typeof n=="function"&&(n=n());try{await((o=n.before)===null||o===void 0?void 0:o.call(n,d)),n.around?l=await n.around(d):l=await i.call(this,...d.args),d.proceed=void 0;const g=await((s=n.afterReturn)===null||s===void 0?void 0:s.call(n,d,l));return l=typeof g>"u"?l:g,l}catch(g){if(d.proceed=void 0,c=g,n.afterThrow)await n.afterThrow(d,c);else throw g}finally{await((u=n.after)===null||u===void 0?void 0:u.call(n,d,l,c))}}:t.prototype[r]=function(...a){var o,s,u;let c,l;const d={methodName:r,target:this,args:a,proceed:(...g)=>i.apply(this,g),proceedIsAsyncFunction:!1};typeof n=="function"&&(n=n());try{(o=n.before)===null||o===void 0||o.call(n,d),n.around?l=n.around(d):l=i.call(this,...d.args),d.proceed=void 0;const g=(s=n.afterReturn)===null||s===void 0?void 0:s.call(n,d,l);return l=typeof g>"u"?l:g,l}catch(g){if(d.proceed=void 0,c=g,n.afterThrow)n.afterThrow(d,c);else throw g}finally{(u=n.after)===null||u===void 0||u.call(n,d,l,c)}}}};Yh=NN([(0,Xa.Provide)(),(0,Xa.Scope)(FN.ScopeEnum.Singleton),BN("design:paramtypes",[Object])],Yh),za.MidwayAspectService=Yh;var Wh=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Rs=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(As,"__esModule",{value:!0}),As.MidwayDecoratorService=void 0;const Kr=Pe(),UN=Ke,$N=za,zh=Gt,jN=_e,KN=Ne,Oc=jN.debuglog("midway:debug");let Is=class{constructor(t){this.applicationContext=t,this.propertyHandlerMap=new Map,this.methodDecoratorMap=new Map,this.parameterDecoratorMap=new Map,this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind(t=>{const r=(0,Kr.getClassMetadata)(Kr.INJECT_CUSTOM_METHOD,t);if(r)for(const i of r){const{propertyName:a,key:o,metadata:s,options:u}=i;!u||!u.impl||this.aspectService.interceptPrototypeMethod(t,a,()=>{const c=this.methodDecoratorMap.get(o);if(!c)throw new zh.MidwayCommonError(`Method Decorator "${o}" handler not found, please register first.`);return c({target:t,propertyName:a,metadata:s})})}const n=(0,Kr.getClassMetadata)(Kr.INJECT_CUSTOM_PARAM,t);if(n)for(const i of Object.keys(n))this.aspectService.interceptPrototypeMethod(t,i,()=>({before:async a=>{const o=[...a.args];for(const s of n[i]){const{propertyName:u,key:c,metadata:l,parameterIndex:f,options:d}=s;let g;if(d&&d.impl){if(g=this.parameterDecoratorMap.get(c),!g)throw new zh.MidwayCommonError(`Parameter Decorator "${c}" handler not found, please register first.`)}else g=async({parameterIndex:y,originArgs:w})=>w[y];const h=(0,Kr.getMethodParamTypes)(t,u);let v=!1;try{o[f]=await g({metadata:l,propertyName:u,parameterIndex:f,target:t,originArgs:o,originParamType:h[f]})}catch(y){if(v=!0,(d==null?void 0:d.throwError)===!0)throw y;Oc(`[core]: Parameter decorator throw error and use origin args, ${y.stack}`)}if(v)continue;const p=[...this.parameterDecoratorPipes.get(c)||[],...(d==null?void 0:d.pipes)||[]];for(const y of p){let w;if("transform"in y)w=y.transform.bind(y);else if((0,KN.isClass)(y)){const m=await this.applicationContext.getAsync(y);w=m.transform.bind(m)}else if(typeof y=="function")w=y;else throw new zh.MidwayParameterError("Pipe must be a function or implement PipeTransform interface");o[f]=await w(o[f],{metaType:(0,Kr.transformTypeFromTSDesign)(h[f]),metadata:l,target:a.target,methodName:a.methodName})}}a.args=o}}))}),this.applicationContext.onObjectCreated((t,r)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(r.definition.handlerProps))for(const n of r.definition.handlerProps)this.defineGetterPropertyValue(n,t,this.getHandler(n.key))}),this.registerPropertyHandler(Kr.APPLICATION_CONTEXT_KEY,(t,r)=>this.applicationContext)}registerPropertyHandler(t,r){Oc(`[core]: Register property decorator key="${t}"`),this.propertyHandlerMap.set(t,r)}registerMethodHandler(t,r){Oc(`[core]: Register method decorator key="${t}"`),this.methodDecoratorMap.set(t,r)}registerParameterHandler(t,r){Oc(`[core]: Register parameter decorator key="${t}"`),this.parameterDecoratorMap.set(t,r)}registerParameterPipes(t,r){this.parameterDecoratorPipes.has(t)||this.parameterDecoratorPipes.set(t,[]),this.parameterDecoratorPipes.set(t,this.parameterDecoratorPipes.get(t).concat(r))}defineGetterPropertyValue(t,r,n){t&&n&&t.propertyName&&Object.defineProperty(r,t.propertyName,{get:()=>{var i;return n(t.propertyName,(i=t.metadata)!==null&&i!==void 0?i:{},r)},configurable:!0,enumerable:!0})}getHandler(t){if(this.propertyHandlerMap.has(t))return this.propertyHandlerMap.get(t)}};Wh([(0,Kr.Inject)(),Rs("design:type",$N.MidwayAspectService)],Is.prototype,"aspectService",void 0),Wh([(0,Kr.Init)(),Rs("design:type",Function),Rs("design:paramtypes",[]),Rs("design:returntype",void 0)],Is.prototype,"init",null),Is=Wh([(0,Kr.Provide)(),(0,Kr.Scope)(UN.ScopeEnum.Singleton),Rs("design:paramtypes",[Object])],Is),As.MidwayDecoratorService=Is;var Os={},qN=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(Os,"__esModule",{value:!0}),Os.MidwayApplicationManager=void 0;const VN=Ke,_b=Pe();let Qh=class{constructor(){this.globalFrameworkMap=new Map,this.globalFrameworkTypeMap=new WeakMap}addFramework(t,r){this.globalFrameworkMap.set(t,r),r.getFrameworkType&&this.globalFrameworkTypeMap.set(r.getFrameworkType(),r)}getFramework(t){if(typeof t=="string"){if(this.globalFrameworkMap.has(t))return this.globalFrameworkMap.get(t)}else if(this.globalFrameworkTypeMap.has(t))return this.globalFrameworkTypeMap.get(t)}getApplication(t){if(typeof t=="string"){if(this.globalFrameworkMap.has(t))return this.globalFrameworkMap.get(t).getApplication()}else if(this.globalFrameworkTypeMap.has(t))return this.globalFrameworkTypeMap.get(t).getApplication()}getApplications(t){return t?t.map(r=>this.getApplication(r)).filter(r=>!!r):Array.from(this.globalFrameworkMap.values()).map(r=>r.getApplication())}};Qh=qN([(0,_b.Provide)(),(0,_b.Scope)(VN.ScopeEnum.Singleton)],Qh),Os.MidwayApplicationManager=Qh;var $i=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},wn=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.MidwayFrameworkService=void 0;const wt=Pe(),GN=Ke,HN=yn,YN=Oa,WN=os,zN=Ui,QN=As,XN=za,JN=Os,ZN=_e,Xh=Gt,e5=ze,Ms=ZN.debuglog("midway:debug");let Tn=class{constructor(t,r){this.applicationContext=t,this.globalOptions=r,this.globalFrameworkList=[]}async init(){var t,r;this.decoratorService.registerPropertyHandler(wt.CONFIG_KEY,(i,a)=>{var o;return a.identifier===wt.ALL?this.configService.getConfiguration():this.configService.getConfiguration((o=a.identifier)!==null&&o!==void 0?o:i)}),this.decoratorService.registerPropertyHandler(wt.LOGGER_KEY,(i,a)=>{var o;return this.loggerService.getLogger((o=a.identifier)!==null&&o!==void 0?o:i)}),this.decoratorService.registerPropertyHandler(wt.PIPELINE_IDENTIFIER,(i,a,o)=>{var s,u;return new zN.MidwayPipelineService((u=(s=o[e5.REQUEST_OBJ_CTX_KEY])===null||s===void 0?void 0:s.requestContext)!==null&&u!==void 0?u:this.applicationContext,a.valves)}),this.decoratorService.registerPropertyHandler(wt.APPLICATION_KEY,(i,a)=>{if(a.type){const o=this.applicationManager.getApplication(a.type);if(!o)throw new Xh.MidwayCommonError(`Framework ${a.type} not Found`);return o}else return this.getMainApp()}),this.decoratorService.registerPropertyHandler(wt.PLUGIN_KEY,(i,a)=>{var o;return this.getMainApp()[(o=a.identifier)!==null&&o!==void 0?o:i]}),this.decoratorService.registerPropertyHandler(wt.FACTORY_SERVICE_CLIENT_KEY,(i,a)=>{const o=this.applicationContext.get(a.serviceFactoryClz),s=a.clientName||o.getDefaultClientName();if(s&&o.has(s))return o.get(s);throw s?new Xh.MidwayParameterError(`ClientName(${s} not found in ${a.serviceFactoryClz.name}).`):new Xh.MidwayParameterError(`Please set clientName or options.defaultClientName for ${a.serviceFactoryClz.name}).`)});let n=(0,wt.listModule)(wt.FRAMEWORK_KEY);if(n=t5(n),Ms(`[core]: Found Framework length = ${n.length}`),n.length){for(const o of n){if(!this.applicationContext.hasDefinition((0,wt.getProviderUUId)(o))){Ms(`[core]: Found Framework "${o.name}" but missing definition, skip initialize.`);continue}const s=await this.applicationContext.getAsync(o,[this.applicationContext]);s.isEnable()?(await s.initialize({applicationContext:this.applicationContext,namespace:s.getNamespace(),...this.globalOptions}),Ms(`[core]: Found Framework "${s.getFrameworkName()}" and initialize.`)):Ms(`[core]: Found Framework "${s.getFrameworkName()}" and delay initialize.`);const u=this.applicationContext.registry.getDefinition((0,wt.getProviderUUId)(o));s.setNamespace(u==null?void 0:u.namespace),this.applicationManager.addFramework((t=u==null?void 0:u.namespace)!==null&&t!==void 0?t:s.getFrameworkName(),s),this.globalFrameworkList.push(s)}let i;const a=this.applicationContext.getNamespaceList();for(const o of a)if(this.applicationManager.getApplication(o)){i=o;break}me.MIDWAY_MAIN_FRAMEWORK=this.mainFramework=(r=this.applicationManager.getFramework(i))!==null&&r!==void 0?r:this.globalFrameworkList[0]}await this.aspectService.loadAspect()}getMainApp(){var t;return(t=this.mainFramework)===null||t===void 0?void 0:t.getApplication()}getMainFramework(){return this.mainFramework}getFramework(t){return this.applicationManager.getFramework(t)}async runFramework(){for(const t of this.globalFrameworkList)t.isEnable()&&(await t.run(),Ms(`[core]: Found Framework "${t.getFrameworkName()}" and run.`))}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map(t=>t.stop()))}};$i([(0,wt.Inject)(),wn("design:type",HN.MidwayConfigService)],Tn.prototype,"configService",void 0),$i([(0,wt.Inject)(),wn("design:type",YN.MidwayLoggerService)],Tn.prototype,"loggerService",void 0),$i([(0,wt.Inject)(),wn("design:type",XN.MidwayAspectService)],Tn.prototype,"aspectService",void 0),$i([(0,wt.Inject)(),wn("design:type",QN.MidwayDecoratorService)],Tn.prototype,"decoratorService",void 0),$i([(0,wt.Inject)(),wn("design:type",JN.MidwayApplicationManager)],Tn.prototype,"applicationManager",void 0),$i([(0,wt.Init)(),wn("design:type",Function),wn("design:paramtypes",[]),wn("design:returntype",Promise)],Tn.prototype,"init",null),Tn=$i([(0,wt.Provide)(),(0,wt.Scope)(GN.ScopeEnum.Singleton),wn("design:paramtypes",[Object,Object])],Tn),Ts.MidwayFrameworkService=Tn;function t5(e){const t=[];for(const r of e){let n=Object.getPrototypeOf(r);for(;n.name&&n.name!==WN.BaseFramework.name;)t.push(n),n=Object.getPrototypeOf(n)}return e.filter(r=>!t.includes(r))}var Mc={},Ls=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},ji=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.MidwayLifeCycleService=void 0;const r5=Ke,an=Pe(),Sb=$n,n5=Ts,i5=yn,a5=_e,o5=qa,Ps=(0,a5.debuglog)("midway:debug");let Ki=class{constructor(t){this.applicationContext=t}async init(){await this.mockService.initSimulation();const t=(0,an.listModule)(an.CONFIGURATION_KEY);Ps(`[core]: Found Configuration length = ${t.length}`);const r=[];for(const n of t)n.target instanceof Sb.FunctionalConfiguration?n.instance=n.target:(Ps(`[core]: Lifecycle run ${n.namespace} init`),n.instance=await this.applicationContext.getAsync(n.target)),n.instance&&r.push(n);await Promise.all([this.runObjectLifeCycle(r,"onBeforeObjectCreated"),this.runObjectLifeCycle(r,"onObjectCreated"),this.runObjectLifeCycle(r,"onObjectInit"),this.runObjectLifeCycle(r,"onBeforeObjectDestroy")]),await this.runContainerLifeCycle(r,"onConfigLoad",n=>{n&&this.configService.addObject(n)}),await this.mockService.runSimulatorSetup(),await this.runContainerLifeCycle(r,"onReady"),await this.frameworkService.runFramework(),await this.runContainerLifeCycle(r,"onServerReady"),this.configService.getConfiguration("debug.recordConfigMergeOrder")||this.configService.clearConfigMergeOrder()}async stop(){await this.mockService.runSimulatorTearDown();const t=(0,an.listModule)(an.CONFIGURATION_KEY)||[];for(const r of t.reverse()){let n;r.target instanceof Sb.FunctionalConfiguration?n=r.target:n=await this.applicationContext.getAsync(r.target),await this.runContainerLifeCycle(n,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(t,r,n){if(Array.isArray(t)){for(const i of t)if(typeof i.instance[r]=="function"){Ps(`[core]: Lifecycle run ${i.instance.constructor.name} ${r}`);const a=await i.instance[r](this.applicationContext,this.frameworkService.getMainApp());n&&n(a)}}else if(typeof t[r]=="function"){Ps(`[core]: Lifecycle run ${t.constructor.name} ${r}`);const i=await t[r](this.applicationContext,this.frameworkService.getMainApp());n&&n(i)}}async runObjectLifeCycle(t,r){for(const n of t)if(typeof n.instance[r]=="function")return Ps(`[core]: Lifecycle run ${n.instance.constructor.name} ${r}`),this.applicationContext[r](n.instance[r].bind(n.instance))}};Ls([(0,an.Inject)(),ji("design:type",n5.MidwayFrameworkService)],Ki.prototype,"frameworkService",void 0),Ls([(0,an.Inject)(),ji("design:type",i5.MidwayConfigService)],Ki.prototype,"configService",void 0),Ls([(0,an.Inject)(),ji("design:type",o5.MidwayMockService)],Ki.prototype,"mockService",void 0),Ls([(0,an.Init)(),ji("design:type",Function),ji("design:paramtypes",[]),ji("design:returntype",Promise)],Ki.prototype,"init",null),Ki=Ls([(0,an.Provide)(),(0,an.Scope)(r5.ScopeEnum.Singleton),ji("design:paramtypes",[Object])],Ki),Mc.MidwayLifeCycleService=Ki;var Ns={},s5=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},u5=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.MidwayWebRouterService=void 0;const or=Pe(),Jh=zt.exports,Zh=Gt,c5=_e,l5=ga,f5=Ne,Cb=Ke,d5=c5.debuglog("midway:debug");let ep=class{constructor(t={}){this.options=t,this.isReady=!1,this.routes=new Map,this.routesPriority=[]}async analyze(){this.analyzeController(),this.sortPrefixAndRouter()}analyzeController(){const t=(0,or.listModule)(or.CONTROLLER_KEY);for(const r of t){const n=(0,or.getClassMetadata)(or.CONTROLLER_KEY,r);this.addController(r,n,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter(t=>this.routes.get(t.prefix).length>0?!0:(this.routes.delete(t.prefix),!1));for(const t of this.routes.keys()){const r=this.routes.get(t);this.routes.set(t,this.sortRouter(r))}this.routesPriority=this.routesPriority.sort((t,r)=>r.prefix.length-t.prefix.length)}addController(t,r,n={},i=!1){var a;n&&typeof n=="boolean"&&(i=n,n=void 0),n||(n={});const o=(0,or.getProviderName)(t);d5(`[core]: Found Controller ${o}.`);const s=(0,or.getProviderUUId)(t);r.routerOptions=r.routerOptions||{};let u;const c=r.routerOptions.middleware,l=!!(!((a=r.routerOptions)===null||a===void 0)&&a.ignoreGlobalPrefix);let f=(0,Jh.joinURLPath)(this.options.globalPrefix,r.prefix||"/");const d=r.prefix||"/";if(l&&(f=d),/\*/.test(f))throw new Zh.MidwayCommonError(`Router prefix ${f} can't set string with *`);if(!this.routes.has(f))this.routes.set(f,[]),this.routesPriority.push({prefix:f,priority:f==="/"&&u===void 0?-999:0,middleware:c,routerOptions:r.routerOptions,controllerId:o,routerModule:t});else if(c&&c.length>0){const h=this.routesPriority.filter(v=>v.prefix===f)[0];throw new Zh.MidwayDuplicateControllerOptionsError(f,o,h.controllerId)}this.routes.has(d)||(this.routes.set(d,[]),this.routesPriority.push({prefix:d,priority:d==="/"&&u===void 0?-999:0,middleware:c,routerOptions:r.routerOptions,controllerId:o,routerModule:t}));const g=(0,or.getClassMetadata)(or.WEB_ROUTER_KEY,t);if(g&&typeof g[Symbol.iterator]=="function")for(const h of g){const v=(0,or.getPropertyDataFromClass)(or.WEB_ROUTER_PARAM_KEY,t,h.method)||[],p=(0,or.getPropertyMetadata)(or.WEB_RESPONSE_KEY,t,h.method)||[],y={id:s,prefix:h.ignoreGlobalPrefix?d:f,routerName:h.routerName||"",url:h.path,requestMethod:h.requestMethod,method:h.method,description:h.description||"",summary:h.summary||"",handlerName:`${o}.${h.method}`,funcHandlerName:`${o}.${h.method}`,controllerId:o,controllerClz:t,middleware:h.middleware||[],controllerMiddleware:c||[],requestMetadata:v,responseMetadata:p};i&&(y.functionName=o+"-"+h.method,y.functionTriggerName=Cb.ServerlessTriggerType.HTTP,y.functionTriggerMetadata={path:(0,Jh.joinURLPath)(f,h.path.toString()),method:h.requestMethod},y.functionMetadata={functionName:y.functionName}),!(n.resourceFilter&&!n.resourceFilter(y))&&this.checkDuplicateAndPush(y.prefix,y)}}addRouter(t,r){const n=r.prefix||"";r.requestMethod=(r.requestMethod||"GET").toUpperCase(),this.routes.has(n)||(this.routes.set(n,[]),this.routesPriority.push({prefix:n,priority:0,middleware:[],routerOptions:{},controllerId:void 0,routerModule:void 0})),this.checkDuplicateAndPush(n,Object.assign(r,{method:t})),this.sortPrefixAndRouter()}sortRouter(t){return t.map(r=>{const n=r.url.toString(),i=f5.Types.isRegExp(r.url)?n.split("\\/"):n.split("/");let a=0;for(const u of i)u===""||u.includes(":")||u.includes("*")?a+=0:a+=1;let o=2;const s=n.includes(":")?n.replace(/:.+$/,""):"";return s&&(o=1),n.includes("*")&&(o=0),{...r,_pureRouter:n.replace(/\**$/,"").replace(/:\w+/,"123"),_level:n.split("/").length-1,_paramString:s,_category:o,_weight:a}}).sort((r,n)=>r._category!==n._category?n._category-r._category:r._weight!==n._weight?n._weight-r._weight:r._level===n._level?n._pureRouter===r._pureRouter?r.url.toString().length-n.url.toString().length:n._pureRouter.length-r._pureRouter.length:n._level-r._level)}async getRoutePriorityList(){return this.isReady||(await this.analyze(),this.isReady=!0),this.routesPriority}async getRouterTable(){return this.isReady||(await this.analyze(),this.isReady=!0),this.routes}async getFlattenRouterTable(t={}){this.isReady||(await this.analyze(),this.isReady=!0);let r=[];for(const n of this.routesPriority)r=r.concat(this.routes.get(n.prefix));if(t.compileUrlPattern)for(const n of r)n.fullUrlFlattenString&&(n.fullUrlCompiledRegexp=l5.PathToRegexpUtil.toRegexp(n.fullUrlFlattenString));return r}async getMatchedRouterInfo(t,r){const n=await this.getFlattenRouterTable({compileUrlPattern:!0});let i;for(const a of n)if(a.fullUrlCompiledRegexp){const o=a.requestMethod.toUpperCase();if((o==="ALL"||r.toUpperCase()===o)&&a.fullUrlCompiledRegexp.test(t)){i=a;break}}return i}checkDuplicateAndPush(t,r){const n=this.routes.get(t),i=n.filter(a=>r.url&&r.requestMethod&&a.url===r.url&&a.requestMethod===r.requestMethod);if(i&&i.length)throw new Zh.MidwayDuplicateRouteError(`${r.requestMethod} ${r.url}`,`${i[0].handlerName}`,`${r.handlerName}`);!r.fullUrlFlattenString&&r.url&&typeof r.url=="string"&&(r.fullUrl=(0,Jh.joinURLPath)(t,r.url),/\*$/.test(r.fullUrl)?r.fullUrlFlattenString=r.fullUrl.replace("*","(.*)"):r.fullUrlFlattenString=r.fullUrl),n.push(r)}};ep=s5([(0,or.Provide)(),(0,or.Scope)(Cb.ScopeEnum.Singleton),u5("design:paramtypes",[Object])],ep),Ns.MidwayWebRouterService=ep;var qi={},An={},Bs={};Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.run=void 0;const tp=_e,rp=_e,wb=Dh.exports,h5=_e,p5=_e,Lc=(0,h5.debuglog)("midway:glob");function np(e){return p5.platform()==="win32"&&e?e.map(t=>t.split(rp.sep).join(rp.posix.sep)):e}const g5=(e,t={cwd:process.cwd(),ignore:[]})=>{Lc(`midway glob pattern = ${e}, options = ${JSON.stringify(t)}`);const r=Date.now(),n=t.cwd;e=np(e)||[],Lc(`after format pattern = ${e}`);const i=wb(e,{ignore:np(t.ignore)||[]}),a=wb("**",{ignore:np(t.ignore)||[]});function o(u,c,l,f){if(!(0,tp.existsSync)(u))return[];const d=(0,tp.readdirSync)(u),g=[];for(let h of d){const v=(0,rp.resolve)(u,h);Lc(`resolvePath = ${v}`);const p=(0,tp.statSync)(v);if(p.isDirectory()&&l(v.replace(n,""))){const y=o(v,c,l);g.push(...y)}else p.isFile()&&c(v.replace(n,""))&&g.push(v)}return g}const s=o(n,i,a);return Lc(`midway glob timing ${Date.now()-r}ms`),s};Bs.run=g5,Object.defineProperty(An,"__esModule",{value:!0}),An.CustomModuleDetector=An.DirectoryFileDetector=An.AbstractFileDetector=void 0;const y5=Ne,v5=Bs,m5=Gt,Tb=ze,E5=Pe();class ip{constructor(t){this.options=t,this.extraDetectorOptions={}}setExtraDetectorOptions(t){this.extraDetectorOptions=t}}An.AbstractFileDetector=ip;const b5=["**/**.tsx"].concat(Tb.DEFAULT_PATTERN),_5=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(Tb.IGNORE_PATTERN);class S5 extends ip{constructor(){super(...arguments),this.duplicateModuleCheckSet=new Map}run(t){const r=[].concat(this.options.loadDir||[]).concat(this.extraDetectorOptions.loadDir||[]);for(const n of r){const i=(0,v5.run)(b5.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:n,ignore:_5.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])}),a=(o,s)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&y5.Types.isClass(o)){const u=(0,E5.getProviderName)(o);if(u){if(this.duplicateModuleCheckSet.has(u))throw new m5.MidwayDuplicateClassNameError(u,s.srcPath,this.duplicateModuleCheckSet.get(u));this.duplicateModuleCheckSet.set(u,s.srcPath)}}};for(const o of i){const s=Tr(o);t.bindClass(s,{namespace:this.options.namespace,srcPath:o,createFrom:"file",bindHook:a})}}this.duplicateModuleCheckSet.clear()}}An.DirectoryFileDetector=S5;class C5 extends ip{run(t){for(const r of this.options.modules)t.bindClass(r,{namespace:this.options.namespace,createFrom:"module"})}}An.CustomModuleDetector=C5;var ap={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getCurrentAsyncContextManager=e.getCurrentMainApp=e.getCurrentMainFramework=e.getCurrentApplicationContext=void 0;const t=ze,r=()=>me.MIDWAY_APPLICATION_CONTEXT;e.getCurrentApplicationContext=r;const n=()=>me.MIDWAY_MAIN_FRAMEWORK;e.getCurrentMainFramework=n;const i=()=>{const o=(0,e.getCurrentMainFramework)();if(o)return o.getApplication()};e.getCurrentMainApp=i;const a=()=>(0,e.getCurrentApplicationContext)().get(t.ASYNC_CONTEXT_MANAGER_KEY);e.getCurrentAsyncContextManager=a})(ap);var w5=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},T5=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(qi,"__esModule",{value:!0}),qi.WebRouterCollector=qi.MidwayServerlessFunctionService=void 0;const Rt=Pe(),op=Ns,A5=_a,x5=An,Pc=ap,R5=Ke;let Ds=class extends op.MidwayWebRouterService{constructor(t={}){super(Object.assign({},t,{includeFunctionRouter:!0})),this.options=t}async analyze(){this.analyzeController(),this.analyzeFunction(),this.sortPrefixAndRouter();for(const t of this.routes.values())for(const r of t)r.requestMethod==="all"&&(r.functionTriggerMetadata=r.functionTriggerMetadata||{},r.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"])}analyzeFunction(){const t=(0,Rt.listModule)(Rt.FUNC_KEY);for(const r of t)this.collectFunctionRoute(r)}collectFunctionRoute(t){var r,n,i,a,o,s,u,c,l,f,d,g,h,v,p,y,w;const m=(0,Rt.getClassMetadata)(Rt.FUNC_KEY,t),S=(0,Rt.getProviderName)(t),A=(0,Rt.getProviderUUId)(t),I="/";this.routes.has(I)||(this.routes.set(I,[]),this.routesPriority.push({prefix:I,priority:-999,middleware:[],routerOptions:{},controllerId:S,routerModule:t}));for(const N of m)if(!((r=N.metadata)===null||r===void 0)&&r.path){const T=(0,Rt.getPropertyDataFromClass)(Rt.WEB_ROUTER_PARAM_KEY,t,N.methodName)||[],M=(0,Rt.getPropertyMetadata)(Rt.WEB_RESPONSE_KEY,t,N.methodName)||[],P={id:A,prefix:I,routerName:"",url:N.metadata.path,requestMethod:(i=(n=N.metadata)===null||n===void 0?void 0:n.method)!==null&&i!==void 0?i:"get",method:N.methodName,description:"",summary:"",handlerName:`${S}.${N.methodName}`,funcHandlerName:`${S}.${N.methodName}`,controllerId:S,middleware:((a=N.metadata)===null||a===void 0?void 0:a.middleware)||[],controllerMiddleware:[],requestMetadata:T,responseMetadata:M},L=(0,Rt.getPropertyMetadata)(Rt.SERVERLESS_FUNC_KEY,t,N.methodName)||{},B=(u=(o=L.functionName)!==null&&o!==void 0?o:(s=N==null?void 0:N.metadata)===null||s===void 0?void 0:s.functionName)!==null&&u!==void 0?u:Ab(t,N.methodName),X=(f=(c=L.handlerName)!==null&&c!==void 0?c:(l=N==null?void 0:N.metadata)===null||l===void 0?void 0:l.handlerName)!==null&&f!==void 0?f:P.funcHandlerName;P.functionName=B,P.funcHandlerName=X,P.functionTriggerName=N.type,P.functionTriggerMetadata=N.metadata,P.functionMetadata={functionName:B,...L},this.checkDuplicateAndPush(I,P)}else{const T=(0,Rt.getPropertyMetadata)(Rt.SERVERLESS_FUNC_KEY,t,N.methodName)||{},M=(h=(d=T.functionName)!==null&&d!==void 0?d:(g=N==null?void 0:N.metadata)===null||g===void 0?void 0:g.functionName)!==null&&h!==void 0?h:Ab(t,N.methodName),P=(y=(v=T.handlerName)!==null&&v!==void 0?v:(p=N==null?void 0:N.metadata)===null||p===void 0?void 0:p.handlerName)!==null&&y!==void 0?y:`${S}.${N.methodName}`;this.checkDuplicateAndPush(I,{id:A,prefix:I,routerName:"",url:"",requestMethod:"",method:N.methodName,description:"",summary:"",handlerName:`${S}.${N.methodName}`,funcHandlerName:P,controllerId:S,middleware:((w=N.metadata)===null||w===void 0?void 0:w.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:M,functionTriggerName:N.type,functionTriggerMetadata:N.metadata,functionMetadata:{functionName:M,...T}})}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:!0})}addServerlessFunction(t,r,n={}){var i,a;const o="";this.routes.has(o)||(this.routes.set(o,[]),this.routesPriority.push({prefix:o,priority:0,middleware:[],routerOptions:{},controllerId:void 0,routerModule:void 0}));const s=(i=r.functionName)!==null&&i!==void 0?i:n.functionName;this.checkDuplicateAndPush(o,{id:null,method:t,url:r.metadata.path||"",requestMethod:r.metadata.method||"",description:"",summary:"",handlerName:"",funcHandlerName:r.handlerName||n.handlerName,controllerId:"",middleware:((a=r.metadata)===null||a===void 0?void 0:a.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:s,functionTriggerName:r.metadata.name,functionTriggerMetadata:r.metadata,functionMetadata:{functionName:s,...n}})}};Ds=w5([(0,Rt.Provide)(),(0,Rt.Scope)(R5.ScopeEnum.Singleton),T5("design:paramtypes",[Object])],Ds),qi.MidwayServerlessFunctionService=Ds;function Ab(e,t){return(0,Rt.getProviderName)(e).replace(/[:#]/g,"-")+"-"+t}class I5{constructor(t="",r={}){this.baseDir=t,this.options=r}async init(){if(!this.proxy){if(this.baseDir){const t=new A5.MidwayContainer;(0,Rt.bindContainer)(t),t.setFileDetector(new x5.DirectoryFileDetector({loadDir:this.baseDir})),await t.ready()}this.options.includeFunctionRouter?(0,Pc.getCurrentMainFramework)()?this.proxy=await(0,Pc.getCurrentMainFramework)().getApplicationContext().getAsync(Ds,[this.options]):this.proxy=new Ds(this.options):(0,Pc.getCurrentMainFramework)()?this.proxy=await(0,Pc.getCurrentMainFramework)().getApplicationContext().getAsync(op.MidwayWebRouterService,[this.options]):this.proxy=new op.MidwayWebRouterService(this.options)}}async getRoutePriorityList(){return await this.init(),this.proxy.getRoutePriorityList()}async getRouterTable(){return await this.init(),this.proxy.getRouterTable()}async getFlattenRouterTable(){return await this.init(),this.proxy.getFlattenRouterTable()}}qi.WebRouterCollector=I5;var ii={};Object.defineProperty(ii,"__esModule",{value:!0}),ii.globModels=ii.formatGlobString=ii.DataSourceManager=void 0;const O5=jn,sp=Gt,M5=Bs,xb=_e,Rb=Ne,Ib=ze,L5=(0,_e.debuglog)("midway:debug");class P5{constructor(){this.dataSource=new Map,this.options={},this.modelMapping=new WeakMap}async initDataSource(t,r){if(this.options=t,!this.options.dataSource)throw new sp.MidwayParameterError("[DataSourceManager] must set options.dataSource.");typeof r=="string"&&(r={appDir:r});for(const n in t.dataSource){const i=t.dataSource[n];if(i.entities){const o=new Set;for(const s of i.entities)if(typeof s=="string"){const u=Mb(s,r.appDir);for(const c of u)o.add(c),this.modelMapping.set(c,n)}else o.add(s),this.modelMapping.set(s,n);i.entities=Array.from(o),L5(`[core]: DataManager load ${i.entities.length} models from ${n}.`)}const a={cacheInstance:t.cacheInstance,validateConnection:t.validateConnection};await this.createInstance(i,n,a)}}getDataSource(t){return this.dataSource.get(t)}hasDataSource(t){return this.dataSource.has(t)}getDataSourceNames(){return Array.from(this.dataSource.keys())}async isConnected(t){const r=this.getDataSource(t);return r?this.checkConnected(r):!1}async createInstance(t,r,n){const i=n&&typeof n.cacheInstance=="boolean"?n.cacheInstance:!0,a=n&&n.validateConnection||!1,o=(0,O5.extend)(!0,{},this.options.default,t),s=await this.createDataSource(o,r);if(i&&r&&s&&this.dataSource.set(r,s),a){if(!s)throw new sp.MidwayCommonError(`[DataSourceManager] ${r} initialization failed.`);if(!await this.checkConnected(s))throw new sp.MidwayCommonError(`[DataSourceManager] ${r} is not connected.`)}return s}getDataSourceNameByModel(t){return this.modelMapping.get(t)}async stop(){const t=Array.from(this.dataSource.values());await Promise.all(t.map(r=>this.destroyDataSource(r))),this.dataSource.clear()}getDefaultDataSourceName(){return this.innerDefaultDataSourceName===void 0&&(this.options.defaultDataSourceName?this.innerDefaultDataSourceName=this.options.defaultDataSourceName:this.dataSource.size===1?this.innerDefaultDataSourceName=Array.from(this.dataSource.keys())[0]:this.innerDefaultDataSourceName=""),this.innerDefaultDataSourceName}}ii.DataSourceManager=P5;function Ob(e){let t;/^\*/.test(e)||(e="/"+e);const r=(0,xb.parse)(e);return r.base&&(/\*/.test(r.base)||r.ext)?t=[e]:t=[...Ib.DEFAULT_PATTERN.map(n=>(0,xb.join)(e,n))],t}ii.formatGlobString=Ob;function Mb(e,t){const r=Ob(e),n=[],i=(0,M5.run)(r,{cwd:t,ignore:Ib.IGNORE_PATTERN});for(const a of i){const o=Tr(a);if(Rb.Types.isClass(o))n.push(o);else for(const s in o){const u=o[s];Rb.Types.isClass(u)&&n.push(u)}}return n}ii.globModels=Mb;var Nc={};Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.LoggerFactory=void 0;class N5{}Nc.LoggerFactory=N5;var Bc={},Lb=me&&me.__decorate||function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Ja=me&&me.__metadata||function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.DataListener=void 0;const Pb=Pe();class up{async init(){this.innerData=await this.initData(),await this.onData(this.setData.bind(this))}setData(t){this.innerData=t}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}Lb([(0,Pb.Init)(),Ja("design:type",Function),Ja("design:paramtypes",[]),Ja("design:returntype",Promise)],up.prototype,"init",null),Lb([(0,Pb.Destroy)(),Ja("design:type",Function),Ja("design:paramtypes",[]),Ja("design:returntype",Promise)],up.prototype,"stop",null),Bc.DataListener=up;var Dc={};Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.WebControllerGenerator=void 0;const Fc=Pe(),B5=_e,D5=Ke,F5=Gt,k5=Ka,Nb=B5.debuglog("midway:debug");class U5{constructor(t,r){this.app=t,this.midwayWebRouterService=r}generateKoaController(t){return async(r,n)=>{if(t.controllerClz&&typeof t.method=="string"&&!await this.app.getFramework().runGuard(r,t.controllerClz,t.method))throw new F5.httpError.ForbiddenError;const i=[r,n];let a;if(typeof t.method!="string")a=await t.method(r,n);else{const o=await r.requestContext.getAsync(t.id);a=await o[t.method].apply(o,i)}if(a!==void 0&&(a===null?(r.response._body=null,r.response._midwayControllerNullBody=!0):r.body=a),Array.isArray(t.responseMetadata)&&t.responseMetadata.length)for(const o of t.responseMetadata)switch(o.type){case Fc.WEB_RESPONSE_HTTP_CODE:r.status=o.code;break;case Fc.WEB_RESPONSE_HEADER:for(const s in(o==null?void 0:o.setHeaders)||{})r.set(s,o.setHeaders[s]);break;case Fc.WEB_RESPONSE_CONTENT_TYPE:r.type=o.contentType;break;case Fc.WEB_RESPONSE_REDIRECT:r.status=o.code,r.redirect(o.url);return}}}async loadMidwayController(t){var r,n;const i=await this.midwayWebRouterService.getRouterTable(),a=await this.midwayWebRouterService.getRoutePriorityList(),o=this.app.getApplicationContext(),s=this.app.getCoreLogger(),u=o.get(k5.MidwayMiddlewareService);for(const c of a){o.bindClass(c.routerModule),s.debug(`Load Controller "${c.controllerId}", prefix=${c.prefix}`),Nb(`[core]: Load Controller "${c.controllerId}", prefix=${c.prefix}`);const l=this.createRouter({prefix:c.prefix,...c.routerOptions});if(c.middleware=(r=c.middleware)!==null&&r!==void 0?r:[],c.middleware.length){const d=await u.compose(c.middleware,this.app);l.use(d)}const f=i.get(c.prefix);for(const d of f){const g=[];if(d.middleware=(n=d.middleware)!==null&&n!==void 0?n:[],d.middleware.length){const v=await u.compose(d.middleware,this.app);g.push(v)}this.app.getFrameworkType()===D5.MidwayFrameworkType.WEB_KOA&&typeof d.url=="string"&&/\*$/.test(d.url)&&(d.url=d.url.replace("*","(.*)"));const h=[d.routerName,d.url,...g,this.generateController(d)];s.debug(`Load Router "${d.requestMethod.toUpperCase()} ${d.url}"`),Nb(`[core]: Load Router "${d.requestMethod.toUpperCase()} ${d.url}"`),l[d.requestMethod.toLowerCase()].apply(l,h)}t&&t(l)}}}Dc.WebControllerGenerator=U5;var xn={},cp={};Object.defineProperty(cp,"__esModule",{value:!0});const Bb=zt.exports,$5=_e,j5=ze;cp.default=e=>{var t;const r=(0,Bb.isDevelopmentEnvironment)((0,Bb.getCurrentEnvironment)()),n=(t=process.env[j5.MIDWAY_LOGGER_WRITEABLE_DIR])!==null&&t!==void 0?t:e.root;return{asyncContextManager:{enable:!1},midwayLogger:{default:{dir:(0,$5.join)(n,"logs",e.name),level:"info",consoleLevel:r?"info":"warn",auditFileDir:".audit"},clients:{coreLogger:{level:r?"info":"warn",fileLogName:"midway-core.log"},appLogger:{fileLogName:"midway-app.log",aliasName:"logger"}}},debug:{recordConfigMergeOrder:r}}};var Db;function K5(){if(Db)return xn;Db=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.prepareGlobalApplicationContext=xn.destroyGlobalApplicationContext=xn.initializeGlobalApplicationContext=void 0;const e=fp(),t=cp,r=Pe(),n=_e,i=_e,a=qi,o=n.debuglog("midway:debug");let s=1;function u(d){o(`
|
|
77
|
-
|
|
78
|
-
Step ${s++}: ${d}
|
|
79
|
-
`)}async function c(d){const g=f(d);u("Init logger");const h=await g.getAsync(e.MidwayLoggerService,[g,d]);h.getLogger("appLogger")&&g.registerObject("logger",h.getLogger("appLogger")),u("Init MidwayMockService"),await g.getAsync(e.MidwayMockService,[g]),u("Init framework"),await g.getAsync(e.MidwayFrameworkService,[g,d]),u("Init lifecycle"),await g.getAsync(e.MidwayLifeCycleService,[g]),u("Init preload modules");const v=(0,r.listPreloadModule)();for(const p of v)await g.getAsync(p);return u("End of initialize and start"),g}xn.initializeGlobalApplicationContext=c;async function l(d){const h=(await d.getAsync(e.MidwayLoggerService)).getCurrentLoggerFactory();await(await d.getAsync(e.MidwayLifeCycleService)).stop(),await d.stop(),(0,r.clearBindContainer)(),h.close(),me.MIDWAY_APPLICATION_CONTEXT=void 0,me.MIDWAY_MAIN_FRAMEWORK=void 0}xn.destroyGlobalApplicationContext=l;function f(d){var g,h,v,p;u("Ready to create applicationContext"),o('[core]: start "initializeGlobalApplicationContext"'),o(`[core]: bootstrap options = ${n.inspect(d)}`);const y=(g=d.appDir)!==null&&g!==void 0?g:"",w=(h=d.baseDir)!==null&&h!==void 0?h:"",m=(v=d.applicationContext)!==null&&v!==void 0?v:new e.MidwayContainer;if(o("[core]: delegate module map from decoratorManager"),(0,r.bindContainer)(m),me.MIDWAY_APPLICATION_CONTEXT=m,m.registerObject("baseDir",w),m.registerObject("appDir",y),u("Ready module detector"),d.moduleDetector!==!1&&(d.moduleDetector===void 0||d.moduleDetector==="file"?m.setFileDetector(new e.DirectoryFileDetector({loadDir:w,ignore:(p=d.ignore)!==null&&p!==void 0?p:[]})):d.moduleDetector&&m.setFileDetector(d.moduleDetector)),u("Binding inner service"),m.bindClass(e.MidwayEnvironmentService),m.bindClass(e.MidwayInformationService),m.bindClass(e.MidwayAspectService),m.bindClass(e.MidwayDecoratorService),m.bindClass(e.MidwayConfigService),m.bindClass(e.MidwayLoggerService),m.bindClass(e.MidwayApplicationManager),m.bindClass(e.MidwayFrameworkService),m.bindClass(e.MidwayMiddlewareService),m.bindClass(e.MidwayLifeCycleService),m.bindClass(e.MidwayMockService),m.bindClass(e.MidwayWebRouterService),m.bindClass(a.MidwayServerlessFunctionService),u("Binding preload module"),d.preloadModules&&d.preloadModules.length)for(const A of d.preloadModules)m.bindClass(A);u("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const S=m.get(e.MidwayConfigService);S.add([{default:t.default}]),m.get(e.MidwayAspectService,[m]),m.get(e.MidwayDecoratorService,[m]),u("Load imports(component) and user code configuration module"),d.imports||(d.imports=[(0,e.safeRequire)((0,i.join)(d.baseDir,"configuration"))]);for(const A of[].concat(d.imports).concat(d.configurationModule))A&&m.load(A);return u("Run applicationContext ready method"),m.ready(),d.globalConfig&&(Array.isArray(d.globalConfig)?S.add(d.globalConfig):S.addObject(d.globalConfig)),u("Load config file"),S.load(),o("[core]: Current config = %j",S.getConfiguration()),m.get(e.MidwayMiddlewareService,[m]),m}return xn.prepareGlobalApplicationContext=f,xn}var Za={};Object.defineProperty(Za,"__esModule",{value:!0}),Za.extractExpressLikeValue=Za.extractKoaLikeValue=void 0;const tt=Pe(),sr=zt.exports,q5=(e,t,r)=>(tt.ALL===t&&(t=void 0),function(n,i){switch(e){case tt.RouteParamTypes.NEXT:return i;case tt.RouteParamTypes.BODY:return(0,sr.transformRequestObjectByType)(t&&n.request.body?n.request.body[t]:n.request.body,r);case tt.RouteParamTypes.PARAM:return(0,sr.transformRequestObjectByType)(t?n.params[t]:n.params,r);case tt.RouteParamTypes.QUERY:return(0,sr.transformRequestObjectByType)(t?n.query[t]:n.query,r);case tt.RouteParamTypes.HEADERS:return(0,sr.transformRequestObjectByType)(t?n.get(t):n.headers,r);case tt.RouteParamTypes.SESSION:return(0,sr.transformRequestObjectByType)(t?n.session[t]:n.session,r);case tt.RouteParamTypes.FILESTREAM:return n.getFileStream?n.getFileStream(t):n.files?n.files[0]:void 0;case tt.RouteParamTypes.FILESSTREAM:return n.multipart?n.multipart(t):n.files?n.files:void 0;case tt.RouteParamTypes.REQUEST_PATH:return n.path;case tt.RouteParamTypes.REQUEST_IP:return n.ip;case tt.RouteParamTypes.QUERIES:return n.queries?(0,sr.transformRequestObjectByType)(t?n.queries[t]:n.queries,r):(0,sr.transformRequestObjectByType)(t?n.query[t]:n.query,r);case tt.RouteParamTypes.FIELDS:return t?n.fields[t]:n.fields;case tt.RouteParamTypes.CUSTOM:return t?t(n):void 0;default:return null}});Za.extractKoaLikeValue=q5;const V5=(e,t,r)=>(tt.ALL===t&&(t=void 0),function(n,i,a){switch(e){case tt.RouteParamTypes.NEXT:return a;case tt.RouteParamTypes.BODY:return(0,sr.transformRequestObjectByType)(t&&n.body?n.body[t]:n.body,r);case tt.RouteParamTypes.PARAM:return(0,sr.transformRequestObjectByType)(t?n.params[t]:n.params,r);case tt.RouteParamTypes.QUERY:return(0,sr.transformRequestObjectByType)(t?n.query[t]:n.query,r);case tt.RouteParamTypes.HEADERS:return(0,sr.transformRequestObjectByType)(t?n.get(t):n.headers,r);case tt.RouteParamTypes.SESSION:return(0,sr.transformRequestObjectByType)(t?n.session[t]:n.session,r);case tt.RouteParamTypes.FILESTREAM:return n.files?n.files[0]:void 0;case tt.RouteParamTypes.FILESSTREAM:return n.files;case tt.RouteParamTypes.REQUEST_PATH:return n.baseUrl;case tt.RouteParamTypes.REQUEST_IP:return n.ip;case tt.RouteParamTypes.QUERIES:return n.queries?(0,sr.transformRequestObjectByType)(t?n.queries[t]:n.queries,r):(0,sr.transformRequestObjectByType)(t?n.query[t]:n.query,r);case tt.RouteParamTypes.FIELDS:return t?n.fields[t]:n.fields;case tt.RouteParamTypes.CUSTOM:return t?t(n,i):void 0;default:return null}});Za.extractExpressLikeValue=V5;var eo={};Object.defineProperty(eo,"__esModule",{value:!0}),eo.HttpClient=eo.makeHttpRequest=void 0;const G5=_e,H5=_e,Y5=_e,W5=_e,z5=Gt,Fb=(0,W5.debuglog)("request-client"),Q5=Y5.URL,kc={text:"application/text",json:"application/json",octet:"application/octet-stream"};function kb(e,t){return e[t]||e[t.toLowerCase()]||e[t.toUpperCase()]}async function Ub(e,t={}){Fb(`request '${e}'`);const r=new Q5(e),n=r.protocol==="https:"?H5:G5;t.method=(t.method||"GET").toUpperCase();const{contentType:i,dataType:a,method:o,timeout:s=5e3,...u}=t,c={Accept:kc[a]||kc.octet,...t.headers};let l;if(o==="GET"&&t.data){for(const f of Object.keys(t.data))r.searchParams.set(f,t.data[f]);c["Content-Length"]=0}else t.data&&(l=Buffer.from(JSON.stringify(t.data)),kb(c,"Content-Type")||(c["Content-Type"]=kc[i]||kc.octet),kb(c,"Content-Length")||(c["Content-Length"]=l.byteLength));return new Promise((f,d)=>{const g=n.request(r.toString(),{method:o,headers:c,...u},h=>{h.setTimeout(s,()=>{h.destroy(new Error("Response Timeout"))}),h.on("error",p=>{d(p)});const v=[];h.on("data",p=>{v.push(p)}),h.on("end",()=>{let p=Buffer.concat(v);if((a==="text"||a==="json")&&(p=p.toString("utf8")),a==="json")try{p=JSON.parse(p)}catch{return d(new Error("[httpclient] Unable to parse response data"))}Object.assign(h,{status:h.statusCode,data:p}),Fb(`request '${e}' resolved with status ${h.statusCode}`),f(h)})});g.setTimeout(s,()=>{g.destroy(new z5.MidwayUtilHttpClientTimeoutError("Request Timeout"))}),g.on("error",h=>{d(h)}),o!=="GET"?g.end(l):g.end()})}eo.makeHttpRequest=Ub;class X5{constructor(t={}){this.defaultOptions=t}async request(t,r){return Ub(t,Object.assign(this.defaultOptions,r))}}eo.HttpClient=X5;var to={};Object.defineProperty(to,"__esModule",{value:!0}),to.retryWith=to.retryWithAsync=void 0;const J5=zt.exports,$b=Gt;function Z5(e,t=1,r={}){let n=t,i;return async(...a)=>{do{try{return await e.bind(r.receiver||this)(...a)}catch(o){i=o}r.retryInterval>=0&&await(0,J5.sleep)(r.retryInterval)}while(n-- >0);throw r.throwOriginError?i:new $b.MidwayRetryExceededMaxTimesError(e.name||"anonymous",t,i)}}to.retryWithAsync=Z5;function e3(e,t=1,r={}){let n=t,i;return(...a)=>{do try{return e.bind(r.receiver||this)(...a)}catch(o){i=o}while(n-- >0);throw r.throwOriginError?i:new $b.MidwayRetryExceededMaxTimesError(e.name||"anonymous",t,i)}}to.retryWith=e3;var ro={};Object.defineProperty(ro,"__esModule",{value:!0}),ro.FileUtils=ro.exists=void 0;const jb=_e;async function Kb(e){return jb.promises.access(e,jb.constants.F_OK).then(()=>!0).catch(()=>!1)}ro.exists=Kb,ro.FileUtils={exists:Kb};var Uc={};Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.FORMAT=void 0;const qb=1e3,Vb=qb*60,Gb=Vb*60,lp=Gb*24,t3=lp*7,r3=lp*365.25,n3={ONE_SECOND:qb,ONE_MINUTE:Vb,ONE_HOUR:Gb,ONE_DAY:lp,ONE_WEEK:t3,ONE_YEAR:r3},i3={EVERY_SECOND:"* * * * * *",EVERY_MINUTE:"0 * * * * *",EVERY_HOUR:"0 0 * * * *",EVERY_DAY:"0 0 0 * * *",EVERY_DAY_ZERO_FIFTEEN:"0 15 0 * * *",EVERY_DAY_ONE_FIFTEEN:"0 15 1 * * *",EVERY_PER_5_SECOND:"*/5 * * * * *",EVERY_PER_10_SECOND:"*/10 * * * * *",EVERY_PER_30_SECOND:"*/30 * * * * *",EVERY_PER_5_MINUTE:"0 */5 * * * *",EVERY_PER_10_MINUTE:"0 */10 * * * *",EVERY_PER_30_MINUTE:"0 */30 * * * *"};Uc.FORMAT={MS:n3,CRONTAB:i3};var Hb;function fp(){return Hb||(Hb=1,function(e){var t=me&&me.__createBinding||(Object.create?function(B,X,V,k){k===void 0&&(k=V);var $=Object.getOwnPropertyDescriptor(X,V);(!$||("get"in $?!X.__esModule:$.writable||$.configurable))&&($={enumerable:!0,get:function(){return X[V]}}),Object.defineProperty(B,k,$)}:function(B,X,V,k){k===void 0&&(k=V),B[k]=X[V]}),r=me&&me.__exportStar||function(B,X){for(var V in B)V!=="default"&&!Object.prototype.hasOwnProperty.call(X,V)&&t(X,B,V)};Object.defineProperty(e,"__esModule",{value:!0}),e.FORMAT=e.FileUtils=e.PathFileUtil=e.Types=e.Utils=e.sleep=e.retryWith=e.retryWithAsync=e.extend=e.wrapAsync=e.wrapMiddleware=e.pathMatching=e.transformRequestObjectByType=e.deprecatedOutput=e.delegateTargetAllPrototypeMethod=e.delegateTargetProperties=e.delegateTargetMethod=e.delegateTargetPrototypeMethod=e.safeRequire=e.safelyGet=e.ASYNC_ROOT_CONTEXT=e.DataSourceManager=e.WebRouterCollector=e.MidwayServerlessFunctionService=e.MidwayWebRouterService=e.MidwayMockService=e.MidwayDecoratorService=e.MidwayMiddlewareService=e.MidwayLifeCycleService=e.MidwayAspectService=e.MidwayFrameworkService=e.MidwayLoggerService=e.MidwayInformationService=e.MidwayEnvironmentService=e.MidwayConfigService=e.FunctionalConfiguration=e.createConfiguration=e.BaseFramework=e.MidwayRequestContainer=void 0,r(Ke,e),r(_a,e);var n=as;Object.defineProperty(e,"MidwayRequestContainer",{enumerable:!0,get:function(){return n.MidwayRequestContainer}});var i=os;Object.defineProperty(e,"BaseFramework",{enumerable:!0,get:function(){return i.BaseFramework}}),r(Cc,e),r(ze,e);var a=$n;Object.defineProperty(e,"createConfiguration",{enumerable:!0,get:function(){return a.createConfiguration}}),Object.defineProperty(e,"FunctionalConfiguration",{enumerable:!0,get:function(){return a.FunctionalConfiguration}});var o=yn;Object.defineProperty(e,"MidwayConfigService",{enumerable:!0,get:function(){return o.MidwayConfigService}});var s=Ii;Object.defineProperty(e,"MidwayEnvironmentService",{enumerable:!0,get:function(){return s.MidwayEnvironmentService}});var u=Ta;Object.defineProperty(e,"MidwayInformationService",{enumerable:!0,get:function(){return u.MidwayInformationService}});var c=Oa;Object.defineProperty(e,"MidwayLoggerService",{enumerable:!0,get:function(){return c.MidwayLoggerService}});var l=Ts;Object.defineProperty(e,"MidwayFrameworkService",{enumerable:!0,get:function(){return l.MidwayFrameworkService}});var f=za;Object.defineProperty(e,"MidwayAspectService",{enumerable:!0,get:function(){return f.MidwayAspectService}});var d=Mc;Object.defineProperty(e,"MidwayLifeCycleService",{enumerable:!0,get:function(){return d.MidwayLifeCycleService}});var g=Ka;Object.defineProperty(e,"MidwayMiddlewareService",{enumerable:!0,get:function(){return g.MidwayMiddlewareService}});var h=As;Object.defineProperty(e,"MidwayDecoratorService",{enumerable:!0,get:function(){return h.MidwayDecoratorService}});var v=qa;Object.defineProperty(e,"MidwayMockService",{enumerable:!0,get:function(){return v.MidwayMockService}});var p=Ns;Object.defineProperty(e,"MidwayWebRouterService",{enumerable:!0,get:function(){return p.MidwayWebRouterService}});var y=qi;Object.defineProperty(e,"MidwayServerlessFunctionService",{enumerable:!0,get:function(){return y.MidwayServerlessFunctionService}}),Object.defineProperty(e,"WebRouterCollector",{enumerable:!0,get:function(){return y.WebRouterCollector}});var w=ii;Object.defineProperty(e,"DataSourceManager",{enumerable:!0,get:function(){return w.DataSourceManager}}),r(Ui,e),r(Nc,e),r(ss,e),r(Bc,e),r(An,e),r(Dc,e),r(Cs,e),r(ws,e),r(Os,e),r(K5(),e),r(Gt,e);var m=Nh;Object.defineProperty(e,"ASYNC_ROOT_CONTEXT",{enumerable:!0,get:function(){return m.ASYNC_ROOT_CONTEXT}}),r(Pe(),e),r(Qr,e),r(fe,e);var S=zt.exports;Object.defineProperty(e,"safelyGet",{enumerable:!0,get:function(){return S.safelyGet}}),Object.defineProperty(e,"safeRequire",{enumerable:!0,get:function(){return S.safeRequire}}),Object.defineProperty(e,"delegateTargetPrototypeMethod",{enumerable:!0,get:function(){return S.delegateTargetPrototypeMethod}}),Object.defineProperty(e,"delegateTargetMethod",{enumerable:!0,get:function(){return S.delegateTargetMethod}}),Object.defineProperty(e,"delegateTargetProperties",{enumerable:!0,get:function(){return S.delegateTargetProperties}}),Object.defineProperty(e,"delegateTargetAllPrototypeMethod",{enumerable:!0,get:function(){return S.delegateTargetAllPrototypeMethod}}),Object.defineProperty(e,"deprecatedOutput",{enumerable:!0,get:function(){return S.deprecatedOutput}}),Object.defineProperty(e,"transformRequestObjectByType",{enumerable:!0,get:function(){return S.transformRequestObjectByType}}),Object.defineProperty(e,"pathMatching",{enumerable:!0,get:function(){return S.pathMatching}}),Object.defineProperty(e,"wrapMiddleware",{enumerable:!0,get:function(){return S.wrapMiddleware}}),Object.defineProperty(e,"wrapAsync",{enumerable:!0,get:function(){return S.wrapAsync}});var A=jn;Object.defineProperty(e,"extend",{enumerable:!0,get:function(){return A.extend}}),r(Za,e),r(ap,e),r(ga,e),r(eo,e);var I=to;Object.defineProperty(e,"retryWithAsync",{enumerable:!0,get:function(){return I.retryWithAsync}}),Object.defineProperty(e,"retryWith",{enumerable:!0,get:function(){return I.retryWith}});var N=zt.exports;Object.defineProperty(e,"sleep",{enumerable:!0,get:function(){return N.sleep}}),Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return N.Utils}});var T=Ne;Object.defineProperty(e,"Types",{enumerable:!0,get:function(){return T.Types}});var M=pr;Object.defineProperty(e,"PathFileUtil",{enumerable:!0,get:function(){return M.PathFileUtil}});var P=ro;Object.defineProperty(e,"FileUtils",{enumerable:!0,get:function(){return P.FileUtils}});var L=Uc;Object.defineProperty(e,"FORMAT",{enumerable:!0,get:function(){return L.FORMAT}})}(Df)),Df}(function(e){var t=me&&me.__createBinding||(Object.create?function(a,o,s,u){u===void 0&&(u=s);var c=Object.getOwnPropertyDescriptor(o,s);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(a,u,c)}:function(a,o,s,u){u===void 0&&(u=s),a[u]=o[s]}),r=me&&me.__exportStar||function(a,o){for(var s in a)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,a,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ServerlessTriggerType=e.MidwayFrameworkType=e.FrameworkType=e.MSListenerType=e.MSProviderType=e.InjectModeEnum=e.ScopeEnum=e.FORMAT=e.FileUtils=e.sleep=e.Utils=e.Types=void 0,r(Pe(),e);var n=fp();Object.defineProperty(e,"Types",{enumerable:!0,get:function(){return n.Types}}),Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return n.Utils}}),Object.defineProperty(e,"sleep",{enumerable:!0,get:function(){return n.sleep}}),Object.defineProperty(e,"FileUtils",{enumerable:!0,get:function(){return n.FileUtils}}),Object.defineProperty(e,"FORMAT",{enumerable:!0,get:function(){return n.FORMAT}});var i=fp();Object.defineProperty(e,"ScopeEnum",{enumerable:!0,get:function(){return i.ScopeEnum}}),Object.defineProperty(e,"InjectModeEnum",{enumerable:!0,get:function(){return i.InjectModeEnum}}),Object.defineProperty(e,"MSProviderType",{enumerable:!0,get:function(){return i.MSProviderType}}),Object.defineProperty(e,"MSListenerType",{enumerable:!0,get:function(){return i.MSListenerType}}),Object.defineProperty(e,"FrameworkType",{enumerable:!0,get:function(){return i.FrameworkType}}),Object.defineProperty(e,"MidwayFrameworkType",{enumerable:!0,get:function(){return i.MidwayFrameworkType}}),Object.defineProperty(e,"ServerlessTriggerType",{enumerable:!0,get:function(){return i.ServerlessTriggerType}})})(No);var a3=Object.defineProperty,o3=Object.getOwnPropertyDescriptor,$c=(e,t,r,n)=>{for(var i=n>1?void 0:n?o3(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&a3(t,r,i),i};let Fs=class{constructor(){ot(this,"config");ot(this,"logger");ot(this,"decoratorService")}async onReady(e){this.logger.info("pipeline install"),this.logger.info("pipeline installed")}};$c([No.Config()],Fs.prototype,"config",2),$c([No.Logger()],Fs.prototype,"logger",2),$c([No.Inject()],Fs.prototype,"decoratorService",2),Fs=$c([No.Configuration({namespace:"pipeline"})],Fs),$e.Client=require("./client"),$e.directory={buypass:{staging:"https://api.test4.buypass.no/acme/directory",production:"https://api.buypass.com/acme/directory"},letsencrypt:{staging:"https://acme-staging-v02.api.letsencrypt.org/directory",production:"https://acme-v02.api.letsencrypt.org/directory"},zerossl:{production:"https://acme.zerossl.com/v2/DV90"}},$e.crypto=require("./crypto"),$e.forge=require("./crypto/forge"),$e.axios=require("./axios"),$e.setLogger=require("./logger").setLogger;class s3{constructor(t){ot(this,"userContext");ot(this,"logger");this.userContext=t.userContext,this.logger=t.logger,(void 0)(r=>{this.logger.info(r)})}async getAccountConfig(t){return await this.userContext.getObj(this.buildAccountKey(t))||{}}buildAccountKey(t){return"acme.config."+t}async saveAccountConfig(t,r){await this.userContext.setObj(this.buildAccountKey(t),r)}async getAcmeClient(t,r=!1){const n=await this.getAccountConfig(t);n.key==null&&(n.key=await this.createNewKey(),await this.saveAccountConfig(t,n));const i=new(void 0)({directoryUrl:void 0,accountKey:n.key,accountUrl:n.accountUrl,backoffAttempts:20,backoffMin:5e3,backoffMax:1e4});if(n.accountUrl==null){const a={termsOfServiceAgreed:!0,contact:[`mailto:${t}`]};await i.createAccount(a),n.accountUrl=i.getAccountUrl(),await this.saveAccountConfig(t,n)}return i}async createNewKey(){return(await(void 0)()).toString()}async challengeCreateFn(t,r,n,i){if(this.logger.info("Triggered challengeCreateFn()"),r.type==="http-01"){const a=`/var/www/html/.well-known/acme-challenge/${r.token}`,o=n;this.logger.info(`Creating challenge response for ${t.identifier.value} at path: ${a}`),this.logger.info(`Would write "${o}" to path "${a}"`)}else if(r.type==="dns-01"){const a=`_acme-challenge.${t.identifier.value}`,o=n;return this.logger.info(`Creating TXT record for ${t.identifier.value}: ${a}`),this.logger.info(`Would create TXT record "${a}" with value "${o}"`),await i.createRecord({fullRecord:a,type:"TXT",value:o})}}async challengeRemoveFn(t,r,n,i,a){if(this.logger.info("Triggered challengeRemoveFn()"),r.type==="http-01"){const o=`/var/www/html/.well-known/acme-challenge/${r.token}`;this.logger.info(`Removing challenge response for ${t.identifier.value} at path: ${o}`),this.logger.info(`Would remove file on path "${o}"`)}else if(r.type==="dns-01"){const o=`_acme-challenge.${t.identifier.value}`,s=n;this.logger.info(`Removing TXT record for ${t.identifier.value}: ${o}`),this.logger.info(`Would remove TXT record "${o}" with value "${s}"`);try{await a.removeRecord({fullRecord:o,type:"TXT",value:n,record:i})}catch(u){throw this.logger.error("\u5220\u9664\u89E3\u6790\u8BB0\u5F55\u51FA\u9519\uFF1A",u),u}}}async order(t){const{email:r,isTest:n,domains:i,csrInfo:a,dnsProvider:o}=t,s=await this.getAcmeClient(r,n),{commonName:u,altNames:c}=this.buildCommonNameByDomains(i),[l,f]=await(void 0)({commonName:u,...a,altNames:c});if(o==null)throw new Error("dnsProvider \u4E0D\u80FD\u4E3A\u7A7A");const g={crt:(await s.auto({csr:f,email:r,termsOfServiceAgreed:!0,challengePriority:["dns-01"],challengeCreateFn:async(h,v,p)=>await this.challengeCreateFn(h,v,p,o),challengeRemoveFn:async(h,v,p,y)=>await this.challengeRemoveFn(h,v,p,y,o)})).toString(),key:l.toString(),csr:f.toString()};return this.logger.debug(`CSR:
|
|
80
|
-
${g.csr}`),this.logger.debug(`Certificate:
|
|
81
|
-
${g.crt}`),this.logger.info("\u8BC1\u4E66\u7533\u8BF7\u6210\u529F"),g}buildCommonNameByDomains(t){if(typeof t=="string"&&(t=t.split(",")),t.length===0)throw new Error("domain can not be empty");const r=t[0];let n;return t.length>1&&(n=bo.default.slice(t,1)),{commonName:r,altNames:n}}}const dp=new pg,Yb="pipeline:dns-provider";function u3(e){return t=>{t=Bn.target(t);const r={},n=Bn.getClassProperties(t);for(const i in n){const a=Reflect.getMetadata(Al,t,i);a&&(r[i]=a)}bo.default.merge(e,{autowire:r}),Reflect.defineMetadata(Yb,e,t),t.define=e,dp.register(e.name,{define:e,target:t})}}var Wb={exports:{}},ke={options:{usePureJavaScript:!1}},hp={},c3=hp,zb={};hp.encode=function(e,t,r){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');var n="";if(!(e instanceof Uint8Array))n=l3(e,t);else{var i=0,a=t.length,o=t.charAt(0),s=[0];for(i=0;i<e.length;++i){for(var u=0,c=e[i];u<s.length;++u)c+=s[u]<<8,s[u]=c%a,c=c/a|0;for(;c>0;)s.push(c%a),c=c/a|0}for(i=0;e[i]===0&&i<e.length-1;++i)n+=o;for(i=s.length-1;i>=0;--i)n+=t[s[i]]}if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join(`\r
|
|
82
|
-
`)}return n},hp.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var r=zb[t];if(!r){r=zb[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");for(var i=t.length,a=t.charAt(0),o=[0],n=0;n<e.length;n++){var s=r[e.charCodeAt(n)];if(s===void 0)return;for(var u=0,c=s;u<o.length;++u)c+=o[u]*i,o[u]=c&255,c>>=8;for(;c>0;)o.push(c&255),c>>=8}for(var l=0;e[l]===a&&l<e.length-1;++l)o.push(0);return typeof Buffer<"u"?Buffer.from(o.reverse()):new Uint8Array(o.reverse())};function l3(e,t){var r=0,n=t.length,i=t.charAt(0),a=[0];for(r=0;r<e.length();++r){for(var o=0,s=e.at(r);o<a.length;++o)s+=a[o]<<8,a[o]=s%n,s=s/n|0;for(;s>0;)a.push(s%n),s=s/n|0}var u="";for(r=0;e.at(r)===0&&r<e.length()-1;++r)u+=i;for(r=a.length-1;r>=0;--r)u+=t[a[r]];return u}var Qb=ke,Xb=c3,ee=Qb.util=Qb.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){ee.nextTick=process.nextTick,typeof setImmediate=="function"?ee.setImmediate=setImmediate:ee.setImmediate=ee.nextTick;return}if(typeof setImmediate=="function"){ee.setImmediate=function(){return setImmediate.apply(void 0,arguments)},ee.nextTick=function(o){return setImmediate(o)};return}if(ee.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(s){if(s.source===window&&s.data===e){s.stopPropagation();var u=t.slice();t.length=0,u.forEach(function(c){c()})}};var e="forge.setImmediate",t=[];ee.setImmediate=function(s){t.push(s),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var r=Date.now(),n=!0,i=document.createElement("div"),t=[];new MutationObserver(function(){var s=t.slice();t.length=0,s.forEach(function(u){u()})}).observe(i,{attributes:!0});var a=ee.setImmediate;ee.setImmediate=function(s){Date.now()-r>15?(r=Date.now(),a(s)):(t.push(s),t.length===1&&i.setAttribute("a",n=!n))}}ee.nextTick=ee.setImmediate})(),ee.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,ee.globalScope=function(){return ee.isNodejs?me:typeof self>"u"?window:self}(),ee.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},ee.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer},ee.isArrayBufferView=function(e){return e&&ee.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function ks(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}ee.ByteBuffer=pp;function pp(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(ee.isArrayBuffer(e)||ee.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof pp||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}ee.ByteStringBuffer=pp;var f3=4096;ee.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>f3&&(this.data.substr(0,1),this._constructedStringLength=0)},ee.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},ee.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},ee.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},ee.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)t&1&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},ee.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},ee.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(ee.encodeUtf8(e))},ee.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))},ee.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))},ee.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))},ee.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))},ee.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},ee.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},ee.ByteStringBuffer.prototype.putInt=function(e,t){ks(t);var r="";do t-=8,r+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(r)},ee.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},ee.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},ee.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},ee.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},ee.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},ee.ByteStringBuffer.prototype.getInt32=function(){var e=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,e},ee.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},ee.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},ee.ByteStringBuffer.prototype.getInt32Le=function(){var e=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,e},ee.ByteStringBuffer.prototype.getInt=function(e){ks(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t},ee.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},ee.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t},ee.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},ee.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},ee.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},ee.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},ee.ByteStringBuffer.prototype.copy=function(){var e=ee.createBuffer(this.data);return e.read=this.read,e},ee.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},ee.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},ee.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},ee.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},ee.ByteStringBuffer.prototype.toString=function(){return ee.decodeUtf8(this.bytes())};function d3(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=ee.isArrayBuffer(e),n=ee.isArrayBufferView(e);if(r||n){r?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}ee.DataBuffer=d3,ee.DataBuffer.prototype.length=function(){return this.write-this.read},ee.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},ee.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},ee.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},ee.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},ee.DataBuffer.prototype.putBytes=function(e,t){if(ee.isArrayBufferView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var i=new Uint8Array(this.data.buffer,this.write);return i.set(r),this.write+=n,this}if(ee.isArrayBuffer(e)){var r=new Uint8Array(e);this.accommodate(r.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(r,this.write),this.write+=r.byteLength,this}if(e instanceof ee.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&ee.isArrayBufferView(e.data)){var r=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(r.byteLength);var i=new Uint8Array(e.data.byteLength,this.write);return i.set(r),this.write+=r.byteLength,this}if(e instanceof ee.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var a;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=ee.binary.hex.decode(e,a,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),a=new Uint8Array(this.data.buffer,this.write),this.write+=ee.binary.base64.decode(e,a,this.write),this;if(t==="utf8"&&(e=ee.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=ee.binary.raw.decode(a),this;if(t==="utf16")return this.accommodate(e.length*2),a=new Uint16Array(this.data.buffer,this.write),this.write+=ee.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},ee.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},ee.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},ee.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},ee.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},ee.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},ee.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},ee.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},ee.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},ee.DataBuffer.prototype.putInt=function(e,t){ks(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this},ee.DataBuffer.prototype.putSignedInt=function(e,t){return ks(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},ee.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},ee.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},ee.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},ee.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},ee.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},ee.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},ee.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},ee.DataBuffer.prototype.getInt=function(e){ks(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t},ee.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},ee.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t},ee.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},ee.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},ee.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},ee.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},ee.DataBuffer.prototype.copy=function(){return new ee.DataBuffer(this)},ee.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},ee.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},ee.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},ee.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},ee.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return ee.binary.raw.encode(t);if(e==="hex")return ee.binary.hex.encode(t);if(e==="base64")return ee.binary.base64.encode(t);if(e==="utf8")return ee.text.utf8.decode(t);if(e==="utf16")return ee.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},ee.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=ee.encodeUtf8(e)),new ee.ByteBuffer(e)},ee.fillString=function(e,t){for(var r="";t>0;)t&1&&(r+=e),t>>>=1,t>0&&(e+=e);return r},ee.xorBytes=function(e,t,r){for(var n="",i="",a="",o=0,s=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(i),++s;return n+=a,n},ee.hexToBytes=function(e){var t="",r=0;for(e.length&!0&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},ee.bytesToHex=function(e){return ee.createBuffer(e).toHex()},ee.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var ai="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",oi=[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],Jb="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";ee.encode64=function(e,t){for(var r="",n="",i,a,o,s=0;s<e.length;)i=e.charCodeAt(s++),a=e.charCodeAt(s++),o=e.charCodeAt(s++),r+=ai.charAt(i>>2),r+=ai.charAt((i&3)<<4|a>>4),isNaN(a)?r+="==":(r+=ai.charAt((a&15)<<2|o>>6),r+=isNaN(o)?"=":ai.charAt(o&63)),t&&r.length>t&&(n+=r.substr(0,t)+`\r
|
|
83
|
-
`,r=r.substr(t));return n+=r,n},ee.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",r,n,i,a,o=0;o<e.length;)r=oi[e.charCodeAt(o++)-43],n=oi[e.charCodeAt(o++)-43],i=oi[e.charCodeAt(o++)-43],a=oi[e.charCodeAt(o++)-43],t+=String.fromCharCode(r<<2|n>>4),i!==64&&(t+=String.fromCharCode((n&15)<<4|i>>2),a!==64&&(t+=String.fromCharCode((i&3)<<6|a)));return t},ee.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},ee.decodeUtf8=function(e){return decodeURIComponent(escape(e))},ee.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Xb.encode,decode:Xb.decode}},ee.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},ee.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,a=0;a<e.length;++a)n[i++]=e.charCodeAt(a);return t?i-r:n},ee.binary.hex.encode=ee.bytesToHex,ee.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2))),r=r||0;var i=0,a=r;for(e.length&1&&(i=1,n[a++]=parseInt(e[0],16));i<e.length;i+=2)n[a++]=parseInt(e.substr(i,2),16);return t?a-r:n},ee.binary.base64.encode=function(e,t){for(var r="",n="",i,a,o,s=0;s<e.byteLength;)i=e[s++],a=e[s++],o=e[s++],r+=ai.charAt(i>>2),r+=ai.charAt((i&3)<<4|a>>4),isNaN(a)?r+="==":(r+=ai.charAt((a&15)<<2|o>>6),r+=isNaN(o)?"=":ai.charAt(o&63)),t&&r.length>t&&(n+=r.substr(0,t)+`\r
|
|
84
|
-
`,r=r.substr(t));return n+=r,n},ee.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var i,a,o,s,u=0,c=r;u<e.length;)i=oi[e.charCodeAt(u++)-43],a=oi[e.charCodeAt(u++)-43],o=oi[e.charCodeAt(u++)-43],s=oi[e.charCodeAt(u++)-43],n[c++]=i<<2|a>>4,o!==64&&(n[c++]=(a&15)<<4|o>>2,s!==64&&(n[c++]=(o&3)<<6|s));return t?c-r:n.subarray(0,c)},ee.binary.base58.encode=function(e,t){return ee.binary.baseN.encode(e,Jb,t)},ee.binary.base58.decode=function(e,t){return ee.binary.baseN.decode(e,Jb,t)},ee.text={utf8:{},utf16:{}},ee.text.utf8.encode=function(e,t,r){e=ee.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,a=0;a<e.length;++a)n[i++]=e.charCodeAt(a);return t?i-r:n},ee.text.utf8.decode=function(e){return ee.decodeUtf8(String.fromCharCode.apply(null,e))},ee.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length*2));var i=new Uint16Array(n.buffer);r=r||0;for(var a=r,o=r,s=0;s<e.length;++s)i[o++]=e.charCodeAt(s),a+=2;return t?a-r:n},ee.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},ee.deflate=function(e,t,r){if(t=ee.decode64(e.deflate(ee.encode64(t)).rval),r){var n=2,i=t.charCodeAt(1);i&32&&(n=6),t=t.substring(n,t.length-4)}return t},ee.inflate=function(e,t,r){var n=e.inflate(ee.encode64(t)).rval;return n===null?null:ee.decode64(n)};var gp=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(r===null?n=e.removeItem(t):(r=ee.encode64(JSON.stringify(r)),n=e.setItem(t,r)),typeof n<"u"&&n.rval!==!0){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},yp=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(r.rval===null){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return r!==null&&(r=JSON.parse(ee.decode64(r))),r},h3=function(e,t,r,n){var i=yp(e,t);i===null&&(i={}),i[r]=n,gp(e,t,i)},p3=function(e,t,r){var n=yp(e,t);return n!==null&&(n=r in n?n[r]:null),n},g3=function(e,t,r){var n=yp(e,t);if(n!==null&&r in n){delete n[r];var i=!0;for(var a in n){i=!1;break}i&&(n=null),gp(e,t,n)}},y3=function(e,t){gp(e,t,null)},jc=function(e,t,r){var n=null;typeof r>"u"&&(r=["web","flash"]);var i,a=!1,o=null;for(var s in r){i=r[s];try{if(i==="flash"||i==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");n=e.apply(this,t),a=i==="flash"}(i==="web"||i==="both")&&(t[0]=localStorage,n=e.apply(this,t),a=!0)}catch(u){o=u}if(a)break}if(!a)throw o;return n};ee.setItem=function(e,t,r,n,i){jc(h3,arguments,i)},ee.getItem=function(e,t,r,n){return jc(p3,arguments,n)},ee.removeItem=function(e,t,r,n){jc(g3,arguments,n)},ee.clearItems=function(e,t,r){jc(y3,arguments,r)},ee.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=r===null?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(n.port!==80&&n.scheme==="http"||n.port!==443&&n.scheme==="https")&&(n.fullHost+=":"+n.port):n.scheme==="http"?n.port=80:n.scheme==="https"&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var Kc=null;ee.getQueryVariables=function(e){var t=function(n){for(var i={},a=n.split("&"),o=0;o<a.length;o++){var s=a[o].indexOf("="),u,c;s>0?(u=a[o].substring(0,s),c=a[o].substring(s+1)):(u=a[o],c=null),u in i||(i[u]=[]),!(u in Object.prototype)&&c!==null&&i[u].push(unescape(c))}return i},r;return typeof e>"u"?(Kc===null&&(typeof window<"u"&&window.location&&window.location.search?Kc=t(window.location.search.substring(1)):Kc={}),r=Kc):r=t(e),r},ee.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");i.length>0&&i[0]===""&&i.shift();var a=r===""?{}:ee.getQueryVariables(r);return{pathString:t,queryString:r,path:i,query:a}},ee.makeRequest=function(e){var t=ee.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(n){return typeof n>"u"?t.path:t.path[n]},getQuery:function(n,i){var a;return typeof n>"u"?a=t.query:(a=t.query[n],a&&typeof i<"u"&&(a=a[i])),a},getQueryLast:function(n,i){var a,o=r.getQuery(n);return o?a=o[o.length-1]:a=i,a}};return r},ee.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},ee.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},ee.format=function(e){for(var t=/%./g,r,n,i=0,a=[],o=0;r=t.exec(e);){n=e.substring(o,t.lastIndex-2),n.length>0&&a.push(n),o=t.lastIndex;var s=r[0][1];switch(s){case"s":case"o":i<arguments.length?a.push(arguments[i+++1]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(e.substring(o)),a.join("")},ee.formatNumber=function(e,t,r,n){var i=e,a=isNaN(t=Math.abs(t))?2:t,o=r===void 0?",":r,s=n===void 0?".":n,u=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(a),10)+"",l=c.length>3?c.length%3:0;return u+(l?c.substr(0,l)+s:"")+c.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(i-c).toFixed(a).slice(2):"")},ee.formatSize=function(e){return e>=1073741824?e=ee.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=ee.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=ee.formatNumber(e/1024,0)+" KiB":e=ee.formatNumber(e,0)+" bytes",e},ee.bytesFromIP=function(e){return e.indexOf(".")!==-1?ee.bytesFromIPv4(e):e.indexOf(":")!==-1?ee.bytesFromIPv6(e):null},ee.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=ee.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},ee.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(o){return o.length===0&&++t,!0});for(var r=(8-e.length+t)*2,n=ee.createBuffer(),i=0;i<8;++i){if(!e[i]||e[i].length===0){n.fillWithByte(0,r),r=0;continue}var a=ee.hexToBytes(e[i]);a.length<2&&n.putByte(0),n.putBytes(a)}return n.getBytes()},ee.bytesToIP=function(e){return e.length===4?ee.bytesToIPv4(e):e.length===16?ee.bytesToIPv6(e):null},ee.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},ee.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var a=ee.bytesToHex(e[i]+e[i+1]);a[0]==="0"&&a!=="0";)a=a.substr(1);if(a==="0"){var o=r[r.length-1],s=t.length;!o||s!==o.end+1?r.push({start:s,end:s}):(o.end=s,o.end-o.start>r[n].end-r[n].start&&(n=r.length-1))}t.push(a)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),u.start===0&&t.unshift(""),u.end===7&&t.push(""))}return t.join(":")},ee.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in ee&&!e.update)return t(null,ee.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return ee.cores=navigator.hardwareConcurrency,t(null,ee.cores);if(typeof Worker>"u")return ee.cores=1,t(null,ee.cores);if(typeof Blob>"u")return ee.cores=2,t(null,ee.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(o){var s=Date.now(),u=s+4;self.postMessage({st:s,et:u})})}.toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(o,s,u){if(s===0){var c=Math.floor(o.reduce(function(l,f){return l+f},0)/o.length);return ee.cores=Math.max(1,c),URL.revokeObjectURL(r),t(null,ee.cores)}i(u,function(l,f){o.push(a(u,f)),n(o,s-1,u)})}function i(o,s){for(var u=[],c=[],l=0;l<o;++l){var f=new Worker(r);f.addEventListener("message",function(d){if(c.push(d.data),c.length===o){for(var g=0;g<o;++g)u[g].terminate();s(null,c)}}),u.push(f)}for(var l=0;l<o;++l)u[l].postMessage(l)}function a(o,s){for(var u=[],c=0;c<o;++c)for(var l=s[c],f=u[c]=[],d=0;d<o;++d)if(c!==d){var g=s[d];(l.st>g.st&&l.st<g.et||g.st>l.st&&g.st<l.et)&&f.push(d)}return u.reduce(function(h,v){return Math.max(h,v.length)},0)}};var It=ke;It.cipher=It.cipher||{},It.cipher.algorithms=It.cipher.algorithms||{},It.cipher.createCipher=function(e,t){var r=e;if(typeof r=="string"&&(r=It.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new It.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},It.cipher.createDecipher=function(e,t){var r=e;if(typeof r=="string"&&(r=It.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new It.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},It.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),It.cipher.algorithms[e]=t},It.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in It.cipher.algorithms?It.cipher.algorithms[e]:null};var vp=It.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};vp.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=It.util.createBuffer(),this.output=e.output||It.util.createBuffer(),this.mode.start(t)},vp.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},vp.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return e(this.blockSize,r,!1)},this.mode.unpad=function(r){return e(this.blockSize,r,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))};var Ot=ke;Ot.cipher=Ot.cipher||{};var qe=Ot.cipher.modes=Ot.cipher.modes||{};qe.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},qe.ecb.prototype.start=function(e){},qe.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},qe.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},qe.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},qe.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return n>this.blockSize<<2?!1:(e.truncate(n),!0)},qe.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},qe.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=qc(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},qe.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},qe.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},qe.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},qe.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return n>this.blockSize<<2?!1:(e.truncate(n),!0)},qe.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Ot.util.createBuffer(),this._partialBytes=0},qe.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=qc(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},qe.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);return}var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(a>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0},qe.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);return}var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0},qe.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Ot.util.createBuffer(),this._partialBytes=0},qe.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=qc(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},qe.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];return}var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0},qe.ofb.prototype.decrypt=qe.ofb.prototype.encrypt,qe.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Ot.util.createBuffer(),this._partialBytes=0},qe.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=qc(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},qe.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Vc(this._inBlock)},qe.ctr.prototype.decrypt=qe.ctr.prototype.encrypt,qe.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Ot.util.createBuffer(),this._partialBytes=0,this._R=3774873600},qe.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=Ot.util.createBuffer(e.iv);this._cipherLength=0;var r;if("additionalData"in e?r=Ot.util.createBuffer(e.additionalData):r=Ot.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=Ot.util.createBuffer(e.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 n=t.length();if(n===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(mp(n*8)))}this._inBlock=this._j0.slice(0),Vc(this._inBlock),this._partialBytes=0,r=Ot.util.createBuffer(r),this._aDataLength=mp(r.length()*8);var i=r.length()%this.blockSize;for(i&&r.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},qe.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a<=0||r){if(r){var o=n%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Vc(this._inBlock)},qe.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Vc(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},qe.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=Ot.util.createBuffer();var n=this._aDataLength.concat(mp(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var a=0;a<this._ints;++a)this.tag.putInt32(this._s[a]^i[a]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},qe.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){var a=e[i/32|0]&1<<31-i%32;a&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},qe.gcm.prototype.pow=function(e,t){for(var r=e[3]&1,n=3;n>0;--n)t[n]=e[n]>>>1|(e[n-1]&1)<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},qe.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=e[n]>>>(7-r%8)*4&15,a=this._m[r][i];t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3]}return t},qe.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},qe.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,a=new Array(i),o=0;o<i;++o){var s=[0,0,0,0],u=o/n|0,c=(n-1-o%n)*t;s[u]=1<<t-1<<c,a[o]=this.generateSubHashTable(this.multiply(s,e),t)}return a},qe.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var a=n>>>1;a>0;)this.pow(i[2*a],i[a]=[]),a>>=1;for(a=2;a<n;){for(var o=1;o<a;++o){var s=i[a],u=i[o];i[a+o]=[s[0]^u[0],s[1]^u[1],s[2]^u[2],s[3]^u[3]]}a*=2}for(i[0]=[0,0,0,0],a=n+1;a<r;++a){var c=i[a^n];i[a]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return i};function qc(e,t){if(typeof e=="string"&&(e=Ot.util.createBuffer(e)),Ot.util.isArray(e)&&e.length>4){var r=e;e=Ot.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!Ot.util.isArray(e)){for(var i=[],a=t/4,n=0;n<a;++n)i.push(e.getInt32());e=i}return e}function Vc(e){e[e.length-1]=e[e.length-1]+1&4294967295}function mp(e){return[e/4294967296|0,e&4294967295]}var st=ke;st.aes=st.aes||{},st.aes.startEncrypting=function(e,t,r,n){var i=Gc({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},st.aes.createEncryptionCipher=function(e,t){return Gc({key:e,output:null,decrypt:!1,mode:t})},st.aes.startDecrypting=function(e,t,r,n){var i=Gc({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},st.aes.createDecryptionCipher=function(e,t){return Gc({key:e,output:null,decrypt:!0,mode:t})},st.aes.Algorithm=function(e,t){Ep||e_();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(n,i){return _p(r._w,n,i,!1)},decrypt:function(n,i){return _p(r._w,n,i,!0)}}}),r._init=!1},st.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,r;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=st.util.createBuffer(t);else if(st.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){r=t,t=st.util.createBuffer();for(var n=0;n<r.length;++n)t.putByte(r[n])}if(!st.util.isArray(t)){r=t,t=[];var i=r.length();if(i===16||i===24||i===32){i=i>>>2;for(var n=0;n<i;++n)t.push(r.getInt32())}}if(!st.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var a=this.mode.name,o=["CFB","OFB","CTR","GCM"].indexOf(a)!==-1;this._w=t_(t,e.decrypt&&!o),this._init=!0}},st.aes._expandKey=function(e,t){return Ep||e_(),t_(e,t)},st.aes._updateBlock=_p,no("AES-ECB",st.cipher.modes.ecb),no("AES-CBC",st.cipher.modes.cbc),no("AES-CFB",st.cipher.modes.cfb),no("AES-OFB",st.cipher.modes.ofb),no("AES-CTR",st.cipher.modes.ctr),no("AES-GCM",st.cipher.modes.gcm);function no(e,t){var r=function(){return new st.aes.Algorithm(e,t)};st.cipher.registerAlgorithm(e,r)}var Ep=!1,io=4,Zt,bp,Zb,Vi,qr;function e_(){Ep=!0,Zb=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;Zt=new Array(256),bp=new Array(256),Vi=new Array(4),qr=new Array(4);for(var t=0;t<4;++t)Vi[t]=new Array(256),qr[t]=new Array(256);for(var r=0,n=0,i,a,o,s,u,c,l,t=0;t<256;++t){s=n^n<<1^n<<2^n<<3^n<<4,s=s>>8^s&255^99,Zt[r]=s,bp[s]=r,u=e[s],i=e[r],a=e[i],o=e[a],c=u<<24^s<<16^s<<8^(s^u),l=(i^a^o)<<24^(r^o)<<16^(r^a^o)<<8^(r^i^o);for(var f=0;f<4;++f)Vi[f][r]=c,qr[f][s]=l,c=c<<24|c>>>8,l=l<<24|l>>>8;r===0?r=n=1:(r=i^e[e[e[i^o]]],n^=e[e[n]])}}function t_(e,t){for(var r=e.slice(0),n,i=1,a=r.length,o=a+6+1,s=io*o,u=a;u<s;++u)n=r[u-1],u%a===0?(n=Zt[n>>>16&255]<<24^Zt[n>>>8&255]<<16^Zt[n&255]<<8^Zt[n>>>24]^Zb[i]<<24,i++):a>6&&u%a===4&&(n=Zt[n>>>24]<<24^Zt[n>>>16&255]<<16^Zt[n>>>8&255]<<8^Zt[n&255]),r[u]=r[u-a]^n;if(t){var c,l=qr[0],f=qr[1],d=qr[2],g=qr[3],h=r.slice(0);s=r.length;for(var u=0,v=s-io;u<s;u+=io,v-=io)if(u===0||u===s-io)h[u]=r[v],h[u+1]=r[v+3],h[u+2]=r[v+2],h[u+3]=r[v+1];else for(var p=0;p<io;++p)c=r[v+p],h[u+(3&-p)]=l[Zt[c>>>24]]^f[Zt[c>>>16&255]]^d[Zt[c>>>8&255]]^g[Zt[c&255]];r=h}return r}function _p(e,t,r,n){var i=e.length/4-1,a,o,s,u,c;n?(a=qr[0],o=qr[1],s=qr[2],u=qr[3],c=bp):(a=Vi[0],o=Vi[1],s=Vi[2],u=Vi[3],c=Zt);var l,f,d,g,h,v,p;l=t[0]^e[0],f=t[n?3:1]^e[1],d=t[2]^e[2],g=t[n?1:3]^e[3];for(var y=3,w=1;w<i;++w)h=a[l>>>24]^o[f>>>16&255]^s[d>>>8&255]^u[g&255]^e[++y],v=a[f>>>24]^o[d>>>16&255]^s[g>>>8&255]^u[l&255]^e[++y],p=a[d>>>24]^o[g>>>16&255]^s[l>>>8&255]^u[f&255]^e[++y],g=a[g>>>24]^o[l>>>16&255]^s[f>>>8&255]^u[d&255]^e[++y],l=h,f=v,d=p;r[0]=c[l>>>24]<<24^c[f>>>16&255]<<16^c[d>>>8&255]<<8^c[g&255]^e[++y],r[n?3:1]=c[f>>>24]<<24^c[d>>>16&255]<<16^c[g>>>8&255]<<8^c[l&255]^e[++y],r[2]=c[d>>>24]<<24^c[g>>>16&255]<<16^c[l>>>8&255]<<8^c[f&255]^e[++y],r[n?1:3]=c[g>>>24]<<24^c[l>>>16&255]<<16^c[f>>>8&255]<<8^c[d&255]^e[++y]}function Gc(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="AES-"+t,n;e.decrypt?n=st.cipher.createDecipher(r,e.key):n=st.cipher.createCipher(r,e.key);var i=n.start;return n.start=function(a,o){var s=null;o instanceof st.util.ByteBuffer&&(s=o,o={}),o=o||{},o.output=s,o.iv=a,i.call(n,o)},n}var Us=ke;Us.pki=Us.pki||{};var Sp=Us.pki.oids=Us.oids=Us.oids||{};function be(e,t){Sp[e]=t,Sp[t]=e}function Ze(e,t){Sp[e]=t}be("1.2.840.113549.1.1.1","rsaEncryption"),be("1.2.840.113549.1.1.4","md5WithRSAEncryption"),be("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),be("1.2.840.113549.1.1.7","RSAES-OAEP"),be("1.2.840.113549.1.1.8","mgf1"),be("1.2.840.113549.1.1.9","pSpecified"),be("1.2.840.113549.1.1.10","RSASSA-PSS"),be("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),be("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),be("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),be("1.3.101.112","EdDSA25519"),be("1.2.840.10040.4.3","dsa-with-sha1"),be("1.3.14.3.2.7","desCBC"),be("1.3.14.3.2.26","sha1"),be("2.16.840.1.101.3.4.2.1","sha256"),be("2.16.840.1.101.3.4.2.2","sha384"),be("2.16.840.1.101.3.4.2.3","sha512"),be("1.2.840.113549.2.5","md5"),be("1.2.840.113549.1.7.1","data"),be("1.2.840.113549.1.7.2","signedData"),be("1.2.840.113549.1.7.3","envelopedData"),be("1.2.840.113549.1.7.4","signedAndEnvelopedData"),be("1.2.840.113549.1.7.5","digestedData"),be("1.2.840.113549.1.7.6","encryptedData"),be("1.2.840.113549.1.9.1","emailAddress"),be("1.2.840.113549.1.9.2","unstructuredName"),be("1.2.840.113549.1.9.3","contentType"),be("1.2.840.113549.1.9.4","messageDigest"),be("1.2.840.113549.1.9.5","signingTime"),be("1.2.840.113549.1.9.6","counterSignature"),be("1.2.840.113549.1.9.7","challengePassword"),be("1.2.840.113549.1.9.8","unstructuredAddress"),be("1.2.840.113549.1.9.14","extensionRequest"),be("1.2.840.113549.1.9.20","friendlyName"),be("1.2.840.113549.1.9.21","localKeyId"),be("1.2.840.113549.1.9.22.1","x509Certificate"),be("1.2.840.113549.1.12.10.1.1","keyBag"),be("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),be("1.2.840.113549.1.12.10.1.3","certBag"),be("1.2.840.113549.1.12.10.1.4","crlBag"),be("1.2.840.113549.1.12.10.1.5","secretBag"),be("1.2.840.113549.1.12.10.1.6","safeContentsBag"),be("1.2.840.113549.1.5.13","pkcs5PBES2"),be("1.2.840.113549.1.5.12","pkcs5PBKDF2"),be("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),be("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),be("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),be("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),be("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),be("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),be("1.2.840.113549.2.7","hmacWithSHA1"),be("1.2.840.113549.2.8","hmacWithSHA224"),be("1.2.840.113549.2.9","hmacWithSHA256"),be("1.2.840.113549.2.10","hmacWithSHA384"),be("1.2.840.113549.2.11","hmacWithSHA512"),be("1.2.840.113549.3.7","des-EDE3-CBC"),be("2.16.840.1.101.3.4.1.2","aes128-CBC"),be("2.16.840.1.101.3.4.1.22","aes192-CBC"),be("2.16.840.1.101.3.4.1.42","aes256-CBC"),be("2.5.4.3","commonName"),be("2.5.4.5","serialName"),be("2.5.4.6","countryName"),be("2.5.4.7","localityName"),be("2.5.4.8","stateOrProvinceName"),be("2.5.4.9","streetAddress"),be("2.5.4.10","organizationName"),be("2.5.4.11","organizationalUnitName"),be("2.5.4.13","description"),be("2.5.4.15","businessCategory"),be("2.5.4.17","postalCode"),be("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),be("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),be("2.16.840.1.113730.1.1","nsCertType"),be("2.16.840.1.113730.1.13","nsComment"),Ze("2.5.29.1","authorityKeyIdentifier"),Ze("2.5.29.2","keyAttributes"),Ze("2.5.29.3","certificatePolicies"),Ze("2.5.29.4","keyUsageRestriction"),Ze("2.5.29.5","policyMapping"),Ze("2.5.29.6","subtreesConstraint"),Ze("2.5.29.7","subjectAltName"),Ze("2.5.29.8","issuerAltName"),Ze("2.5.29.9","subjectDirectoryAttributes"),Ze("2.5.29.10","basicConstraints"),Ze("2.5.29.11","nameConstraints"),Ze("2.5.29.12","policyConstraints"),Ze("2.5.29.13","basicConstraints"),be("2.5.29.14","subjectKeyIdentifier"),be("2.5.29.15","keyUsage"),Ze("2.5.29.16","privateKeyUsagePeriod"),be("2.5.29.17","subjectAltName"),be("2.5.29.18","issuerAltName"),be("2.5.29.19","basicConstraints"),Ze("2.5.29.20","cRLNumber"),Ze("2.5.29.21","cRLReason"),Ze("2.5.29.22","expirationDate"),Ze("2.5.29.23","instructionCode"),Ze("2.5.29.24","invalidityDate"),Ze("2.5.29.25","cRLDistributionPoints"),Ze("2.5.29.26","issuingDistributionPoint"),Ze("2.5.29.27","deltaCRLIndicator"),Ze("2.5.29.28","issuingDistributionPoint"),Ze("2.5.29.29","certificateIssuer"),Ze("2.5.29.30","nameConstraints"),be("2.5.29.31","cRLDistributionPoints"),be("2.5.29.32","certificatePolicies"),Ze("2.5.29.33","policyMappings"),Ze("2.5.29.34","policyConstraints"),be("2.5.29.35","authorityKeyIdentifier"),Ze("2.5.29.36","policyConstraints"),be("2.5.29.37","extKeyUsage"),Ze("2.5.29.46","freshestCRL"),Ze("2.5.29.54","inhibitAnyPolicy"),be("1.3.6.1.4.1.11129.2.4.2","timestampList"),be("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),be("1.3.6.1.5.5.7.3.1","serverAuth"),be("1.3.6.1.5.5.7.3.2","clientAuth"),be("1.3.6.1.5.5.7.3.3","codeSigning"),be("1.3.6.1.5.5.7.3.4","emailProtection"),be("1.3.6.1.5.5.7.3.8","timeStamping");var ft=ke,Ae=ft.asn1=ft.asn1||{};Ae.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},Ae.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},Ae.create=function(e,t,r,n,i){if(ft.util.isArray(n)){for(var a=[],o=0;o<n.length;++o)n[o]!==void 0&&a.push(n[o]);n=a}var s={tagClass:e,type:t,constructed:r,composed:r||ft.util.isArray(n),value:n};return i&&"bitStringContents"in i&&(s.bitStringContents=i.bitStringContents,s.original=Ae.copy(s)),s},Ae.copy=function(e,t){var r;if(ft.util.isArray(e)){r=[];for(var n=0;n<e.length;++n)r.push(Ae.copy(e[n],t));return r}return typeof e=="string"?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:Ae.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},Ae.equals=function(e,t,r){if(ft.util.isArray(e)){if(!ft.util.isArray(t)||e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!Ae.equals(e[n],t[n]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var i=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&Ae.equals(e.value,t.value);return r&&r.includeBitStringContents&&(i=i&&e.bitStringContents===t.bitStringContents),i},Ae.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var r,n=t&128;return n?r=e.getInt((t&127)<<3):r=t,r}};function $s(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}var v3=function(e,t){var r=e.getByte();if(t--,r!==128){var n,i=r&128;if(!i)n=r;else{var a=r&127;$s(e,t,a),n=e.getInt(a<<3)}if(n<0)throw new Error("Negative length: "+n);return n}};Ae.fromDer=function(e,t){return t===void 0&&(t={strict:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),typeof e=="string"&&(e=ft.util.createBuffer(e)),Hc(e,e.length(),0,t)};function Hc(e,t,r,n){var i;$s(e,t,2);var a=e.getByte();t--;var o=a&192,s=a&31;i=e.length();var u=v3(e,t);if(t-=i-e.length(),u!==void 0&&u>t){if(n.strict){var c=new Error("Too few bytes to read ASN.1 value.");throw c.available=e.length(),c.remaining=t,c.requested=u,c}u=t}var l,f,d=(a&32)===32;if(d)if(l=[],u===void 0)for(;;){if($s(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}i=e.length(),l.push(Hc(e,t,r+1,n)),t-=i-e.length()}else for(;u>0;)i=e.length(),l.push(Hc(e,u,r+1,n)),t-=i-e.length(),u-=i-e.length();if(l===void 0&&o===Ae.Class.UNIVERSAL&&s===Ae.Type.BITSTRING&&(f=e.bytes(u)),l===void 0&&n.decodeBitStrings&&o===Ae.Class.UNIVERSAL&&s===Ae.Type.BITSTRING&&u>1){var g=e.read,h=t,v=0;if(s===Ae.Type.BITSTRING&&($s(e,t,1),v=e.getByte(),t--),v===0)try{i=e.length();var p={verbose:n.verbose,strict:!0,decodeBitStrings:!0},y=Hc(e,t,r+1,p),w=i-e.length();t-=w,s==Ae.Type.BITSTRING&&w++;var m=y.tagClass;w===u&&(m===Ae.Class.UNIVERSAL||m===Ae.Class.CONTEXT_SPECIFIC)&&(l=[y])}catch{}l===void 0&&(e.read=g,t=h)}if(l===void 0){if(u===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");u=t}if(s===Ae.Type.BMPSTRING)for(l="";u>0;u-=2)$s(e,t,2),l+=String.fromCharCode(e.getInt16()),t-=2;else l=e.getBytes(u)}var S=f===void 0?null:{bitStringContents:f};return Ae.create(o,s,d,l,S)}Ae.toDer=function(e){var t=ft.util.createBuffer(),r=e.tagClass|e.type,n=ft.util.createBuffer(),i=!1;if("bitStringContents"in e&&(i=!0,e.original&&(i=Ae.equals(e,e.original))),i)n.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:n.putByte(0);for(var a=0;a<e.value.length;++a)e.value[a]!==void 0&&n.putBuffer(Ae.toDer(e.value[a]))}else if(e.type===Ae.Type.BMPSTRING)for(var a=0;a<e.value.length;++a)n.putInt16(e.value.charCodeAt(a));else e.type===Ae.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&(e.value.charCodeAt(1)&128)===0||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(n.length()&127);else{var o=n.length(),s="";do s+=String.fromCharCode(o&255),o=o>>>8;while(o>0);t.putByte(s.length|128);for(var a=s.length-1;a>=0;--a)t.putByte(s.charCodeAt(a))}return t.putBuffer(n),t},Ae.oidToDer=function(e){var t=e.split("."),r=ft.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,i,a,o,s=2;s<t.length;++s){n=!0,i=[],a=parseInt(t[s],10);do o=a&127,a=a>>>7,n||(o|=128),i.push(o),n=!1;while(a>0);for(var u=i.length-1;u>=0;--u)r.putByte(i[u])}return r},Ae.derToOid=function(e){var t;typeof e=="string"&&(e=ft.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n=n<<7,r&128?n+=r&127:(t+="."+(n+r),n=0);return t},Ae.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var u=e.charAt(10),c=10;u!=="+"&&u!=="-"&&(s=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(a,o,s,0),c&&(u=e.charAt(c),u==="+"||u==="-")){var l=parseInt(e.substr(c+1,2),10),f=parseInt(e.substr(c+4,2),10),d=l*60+f;d*=6e4,u==="+"?t.setTime(+t-d):t.setTime(+t+d)}return t},Ae.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),u=0,c=0,l=!1;e.charAt(e.length-1)==="Z"&&(l=!0);var f=e.length-5,d=e.charAt(f);if(d==="+"||d==="-"){var g=parseInt(e.substr(f+1,2),10),h=parseInt(e.substr(f+4,2),10);c=g*60+h,c*=6e4,d==="+"&&(c*=-1),l=!0}return e.charAt(14)==="."&&(u=parseFloat(e.substr(14),10)*1e3),l?(t.setUTCFullYear(r,n,i),t.setUTCHours(a,o,s,u),t.setTime(+t+c)):(t.setFullYear(r,n,i),t.setHours(a,o,s,u)),t},Ae.dateToUtcTime=function(e){if(typeof e=="string")return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z",t},Ae.dateToGeneralizedTime=function(e){if(typeof e=="string")return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z",t},Ae.integerToDer=function(e){var t=ft.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},Ae.derToInteger=function(e){typeof e=="string"&&(e=ft.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},Ae.validate=function(e,t,r,n){var i=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(i=!0,t.value&&ft.util.isArray(t.value))for(var a=0,o=0;i&&o<t.value.length;++o)i=t.value[o].optional||!1,e.value[a]&&(i=Ae.validate(e.value[a],t.value[o],r,n),i?++a:t.value[o].optional&&(i=!0)),!i&&n&&n.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(i&&r&&(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{var s=e.bitStringContents.charCodeAt(0);if(s!==0)throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else n&&n.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');else n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));return i};var r_=/[^\\u0000-\\u00ff]/;Ae.prettyPrint=function(e,t,r){var n="";t=t||0,r=r||2,t>0&&(n+=`
|
|
85
|
-
`);for(var i="",a=0;a<t*r;++a)i+=" ";switch(n+=i+"Tag: ",e.tagClass){case Ae.Class.UNIVERSAL:n+="Universal:";break;case Ae.Class.APPLICATION:n+="Application:";break;case Ae.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case Ae.Class.PRIVATE:n+="Private:";break}if(e.tagClass===Ae.Class.UNIVERSAL)switch(n+=e.type,e.type){case Ae.Type.NONE:n+=" (None)";break;case Ae.Type.BOOLEAN:n+=" (Boolean)";break;case Ae.Type.INTEGER:n+=" (Integer)";break;case Ae.Type.BITSTRING:n+=" (Bit string)";break;case Ae.Type.OCTETSTRING:n+=" (Octet string)";break;case Ae.Type.NULL:n+=" (Null)";break;case Ae.Type.OID:n+=" (Object Identifier)";break;case Ae.Type.ODESC:n+=" (Object Descriptor)";break;case Ae.Type.EXTERNAL:n+=" (External or Instance of)";break;case Ae.Type.REAL:n+=" (Real)";break;case Ae.Type.ENUMERATED:n+=" (Enumerated)";break;case Ae.Type.EMBEDDED:n+=" (Embedded PDV)";break;case Ae.Type.UTF8:n+=" (UTF8)";break;case Ae.Type.ROID:n+=" (Relative Object Identifier)";break;case Ae.Type.SEQUENCE:n+=" (Sequence)";break;case Ae.Type.SET:n+=" (Set)";break;case Ae.Type.PRINTABLESTRING:n+=" (Printable String)";break;case Ae.Type.IA5String:n+=" (IA5String (ASCII))";break;case Ae.Type.UTCTIME:n+=" (UTC time)";break;case Ae.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case Ae.Type.BMPSTRING:n+=" (BMP String)";break}else n+=e.type;if(n+=`
|
|
86
|
-
`,n+=i+"Constructed: "+e.constructed+`
|
|
87
|
-
`,e.composed){for(var o=0,s="",a=0;a<e.value.length;++a)e.value[a]!==void 0&&(o+=1,s+=Ae.prettyPrint(e.value[a],t+1,r),a+1<e.value.length&&(s+=","));n+=i+"Sub values: "+o+s}else{if(n+=i+"Value: ",e.type===Ae.Type.OID){var u=Ae.derToOid(e.value);n+=u,ft.pki&&ft.pki.oids&&u in ft.pki.oids&&(n+=" ("+ft.pki.oids[u]+") ")}if(e.type===Ae.Type.INTEGER)try{n+=Ae.derToInteger(e.value)}catch{n+="0x"+ft.util.bytesToHex(e.value)}else if(e.type===Ae.Type.BITSTRING){if(e.value.length>1?n+="0x"+ft.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var c=e.value.charCodeAt(0);c==1?n+=" (1 unused bit shown)":c>1&&(n+=" ("+c+" unused bits shown)")}}else e.type===Ae.Type.OCTETSTRING?(r_.test(e.value)||(n+="("+e.value+") "),n+="0x"+ft.util.bytesToHex(e.value)):e.type===Ae.Type.UTF8?n+=ft.util.decodeUtf8(e.value):e.type===Ae.Type.PRINTABLESTRING||e.type===Ae.Type.IA5String?n+=e.value:r_.test(e.value)?n+="0x"+ft.util.bytesToHex(e.value):e.value.length===0?n+="[null]":n+=e.value}return n};var Yc=ke,m3=Yc.md=Yc.md||{};Yc.md.algorithms=Yc.md.algorithms||{};var Rn=ke,E3=Rn.hmac=Rn.hmac||{};E3.create=function(){var e=null,t=null,r=null,n=null,i={};return i.start=function(a,o){if(a!==null)if(typeof a=="string")if(a=a.toLowerCase(),a in Rn.md.algorithms)t=Rn.md.algorithms[a].create();else throw new Error('Unknown hash algorithm "'+a+'"');else t=a;if(o===null)o=e;else{if(typeof o=="string")o=Rn.util.createBuffer(o);else if(Rn.util.isArray(o)){var s=o;o=Rn.util.createBuffer();for(var u=0;u<s.length;++u)o.putByte(s[u])}var c=o.length();c>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=Rn.util.createBuffer(),n=Rn.util.createBuffer(),c=o.length();for(var u=0;u<c;++u){var s=o.at(u);r.putByte(54^s),n.putByte(92^s)}if(c<t.blockLength)for(var s=t.blockLength-c,u=0;u<s;++u)r.putByte(54),n.putByte(92);e=o,r=r.bytes(),n=n.bytes()}t.start(),t.update(r)},i.update=function(a){t.update(a)},i.getMac=function(){var a=t.digest().bytes();return t.start(),t.update(n),t.update(a),t.digest()},i.digest=i.getMac,i};var on=ke,n_=on.md5=on.md5||{};on.md.md5=on.md.algorithms.md5=n_,n_.create=function(){i_||b3();var e=null,t=on.util.createBuffer(),r=new Array(16),n={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,a=0;a<i;++a)n.fullMessageLength.push(0);return t=on.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},n},n.start(),n.update=function(i,a){a==="utf8"&&(i=on.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var s=n.fullMessageLength.length-1;s>=0;--s)n.fullMessageLength[s]+=o[1],o[1]=o[0]+(n.fullMessageLength[s]/4294967296>>>0),n.fullMessageLength[s]=n.fullMessageLength[s]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),a_(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var i=on.util.createBuffer();i.putBytes(t.bytes());var a=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=a&n.blockLength-1;i.putBytes(Cp.substr(0,n.blockLength-o));for(var s,u=0,c=n.fullMessageLength.length-1;c>=0;--c)s=n.fullMessageLength[c]*8+u,u=s/4294967296>>>0,i.putInt32Le(s>>>0);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a_(l,r,i);var f=on.util.createBuffer();return f.putInt32Le(l.h0),f.putInt32Le(l.h1),f.putInt32Le(l.h2),f.putInt32Le(l.h3),f},n};var Cp=null,Wc=null,js=null,ao=null,i_=!1;function b3(){Cp=String.fromCharCode(128),Cp+=on.util.fillString(String.fromCharCode(0),64),Wc=[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],js=[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],ao=new Array(64);for(var e=0;e<64;++e)ao[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);i_=!0}function a_(e,t,r){for(var n,i,a,o,s,u,c,l,f=r.length();f>=64;){for(i=e.h0,a=e.h1,o=e.h2,s=e.h3,l=0;l<16;++l)t[l]=r.getInt32Le(),u=s^a&(o^s),n=i+u+ao[l]+t[l],c=js[l],i=s,s=o,o=a,a+=n<<c|n>>>32-c;for(;l<32;++l)u=o^s&(a^o),n=i+u+ao[l]+t[Wc[l]],c=js[l],i=s,s=o,o=a,a+=n<<c|n>>>32-c;for(;l<48;++l)u=a^o^s,n=i+u+ao[l]+t[Wc[l]],c=js[l],i=s,s=o,o=a,a+=n<<c|n>>>32-c;for(;l<64;++l)u=o^(a|~s),n=i+u+ao[l]+t[Wc[l]],c=js[l],i=s,s=o,o=a,a+=n<<c|n>>>32-c;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+o|0,e.h3=e.h3+s|0,f-=64}}var zc=ke,o_=zc.pem=zc.pem||{};o_.encode=function(e,t){t=t||{};var r="-----BEGIN "+e.type+`-----\r
|
|
88
|
-
`,n;if(e.procType&&(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},r+=Qc(n)),e.contentDomain&&(n={name:"Content-Domain",values:[e.contentDomain]},r+=Qc(n)),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),r+=Qc(n)),e.headers)for(var i=0;i<e.headers.length;++i)r+=Qc(e.headers[i]);return e.procType&&(r+=`\r
|
|
89
|
-
`),r+=zc.util.encode64(e.body,t.maxline||64)+`\r
|
|
90
|
-
`,r+="-----END "+e.type+`-----\r
|
|
91
|
-
`,r},o_.decode=function(e){for(var t=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,a;a=r.exec(e),!!a;){var o={type:a[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:zc.util.decode64(a[3])};if(t.push(o),!!a[2]){for(var s=a[2].split(i),u=0;a&&u<s.length;){for(var c=s[u].replace(/\s+$/,""),l=u+1;l<s.length;++l){var f=s[l];if(!/\s/.test(f[0]))break;c+=f,u=l}if(a=c.match(n),a){for(var d={name:a[1],values:[]},g=a[2].split(","),h=0;h<g.length;++h)d.values.push(_3(g[h]));if(o.procType)if(!o.contentDomain&&d.name==="Content-Domain")o.contentDomain=g[0]||"";else if(!o.dekInfo&&d.name==="DEK-Info"){if(d.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:g[0],parameters:g[1]||null}}else o.headers.push(d);else{if(d.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(d.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:g[0],type:g[1]}}}++u}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function Qc(e){for(var t=e.name+": ",r=[],n=function(u,c){return" "+c},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+`\r
|
|
92
|
-
`;for(var a=0,o=-1,i=0;i<t.length;++i,++a)if(a>65&&o!==-1){var s=t[o];s===","?(++o,t=t.substr(0,o)+`\r
|
|
93
|
-
`+t.substr(o)):t=t.substr(0,o)+`\r
|
|
94
|
-
`+s+t.substr(o+1),a=i-o-1,o=-1,++i}else(t[i]===" "||t[i]===" "||t[i]===",")&&(o=i);return t}function _3(e){return e.replace(/^\s+/,"")}var dt=ke;dt.des=dt.des||{},dt.des.startEncrypting=function(e,t,r,n){var i=Xc({key:e,output:r,decrypt:!1,mode:n||(t===null?"ECB":"CBC")});return i.start(t),i},dt.des.createEncryptionCipher=function(e,t){return Xc({key:e,output:null,decrypt:!1,mode:t})},dt.des.startDecrypting=function(e,t,r,n){var i=Xc({key:e,output:r,decrypt:!0,mode:n||(t===null?"ECB":"CBC")});return i.start(t),i},dt.des.createDecryptionCipher=function(e,t){return Xc({key:e,output:null,decrypt:!0,mode:t})},dt.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(n,i){return s_(r._keys,n,i,!1)},decrypt:function(n,i){return s_(r._keys,n,i,!0)}}}),r._init=!1},dt.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=dt.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=O3(t),this._init=!0}},sn("DES-ECB",dt.cipher.modes.ecb),sn("DES-CBC",dt.cipher.modes.cbc),sn("DES-CFB",dt.cipher.modes.cfb),sn("DES-OFB",dt.cipher.modes.ofb),sn("DES-CTR",dt.cipher.modes.ctr),sn("3DES-ECB",dt.cipher.modes.ecb),sn("3DES-CBC",dt.cipher.modes.cbc),sn("3DES-CFB",dt.cipher.modes.cfb),sn("3DES-OFB",dt.cipher.modes.ofb),sn("3DES-CTR",dt.cipher.modes.ctr);function sn(e,t){var r=function(){return new dt.des.Algorithm(e,t)};dt.cipher.registerAlgorithm(e,r)}var S3=[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],C3=[-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],w3=[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],T3=[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],A3=[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],x3=[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],R3=[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],I3=[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 O3(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],s=[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],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],g=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],v=e.length()>8?3:1,p=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],w=0,m,S=0;S<v;S++){var A=e.getInt32(),I=e.getInt32();m=(A>>>4^I)&252645135,I^=m,A^=m<<4,m=(I>>>-16^A)&65535,A^=m,I^=m<<-16,m=(A>>>2^I)&858993459,I^=m,A^=m<<2,m=(I>>>-16^A)&65535,A^=m,I^=m<<-16,m=(A>>>1^I)&1431655765,I^=m,A^=m<<1,m=(I>>>8^A)&16711935,A^=m,I^=m<<8,m=(A>>>1^I)&1431655765,I^=m,A^=m<<1,m=A<<8|I>>>20&240,A=I<<24|I<<8&16711680|I>>>8&65280|I>>>24&240,I=m;for(var N=0;N<y.length;++N){y[N]?(A=A<<2|A>>>26,I=I<<2|I>>>26):(A=A<<1|A>>>27,I=I<<1|I>>>27),A&=-15,I&=-15;var T=t[A>>>28]|r[A>>>24&15]|n[A>>>20&15]|i[A>>>16&15]|a[A>>>12&15]|o[A>>>8&15]|s[A>>>4&15],M=u[I>>>28]|c[I>>>24&15]|l[I>>>20&15]|f[I>>>16&15]|d[I>>>12&15]|g[I>>>8&15]|h[I>>>4&15];m=(M>>>16^T)&65535,p[w++]=T^m,p[w++]=M^m<<16}}return p}function s_(e,t,r,n){var i=e.length===32?3:9,a;i===3?a=n?[30,-2,-2]:[0,32,2]:a=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,s=t[0],u=t[1];o=(s>>>4^u)&252645135,u^=o,s^=o<<4,o=(s>>>16^u)&65535,u^=o,s^=o<<16,o=(u>>>2^s)&858993459,s^=o,u^=o<<2,o=(u>>>8^s)&16711935,s^=o,u^=o<<8,o=(s>>>1^u)&1431655765,u^=o,s^=o<<1,s=s<<1|s>>>31,u=u<<1|u>>>31;for(var c=0;c<i;c+=3){for(var l=a[c+1],f=a[c+2],d=a[c];d!=l;d+=f){var g=u^e[d],h=(u>>>4|u<<28)^e[d+1];o=s,s=u,u=o^(C3[g>>>24&63]|T3[g>>>16&63]|x3[g>>>8&63]|I3[g&63]|S3[h>>>24&63]|w3[h>>>16&63]|A3[h>>>8&63]|R3[h&63])}o=s,s=u,u=o}s=s>>>1|s<<31,u=u>>>1|u<<31,o=(s>>>1^u)&1431655765,u^=o,s^=o<<1,o=(u>>>8^s)&16711935,s^=o,u^=o<<8,o=(u>>>2^s)&858993459,s^=o,u^=o<<2,o=(s>>>16^u)&65535,u^=o,s^=o<<16,o=(s>>>4^u)&252645135,u^=o,s^=o<<4,r[0]=s,r[1]=u}function Xc(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="DES-"+t,n;e.decrypt?n=dt.cipher.createDecipher(r,e.key):n=dt.cipher.createCipher(r,e.key);var i=n.start;return n.start=function(a,o){var s=null;o instanceof dt.util.ByteBuffer&&(s=o,o={}),o=o||{},o.output=s,o.iv=a,i.call(n,o)},n}var er=ke,M3=er.pkcs5=er.pkcs5||{},In;er.util.isNodejs&&!er.options.usePureJavaScript&&(In=_e),er.pbkdf2=M3.pbkdf2=function(e,t,r,n,i,a){if(typeof i=="function"&&(a=i,i=null),er.util.isNodejs&&!er.options.usePureJavaScript&&In.pbkdf2&&(i===null||typeof i!="object")&&(In.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?In.pbkdf2Sync.length===4?In.pbkdf2(e,t,r,n,function(m,S){if(m)return a(m);a(null,S.toString("binary"))}):In.pbkdf2(e,t,r,n,i,function(m,S){if(m)return a(m);a(null,S.toString("binary"))}):In.pbkdf2Sync.length===4?In.pbkdf2Sync(e,t,r,n).toString("binary"):In.pbkdf2Sync(e,t,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in er.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=er.md[i].create()}var o=i.digestLength;if(n>4294967295*o){var s=new Error("Derived key is too long.");if(a)return a(s);throw s}var u=Math.ceil(n/o),c=n-(u-1)*o,l=er.hmac.create();l.start(i,e);var f="",d,g,h;if(!a){for(var v=1;v<=u;++v){l.start(null,null),l.update(t),l.update(er.util.int32ToBytes(v)),d=h=l.digest().getBytes();for(var p=2;p<=r;++p)l.start(null,null),l.update(h),g=l.digest().getBytes(),d=er.util.xorBytes(d,g,o),h=g;f+=v<u?d:d.substr(0,c)}return f}var v=1,p;function y(){if(v>u)return a(null,f);l.start(null,null),l.update(t),l.update(er.util.int32ToBytes(v)),d=h=l.digest().getBytes(),p=2,w()}function w(){if(p<=r)return l.start(null,null),l.update(h),g=l.digest().getBytes(),d=er.util.xorBytes(d,g,o),h=g,++p,er.util.setImmediate(w);f+=v<u?d:d.substr(0,c),++v,y()}y()};var un=ke,u_=un.sha256=un.sha256||{};un.md.sha256=un.md.algorithms.sha256=u_,u_.create=function(){c_||L3();var e=null,t=un.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,a=0;a<i;++a)n.fullMessageLength.push(0);return t=un.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(i,a){a==="utf8"&&(i=un.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var s=n.fullMessageLength.length-1;s>=0;--s)n.fullMessageLength[s]+=o[1],o[1]=o[0]+(n.fullMessageLength[s]/4294967296>>>0),n.fullMessageLength[s]=n.fullMessageLength[s]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),f_(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var i=un.util.createBuffer();i.putBytes(t.bytes());var a=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=a&n.blockLength-1;i.putBytes(wp.substr(0,n.blockLength-o));for(var s,u,c=n.fullMessageLength[0]*8,l=0;l<n.fullMessageLength.length-1;++l)s=n.fullMessageLength[l+1]*8,u=s/4294967296>>>0,c+=u,i.putInt32(c>>>0),c=s>>>0;i.putInt32(c);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};f_(f,r,i);var d=un.util.createBuffer();return d.putInt32(f.h0),d.putInt32(f.h1),d.putInt32(f.h2),d.putInt32(f.h3),d.putInt32(f.h4),d.putInt32(f.h5),d.putInt32(f.h6),d.putInt32(f.h7),d},n};var wp=null,c_=!1,l_=null;function L3(){wp=String.fromCharCode(128),wp+=un.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],c_=!0}function f_(e,t,r){for(var n,i,a,o,s,u,c,l,f,d,g,h,v,p,y,w=r.length();w>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=t[c-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[c-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(l=e.h0,f=e.h1,d=e.h2,g=e.h3,h=e.h4,v=e.h5,p=e.h6,y=e.h7,c=0;c<64;++c)o=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p^h&(v^p),a=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),u=l&f|d&(l^f),n=y+o+s+l_[c]+t[c],i=a+u,y=p,p=v,v=h,h=g+n>>>0,g=d,d=f,f=l,l=n+i>>>0;e.h0=e.h0+l|0,e.h1=e.h1+f|0,e.h2=e.h2+d|0,e.h3=e.h3+g|0,e.h4=e.h4+h|0,e.h5=e.h5+v|0,e.h6=e.h6+p|0,e.h7=e.h7+y|0,w-=64}}var cn=ke,Jc=null;cn.util.isNodejs&&!cn.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Jc=_e);var P3=cn.prng=cn.prng||{};P3.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=new Array(32),i=0;i<32;++i)n[i]=r.create();t.pools=n,t.pool=0,t.generate=function(c,l){if(!l)return t.generateSync(c);var f=t.plugin.cipher,d=t.plugin.increment,g=t.plugin.formatKey,h=t.plugin.formatSeed,v=cn.util.createBuffer();t.key=null,p();function p(y){if(y)return l(y);if(v.length()>=c)return l(null,v.getBytes(c));if(t.generated>1048575&&(t.key=null),t.key===null)return cn.util.nextTick(function(){a(p)});var w=f(t.key,t.seed);t.generated+=w.length,v.putBytes(w),t.key=g(f(t.key,d(t.seed))),t.seed=h(f(t.key,t.seed)),cn.util.setImmediate(p)}},t.generateSync=function(c){var l=t.plugin.cipher,f=t.plugin.increment,d=t.plugin.formatKey,g=t.plugin.formatSeed;t.key=null;for(var h=cn.util.createBuffer();h.length()<c;){t.generated>1048575&&(t.key=null),t.key===null&&o();var v=l(t.key,t.seed);t.generated+=v.length,h.putBytes(v),t.key=d(l(t.key,f(t.seed))),t.seed=g(l(t.key,t.seed))}return h.getBytes(c)};function a(c){if(t.pools[0].messageLength>=32)return s(),c();var l=32-t.pools[0].messageLength<<5;t.seedFile(l,function(f,d){if(f)return c(f);t.collect(d),s(),c()})}function o(){if(t.pools[0].messageLength>=32)return s();var c=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(c)),s()}function s(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var c=t.plugin.md.create();c.update(t.keyBytes);for(var l=1,f=0;f<32;++f)t.reseeds%l===0&&(c.update(t.pools[f].digest().getBytes()),t.pools[f].start()),l=l<<1;t.keyBytes=c.digest().getBytes(),c.start(),c.update(t.keyBytes);var d=c.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(d),t.generated=0}function u(c){var l=null,f=cn.util.globalScope,d=f.crypto||f.msCrypto;d&&d.getRandomValues&&(l=function(A){return d.getRandomValues(A)});var g=cn.util.createBuffer();if(l)for(;g.length()<c;){var h=Math.max(1,Math.min(c-g.length(),65536)/4),v=new Uint32Array(Math.floor(h));try{l(v);for(var p=0;p<v.length;++p)g.putInt32(v[p])}catch(A){if(!(typeof QuotaExceededError<"u"&&A instanceof QuotaExceededError))throw A}}if(g.length()<c)for(var y,w,m,S=Math.floor(Math.random()*65536);g.length()<c;){w=16807*(S&65535),y=16807*(S>>16),w+=(y&32767)<<16,w+=y>>15,w=(w&2147483647)+(w>>31),S=w&4294967295;for(var p=0;p<3;++p)m=S>>>(p<<3),m^=Math.floor(Math.random()*256),g.putByte(String.fromCharCode(m&255))}return g.getBytes(c)}return Jc?(t.seedFile=function(c,l){Jc.randomBytes(c,function(f,d){if(f)return l(f);l(null,d.toString())})},t.seedFileSync=function(c){return Jc.randomBytes(c).toString()}):(t.seedFile=function(c,l){try{l(null,u(c))}catch(f){l(f)}},t.seedFileSync=u),t.collect=function(c){for(var l=c.length,f=0;f<l;++f)t.pools[t.pool].update(c.substr(f,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(c,l){for(var f="",d=0;d<l;d+=8)f+=String.fromCharCode(c>>d&255);t.collect(f)},t.registerWorker=function(c){if(c===self)t.seedFile=function(f,d){function g(h){var v=h.data;v.forge&&v.forge.prng&&(self.removeEventListener("message",g),d(v.forge.prng.err,v.forge.prng.bytes))}self.addEventListener("message",g),self.postMessage({forge:{prng:{needed:f}}})};else{var l=function(f){var d=f.data;d.forge&&d.forge.prng&&t.seedFile(d.forge.prng.needed,function(g,h){c.postMessage({forge:{prng:{err:g,bytes:h}}})})};c.addEventListener("message",l)}},t};var Mt=ke;(function(){if(Mt.random&&Mt.random.getBytes){Mt.random;return}(function(e){var t={},r=new Array(4),n=Mt.util.createBuffer();t.formatKey=function(f){var d=Mt.util.createBuffer(f);return f=new Array(4),f[0]=d.getInt32(),f[1]=d.getInt32(),f[2]=d.getInt32(),f[3]=d.getInt32(),Mt.aes._expandKey(f,!1)},t.formatSeed=function(f){var d=Mt.util.createBuffer(f);return f=new Array(4),f[0]=d.getInt32(),f[1]=d.getInt32(),f[2]=d.getInt32(),f[3]=d.getInt32(),f},t.cipher=function(f,d){return Mt.aes._updateBlock(f,d,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},t.increment=function(f){return++f[3],f},t.md=Mt.md.sha256;function i(){var f=Mt.prng.create(t);return f.getBytes=function(d,g){return f.generate(d,g)},f.getBytesSync=function(d){return f.generate(d)},f}var a=i(),o=null,s=Mt.util.globalScope,u=s.crypto||s.msCrypto;if(u&&u.getRandomValues&&(o=function(f){return u.getRandomValues(f)}),Mt.options.usePureJavaScript||!Mt.util.isNodejs&&!o){if(a.collectInt(+new Date,32),typeof navigator<"u"){var c="";for(var l in navigator)try{typeof navigator[l]=="string"&&(c+=navigator[l])}catch{}a.collect(c),c=null}e&&(e().mousemove(function(f){a.collectInt(f.clientX,16),a.collectInt(f.clientY,16)}),e().keypress(function(f){a.collectInt(f.charCode,8)}))}if(!Mt.random)Mt.random=a;else for(var l in a)Mt.random[l]=a[l];Mt.random.createInstance=i,Mt.random})(typeof jQuery<"u"?jQuery:null)})();var ur=ke,Tp=[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],d_=[1,2,3,5],N3=function(e,t){return e<<t&65535|(e&65535)>>16-t},B3=function(e,t){return(e&65535)>>t|e<<16-t&65535};ur.rc2=ur.rc2||{},ur.rc2.expandKey=function(e,t){typeof e=="string"&&(e=ur.util.createBuffer(e)),t=t||128;var r=e,n=e.length(),i=t,a=Math.ceil(i/8),o=255>>(i&7),s;for(s=n;s<128;s++)r.putByte(Tp[r.at(s-1)+r.at(s-n)&255]);for(r.setAt(128-a,Tp[r.at(128-a)&o]),s=127-a;s>=0;s--)r.setAt(s,Tp[r.at(s+1)^r.at(s+a)]);return r};var h_=function(e,t,r){var n=!1,i=null,a=null,o=null,s,u,c,l,f=[];for(e=ur.rc2.expandKey(e,t),c=0;c<64;c++)f.push(e.getInt16Le());r?(s=function(h){for(c=0;c<4;c++)h[c]+=f[l]+(h[(c+3)%4]&h[(c+2)%4])+(~h[(c+3)%4]&h[(c+1)%4]),h[c]=N3(h[c],d_[c]),l++},u=function(h){for(c=0;c<4;c++)h[c]+=f[h[(c+3)%4]&63]}):(s=function(h){for(c=3;c>=0;c--)h[c]=B3(h[c],d_[c]),h[c]-=f[l]+(h[(c+3)%4]&h[(c+2)%4])+(~h[(c+3)%4]&h[(c+1)%4]),l--},u=function(h){for(c=3;c>=0;c--)h[c]-=f[h[(c+3)%4]&63]});var d=function(h){var v=[];for(c=0;c<4;c++){var p=i.getInt16Le();o!==null&&(r?p^=o.getInt16Le():o.putInt16Le(p)),v.push(p&65535)}l=r?0:63;for(var y=0;y<h.length;y++)for(var w=0;w<h[y][0];w++)h[y][1](v);for(c=0;c<4;c++)o!==null&&(r?o.putInt16Le(v[c]):v[c]^=o.getInt16Le()),a.putInt16Le(v[c])},g=null;return g={start:function(h,v){h&&typeof h=="string"&&(h=ur.util.createBuffer(h)),n=!1,i=ur.util.createBuffer(),a=v||new ur.util.createBuffer,o=h,g.output=a},update:function(h){for(n||i.putBuffer(h);i.length()>=8;)d([[5,s],[1,u],[6,s],[1,u],[5,s]])},finish:function(h){var v=!0;if(r)if(h)v=h(8,i,!r);else{var p=i.length()===8?8:8-i.length();i.fillWithByte(p,p)}if(v&&(n=!0,g.update()),!r&&(v=i.length()===0,v))if(h)v=h(8,a,!r);else{var y=a.length(),w=a.at(y-1);w>y?v=!1:a.truncate(w)}return v}},g};ur.rc2.startEncrypting=function(e,t,r){var n=ur.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},ur.rc2.createEncryptionCipher=function(e,t){return h_(e,t,!0)},ur.rc2.startDecrypting=function(e,t,r){var n=ur.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},ur.rc2.createDecryptionCipher=function(e,t){return h_(e,t,!1)};var Ap=ke;Ap.jsbn=Ap.jsbn||{};var On;function ge(e,t,r){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}Ap.jsbn.BigInteger=ge;function Qe(){return new ge(null)}function D3(e,t,r,n,i,a){for(;--a>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=o&67108863}return i}function F3(e,t,r,n,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var u=this.data[e]&32767,c=this.data[e++]>>15,l=s*u+c*o;u=o*u+((l&32767)<<15)+r.data[n]+(i&1073741823),i=(u>>>30)+(l>>>15)+s*c+(i>>>30),r.data[n++]=u&1073741823}return i}function p_(e,t,r,n,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var u=this.data[e]&16383,c=this.data[e++]>>14,l=s*u+c*o;u=o*u+((l&16383)<<14)+r.data[n]+i,i=(u>>28)+(l>>14)+s*c,r.data[n++]=u&268435455}return i}typeof navigator>"u"?(ge.prototype.am=p_,On=28):navigator.appName=="Microsoft Internet Explorer"?(ge.prototype.am=F3,On=30):navigator.appName!="Netscape"?(ge.prototype.am=D3,On=26):(ge.prototype.am=p_,On=28),ge.prototype.DB=On,ge.prototype.DM=(1<<On)-1,ge.prototype.DV=1<<On;var xp=52;ge.prototype.FV=Math.pow(2,xp),ge.prototype.F1=xp-On,ge.prototype.F2=2*On-xp;var k3="0123456789abcdefghijklmnopqrstuvwxyz",Zc=new Array,oo,Mr;for(oo="0".charCodeAt(0),Mr=0;Mr<=9;++Mr)Zc[oo++]=Mr;for(oo="a".charCodeAt(0),Mr=10;Mr<36;++Mr)Zc[oo++]=Mr;for(oo="A".charCodeAt(0),Mr=10;Mr<36;++Mr)Zc[oo++]=Mr;function g_(e){return k3.charAt(e)}function y_(e,t){var r=Zc[e.charCodeAt(t)];return r==null?-1:r}function U3(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function $3(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function si(e){var t=Qe();return t.fromInt(e),t}function j3(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,i=!1,a=0;--n>=0;){var o=r==8?e[n]&255:y_(e,n);if(o<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,a==0?this.data[this.t++]=o:a+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this.data[this.t++]=o>>this.DB-a):this.data[this.t-1]|=o<<a,a+=r,a>=this.DB&&(a-=this.DB)}r==8&&(e[0]&128)!=0&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&ge.ZERO.subTo(this,this)}function K3(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function q3(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,i=!1,a="",o=this.t,s=this.DB-o*this.DB%t;if(o-- >0)for(s<this.DB&&(n=this.data[o]>>s)>0&&(i=!0,a=g_(n));o>=0;)s<t?(n=(this.data[o]&(1<<s)-1)<<t-s,n|=this.data[--o]>>(s+=this.DB-t)):(n=this.data[o]>>(s-=t)&r,s<=0&&(s+=this.DB,--o)),n>0&&(i=!0),i&&(a+=g_(n));return i?a:"0"}function V3(){var e=Qe();return ge.ZERO.subTo(this,e),e}function G3(){return this.s<0?this.negate():this}function H3(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this.data[r]-e.data[r])!=0)return t;return 0}function el(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function Y3(){return this.t<=0?0:this.DB*(this.t-1)+el(this.data[this.t-1]^this.s&this.DM)}function W3(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function z3(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s}function Q3(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,a=Math.floor(e/this.DB),o=this.s<<r&this.DM,s;for(s=this.t-1;s>=0;--s)t.data[s+a+1]=this.data[s]>>n|o,o=(this.data[s]&i)<<r;for(s=a-1;s>=0;--s)t.data[s]=0;t.data[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()}function X3(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,a=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&a)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&a)<<i),t.t=this.t-r,t.clamp()}function J3(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function Z3(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&ge.ZERO.subTo(t,t)}function eB(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function tB(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){t!=null&&t.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=Qe());var a=Qe(),o=this.s,s=e.s,u=this.DB-el(n.data[n.t-1]);u>0?(n.lShiftTo(u,a),i.lShiftTo(u,r)):(n.copyTo(a),i.copyTo(r));var c=a.t,l=a.data[c-1];if(l!=0){var f=l*(1<<this.F1)+(c>1?a.data[c-2]>>this.F2:0),d=this.FV/f,g=(1<<this.F1)/f,h=1<<this.F2,v=r.t,p=v-c,y=t==null?Qe():t;for(a.dlShiftTo(p,y),r.compareTo(y)>=0&&(r.data[r.t++]=1,r.subTo(y,r)),ge.ONE.dlShiftTo(c,y),y.subTo(a,a);a.t<c;)a.data[a.t++]=0;for(;--p>=0;){var w=r.data[--v]==l?this.DM:Math.floor(r.data[v]*d+(r.data[v-1]+h)*g);if((r.data[v]+=a.am(0,w,r,p,0,c))<w)for(a.dlShiftTo(p,y),r.subTo(y,r);r.data[v]<--w;)r.subTo(y,r)}t!=null&&(r.drShiftTo(c,t),o!=s&&ge.ZERO.subTo(t,t)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),o<0&&ge.ZERO.subTo(r,r)}}}function rB(e){var t=Qe();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(ge.ZERO)>0&&e.subTo(t,t),t}function Gi(e){this.m=e}function nB(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function iB(e){return e}function aB(e){e.divRemTo(this.m,null,e)}function oB(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function sB(e,t){e.squareTo(t),this.reduce(t)}Gi.prototype.convert=nB,Gi.prototype.revert=iB,Gi.prototype.reduce=aB,Gi.prototype.mulTo=oB,Gi.prototype.sqrTo=sB;function uB(){if(this.t<1)return 0;var e=this.data[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Hi(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function cB(e){var t=Qe();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(ge.ZERO)>0&&this.m.subTo(t,t),t}function lB(e){var t=Qe();return e.copyTo(t),this.reduce(t),t}function fB(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e.data[t]&32767,n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function dB(e,t){e.squareTo(t),this.reduce(t)}function hB(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Hi.prototype.convert=cB,Hi.prototype.revert=lB,Hi.prototype.reduce=fB,Hi.prototype.mulTo=hB,Hi.prototype.sqrTo=dB;function pB(){return(this.t>0?this.data[0]&1:this.s)==0}function gB(e,t){if(e>4294967295||e<1)return ge.ONE;var r=Qe(),n=Qe(),i=t.convert(this),a=el(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var o=r;r=n,n=o}return t.revert(r)}function yB(e,t){var r;return e<256||t.isEven()?r=new Gi(t):r=new Hi(t),this.exp(e,r)}ge.prototype.copyTo=U3,ge.prototype.fromInt=$3,ge.prototype.fromString=j3,ge.prototype.clamp=K3,ge.prototype.dlShiftTo=W3,ge.prototype.drShiftTo=z3,ge.prototype.lShiftTo=Q3,ge.prototype.rShiftTo=X3,ge.prototype.subTo=J3,ge.prototype.multiplyTo=Z3,ge.prototype.squareTo=eB,ge.prototype.divRemTo=tB,ge.prototype.invDigit=uB,ge.prototype.isEven=pB,ge.prototype.exp=gB,ge.prototype.toString=q3,ge.prototype.negate=V3,ge.prototype.abs=G3,ge.prototype.compareTo=H3,ge.prototype.bitLength=Y3,ge.prototype.mod=rB,ge.prototype.modPowInt=yB,ge.ZERO=si(0),ge.ONE=si(1);function vB(){var e=Qe();return this.copyTo(e),e}function mB(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function EB(){return this.t==0?this.s:this.data[0]<<24>>24}function bB(){return this.t==0?this.s:this.data[0]<<16>>16}function _B(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function SB(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function CB(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=si(r),i=Qe(),a=Qe(),o="";for(this.divRemTo(n,i,a);i.signum()>0;)o=(r+a.intValue()).toString(e).substr(1)+o,i.divRemTo(n,i,a);return a.intValue().toString(e)+o}function wB(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,a=0,o=0,s=0;s<e.length;++s){var u=y_(e,s);if(u<0){e.charAt(s)=="-"&&this.signum()==0&&(i=!0);continue}o=t*o+u,++a>=r&&(this.dMultiply(n),this.dAddOffset(o,0),a=0,o=0)}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(o,0)),i&&ge.ZERO.subTo(this,this)}function TB(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(ge.ONE.shiftLeft(e-1),Rp,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(ge.ONE.shiftLeft(e-1),this);else{var n=new Array,i=e&7;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function AB(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this.data[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this.data[e]&(1<<r)-1)<<8-r,n|=this.data[--e]>>(r+=this.DB-8)):(n=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),(n&128)!=0&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function xB(e){return this.compareTo(e)==0}function RB(e){return this.compareTo(e)<0?this:e}function IB(e){return this.compareTo(e)>0?this:e}function OB(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=a;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=a;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function MB(e,t){return e&t}function LB(e){var t=Qe();return this.bitwiseTo(e,MB,t),t}function Rp(e,t){return e|t}function PB(e){var t=Qe();return this.bitwiseTo(e,Rp,t),t}function v_(e,t){return e^t}function NB(e){var t=Qe();return this.bitwiseTo(e,v_,t),t}function m_(e,t){return e&~t}function BB(e){var t=Qe();return this.bitwiseTo(e,m_,t),t}function DB(){for(var e=Qe(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function FB(e){var t=Qe();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function kB(e){var t=Qe();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function UB(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function $B(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+UB(this.data[e]);return this.s<0?this.t*this.DB:-1}function jB(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function KB(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=jB(this.data[r]^t);return e}function qB(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function VB(e,t){var r=ge.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function GB(e){return this.changeBit(e,Rp)}function HB(e){return this.changeBit(e,m_)}function YB(e){return this.changeBit(e,v_)}function WB(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function zB(e){var t=Qe();return this.addTo(e,t),t}function QB(e){var t=Qe();return this.subTo(e,t),t}function XB(e){var t=Qe();return this.multiplyTo(e,t),t}function JB(e){var t=Qe();return this.divRemTo(e,t,null),t}function ZB(e){var t=Qe();return this.divRemTo(e,null,t),t}function eD(e){var t=Qe(),r=Qe();return this.divRemTo(e,t,r),new Array(t,r)}function tD(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function rD(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Ks(){}function E_(e){return e}function nD(e,t,r){e.multiplyTo(t,r)}function iD(e,t){e.squareTo(t)}Ks.prototype.convert=E_,Ks.prototype.revert=E_,Ks.prototype.mulTo=nD,Ks.prototype.sqrTo=iD;function aD(e){return this.exp(e,new Ks)}function oD(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()}function sD(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function so(e){this.r2=Qe(),this.q3=Qe(),ge.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function uD(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Qe();return e.copyTo(t),this.reduce(t),t}function cD(e){return e}function lD(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function fD(e,t){e.squareTo(t),this.reduce(t)}function dD(e,t,r){e.multiplyTo(t,r),this.reduce(r)}so.prototype.convert=uD,so.prototype.revert=cD,so.prototype.reduce=lD,so.prototype.mulTo=dD,so.prototype.sqrTo=fD;function hD(e,t){var r=e.bitLength(),n,i=si(1),a;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?a=new Gi(t):t.isEven()?a=new so(t):a=new Hi(t);var o=new Array,s=3,u=n-1,c=(1<<n)-1;if(o[1]=a.convert(this),n>1){var l=Qe();for(a.sqrTo(o[1],l);s<=c;)o[s]=Qe(),a.mulTo(l,o[s-2],o[s]),s+=2}var f=e.t-1,d,g=!0,h=Qe(),v;for(r=el(e.data[f])-1;f>=0;){for(r>=u?d=e.data[f]>>r-u&c:(d=(e.data[f]&(1<<r+1)-1)<<u-r,f>0&&(d|=e.data[f-1]>>this.DB+r-u)),s=n;(d&1)==0;)d>>=1,--s;if((r-=s)<0&&(r+=this.DB,--f),g)o[d].copyTo(i),g=!1;else{for(;s>1;)a.sqrTo(i,h),a.sqrTo(h,i),s-=2;s>0?a.sqrTo(i,h):(v=i,i=h,h=v),a.mulTo(h,o[d],i)}for(;f>=0&&(e.data[f]&1<<r)==0;)a.sqrTo(i,h),v=i,i=h,h=v,--r<0&&(r=this.DB-1,--f)}return a.revert(i)}function pD(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r}function gD(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function yD(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return ge.ZERO;for(var r=e.clone(),n=this.clone(),i=si(1),a=si(0),o=si(0),s=si(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!a.isEven())&&(i.addTo(this,i),a.subTo(e,a)),i.rShiftTo(1,i)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),t?((!o.isEven()||!s.isEven())&&(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(o,i),a.subTo(s,a)):(n.subTo(r,n),t&&o.subTo(i,o),s.subTo(a,s))}if(n.compareTo(ge.ONE)!=0)return ge.ZERO;if(s.compareTo(e)>=0)return s.subtract(e);if(s.signum()<0)s.addTo(e,s);else return s;return s.signum()<0?s.add(e):s}var Vr=[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],vD=(1<<26)/Vr[Vr.length-1];function mD(e){var t,r=this.abs();if(r.t==1&&r.data[0]<=Vr[Vr.length-1]){for(t=0;t<Vr.length;++t)if(r.data[0]==Vr[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Vr.length;){for(var n=Vr[t],i=t+1;i<Vr.length&&n<vD;)n*=Vr[i++];for(n=r.modInt(n);t<i;)if(n%Vr[t++]==0)return!1}return r.millerRabin(e)}function ED(e){var t=this.subtract(ge.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n=t.shiftRight(r),i=bD(),a,o=0;o<e;++o){do a=new ge(this.bitLength(),i);while(a.compareTo(ge.ONE)<=0||a.compareTo(t)>=0);var s=a.modPow(n,this);if(s.compareTo(ge.ONE)!=0&&s.compareTo(t)!=0){for(var u=1;u++<r&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(ge.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}function bD(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}ge.prototype.chunkSize=_B,ge.prototype.toRadix=CB,ge.prototype.fromRadix=wB,ge.prototype.fromNumber=TB,ge.prototype.bitwiseTo=OB,ge.prototype.changeBit=VB,ge.prototype.addTo=WB,ge.prototype.dMultiply=tD,ge.prototype.dAddOffset=rD,ge.prototype.multiplyLowerTo=oD,ge.prototype.multiplyUpperTo=sD,ge.prototype.modInt=gD,ge.prototype.millerRabin=ED,ge.prototype.clone=vB,ge.prototype.intValue=mB,ge.prototype.byteValue=EB,ge.prototype.shortValue=bB,ge.prototype.signum=SB,ge.prototype.toByteArray=AB,ge.prototype.equals=xB,ge.prototype.min=RB,ge.prototype.max=IB,ge.prototype.and=LB,ge.prototype.or=PB,ge.prototype.xor=NB,ge.prototype.andNot=BB,ge.prototype.not=DB,ge.prototype.shiftLeft=FB,ge.prototype.shiftRight=kB,ge.prototype.getLowestSetBit=$B,ge.prototype.bitCount=KB,ge.prototype.testBit=qB,ge.prototype.setBit=GB,ge.prototype.clearBit=HB,ge.prototype.flipBit=YB,ge.prototype.add=zB,ge.prototype.subtract=QB,ge.prototype.multiply=XB,ge.prototype.divide=JB,ge.prototype.remainder=ZB,ge.prototype.divideAndRemainder=eD,ge.prototype.modPow=hD,ge.prototype.modInverse=yD,ge.prototype.pow=aD,ge.prototype.gcd=pD,ge.prototype.isProbablePrime=mD;var ln=ke,b_=ln.sha1=ln.sha1||{};ln.md.sha1=ln.md.algorithms.sha1=b_,b_.create=function(){__||_D();var e=null,t=ln.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,a=0;a<i;++a)n.fullMessageLength.push(0);return t=ln.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,a){a==="utf8"&&(i=ln.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var s=n.fullMessageLength.length-1;s>=0;--s)n.fullMessageLength[s]+=o[1],o[1]=o[0]+(n.fullMessageLength[s]/4294967296>>>0),n.fullMessageLength[s]=n.fullMessageLength[s]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),S_(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var i=ln.util.createBuffer();i.putBytes(t.bytes());var a=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=a&n.blockLength-1;i.putBytes(Ip.substr(0,n.blockLength-o));for(var s,u,c=n.fullMessageLength[0]*8,l=0;l<n.fullMessageLength.length-1;++l)s=n.fullMessageLength[l+1]*8,u=s/4294967296>>>0,c+=u,i.putInt32(c>>>0),c=s>>>0;i.putInt32(c);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};S_(f,r,i);var d=ln.util.createBuffer();return d.putInt32(f.h0),d.putInt32(f.h1),d.putInt32(f.h2),d.putInt32(f.h3),d.putInt32(f.h4),d},n};var Ip=null,__=!1;function _D(){Ip=String.fromCharCode(128),Ip+=ln.util.fillString(String.fromCharCode(0),64),__=!0}function S_(e,t,r){for(var n,i,a,o,s,u,c,l,f=r.length();f>=64;){for(i=e.h0,a=e.h1,o=e.h2,s=e.h3,u=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,c=s^a&(o^s),n=(i<<5|i>>>27)+c+u+1518500249+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;l<20;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=s^a&(o^s),n=(i<<5|i>>>27)+c+u+1518500249+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;l<32;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=a^o^s,n=(i<<5|i>>>27)+c+u+1859775393+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;l<40;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=a^o^s,n=(i<<5|i>>>27)+c+u+1859775393+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;l<60;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=a&o|s&(a^o),n=(i<<5|i>>>27)+c+u+2400959708+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;l<80;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=a^o^s,n=(i<<5|i>>>27)+c+u+3395469782+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+o|0,e.h3=e.h3+s|0,e.h4=e.h4+u|0,f-=64}}var fn=ke,C_=fn.pkcs1=fn.pkcs1||{};C_.encode_rsa_oaep=function(e,t,r){var n,i,a,o;typeof r=="string"?(n=r,i=arguments[3]||void 0,a=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md)),a?a.start():a=fn.md.sha1.create(),o||(o=a);var s=Math.ceil(e.n.bitLength()/8),u=s-2*a.digestLength-2;if(t.length>u){var c=new Error("RSAES-OAEP input message length is too long.");throw c.length=t.length,c.maxLength=u,c}n||(n=""),a.update(n,"raw");for(var l=a.digest(),f="",d=u-t.length,g=0;g<d;g++)f+="\0";var h=l.getBytes()+f+""+t;if(!i)i=fn.random.getBytes(a.digestLength);else if(i.length!==a.digestLength){var c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw c.seedLength=i.length,c.digestLength=a.digestLength,c}var v=tl(i,s-a.digestLength-1,o),p=fn.util.xorBytes(h,v,h.length),y=tl(p,a.digestLength,o),w=fn.util.xorBytes(i,y,i.length);return"\0"+w+p},C_.decode_rsa_oaep=function(e,t,r){var n,i,a;typeof r=="string"?(n=r,i=arguments[3]||void 0):r&&(n=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var o=Math.ceil(e.n.bitLength()/8);if(t.length!==o){var p=new Error("RSAES-OAEP encoded message length is invalid.");throw p.length=t.length,p.expectedLength=o,p}if(i===void 0?i=fn.md.sha1.create():i.start(),a||(a=i),o<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),i.update(n,"raw");for(var s=i.digest().getBytes(),u=t.charAt(0),c=t.substring(1,i.digestLength+1),l=t.substring(1+i.digestLength),f=tl(l,i.digestLength,a),d=fn.util.xorBytes(c,f,c.length),g=tl(d,o-i.digestLength-1,a),h=fn.util.xorBytes(l,g,l.length),v=h.substring(0,i.digestLength),p=u!=="\0",y=0;y<i.digestLength;++y)p|=s.charAt(y)!==v.charAt(y);for(var w=1,m=i.digestLength,S=i.digestLength;S<h.length;S++){var A=h.charCodeAt(S),I=A&1^1,N=w?65534:0;p|=A&N,w=w&I,m+=w}if(p||h.charCodeAt(m)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(m+1)};function tl(e,t,r){r||(r=fn.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),a=0;a<i;++a){var o=String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255);r.start(),r.update(e+o),n+=r.digest().getBytes()}return n.substring(0,t)}var ui=ke;(function(){if(ui.prime){ui.prime;return}var e=ui.prime=ui.prime||{},t=ui.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new t(null);n.fromInt(30);var i=function(f,d){return f|d};e.generateProbablePrime=function(f,d,g){typeof d=="function"&&(g=d,d={}),d=d||{};var h=d.algorithm||"PRIMEINC";typeof h=="string"&&(h={name:h}),h.options=h.options||{};var v=d.prng||ui.random,p={nextBytes:function(y){for(var w=v.getBytesSync(y.length),m=0;m<y.length;++m)y[m]=w.charCodeAt(m)}};if(h.name==="PRIMEINC")return a(f,p,h.options,g);throw new Error("Invalid prime generation algorithm: "+h.name)};function a(f,d,g,h){return"workers"in g?u(f,d,g,h):o(f,d,g,h)}function o(f,d,g,h){var v=c(f,d),p=0,y=l(v.bitLength());"millerRabinTests"in g&&(y=g.millerRabinTests);var w=10;"maxBlockTime"in g&&(w=g.maxBlockTime),s(v,f,d,p,y,w,h)}function s(f,d,g,h,v,p,y){var w=+new Date;do{if(f.bitLength()>d&&(f=c(d,g)),f.isProbablePrime(v))return y(null,f);f.dAddOffset(r[h++%8],0)}while(p<0||+new Date-w<p);ui.util.setImmediate(function(){s(f,d,g,h,v,p,y)})}function u(f,d,g,h){if(typeof Worker>"u")return o(f,d,g,h);var v=c(f,d),p=g.workers,y=g.workLoad||100,w=y*30/8,m=g.workerScript||"forge/prime.worker.js";if(p===-1)return ui.util.estimateCores(function(A,I){A&&(I=2),p=I-1,S()});S();function S(){p=Math.max(1,p);for(var A=[],I=0;I<p;++I)A[I]=new Worker(m);for(var I=0;I<p;++I)A[I].addEventListener("message",T);var N=!1;function T(M){if(!N){var P=M.data;if(P.found){for(var L=0;L<A.length;++L)A[L].terminate();return N=!0,h(null,new t(P.prime,16))}v.bitLength()>f&&(v=c(f,d));var B=v.toString(16);M.target.postMessage({hex:B,workLoad:y}),v.dAddOffset(w,0)}}}}function c(f,d){var g=new t(f,d),h=f-1;return g.testBit(h)||g.bitwiseTo(t.ONE.shiftLeft(h),i,g),g.dAddOffset(31-g.mod(n).byteValue(),0),g}function l(f){return f<=100?27:f<=150?18:f<=200?15:f<=250?12:f<=300?9:f<=350?8:f<=400?7:f<=500?6:f<=600?5:f<=800?4:f<=1250?3:2}})();var De=ke;if(typeof Xe>"u")var Xe=De.jsbn.BigInteger;var Op=De.util.isNodejs?_e:null,ie=De.asn1,Lr=De.util;De.pki=De.pki||{},De.pki.rsa=De.rsa=De.rsa||{};var Fe=De.pki,SD=[6,4,2,4,2,4,6,2],CD={name:"PrivateKeyInfo",tagClass:ie.Class.UNIVERSAL,type:ie.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:ie.Class.UNIVERSAL,type:ie.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ie.Class.UNIVERSAL,type:ie.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:ie.Class.UNIVERSAL,type:ie.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},wD={name:"RSAPrivateKey",tagClass:ie.Class.UNIVERSAL,type:ie.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},TD={name:"RSAPublicKey",tagClass:ie.Class.UNIVERSAL,type:ie.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:ie.Class.UNIVERSAL,type:ie.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},AD=De.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:ie.Class.UNIVERSAL,type:ie.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:ie.Class.UNIVERSAL,type:ie.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ie.Class.UNIVERSAL,type:ie.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:ie.Class.UNIVERSAL,type:ie.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:ie.Class.UNIVERSAL,type:ie.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},xD=function(e){var t;if(e.algorithm in Fe.oids)t=Fe.oids[e.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}var n=ie.oidToDer(t).getBytes(),i=ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[]),a=ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[]);a.value.push(ie.create(ie.Class.UNIVERSAL,ie.Type.OID,!1,n)),a.value.push(ie.create(ie.Class.UNIVERSAL,ie.Type.NULL,!1,""));var o=ie.create(ie.Class.UNIVERSAL,ie.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(o),ie.toDer(i).getBytes()},w_=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(Xe.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(Xe.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var n;do n=new Xe(De.util.bytesToHex(De.random.getBytes(t.n.bitLength()/8)),16);while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(Xe.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var i=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(a)<0;)i=i.add(t.p);var o=i.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return o=o.multiply(n.modInverse(t.n)).mod(t.n),o};Fe.rsa.encrypt=function(e,t,r){var n=r,i,a=Math.ceil(t.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=T_(e,t,r)):(i=De.util.createBuffer(),i.putBytes(e));for(var o=new Xe(i.toHex(),16),s=w_(o,t,n),u=s.toString(16),c=De.util.createBuffer(),l=a-Math.ceil(u.length/2);l>0;)c.putByte(0),--l;return c.putBytes(De.util.hexToBytes(u)),c.getBytes()},Fe.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=i,a}var o=new Xe(De.util.createBuffer(e).toHex(),16);if(o.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=w_(o,t,r),u=s.toString(16),c=De.util.createBuffer(),l=i-Math.ceil(u.length/2);l>0;)c.putByte(0),--l;return c.putBytes(De.util.hexToBytes(u)),n!==!1?rl(c.getBytes(),t,r):c.getBytes()},Fe.rsa.createKeyPairGenerationState=function(e,t,r){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n=r.prng||De.random,i={nextBytes:function(s){for(var u=n.getBytesSync(s.length),c=0;c<s.length;++c)s[c]=u.charCodeAt(c)}},a=r.algorithm||"PRIMEINC",o;if(a==="PRIMEINC")o={algorithm:a,state:0,bits:e,rng:i,eInt:t||65537,e:new Xe(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},o.e.fromInt(o.eInt);else throw new Error("Invalid key generation algorithm: "+a);return o},Fe.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new Xe(null);r.fromInt(30);for(var n=0,i=function(f,d){return f|d},a=+new Date,o,s=0;e.keys===null&&(t<=0||s<t);){if(e.state===0){var u=e.p===null?e.pBits:e.qBits,c=u-1;e.pqState===0?(e.num=new Xe(u,e.rng),e.num.testBit(c)||e.num.bitwiseTo(Xe.ONE.shiftLeft(c),i,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),n=0,++e.pqState):e.pqState===1?e.num.bitLength()>u?e.pqState=0:e.num.isProbablePrime(ID(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(SD[n++%8],0):e.pqState===2?e.pqState=e.num.subtract(Xe.ONE).gcd(e.e).compareTo(Xe.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(Xe.ONE),e.q1=e.q.subtract(Xe.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(Xe.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var l=e.e.modInverse(e.phi);e.keys={privateKey:Fe.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:Fe.rsa.setPublicKey(e.n,e.e)}}o=+new Date,s+=o-a,a=o}return e.keys!==null},Fe.rsa.generateKeyPair=function(e,t,r,n){if(arguments.length===1?typeof e=="object"?(r=e,e=void 0):typeof e=="function"&&(n=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(n=t,t=void 0):typeof t!="number"&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof r=="function"&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},e===void 0&&(e=r.bits||2048),t===void 0&&(t=r.e||65537),!De.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(n){if(A_("generateKeyPair"))return Op.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(s,u,c){if(s)return n(s);n(null,{privateKey:Fe.privateKeyFromPem(c),publicKey:Fe.publicKeyFromPem(u)})});if(x_("generateKey")&&x_("exportKey"))return Lr.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(s){return Lr.globalScope.crypto.subtle.exportKey("pkcs8",s.privateKey)}).then(void 0,function(s){n(s)}).then(function(s){if(s){var u=Fe.privateKeyFromAsn1(ie.fromDer(De.util.createBuffer(s)));n(null,{privateKey:u,publicKey:Fe.setRsaPublicKey(u.n,u.e)})}});if(R_("generateKey")&&R_("exportKey")){var i=Lr.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I_(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(s){var u=s.target.result,c=Lr.globalScope.msCrypto.subtle.exportKey("pkcs8",u.privateKey);c.oncomplete=function(l){var f=l.target.result,d=Fe.privateKeyFromAsn1(ie.fromDer(De.util.createBuffer(f)));n(null,{privateKey:d,publicKey:Fe.setRsaPublicKey(d.n,d.e)})},c.onerror=function(l){n(l)}},i.onerror=function(s){n(s)};return}}else if(A_("generateKeyPairSync")){var a=Op.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Fe.privateKeyFromPem(a.privateKey),publicKey:Fe.publicKeyFromPem(a.publicKey)}}}var o=Fe.rsa.createKeyPairGenerationState(e,t,r);if(!n)return Fe.rsa.stepKeyPairGenerationState(o,0),o.keys;RD(o,r,n)},Fe.setRsaPublicKey=Fe.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(n,i,a){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(s,u,c){return T_(s,u,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(s,u){return De.pkcs1.encode_rsa_oaep(u,s,a)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(s){return s}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var o=i.encode(n,r,!0);return Fe.rsa.encrypt(o,r,!0)},r.verify=function(n,i,a){typeof a=="string"?a=a.toUpperCase():a===void 0&&(a="RSASSA-PKCS1-V1_5"),a==="RSASSA-PKCS1-V1_5"?a={verify:function(s,u){u=rl(u,r,!0);var c=ie.fromDer(u);return s===c.value[1].value}}:(a==="NONE"||a==="NULL"||a===null)&&(a={verify:function(s,u){return u=rl(u,r,!0),s===u}});var o=Fe.rsa.decrypt(i,r,!0,!1);return a.verify(n,o,r.n.bitLength())},r},Fe.setRsaPrivateKey=Fe.rsa.setPrivateKey=function(e,t,r,n,i,a,o,s){var u={n:e,e:t,d:r,p:n,q:i,dP:a,dQ:o,qInv:s};return u.decrypt=function(c,l,f){typeof l=="string"?l=l.toUpperCase():l===void 0&&(l="RSAES-PKCS1-V1_5");var d=Fe.rsa.decrypt(c,u,!1,!1);if(l==="RSAES-PKCS1-V1_5")l={decode:rl};else if(l==="RSA-OAEP"||l==="RSAES-OAEP")l={decode:function(g,h){return De.pkcs1.decode_rsa_oaep(h,g,f)}};else if(["RAW","NONE","NULL",null].indexOf(l)!==-1)l={decode:function(g){return g}};else throw new Error('Unsupported encryption scheme: "'+l+'".');return l.decode(d,u,!1)},u.sign=function(c,l){var f=!1;typeof l=="string"&&(l=l.toUpperCase()),l===void 0||l==="RSASSA-PKCS1-V1_5"?(l={encode:xD},f=1):(l==="NONE"||l==="NULL"||l===null)&&(l={encode:function(){return c}},f=1);var d=l.encode(c,u.n.bitLength());return Fe.rsa.encrypt(d,u,f)},u},Fe.wrapRsaPrivateKey=function(e){return ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,ie.integerToDer(0).getBytes()),ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[ie.create(ie.Class.UNIVERSAL,ie.Type.OID,!1,ie.oidToDer(Fe.oids.rsaEncryption).getBytes()),ie.create(ie.Class.UNIVERSAL,ie.Type.NULL,!1,"")]),ie.create(ie.Class.UNIVERSAL,ie.Type.OCTETSTRING,!1,ie.toDer(e).getBytes())])},Fe.privateKeyFromAsn1=function(e){var t={},r=[];if(ie.validate(e,CD,t,r)&&(e=ie.fromDer(De.util.createBuffer(t.privateKey))),t={},r=[],!ie.validate(e,wD,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,a,o,s,u,c,l,f;return i=De.util.createBuffer(t.privateKeyModulus).toHex(),a=De.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=De.util.createBuffer(t.privateKeyPrivateExponent).toHex(),s=De.util.createBuffer(t.privateKeyPrime1).toHex(),u=De.util.createBuffer(t.privateKeyPrime2).toHex(),c=De.util.createBuffer(t.privateKeyExponent1).toHex(),l=De.util.createBuffer(t.privateKeyExponent2).toHex(),f=De.util.createBuffer(t.privateKeyCoefficient).toHex(),Fe.setRsaPrivateKey(new Xe(i,16),new Xe(a,16),new Xe(o,16),new Xe(s,16),new Xe(u,16),new Xe(c,16),new Xe(l,16),new Xe(f,16))},Fe.privateKeyToAsn1=Fe.privateKeyToRSAPrivateKey=function(e){return ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,ie.integerToDer(0).getBytes()),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.n)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.e)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.d)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.p)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.q)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.dP)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.dQ)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.qInv))])},Fe.publicKeyFromAsn1=function(e){var t={},r=[];if(ie.validate(e,AD,t,r)){var n=ie.derToOid(t.publicKeyOid);if(n!==Fe.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}e=t.rsaPublicKey}if(r=[],!ie.validate(e,TD,t,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var a=De.util.createBuffer(t.publicKeyModulus).toHex(),o=De.util.createBuffer(t.publicKeyExponent).toHex();return Fe.setRsaPublicKey(new Xe(a,16),new Xe(o,16))},Fe.publicKeyToAsn1=Fe.publicKeyToSubjectPublicKeyInfo=function(e){return ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[ie.create(ie.Class.UNIVERSAL,ie.Type.OID,!1,ie.oidToDer(Fe.oids.rsaEncryption).getBytes()),ie.create(ie.Class.UNIVERSAL,ie.Type.NULL,!1,"")]),ie.create(ie.Class.UNIVERSAL,ie.Type.BITSTRING,!1,[Fe.publicKeyToRSAPublicKey(e)])])},Fe.publicKeyToRSAPublicKey=function(e){return ie.create(ie.Class.UNIVERSAL,ie.Type.SEQUENCE,!0,[ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.n)),ie.create(ie.Class.UNIVERSAL,ie.Type.INTEGER,!1,dn(e.e))])};function T_(e,t,r){var n=De.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var a=new Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=e.length,a.max=i-11,a}n.putByte(0),n.putByte(r);var o=i-3-e.length,s;if(r===0||r===1){s=r===0?0:255;for(var u=0;u<o;++u)n.putByte(s)}else for(;o>0;){for(var c=0,l=De.random.getBytes(o),u=0;u<o;++u)s=l.charCodeAt(u),s===0?++c:n.putByte(s);o=c}return n.putByte(0),n.putBytes(e),n}function rl(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8),a=De.util.createBuffer(e),o=a.getByte(),s=a.getByte();if(o!==0||r&&s!==0&&s!==1||!r&&s!=2||r&&s===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var u=0;if(s===0){u=i-3-n;for(var c=0;c<u;++c)if(a.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(s===1)for(u=0;a.length()>1;){if(a.getByte()!==255){--a.read;break}++u}else if(s===2)for(u=0;a.length()>1;){if(a.getByte()===0){--a.read;break}++u}var l=a.getByte();if(l!==0||u!==i-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function RD(e,t,r){typeof t=="function"&&(r=t,t={}),t=t||{};var n={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(n.prng=t.prng),i();function i(){a(e.pBits,function(s,u){if(s)return r(s);if(e.p=u,e.q!==null)return o(s,e.q);a(e.qBits,o)})}function a(s,u){De.prime.generateProbablePrime(s,n,u)}function o(s,u){if(s)return r(s);if(e.q=u,e.p.compareTo(e.q)<0){var c=e.p;e.p=e.q,e.q=c}if(e.p.subtract(Xe.ONE).gcd(e.e).compareTo(Xe.ONE)!==0){e.p=null,i();return}if(e.q.subtract(Xe.ONE).gcd(e.e).compareTo(Xe.ONE)!==0){e.q=null,a(e.qBits,o);return}if(e.p1=e.p.subtract(Xe.ONE),e.q1=e.q.subtract(Xe.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(Xe.ONE)!==0){e.p=e.q=null,i();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,a(e.qBits,o);return}var l=e.e.modInverse(e.phi);e.keys={privateKey:Fe.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:Fe.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}}function dn(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=De.util.hexToBytes(t);return r.length>1&&(r.charCodeAt(0)===0&&(r.charCodeAt(1)&128)===0||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function ID(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function A_(e){return De.util.isNodejs&&typeof Op[e]=="function"}function x_(e){return typeof Lr.globalScope<"u"&&typeof Lr.globalScope.crypto=="object"&&typeof Lr.globalScope.crypto.subtle=="object"&&typeof Lr.globalScope.crypto.subtle[e]=="function"}function R_(e){return typeof Lr.globalScope<"u"&&typeof Lr.globalScope.msCrypto=="object"&&typeof Lr.globalScope.msCrypto.subtle=="object"&&typeof Lr.globalScope.msCrypto.subtle[e]=="function"}function I_(e){for(var t=De.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}var Ie=ke;if(typeof OD>"u")var OD=Ie.jsbn.BigInteger;var ce=Ie.asn1,Ue=Ie.pki=Ie.pki||{};Ue.pbe=Ie.pbe=Ie.pbe||{};var Yi=Ue.oids,MD={name:"EncryptedPrivateKeyInfo",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},LD={name:"PBES2Algorithms",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:ce.Class.UNIVERSAL,type:ce.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:ce.Class.UNIVERSAL,type:ce.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},PD={name:"pkcs-12PbeParams",tagClass:ce.Class.UNIVERSAL,type:ce.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:ce.Class.UNIVERSAL,type:ce.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:ce.Class.UNIVERSAL,type:ce.Type.INTEGER,constructed:!1,capture:"iterations"}]};Ue.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n=Ie.random.getBytesSync(r.saltSize),i=r.count,a=ce.integerToDer(i),o,s,u;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var c,l,f;switch(r.algorithm){case"aes128":o=16,c=16,l=Yi["aes128-CBC"],f=Ie.aes.createEncryptionCipher;break;case"aes192":o=24,c=16,l=Yi["aes192-CBC"],f=Ie.aes.createEncryptionCipher;break;case"aes256":o=32,c=16,l=Yi["aes256-CBC"],f=Ie.aes.createEncryptionCipher;break;case"des":o=8,c=8,l=Yi.desCBC,f=Ie.des.createEncryptionCipher;break;default:var d=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw d.algorithm=r.algorithm,d}var g="hmacWith"+r.prfAlgorithm.toUpperCase(),h=L_(g),v=Ie.pkcs5.pbkdf2(t,n,i,o,h),p=Ie.random.getBytesSync(c),y=f(v);y.start(p),y.update(ce.toDer(e)),y.finish(),u=y.output.getBytes();var w=ND(n,a,o,g);s=ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.OID,!1,ce.oidToDer(Yi.pkcs5PBES2).getBytes()),ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.OID,!1,ce.oidToDer(Yi.pkcs5PBKDF2).getBytes()),w]),ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.OID,!1,ce.oidToDer(l).getBytes()),ce.create(ce.Class.UNIVERSAL,ce.Type.OCTETSTRING,!1,p)])])])}else if(r.algorithm==="3des"){o=24;var m=new Ie.util.ByteBuffer(n),v=Ue.pbe.generatePkcs12Key(t,m,1,i,o),p=Ue.pbe.generatePkcs12Key(t,m,2,i,o),y=Ie.des.createEncryptionCipher(v);y.start(p),y.update(ce.toDer(e)),y.finish(),u=y.output.getBytes(),s=ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.OID,!1,ce.oidToDer(Yi["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.OCTETSTRING,!1,n),ce.create(ce.Class.UNIVERSAL,ce.Type.INTEGER,!1,a.getBytes())])])}else{var d=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw d.algorithm=r.algorithm,d}var S=ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[s,ce.create(ce.Class.UNIVERSAL,ce.Type.OCTETSTRING,!1,u)]);return S},Ue.decryptPrivateKeyInfo=function(e,t){var r=null,n={},i=[];if(!ce.validate(e,MD,n,i)){var a=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}var o=ce.derToOid(n.encryptionOid),s=Ue.pbe.getCipher(o,n.encryptionParams,t),u=Ie.util.createBuffer(n.encryptedData);return s.update(u),s.finish()&&(r=ce.fromDer(s.output)),r},Ue.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:ce.toDer(e).getBytes()};return Ie.pem.encode(r,{maxline:t})},Ue.encryptedPrivateKeyFromPem=function(e){var t=Ie.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return ce.fromDer(t.body)},Ue.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var n=Ue.wrapRsaPrivateKey(Ue.privateKeyToAsn1(e));return n=Ue.encryptPrivateKeyInfo(n,t,r),Ue.encryptedPrivateKeyToPem(n)}var i,a,o,s;switch(r.algorithm){case"aes128":i="AES-128-CBC",o=16,a=Ie.random.getBytesSync(16),s=Ie.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",o=24,a=Ie.random.getBytesSync(16),s=Ie.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",o=32,a=Ie.random.getBytesSync(16),s=Ie.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",o=24,a=Ie.random.getBytesSync(8),s=Ie.des.createEncryptionCipher;break;case"des":i="DES-CBC",o=8,a=Ie.random.getBytesSync(8),s=Ie.des.createEncryptionCipher;break;default:var u=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw u.algorithm=r.algorithm,u}var c=Ie.pbe.opensslDeriveBytes(t,a.substr(0,8),o),l=s(c);l.start(a),l.update(ce.toDer(Ue.privateKeyToAsn1(e))),l.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:Ie.util.bytesToHex(a).toUpperCase()},body:l.output.getBytes()};return Ie.pem.encode(f)},Ue.decryptRsaPrivateKey=function(e,t){var r=null,n=Ie.pem.decode(e)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&n.procType.type==="ENCRYPTED"){var a,o;switch(n.dekInfo.algorithm){case"DES-CBC":a=8,o=Ie.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,o=Ie.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,o=Ie.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,o=Ie.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,o=Ie.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,o=function(f){return Ie.rc2.createDecryptionCipher(f,40)};break;case"RC2-64-CBC":a=8,o=function(f){return Ie.rc2.createDecryptionCipher(f,64)};break;case"RC2-128-CBC":a=16,o=function(f){return Ie.rc2.createDecryptionCipher(f,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var s=Ie.util.hexToBytes(n.dekInfo.parameters),u=Ie.pbe.opensslDeriveBytes(t,s.substr(0,8),a),c=o(u);if(c.start(s),c.update(Ie.util.createBuffer(n.body)),c.finish())r=c.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=Ue.decryptPrivateKeyInfo(ce.fromDer(r),t):r=ce.fromDer(r),r!==null&&(r=Ue.privateKeyFromAsn1(r)),r},Ue.pbe.generatePkcs12Key=function(e,t,r,n,i,a){var o,s;if(typeof a>"u"||a===null){if(!("sha1"in Ie.md))throw new Error('"sha1" hash algorithm unavailable.');a=Ie.md.sha1.create()}var u=a.digestLength,c=a.blockLength,l=new Ie.util.ByteBuffer,f=new Ie.util.ByteBuffer;if(e!=null){for(s=0;s<e.length;s++)f.putInt16(e.charCodeAt(s));f.putInt16(0)}var d=f.length(),g=t.length(),h=new Ie.util.ByteBuffer;h.fillWithByte(r,c);var v=c*Math.ceil(g/c),p=new Ie.util.ByteBuffer;for(s=0;s<v;s++)p.putByte(t.at(s%g));var y=c*Math.ceil(d/c),w=new Ie.util.ByteBuffer;for(s=0;s<y;s++)w.putByte(f.at(s%d));var m=p;m.putBuffer(w);for(var S=Math.ceil(i/u),A=1;A<=S;A++){var I=new Ie.util.ByteBuffer;I.putBytes(h.bytes()),I.putBytes(m.bytes());for(var N=0;N<n;N++)a.start(),a.update(I.getBytes()),I=a.digest();var T=new Ie.util.ByteBuffer;for(s=0;s<c;s++)T.putByte(I.at(s%u));var M=Math.ceil(g/c)+Math.ceil(d/c),P=new Ie.util.ByteBuffer;for(o=0;o<M;o++){var L=new Ie.util.ByteBuffer(m.getBytes(c)),B=511;for(s=T.length()-1;s>=0;s--)B=B>>8,B+=T.at(s)+L.at(s),L.setAt(s,B&255);P.putBuffer(L)}m=P,l.putBuffer(I)}return l.truncate(l.length()-i),l},Ue.pbe.getCipher=function(e,t,r){switch(e){case Ue.oids.pkcs5PBES2:return Ue.pbe.getCipherForPBES2(e,t,r);case Ue.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Ue.oids["pbewithSHAAnd40BitRC2-CBC"]:return Ue.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},Ue.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!ce.validate(t,LD,n,i)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}if(e=ce.derToOid(n.kdfOid),e!==Ue.oids.pkcs5PBKDF2){var a=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw a.oid=e,a.supportedOids=["pkcs5PBKDF2"],a}if(e=ce.derToOid(n.encOid),e!==Ue.oids["aes128-CBC"]&&e!==Ue.oids["aes192-CBC"]&&e!==Ue.oids["aes256-CBC"]&&e!==Ue.oids["des-EDE3-CBC"]&&e!==Ue.oids.desCBC){var a=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw a.oid=e,a.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],a}var o=n.kdfSalt,s=Ie.util.createBuffer(n.kdfIterationCount);s=s.getInt(s.length()<<3);var u,c;switch(Ue.oids[e]){case"aes128-CBC":u=16,c=Ie.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,c=Ie.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,c=Ie.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,c=Ie.des.createDecryptionCipher;break;case"desCBC":u=8,c=Ie.des.createDecryptionCipher;break}var l=M_(n.prfOid),f=Ie.pkcs5.pbkdf2(r,o,s,u,l),d=n.encIv,g=c(f);return g.start(d),g},Ue.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!ce.validate(t,PD,n,i)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}var o=Ie.util.createBuffer(n.salt),s=Ie.util.createBuffer(n.iterations);s=s.getInt(s.length()<<3);var u,c,l;switch(e){case Ue.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,c=8,l=Ie.des.startDecrypting;break;case Ue.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,c=8,l=function(v,p){var y=Ie.rc2.createDecryptionCipher(v,40);return y.start(p,null),y};break;default:var a=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw a.oid=e,a}var f=M_(n.prfOid),d=Ue.pbe.generatePkcs12Key(r,o,1,s,u,f);f.start();var g=Ue.pbe.generatePkcs12Key(r,o,2,s,c,f);return l(d,g)},Ue.pbe.opensslDeriveBytes=function(e,t,r,n){if(typeof n>"u"||n===null){if(!("md5"in Ie.md))throw new Error('"md5" hash algorithm unavailable.');n=Ie.md.md5.create()}t===null&&(t="");for(var i=[O_(n,e+t)],a=16,o=1;a<r;++o,a+=16)i.push(O_(n,i[o-1]+e+t));return i.join("").substr(0,r)};function O_(e,t){return e.start().update(t).digest().getBytes()}function M_(e){var t;if(!e)t="hmacWithSHA1";else if(t=Ue.oids[ce.derToOid(e)],!t){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return L_(t)}function L_(e){var t=Ie.md;switch(e){case"hmacWithSHA224":t=Ie.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function ND(e,t,r,n){var i=ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.OCTETSTRING,!1,e),ce.create(ce.Class.UNIVERSAL,ce.Type.INTEGER,!1,t.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(ce.create(ce.Class.UNIVERSAL,ce.Type.INTEGER,!1,Ie.util.hexToBytes(r.toString(16))),ce.create(ce.Class.UNIVERSAL,ce.Type.SEQUENCE,!0,[ce.create(ce.Class.UNIVERSAL,ce.Type.OID,!1,ce.oidToDer(Ue.oids[n]).getBytes()),ce.create(ce.Class.UNIVERSAL,ce.Type.NULL,!1,"")])),i}var uo=ke,xe=uo.asn1,co=uo.pkcs7asn1=uo.pkcs7asn1||{};uo.pkcs7=uo.pkcs7||{},uo.pkcs7.asn1=co;var P_={name:"ContentInfo",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:xe.Class.UNIVERSAL,type:xe.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:xe.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};co.contentInfoValidator=P_;var N_={name:"EncryptedContentInfo",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:xe.Class.UNIVERSAL,type:xe.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:xe.Class.UNIVERSAL,type:xe.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:xe.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:xe.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};co.envelopedDataValidator={name:"EnvelopedData",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:xe.Class.UNIVERSAL,type:xe.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(N_)},co.encryptedDataValidator={name:"EncryptedData",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:xe.Class.UNIVERSAL,type:xe.Type.INTEGER,constructed:!1,capture:"version"}].concat(N_)};var BD={name:"SignerInfo",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:xe.Class.UNIVERSAL,type:xe.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:xe.Class.UNIVERSAL,type:xe.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:xe.Class.UNIVERSAL,type:xe.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:xe.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:xe.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:xe.Class.UNIVERSAL,type:xe.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:xe.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};co.signedDataValidator={name:"SignedData",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:xe.Class.UNIVERSAL,type:xe.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},P_,{name:"SignedData.Certificates",tagClass:xe.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:xe.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SET,capture:"signerInfos",optional:!0,value:[BD]}]},co.recipientInfoValidator={name:"RecipientInfo",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:xe.Class.UNIVERSAL,type:xe.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:xe.Class.UNIVERSAL,type:xe.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:xe.Class.UNIVERSAL,type:xe.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:xe.Class.UNIVERSAL,type:xe.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:xe.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:xe.Class.UNIVERSAL,type:xe.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]};var Wi=ke;Wi.mgf=Wi.mgf||{};var DD=Wi.mgf.mgf1=Wi.mgf1=Wi.mgf1||{};DD.create=function(e){var t={generate:function(r,n){for(var i=new Wi.util.ByteBuffer,a=Math.ceil(n/e.digestLength),o=0;o<a;o++){var s=new Wi.util.ByteBuffer;s.putInt32(o),e.start(),e.update(r+s.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-n),i.getBytes()}};return t};var nl=ke;nl.mgf=nl.mgf||{},nl.mgf.mgf1=nl.mgf1;var zi=ke,FD=zi.pss=zi.pss||{};FD.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,r=e.mgf,n=t.digestLength,i=e.salt||null;typeof i=="string"&&(i=zi.util.createBuffer(i));var a;if("saltLength"in e)a=e.saltLength;else if(i!==null)a=i.length();else throw new Error("Salt length not specified or specific salt not given.");if(i!==null&&i.length()!==a)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||zi.random,s={};return s.encode=function(u,c){var l,f=c-1,d=Math.ceil(f/8),g=u.digest().getBytes();if(d<n+a+2)throw new Error("Message is too long to encrypt.");var h;i===null?h=o.getBytesSync(a):h=i.bytes();var v=new zi.util.ByteBuffer;v.fillWithByte(0,8),v.putBytes(g),v.putBytes(h),t.start(),t.update(v.getBytes());var p=t.digest().getBytes(),y=new zi.util.ByteBuffer;y.fillWithByte(0,d-a-n-2),y.putByte(1),y.putBytes(h);var w=y.getBytes(),m=d-n-1,S=r.generate(p,m),A="";for(l=0;l<m;l++)A+=String.fromCharCode(w.charCodeAt(l)^S.charCodeAt(l));var I=65280>>8*d-f&255;return A=String.fromCharCode(A.charCodeAt(0)&~I)+A.substr(1),A+p+String.fromCharCode(188)},s.verify=function(u,c,l){var f,d=l-1,g=Math.ceil(d/8);if(c=c.substr(-g),g<n+a+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(c.charCodeAt(g-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var h=g-n-1,v=c.substr(0,h),p=c.substr(h,n),y=65280>>8*g-d&255;if((v.charCodeAt(0)&y)!==0)throw new Error("Bits beyond keysize not zero as expected.");var w=r.generate(p,h),m="";for(f=0;f<h;f++)m+=String.fromCharCode(v.charCodeAt(f)^w.charCodeAt(f));m=String.fromCharCode(m.charCodeAt(0)&~y)+m.substr(1);var S=g-n-a-2;for(f=0;f<S;f++)if(m.charCodeAt(f)!==0)throw new Error("Leftmost octets not zero as expected");if(m.charCodeAt(S)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var A=m.substr(-a),I=new zi.util.ByteBuffer;I.fillWithByte(0,8),I.putBytes(u),I.putBytes(A),t.start(),t.update(I.getBytes());var N=t.digest().getBytes();return p===N},s};var we=ke,D=we.asn1,Se=we.pki=we.pki||{},Be=Se.oids,pt={};pt.CN=Be.commonName,pt.commonName="CN",pt.C=Be.countryName,pt.countryName="C",pt.L=Be.localityName,pt.localityName="L",pt.ST=Be.stateOrProvinceName,pt.stateOrProvinceName="ST",pt.O=Be.organizationName,pt.organizationName="O",pt.OU=Be.organizationalUnitName,pt.organizationalUnitName="OU",pt.E=Be.emailAddress,pt.emailAddress="E";var B_=we.pki.rsa.publicKeyValidator,kD={name:"Certificate",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:D.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:D.Class.UNIVERSAL,type:D.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:D.Class.UNIVERSAL,type:D.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:D.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:D.Class.UNIVERSAL,type:D.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:D.Class.UNIVERSAL,type:D.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:D.Class.UNIVERSAL,type:D.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:D.Class.UNIVERSAL,type:D.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},B_,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:D.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:D.Class.UNIVERSAL,type:D.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:D.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:D.Class.UNIVERSAL,type:D.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:D.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:D.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:D.Class.UNIVERSAL,type:D.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},UD={name:"rsapss",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:D.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:D.Class.UNIVERSAL,type:D.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:D.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:D.Class.UNIVERSAL,type:D.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:D.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:D.Class.UNIVERSAL,type:D.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:D.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:D.Class.UNIVERSAL,type:D.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},$D={name:"CertificationRequestInfo",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:D.Class.UNIVERSAL,type:D.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},B_,{name:"CertificationRequestInfo.attributes",tagClass:D.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:D.Class.UNIVERSAL,type:D.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:D.Class.UNIVERSAL,type:D.Type.SET,constructed:!0}]}]}]},jD={name:"CertificationRequest",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[$D,{name:"CertificationRequest.signatureAlgorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:D.Class.UNIVERSAL,type:D.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:D.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:D.Class.UNIVERSAL,type:D.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};Se.RDNAttributesAsArray=function(e,t){for(var r=[],n,i,a,o=0;o<e.value.length;++o){n=e.value[o];for(var s=0;s<n.value.length;++s)a={},i=n.value[s],a.type=D.derToOid(i.value[0].value),a.value=i.value[1].value,a.valueTagClass=i.value[1].type,a.type in Be&&(a.name=Be[a.type],a.name in pt&&(a.shortName=pt[a.name])),t&&(t.update(a.type),t.update(a.value)),r.push(a)}return r},Se.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],i=D.derToOid(n.value[0].value),a=n.value[1].value,o=0;o<a.length;++o){var s={};if(s.type=i,s.value=a[o].value,s.valueTagClass=a[o].type,s.type in Be&&(s.name=Be[s.type],s.name in pt&&(s.shortName=pt[s.name])),s.type===Be.extensionRequest){s.extensions=[];for(var u=0;u<s.value.length;++u)s.extensions.push(Se.certificateExtensionFromAsn1(s.value[u]))}t.push(s)}return t};function ci(e,t){typeof t=="string"&&(t={shortName:t});for(var r=null,n,i=0;r===null&&i<e.attributes.length;++i)n=e.attributes[i],(t.type&&t.type===n.type||t.name&&t.name===n.name||t.shortName&&t.shortName===n.shortName)&&(r=n);return r}var il=function(e,t,r){var n={};if(e!==Be["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:Be.sha1},mgf:{algorithmOid:Be.mgf1,hash:{algorithmOid:Be.sha1}},saltLength:20});var i={},a=[];if(!D.validate(t,UD,i,a)){var o=new Error("Cannot read RSASSA-PSS parameter block.");throw o.errors=a,o}return i.hashOid!==void 0&&(n.hash=n.hash||{},n.hash.algorithmOid=D.derToOid(i.hashOid)),i.maskGenOid!==void 0&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=D.derToOid(i.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=D.derToOid(i.maskGenHashOid)),i.saltLength!==void 0&&(n.saltLength=i.saltLength.charCodeAt(0)),n};Se.certificateFromPem=function(e,t,r){var n=we.pem.decode(e)[0];if(n.type!=="CERTIFICATE"&&n.type!=="X509 CERTIFICATE"&&n.type!=="TRUSTED CERTIFICATE"){var i=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw i.headerType=n.type,i}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var a=D.fromDer(n.body,r);return Se.certificateFromAsn1(a,t)},Se.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:D.toDer(Se.certificateToAsn1(e)).getBytes()};return we.pem.encode(r,{maxline:t})},Se.publicKeyFromPem=function(e){var t=we.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var n=D.fromDer(t.body);return Se.publicKeyFromAsn1(n)},Se.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:D.toDer(Se.publicKeyToAsn1(e)).getBytes()};return we.pem.encode(r,{maxline:t})},Se.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:D.toDer(Se.publicKeyToRSAPublicKey(e)).getBytes()};return we.pem.encode(r,{maxline:t})},Se.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||we.md.sha1.create(),n=t.type||"RSAPublicKey",i;switch(n){case"RSAPublicKey":i=D.toDer(Se.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":i=D.toDer(Se.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}r.start(),r.update(i);var a=r.digest();if(t.encoding==="hex"){var o=a.toHex();return t.delimiter?o.match(/.{2}/g).join(t.delimiter):o}else{if(t.encoding==="binary")return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return a},Se.certificationRequestFromPem=function(e,t,r){var n=we.pem.decode(e)[0];if(n.type!=="CERTIFICATE REQUEST"){var i=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw i.headerType=n.type,i}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var a=D.fromDer(n.body,r);return Se.certificationRequestFromAsn1(a,t)},Se.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:D.toDer(Se.certificationRequestToAsn1(e)).getBytes()};return we.pem.encode(r,{maxline:t})},Se.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return ci(e.issuer,t)},e.issuer.addField=function(t){Pr([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return ci(e.subject,t)},e.subject.addField=function(t){Pr([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){Pr(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){Pr(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)D_(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var r=null,n,i=0;r===null&&i<e.extensions.length;++i)n=e.extensions[i],(t.id&&n.id===t.id||t.name&&n.name===t.name)&&(r=n);return r},e.sign=function(t,r){e.md=r||we.md.sha1.create();var n=Be[e.md.algorithm+"WithRSAEncryption"];if(!n){var i=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=n,e.tbsCertificate=Se.getTBSCertificate(e);var a=D.toDer(e.tbsCertificate);e.md.update(a.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,i=e.subject,a=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 a.expectedIssuer=n.attributes,a.actualIssuer=i.attributes,a}var o=t.md;if(o===null){if(t.signatureOid in Be){var s=Be[t.signatureOid];switch(s){case"sha1WithRSAEncryption":o=we.md.sha1.create();break;case"md5WithRSAEncryption":o=we.md.md5.create();break;case"sha256WithRSAEncryption":o=we.md.sha256.create();break;case"sha384WithRSAEncryption":o=we.md.sha384.create();break;case"sha512WithRSAEncryption":o=we.md.sha512.create();break;case"RSASSA-PSS":o=we.md.sha256.create();break}}if(o===null){var a=new Error("Could not compute certificate digest. Unknown signature OID.");throw a.signatureOid=t.signatureOid,a}var u=t.tbsCertificate||Se.getTBSCertificate(t),c=D.toDer(u);o.update(c.getBytes())}if(o!==null){var l;switch(t.signatureOid){case Be.sha1WithRSAEncryption:l=void 0;break;case Be["RSASSA-PSS"]:var f,d;if(f=Be[t.signatureParameters.mgf.hash.algorithmOid],f===void 0||we.md[f]===void 0){var a=new Error("Unsupported MGF hash function.");throw a.oid=t.signatureParameters.mgf.hash.algorithmOid,a.name=f,a}if(d=Be[t.signatureParameters.mgf.algorithmOid],d===void 0||we.mgf[d]===void 0){var a=new Error("Unsupported MGF function.");throw a.oid=t.signatureParameters.mgf.algorithmOid,a.name=d,a}if(d=we.mgf[d].create(we.md[f].create()),f=Be[t.signatureParameters.hash.algorithmOid],f===void 0||we.md[f]===void 0)throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:f};l=we.pss.create(we.md[f].create(),d,t.signatureParameters.saltLength);break}r=e.publicKey.verify(o.digest().getBytes(),t.signature,l)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){r=!0;for(var a,o,s=0;r&&s<n.attributes.length;++s)a=n.attributes[s],o=i.attributes[s],(a.type!==o.type||a.value!==o.value)&&(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return Se.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=Be.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var n=e.extensions[r];if(n.id===t){var i=e.generateSubjectKeyIdentifier().getBytes();return we.util.hexToBytes(n.subjectKeyIdentifier)===i}}return!1},e},Se.certificateFromAsn1=function(e,t){var r={},n=[];if(!D.validate(e,kD,r,n)){var i=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw i.errors=n,i}var a=D.derToOid(r.publicKeyOid);if(a!==Se.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var o=Se.createCertificate();o.version=r.certVersion?r.certVersion.charCodeAt(0):0;var s=we.util.createBuffer(r.certSerialNumber);o.serialNumber=s.toHex(),o.signatureOid=we.asn1.derToOid(r.certSignatureOid),o.signatureParameters=il(o.signatureOid,r.certSignatureParams,!0),o.siginfo.algorithmOid=we.asn1.derToOid(r.certinfoSignatureOid),o.siginfo.parameters=il(o.siginfo.algorithmOid,r.certinfoSignatureParams,!1),o.signature=r.certSignature;var u=[];if(r.certValidity1UTCTime!==void 0&&u.push(D.utcTimeToDate(r.certValidity1UTCTime)),r.certValidity2GeneralizedTime!==void 0&&u.push(D.generalizedTimeToDate(r.certValidity2GeneralizedTime)),r.certValidity3UTCTime!==void 0&&u.push(D.utcTimeToDate(r.certValidity3UTCTime)),r.certValidity4GeneralizedTime!==void 0&&u.push(D.generalizedTimeToDate(r.certValidity4GeneralizedTime)),u.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(u.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(o.validity.notBefore=u[0],o.validity.notAfter=u[1],o.tbsCertificate=r.tbsCertificate,t){if(o.md=null,o.signatureOid in Be){var a=Be[o.signatureOid];switch(a){case"sha1WithRSAEncryption":o.md=we.md.sha1.create();break;case"md5WithRSAEncryption":o.md=we.md.md5.create();break;case"sha256WithRSAEncryption":o.md=we.md.sha256.create();break;case"sha384WithRSAEncryption":o.md=we.md.sha384.create();break;case"sha512WithRSAEncryption":o.md=we.md.sha512.create();break;case"RSASSA-PSS":o.md=we.md.sha256.create();break}}if(o.md===null){var i=new Error("Could not compute certificate digest. Unknown signature OID.");throw i.signatureOid=o.signatureOid,i}var c=D.toDer(o.tbsCertificate);o.md.update(c.getBytes())}var l=we.md.sha1.create();o.issuer.getField=function(d){return ci(o.issuer,d)},o.issuer.addField=function(d){Pr([d]),o.issuer.attributes.push(d)},o.issuer.attributes=Se.RDNAttributesAsArray(r.certIssuer,l),r.certIssuerUniqueId&&(o.issuer.uniqueId=r.certIssuerUniqueId),o.issuer.hash=l.digest().toHex();var f=we.md.sha1.create();return o.subject.getField=function(d){return ci(o.subject,d)},o.subject.addField=function(d){Pr([d]),o.subject.attributes.push(d)},o.subject.attributes=Se.RDNAttributesAsArray(r.certSubject,f),r.certSubjectUniqueId&&(o.subject.uniqueId=r.certSubjectUniqueId),o.subject.hash=f.digest().toHex(),r.certExtensions?o.extensions=Se.certificateExtensionsFromAsn1(r.certExtensions):o.extensions=[],o.publicKey=Se.publicKeyFromAsn1(r.subjectPublicKeyInfo),o},Se.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(Se.certificateExtensionFromAsn1(n.value[i]));return t},Se.certificateExtensionFromAsn1=function(e){var t={};if(t.id=D.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===D.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in Be){if(t.name=Be[t.id],t.name==="keyUsage"){var r=D.fromDer(t.value),n=0,i=0;r.value.length>1&&(n=r.value.charCodeAt(1),i=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=(n&128)===128,t.nonRepudiation=(n&64)===64,t.keyEncipherment=(n&32)===32,t.dataEncipherment=(n&16)===16,t.keyAgreement=(n&8)===8,t.keyCertSign=(n&4)===4,t.cRLSign=(n&2)===2,t.encipherOnly=(n&1)===1,t.decipherOnly=(i&128)===128}else if(t.name==="basicConstraints"){var r=D.fromDer(t.value);r.value.length>0&&r.value[0].type===D.Type.BOOLEAN?t.cA=r.value[0].value.charCodeAt(0)!==0:t.cA=!1;var a=null;r.value.length>0&&r.value[0].type===D.Type.INTEGER?a=r.value[0].value:r.value.length>1&&(a=r.value[1].value),a!==null&&(t.pathLenConstraint=D.derToInteger(a))}else if(t.name==="extKeyUsage")for(var r=D.fromDer(t.value),o=0;o<r.value.length;++o){var s=D.derToOid(r.value[o].value);s in Be?t[Be[s]]=!0:t[s]=!0}else if(t.name==="nsCertType"){var r=D.fromDer(t.value),n=0;r.value.length>1&&(n=r.value.charCodeAt(1)),t.client=(n&128)===128,t.server=(n&64)===64,t.email=(n&32)===32,t.objsign=(n&16)===16,t.reserved=(n&8)===8,t.sslCA=(n&4)===4,t.emailCA=(n&2)===2,t.objCA=(n&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var u,r=D.fromDer(t.value),c=0;c<r.value.length;++c){u=r.value[c];var l={type:u.type,value:u.value};switch(t.altNames.push(l),u.type){case 1:case 2:case 6:break;case 7:l.ip=we.util.bytesToIP(u.value);break;case 8:l.oid=D.derToOid(u.value);break}}}else if(t.name==="subjectKeyIdentifier"){var r=D.fromDer(t.value);t.subjectKeyIdentifier=we.util.bytesToHex(r.value)}}return t},Se.certificationRequestFromAsn1=function(e,t){var r={},n=[];if(!D.validate(e,jD,r,n)){var i=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw i.errors=n,i}var a=D.derToOid(r.publicKeyOid);if(a!==Se.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var o=Se.createCertificationRequest();if(o.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,o.signatureOid=we.asn1.derToOid(r.csrSignatureOid),o.signatureParameters=il(o.signatureOid,r.csrSignatureParams,!0),o.siginfo.algorithmOid=we.asn1.derToOid(r.csrSignatureOid),o.siginfo.parameters=il(o.siginfo.algorithmOid,r.csrSignatureParams,!1),o.signature=r.csrSignature,o.certificationRequestInfo=r.certificationRequestInfo,t){if(o.md=null,o.signatureOid in Be){var a=Be[o.signatureOid];switch(a){case"sha1WithRSAEncryption":o.md=we.md.sha1.create();break;case"md5WithRSAEncryption":o.md=we.md.md5.create();break;case"sha256WithRSAEncryption":o.md=we.md.sha256.create();break;case"sha384WithRSAEncryption":o.md=we.md.sha384.create();break;case"sha512WithRSAEncryption":o.md=we.md.sha512.create();break;case"RSASSA-PSS":o.md=we.md.sha256.create();break}}if(o.md===null){var i=new Error("Could not compute certification request digest. Unknown signature OID.");throw i.signatureOid=o.signatureOid,i}var s=D.toDer(o.certificationRequestInfo);o.md.update(s.getBytes())}var u=we.md.sha1.create();return o.subject.getField=function(c){return ci(o.subject,c)},o.subject.addField=function(c){Pr([c]),o.subject.attributes.push(c)},o.subject.attributes=Se.RDNAttributesAsArray(r.certificationRequestInfoSubject,u),o.subject.hash=u.digest().toHex(),o.publicKey=Se.publicKeyFromAsn1(r.subjectPublicKeyInfo),o.getAttribute=function(c){return ci(o,c)},o.addAttribute=function(c){Pr([c]),o.attributes.push(c)},o.attributes=Se.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),o},Se.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return ci(e.subject,t)},e.subject.addField=function(t){Pr([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return ci(e,t)},e.addAttribute=function(t){Pr([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){Pr(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){Pr(t),e.attributes=t},e.sign=function(t,r){e.md=r||we.md.sha1.create();var n=Be[e.md.algorithm+"WithRSAEncryption"];if(!n){var i=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=n,e.certificationRequestInfo=Se.getCertificationRequestInfo(e);var a=D.toDer(e.certificationRequestInfo);e.md.update(a.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(r===null){if(e.signatureOid in Be){var n=Be[e.signatureOid];switch(n){case"sha1WithRSAEncryption":r=we.md.sha1.create();break;case"md5WithRSAEncryption":r=we.md.md5.create();break;case"sha256WithRSAEncryption":r=we.md.sha256.create();break;case"sha384WithRSAEncryption":r=we.md.sha384.create();break;case"sha512WithRSAEncryption":r=we.md.sha512.create();break;case"RSASSA-PSS":r=we.md.sha256.create();break}}if(r===null){var i=new Error("Could not compute certification request digest. Unknown signature OID.");throw i.signatureOid=e.signatureOid,i}var a=e.certificationRequestInfo||Se.getCertificationRequestInfo(e),o=D.toDer(a);r.update(o.getBytes())}if(r!==null){var s;switch(e.signatureOid){case Be.sha1WithRSAEncryption:break;case Be["RSASSA-PSS"]:var u,c;if(u=Be[e.signatureParameters.mgf.hash.algorithmOid],u===void 0||we.md[u]===void 0){var i=new Error("Unsupported MGF hash function.");throw i.oid=e.signatureParameters.mgf.hash.algorithmOid,i.name=u,i}if(c=Be[e.signatureParameters.mgf.algorithmOid],c===void 0||we.mgf[c]===void 0){var i=new Error("Unsupported MGF function.");throw i.oid=e.signatureParameters.mgf.algorithmOid,i.name=c,i}if(c=we.mgf[c].create(we.md[u].create()),u=Be[e.signatureParameters.hash.algorithmOid],u===void 0||we.md[u]===void 0){var i=new Error("Unsupported RSASSA-PSS hash function.");throw i.oid=e.signatureParameters.hash.algorithmOid,i.name=u,i}s=we.pss.create(we.md[u].create(),c,e.signatureParameters.saltLength);break}t=e.publicKey.verify(r.digest().getBytes(),e.signature,s)}return t},e};function lo(e){for(var t=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]),r,n,i=e.attributes,a=0;a<i.length;++a){r=i[a];var o=r.value,s=D.Type.PRINTABLESTRING;"valueTagClass"in r&&(s=r.valueTagClass,s===D.Type.UTF8&&(o=we.util.encodeUtf8(o))),n=D.create(D.Class.UNIVERSAL,D.Type.SET,!0,[D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(r.type).getBytes()),D.create(D.Class.UNIVERSAL,s,!1,o)])]),t.value.push(n)}return t}function Pr(e){for(var t,r=0;r<e.length;++r){if(t=e[r],typeof t.name>"u"&&(t.type&&t.type in Se.oids?t.name=Se.oids[t.type]:t.shortName&&t.shortName in pt&&(t.name=Se.oids[pt[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in Se.oids)t.type=Se.oids[t.name];else{var n=new Error("Attribute type not specified.");throw n.attribute=t,n}if(typeof t.shortName>"u"&&t.name&&t.name in pt&&(t.shortName=pt[t.name]),t.type===Be.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=D.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var i=0;i<t.extensions.length;++i)t.value.push(Se.certificateExtensionToAsn1(D_(t.extensions[i])))}if(typeof t.value>"u"){var n=new Error("Attribute value not specified.");throw n.attribute=t,n}}}function D_(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in Se.oids&&(e.name=Se.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in Se.oids)e.id=Se.oids[e.name];else{var r=new Error("Extension ID not specified.");throw r.extension=e,r}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var n=0,i=0,a=0;e.digitalSignature&&(i|=128,n=7),e.nonRepudiation&&(i|=64,n=6),e.keyEncipherment&&(i|=32,n=5),e.dataEncipherment&&(i|=16,n=4),e.keyAgreement&&(i|=8,n=3),e.keyCertSign&&(i|=4,n=2),e.cRLSign&&(i|=2,n=1),e.encipherOnly&&(i|=1,n=0),e.decipherOnly&&(a|=128,n=7);var o=String.fromCharCode(n);a!==0?o+=String.fromCharCode(i)+String.fromCharCode(a):i!==0&&(o+=String.fromCharCode(i)),e.value=D.create(D.Class.UNIVERSAL,D.Type.BITSTRING,!1,o)}else if(e.name==="basicConstraints")e.value=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(D.create(D.Class.UNIVERSAL,D.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(D.create(D.Class.UNIVERSAL,D.Type.INTEGER,!1,D.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]);var s=e.value.value;for(var u in e)e[u]===!0&&(u in Be?s.push(D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(Be[u]).getBytes())):u.indexOf(".")!==-1&&s.push(D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(u).getBytes())))}else if(e.name==="nsCertType"){var n=0,i=0;e.client&&(i|=128,n=7),e.server&&(i|=64,n=6),e.email&&(i|=32,n=5),e.objsign&&(i|=16,n=4),e.reserved&&(i|=8,n=3),e.sslCA&&(i|=4,n=2),e.emailCA&&(i|=2,n=1),e.objCA&&(i|=1,n=0);var o=String.fromCharCode(n);i!==0&&(o+=String.fromCharCode(i)),e.value=D.create(D.Class.UNIVERSAL,D.Type.BITSTRING,!1,o)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]);for(var c,l=0;l<e.altNames.length;++l){c=e.altNames[l];var o=c.value;if(c.type===7&&c.ip){if(o=we.util.bytesFromIP(c.ip),o===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else c.type===8&&(c.oid?o=D.oidToDer(D.oidToDer(c.oid)):o=D.oidToDer(o));e.value.value.push(D.create(D.Class.CONTEXT_SPECIFIC,c.type,!1,o))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=D.create(D.Class.UNIVERSAL,D.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=D.create(D.Class.UNIVERSAL,D.Type.OCTETSTRING,!1,f.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var d=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(D.create(D.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[D.create(D.Class.CONTEXT_SPECIFIC,4,!0,[lo(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];s.push(D.create(D.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var h=we.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);s.push(D.create(D.Class.CONTEXT_SPECIFIC,2,!1,h))}}else if(e.name==="cRLDistributionPoints"){e.value=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]);for(var s=e.value.value,v=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]),p=D.create(D.Class.CONTEXT_SPECIFIC,0,!0,[]),c,l=0;l<e.altNames.length;++l){c=e.altNames[l];var o=c.value;if(c.type===7&&c.ip){if(o=we.util.bytesFromIP(c.ip),o===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else c.type===8&&(c.oid?o=D.oidToDer(D.oidToDer(c.oid)):o=D.oidToDer(o));p.value.push(D.create(D.Class.CONTEXT_SPECIFIC,c.type,!1,o))}v.value.push(D.create(D.Class.CONTEXT_SPECIFIC,0,!0,[p])),s.push(v)}if(typeof e.value>"u"){var r=new Error("Extension value not specified.");throw r.extension=e,r}return e}function Mp(e,t){switch(e){case Be["RSASSA-PSS"]:var r=[];return t.hash.algorithmOid!==void 0&&r.push(D.create(D.Class.CONTEXT_SPECIFIC,0,!0,[D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(t.hash.algorithmOid).getBytes()),D.create(D.Class.UNIVERSAL,D.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&r.push(D.create(D.Class.CONTEXT_SPECIFIC,1,!0,[D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(t.mgf.algorithmOid).getBytes()),D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(t.mgf.hash.algorithmOid).getBytes()),D.create(D.Class.UNIVERSAL,D.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&r.push(D.create(D.Class.CONTEXT_SPECIFIC,2,!0,[D.create(D.Class.UNIVERSAL,D.Type.INTEGER,!1,D.integerToDer(t.saltLength).getBytes())])),D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,r);default:return D.create(D.Class.UNIVERSAL,D.Type.NULL,!1,"")}}function KD(e){var t=D.create(D.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var r=e.attributes,n=0;n<r.length;++n){var i=r[n],a=i.value,o=D.Type.UTF8;"valueTagClass"in i&&(o=i.valueTagClass),o===D.Type.UTF8&&(a=we.util.encodeUtf8(a));var s=!1;"valueConstructed"in i&&(s=i.valueConstructed);var u=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(i.type).getBytes()),D.create(D.Class.UNIVERSAL,D.Type.SET,!0,[D.create(D.Class.UNIVERSAL,o,s,a)])]);t.value.push(u)}return t}var qD=new Date("1950-01-01T00:00:00Z"),VD=new Date("2050-01-01T00:00:00Z");function F_(e){return e>=qD&&e<VD?D.create(D.Class.UNIVERSAL,D.Type.UTCTIME,!1,D.dateToUtcTime(e)):D.create(D.Class.UNIVERSAL,D.Type.GENERALIZEDTIME,!1,D.dateToGeneralizedTime(e))}Se.getTBSCertificate=function(e){var t=F_(e.validity.notBefore),r=F_(e.validity.notAfter),n=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.CONTEXT_SPECIFIC,0,!0,[D.create(D.Class.UNIVERSAL,D.Type.INTEGER,!1,D.integerToDer(e.version).getBytes())]),D.create(D.Class.UNIVERSAL,D.Type.INTEGER,!1,we.util.hexToBytes(e.serialNumber)),D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(e.siginfo.algorithmOid).getBytes()),Mp(e.siginfo.algorithmOid,e.siginfo.parameters)]),lo(e.issuer),D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[t,r]),lo(e.subject),Se.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&n.value.push(D.create(D.Class.CONTEXT_SPECIFIC,1,!0,[D.create(D.Class.UNIVERSAL,D.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&n.value.push(D.create(D.Class.CONTEXT_SPECIFIC,2,!0,[D.create(D.Class.UNIVERSAL,D.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&n.value.push(Se.certificateExtensionsToAsn1(e.extensions)),n},Se.getCertificationRequestInfo=function(e){var t=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.INTEGER,!1,D.integerToDer(e.version).getBytes()),lo(e.subject),Se.publicKeyToAsn1(e.publicKey),KD(e)]);return t},Se.distinguishedNameToAsn1=function(e){return lo(e)},Se.certificateToAsn1=function(e){var t=e.tbsCertificate||Se.getTBSCertificate(e);return D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[t,D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(e.signatureOid).getBytes()),Mp(e.signatureOid,e.signatureParameters)]),D.create(D.Class.UNIVERSAL,D.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},Se.certificateExtensionsToAsn1=function(e){var t=D.create(D.Class.CONTEXT_SPECIFIC,3,!0,[]),r=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(Se.certificateExtensionToAsn1(e[n]));return t},Se.certificateExtensionToAsn1=function(e){var t=D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[]);t.value.push(D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(e.id).getBytes())),e.critical&&t.value.push(D.create(D.Class.UNIVERSAL,D.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return typeof e.value!="string"&&(r=D.toDer(r).getBytes()),t.value.push(D.create(D.Class.UNIVERSAL,D.Type.OCTETSTRING,!1,r)),t},Se.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||Se.getCertificationRequestInfo(e);return D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[t,D.create(D.Class.UNIVERSAL,D.Type.SEQUENCE,!0,[D.create(D.Class.UNIVERSAL,D.Type.OID,!1,D.oidToDer(e.signatureOid).getBytes()),Mp(e.signatureOid,e.signatureParameters)]),D.create(D.Class.UNIVERSAL,D.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},Se.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(o){var s=r(o.issuer);return s},t.addCertificate=function(o){if(typeof o=="string"&&(o=we.pki.certificateFromPem(o)),n(o.subject),!t.hasCertificate(o))if(o.subject.hash in t.certs){var s=t.certs[o.subject.hash];we.util.isArray(s)||(s=[s]),s.push(o),t.certs[o.subject.hash]=s}else t.certs[o.subject.hash]=o},t.hasCertificate=function(o){typeof o=="string"&&(o=we.pki.certificateFromPem(o));var s=r(o.subject);if(!s)return!1;we.util.isArray(s)||(s=[s]);for(var u=D.toDer(Se.certificateToAsn1(o)).getBytes(),c=0;c<s.length;++c){var l=D.toDer(Se.certificateToAsn1(s[c])).getBytes();if(u===l)return!0}return!1},t.listAllCertificates=function(){var o=[];for(var s in t.certs)if(t.certs.hasOwnProperty(s)){var u=t.certs[s];if(!we.util.isArray(u))o.push(u);else for(var c=0;c<u.length;++c)o.push(u[c])}return o},t.removeCertificate=function(o){var s;if(typeof o=="string"&&(o=we.pki.certificateFromPem(o)),n(o.subject),!t.hasCertificate(o))return null;var u=r(o.subject);if(!we.util.isArray(u))return s=t.certs[o.subject.hash],delete t.certs[o.subject.hash],s;for(var c=D.toDer(Se.certificateToAsn1(o)).getBytes(),l=0;l<u.length;++l){var f=D.toDer(Se.certificateToAsn1(u[l])).getBytes();c===f&&(s=u[l],u.splice(l,1))}return u.length===0&&delete t.certs[o.subject.hash],s};function r(o){return n(o),t.certs[o.hash]||null}function n(o){if(!o.hash){var s=we.md.sha1.create();o.attributes=Se.RDNAttributesAsArray(lo(o),s),o.hash=s.digest().toHex()}}if(e)for(var i=0;i<e.length;++i){var a=e[i];t.addCertificate(a)}return t},Se.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"},Se.verifyCertificateChain=function(e,t,r){typeof r=="function"&&(r={verify:r}),r=r||{},t=t.slice(0);var n=t.slice(0),i=r.validityCheckDate;typeof i>"u"&&(i=new Date);var a=!0,o=null,s=0;do{var u=t.shift(),c=null,l=!1;if(i&&(i<u.validity.notBefore||i>u.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:Se.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:i}),o===null){if(c=t[0]||e.getIssuer(u),c===null&&u.isIssuer(u)&&(l=!0,c=u),c){var f=c;we.util.isArray(f)||(f=[f]);for(var d=!1;!d&&f.length>0;){c=f.shift();try{d=c.verify(u)}catch{}}d||(o={message:"Certificate signature is invalid.",error:Se.certificateError.bad_certificate})}o===null&&(!c||l)&&!e.hasCertificate(u)&&(o={message:"Certificate is not trusted.",error:Se.certificateError.unknown_ca})}if(o===null&&c&&!u.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:Se.certificateError.bad_certificate}),o===null)for(var g={keyUsage:!0,basicConstraints:!0},h=0;o===null&&h<u.extensions.length;++h){var v=u.extensions[h];v.critical&&!(v.name in g)&&(o={message:"Certificate has an unsupported critical extension.",error:Se.certificateError.unsupported_certificate})}if(o===null&&(!a||t.length===0&&(!c||l))){var p=u.getExtension("basicConstraints"),y=u.getExtension("keyUsage");if(y!==null&&(!y.keyCertSign||p===null)&&(o={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:Se.certificateError.bad_certificate}),o===null&&p!==null&&!p.cA&&(o={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:Se.certificateError.bad_certificate}),o===null&&y!==null&&"pathLenConstraint"in p){var w=s-1;w>p.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:Se.certificateError.bad_certificate})}}var m=o===null?!0:o.error,S=r.verify?r.verify(m,s,n):m;if(S===!0)o=null;else throw m===!0&&(o={message:"The application rejected the certificate.",error:Se.certificateError.bad_certificate}),(S||S===0)&&(typeof S=="object"&&!we.util.isArray(S)?(S.message&&(o.message=S.message),S.error&&(o.error=S.error)):typeof S=="string"&&(o.error=S)),o;a=!1,++s}while(t.length>0);return!0};var ut=ke,H=ut.asn1,Ve=ut.pki,qs=ut.pkcs12=ut.pkcs12||{},k_={name:"ContentInfo",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:H.Class.UNIVERSAL,type:H.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:H.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},GD={name:"PFX",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:H.Class.UNIVERSAL,type:H.Type.INTEGER,constructed:!1,capture:"version"},k_,{name:"PFX.macData",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:H.Class.UNIVERSAL,type:H.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:H.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:H.Class.UNIVERSAL,type:H.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:H.Class.UNIVERSAL,type:H.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:H.Class.UNIVERSAL,type:H.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},HD={name:"SafeBag",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:H.Class.UNIVERSAL,type:H.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:H.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:H.Class.UNIVERSAL,type:H.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},YD={name:"Attribute",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:H.Class.UNIVERSAL,type:H.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:H.Class.UNIVERSAL,type:H.Type.SET,constructed:!0,capture:"values"}]},WD={name:"CertBag",tagClass:H.Class.UNIVERSAL,type:H.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:H.Class.UNIVERSAL,type:H.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:H.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:H.Class.UNIVERSAL,type:H.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Vs(e,t,r,n){for(var i=[],a=0;a<e.length;a++)for(var o=0;o<e[a].safeBags.length;o++){var s=e[a].safeBags[o];if(!(n!==void 0&&s.type!==n)){if(t===null){i.push(s);continue}s.attributes[t]!==void 0&&s.attributes[t].indexOf(r)>=0&&i.push(s)}}return i}qs.pkcs12FromAsn1=function(e,t,r){typeof t=="string"?(r=t,t=!0):t===void 0&&(t=!0);var n={},i=[];if(!H.validate(e,GD,n,i)){var a=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw a.errors=a,a}var o={version:n.version.charCodeAt(0),safeContents:[],getBags:function(p){var y={},w;return"localKeyId"in p?w=p.localKeyId:"localKeyIdHex"in p&&(w=ut.util.hexToBytes(p.localKeyIdHex)),w===void 0&&!("friendlyName"in p)&&"bagType"in p&&(y[p.bagType]=Vs(o.safeContents,null,null,p.bagType)),w!==void 0&&(y.localKeyId=Vs(o.safeContents,"localKeyId",w,p.bagType)),"friendlyName"in p&&(y.friendlyName=Vs(o.safeContents,"friendlyName",p.friendlyName,p.bagType)),y},getBagsByFriendlyName:function(p,y){return Vs(o.safeContents,"friendlyName",p,y)},getBagsByLocalKeyId:function(p,y){return Vs(o.safeContents,"localKeyId",p,y)}};if(n.version.charCodeAt(0)!==3){var a=new Error("PKCS#12 PFX of version other than 3 not supported.");throw a.version=n.version.charCodeAt(0),a}if(H.derToOid(n.contentType)!==Ve.oids.data){var a=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw a.oid=H.derToOid(n.contentType),a}var s=n.content.value[0];if(s.tagClass!==H.Class.UNIVERSAL||s.type!==H.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(s=Lp(s),n.mac){var u=null,c=0,l=H.derToOid(n.macAlgorithm);switch(l){case Ve.oids.sha1:u=ut.md.sha1.create(),c=20;break;case Ve.oids.sha256:u=ut.md.sha256.create(),c=32;break;case Ve.oids.sha384:u=ut.md.sha384.create(),c=48;break;case Ve.oids.sha512:u=ut.md.sha512.create(),c=64;break;case Ve.oids.md5:u=ut.md.md5.create(),c=16;break}if(u===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+l);var f=new ut.util.ByteBuffer(n.macSalt),d="macIterations"in n?parseInt(ut.util.bytesToHex(n.macIterations),16):1,g=qs.generateKey(r,f,3,d,c,u),h=ut.hmac.create();h.start(u,g),h.update(s.value);var v=h.getMac();if(v.getBytes()!==n.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return zD(o,s.value,t,r),o};function Lp(e){if(e.composed||e.constructed){for(var t=ut.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function zD(e,t,r,n){if(t=H.fromDer(t,r),t.tagClass!==H.Class.UNIVERSAL||t.type!==H.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var i=0;i<t.value.length;i++){var a=t.value[i],o={},s=[];if(!H.validate(a,k_,o,s)){var u=new Error("Cannot read ContentInfo.");throw u.errors=s,u}var c={encrypted:!1},l=null,f=o.content.value[0];switch(H.derToOid(o.contentType)){case Ve.oids.data:if(f.tagClass!==H.Class.UNIVERSAL||f.type!==H.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");l=Lp(f).value;break;case Ve.oids.encryptedData:l=QD(f,n),c.encrypted=!0;break;default:var u=new Error("Unsupported PKCS#12 contentType.");throw u.contentType=H.derToOid(o.contentType),u}c.safeBags=XD(l,r,n),e.safeContents.push(c)}}function QD(e,t){var r={},n=[];if(!H.validate(e,ut.pkcs7.asn1.encryptedDataValidator,r,n)){var i=new Error("Cannot read EncryptedContentInfo.");throw i.errors=n,i}var a=H.derToOid(r.contentType);if(a!==Ve.oids.data){var i=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw i.oid=a,i}a=H.derToOid(r.encAlgorithm);var o=Ve.pbe.getCipher(a,r.encParameter,t),s=Lp(r.encryptedContentAsn1),u=ut.util.createBuffer(s.value);if(o.update(u),!o.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return o.output.getBytes()}function XD(e,t,r){if(!t&&e.length===0)return[];if(e=H.fromDer(e,t),e.tagClass!==H.Class.UNIVERSAL||e.type!==H.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],i=0;i<e.value.length;i++){var a=e.value[i],o={},s=[];if(!H.validate(a,HD,o,s)){var u=new Error("Cannot read SafeBag.");throw u.errors=s,u}var c={type:H.derToOid(o.bagId),attributes:JD(o.bagAttributes)};n.push(c);var l,f,d=o.bagValue.value[0];switch(c.type){case Ve.oids.pkcs8ShroudedKeyBag:if(d=Ve.decryptPrivateKeyInfo(d,r),d===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case Ve.oids.keyBag:try{c.key=Ve.privateKeyFromAsn1(d)}catch{c.key=null,c.asn1=d}continue;case Ve.oids.certBag:l=WD,f=function(){if(H.derToOid(o.certId)!==Ve.oids.x509Certificate){var h=new Error("Unsupported certificate type, only X.509 supported.");throw h.oid=H.derToOid(o.certId),h}var v=H.fromDer(o.cert,t);try{c.cert=Ve.certificateFromAsn1(v,!0)}catch{c.cert=null,c.asn1=v}};break;default:var u=new Error("Unsupported PKCS#12 SafeBag type.");throw u.oid=c.type,u}if(l!==void 0&&!H.validate(d,l,o,s)){var u=new Error("Cannot read PKCS#12 "+l.name);throw u.errors=s,u}f()}return n}function JD(e){var t={};if(e!==void 0)for(var r=0;r<e.length;++r){var n={},i=[];if(!H.validate(e[r],YD,n,i)){var a=new Error("Cannot read PKCS#12 BagAttribute.");throw a.errors=i,a}var o=H.derToOid(n.oid);if(Ve.oids[o]!==void 0){t[Ve.oids[o]]=[];for(var s=0;s<n.values.length;++s)t[Ve.oids[o]].push(n.values[s].value)}}return t}qs.toPkcs12Asn1=function(e,t,r,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||n.encAlgorithm||"aes128","useMac"in n||(n.useMac=!0),"localKeyId"in n||(n.localKeyId=null),"generateLocalKeyId"in n||(n.generateLocalKeyId=!0);var i=n.localKeyId,a;if(i!==null)i=ut.util.hexToBytes(i);else if(n.generateLocalKeyId)if(t){var o=ut.util.isArray(t)?t[0]:t;typeof o=="string"&&(o=Ve.certificateFromPem(o));var s=ut.md.sha1.create();s.update(H.toDer(Ve.certificateToAsn1(o)).getBytes()),i=s.digest().getBytes()}else i=ut.random.getBytes(20);var u=[];i!==null&&u.push(H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.localKeyId).getBytes()),H.create(H.Class.UNIVERSAL,H.Type.SET,!0,[H.create(H.Class.UNIVERSAL,H.Type.OCTETSTRING,!1,i)])])),"friendlyName"in n&&u.push(H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.friendlyName).getBytes()),H.create(H.Class.UNIVERSAL,H.Type.SET,!0,[H.create(H.Class.UNIVERSAL,H.Type.BMPSTRING,!1,n.friendlyName)])])),u.length>0&&(a=H.create(H.Class.UNIVERSAL,H.Type.SET,!0,u));var c=[],l=[];t!==null&&(ut.util.isArray(t)?l=t:l=[t]);for(var f=[],d=0;d<l.length;++d){t=l[d],typeof t=="string"&&(t=Ve.certificateFromPem(t));var g=d===0?a:void 0,h=Ve.certificateToAsn1(t),v=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.certBag).getBytes()),H.create(H.Class.CONTEXT_SPECIFIC,0,!0,[H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.x509Certificate).getBytes()),H.create(H.Class.CONTEXT_SPECIFIC,0,!0,[H.create(H.Class.UNIVERSAL,H.Type.OCTETSTRING,!1,H.toDer(h).getBytes())])])]),g]);f.push(v)}if(f.length>0){var p=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,f),y=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.data).getBytes()),H.create(H.Class.CONTEXT_SPECIFIC,0,!0,[H.create(H.Class.UNIVERSAL,H.Type.OCTETSTRING,!1,H.toDer(p).getBytes())])]);c.push(y)}var w=null;if(e!==null){var m=Ve.wrapRsaPrivateKey(Ve.privateKeyToAsn1(e));r===null?w=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.keyBag).getBytes()),H.create(H.Class.CONTEXT_SPECIFIC,0,!0,[m]),a]):w=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.pkcs8ShroudedKeyBag).getBytes()),H.create(H.Class.CONTEXT_SPECIFIC,0,!0,[Ve.encryptPrivateKeyInfo(m,r,n)]),a]);var S=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[w]),A=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.data).getBytes()),H.create(H.Class.CONTEXT_SPECIFIC,0,!0,[H.create(H.Class.UNIVERSAL,H.Type.OCTETSTRING,!1,H.toDer(S).getBytes())])]);c.push(A)}var I=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,c),N;if(n.useMac){var s=ut.md.sha1.create(),T=new ut.util.ByteBuffer(ut.random.getBytes(n.saltSize)),M=n.count,e=qs.generateKey(r,T,3,M,20),P=ut.hmac.create();P.start(s,e),P.update(H.toDer(I).getBytes());var L=P.getMac();N=H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.sha1).getBytes()),H.create(H.Class.UNIVERSAL,H.Type.NULL,!1,"")]),H.create(H.Class.UNIVERSAL,H.Type.OCTETSTRING,!1,L.getBytes())]),H.create(H.Class.UNIVERSAL,H.Type.OCTETSTRING,!1,T.getBytes()),H.create(H.Class.UNIVERSAL,H.Type.INTEGER,!1,H.integerToDer(M).getBytes())])}return H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.INTEGER,!1,H.integerToDer(3).getBytes()),H.create(H.Class.UNIVERSAL,H.Type.SEQUENCE,!0,[H.create(H.Class.UNIVERSAL,H.Type.OID,!1,H.oidToDer(Ve.oids.data).getBytes()),H.create(H.Class.CONTEXT_SPECIFIC,0,!0,[H.create(H.Class.UNIVERSAL,H.Type.OCTETSTRING,!1,H.toDer(I).getBytes())])]),N])},qs.generateKey=ut.pbe.generatePkcs12Key;var li=ke,Pp=li.asn1,fo=li.pki=li.pki||{};fo.pemToDer=function(e){var t=li.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return li.util.createBuffer(t.body)},fo.privateKeyFromPem=function(e){var t=li.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var n=Pp.fromDer(t.body);return fo.privateKeyFromAsn1(n)},fo.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:Pp.toDer(fo.privateKeyToAsn1(e)).getBytes()};return li.pem.encode(r,{maxline:t})},fo.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:Pp.toDer(e).getBytes()};return li.pem.encode(r,{maxline:t})};var ye=ke,al=function(e,t,r,n){var i=ye.util.createBuffer(),a=e.length>>1,o=a+(e.length&1),s=e.substr(0,o),u=e.substr(a,o),c=ye.util.createBuffer(),l=ye.hmac.create();r=t+r;var f=Math.ceil(n/16),d=Math.ceil(n/20);l.start("MD5",s);var g=ye.util.createBuffer();c.putBytes(r);for(var h=0;h<f;++h)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+r),g.putBuffer(l.digest());l.start("SHA1",u);var v=ye.util.createBuffer();c.clear(),c.putBytes(r);for(var h=0;h<d;++h)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+r),v.putBuffer(l.digest());return i.putBytes(ye.util.xorBytes(g.getBytes(),v.getBytes(),n)),i},ZD=function(e,t,r){var n=ye.hmac.create();n.start("SHA1",e);var i=ye.util.createBuffer();return i.putInt32(t[0]),i.putInt32(t[1]),i.putByte(r.type),i.putByte(r.version.major),i.putByte(r.version.minor),i.putInt16(r.length),i.putBytes(r.fragment.bytes()),n.update(i.getBytes()),n.digest().getBytes()},e4=function(e,t,r){var n=!1;try{var i=e.deflate(t.fragment.getBytes());t.fragment=ye.util.createBuffer(i),t.length=i.length,n=!0}catch{}return n},t4=function(e,t,r){var n=!1;try{var i=e.inflate(t.fragment.getBytes());t.fragment=ye.util.createBuffer(i),t.length=i.length,n=!0}catch{}return n},_r=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32();break}return ye.util.createBuffer(e.getBytes(r))},Nr=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},U={};U.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},U.SupportedVersions=[U.Versions.TLS_1_1,U.Versions.TLS_1_0],U.Version=U.SupportedVersions[0],U.MaxFragment=16384-1024,U.ConnectionEnd={server:0,client:1},U.PRFAlgorithm={tls_prf_sha256:0},U.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},U.CipherType={stream:0,block:1,aead:2},U.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},U.CompressionMethod={none:0,deflate:1},U.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},U.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},U.Alert={},U.Alert.Level={warning:1,fatal:2},U.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},U.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},U.CipherSuites={},U.getCipherSuite=function(e){var t=null;for(var r in U.CipherSuites){var n=U.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},U.handleUnexpected=function(e,t){var r=!e.open&&e.entity===U.ConnectionEnd.client;r||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unexpected_message}})},U.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(U.queue(e,U.createAlert(e,{level:U.Alert.Level.warning,description:U.Alert.Description.no_renegotiation})),U.flush(e)),e.process()},U.parseHelloMessage=function(e,t,r){var n=null,i=e.entity===U.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});else{var a=t.fragment,o=a.length();if(n={version:{major:a.getByte(),minor:a.getByte()},random:ye.util.createBuffer(a.getBytes(32)),session_id:_r(a,1),extensions:[]},i?(n.cipher_suite=a.getBytes(2),n.compression_method=a.getByte()):(n.cipher_suites=_r(a,2),n.compression_methods=_r(a,1)),o=r-(o-a.length()),o>0){for(var s=_r(a,2);s.length()>0;)n.extensions.push({type:[s.getByte(),s.getByte()],data:_r(s,2)});if(!i)for(var u=0;u<n.extensions.length;++u){var c=n.extensions[u];if(c.type[0]===0&&c.type[1]===0)for(var l=_r(c.data,2);l.length()>0;){var f=l.getByte();if(f!==0)break;e.session.extensions.server_name.serverNameList.push(_r(l,2).getBytes())}}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=U.getCipherSuite(n.cipher_suite);else for(var d=ye.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=U.getCipherSuite(d.getBytes(2)),e.session.cipherSuite===null););if(e.session.cipherSuite===null)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.handshake_failure},cipherSuite:ye.util.bytesToHex(n.cipher_suite)});i?e.session.compressionMethod=n.compression_method:e.session.compressionMethod=U.CompressionMethod.none}return n},U.createSecurityParameters=function(e,t){var r=e.entity===U.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,a=r?n:U.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:U.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:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:a}},U.handleServerHello=function(e,t,r){var n=U.parseHelloMessage(e,t,r);if(!e.fail){if(n.version.minor<=e.version.minor)e.version.minor=n.version.minor;else return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}});e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=$_,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=n4,e.session.resuming=!1,U.createSecurityParameters(e,n)),e.session.id=i,e.process()}},U.handleClientHello=function(e,t,r){var n=U.parseHelloMessage(e,t,r);if(!e.fail){var i=n.session_id.bytes(),a=null;if(e.sessionCache&&(a=e.sessionCache.getSession(i),a===null?i="":(a.version.major!==n.version.major||a.version.minor>n.version.minor)&&(a=null,i="")),i.length===0&&(i=ye.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=n.version,e.session.sp={},a)e.version=e.session.version=a.version,e.session.sp=a.sp;else{for(var o,s=1;s<U.SupportedVersions.length&&(o=U.SupportedVersions[s],!(o.minor<=n.version.minor));++s);e.version={major:o.major,minor:o.minor},e.session.version=e.version}a!==null?(e.expect=Bp,e.session.resuming=!0,e.session.sp.client_random=n.random.bytes()):(e.expect=e.verifyClient!==!1?l4:Np,e.session.resuming=!1,U.createSecurityParameters(e,n)),e.open=!0,U.queue(e,U.createRecord(e,{type:U.ContentType.handshake,data:U.createServerHello(e)})),e.session.resuming?(U.queue(e,U.createRecord(e,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),e.state.pending=U.createConnectionState(e),e.state.current.write=e.state.pending.write,U.queue(e,U.createRecord(e,{type:U.ContentType.handshake,data:U.createFinished(e)}))):(U.queue(e,U.createRecord(e,{type:U.ContentType.handshake,data:U.createCertificate(e)})),e.fail||(U.queue(e,U.createRecord(e,{type:U.ContentType.handshake,data:U.createServerKeyExchange(e)})),e.verifyClient!==!1&&U.queue(e,U.createRecord(e,{type:U.ContentType.handshake,data:U.createCertificateRequest(e)})),U.queue(e,U.createRecord(e,{type:U.ContentType.handshake,data:U.createServerHelloDone(e)})))),U.flush(e),e.process()}},U.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_list:_r(n,3)},a,o,s=[];try{for(;i.certificate_list.length()>0;)a=_r(i.certificate_list,3),o=ye.asn1.fromDer(a),a=ye.pki.certificateFromAsn1(o,!0),s.push(a)}catch(c){return e.error(e,{message:"Could not parse certificate list.",cause:c,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate}})}var u=e.entity===U.ConnectionEnd.client;(u||e.verifyClient===!0)&&s.length===0?e.error(e,{message:u?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}}):s.length===0?e.expect=u?U_:Np:(u?e.session.serverCertificate=s[0]:e.session.clientCertificate=s[0],U.verifyCertificateChain(e,s)&&(e.expect=u?U_:Np)),e.process()},U.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unsupported_certificate}});e.expect=i4,e.process()},U.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unsupported_certificate}});var n=t.fragment,i={enc_pre_master_secret:_r(n,2).getBytes()},a=null;if(e.getPrivateKey)try{a=e.getPrivateKey(e,e.session.serverCertificate),a=ye.pki.privateKeyFromPem(a)}catch(u){e.error(e,{message:"Could not get private key.",cause:u,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}})}if(a===null)return e.error(e,{message:"No private key set.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}});try{var o=e.session.sp;o.pre_master_secret=a.decrypt(i.enc_pre_master_secret);var s=e.session.clientHelloVersion;if(s.major!==o.pre_master_secret.charCodeAt(0)||s.minor!==o.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{o.pre_master_secret=ye.random.getBytes(48)}e.expect=Bp,e.session.clientCertificate!==null&&(e.expect=f4),e.process()},U.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:_r(n,1),certificate_authorities:_r(n,2)};e.session.certificateRequest=i,e.expect=a4,e.process()},U.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var a={signature:_r(n,2).getBytes()},o=ye.util.createBuffer();o.putBuffer(e.session.md5.digest()),o.putBuffer(e.session.sha1.digest()),o=o.getBytes();try{var s=e.session.clientCertificate;if(!s.publicKey.verify(o,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch{return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.handshake_failure}})}e.expect=Bp,e.process()},U.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.record_overflow}});if(e.serverCertificate===null){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.insufficient_security}},i=0,a=e.verify(e,n.alert.description,i,[]);if(a!==!0)return(a||a===0)&&(typeof a=="object"&&!ye.util.isArray(a)?(a.message&&(n.message=a.message),a.alert&&(n.alert.description=a.alert)):typeof a=="number"&&(n.alert.description=a)),e.error(e,n)}e.session.certificateRequest!==null&&(t=U.createRecord(e,{type:U.ContentType.handshake,data:U.createCertificate(e)}),U.queue(e,t)),t=U.createRecord(e,{type:U.ContentType.handshake,data:U.createClientKeyExchange(e)}),U.queue(e,t),e.expect=u4;var o=function(s,u){s.session.certificateRequest!==null&&s.session.clientCertificate!==null&&U.queue(s,U.createRecord(s,{type:U.ContentType.handshake,data:U.createCertificateVerify(s,u)})),U.queue(s,U.createRecord(s,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),s.state.pending=U.createConnectionState(s),s.state.current.write=s.state.pending.write,U.queue(s,U.createRecord(s,{type:U.ContentType.handshake,data:U.createFinished(s)})),s.expect=$_,U.flush(s),s.process()};if(e.session.certificateRequest===null||e.session.clientCertificate===null)return o(e,null);U.getClientSignature(e,o)},U.handleChangeCipherSpec=function(e,t){if(t.fragment.getByte()!==1)return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var r=e.entity===U.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=U.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?o4:d4,e.process()},U.handleFinished=function(e,t,r){var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var a=t.fragment.getBytes();n=ye.util.createBuffer(),n.putBuffer(e.session.md5.digest()),n.putBuffer(e.session.sha1.digest());var o=e.entity===U.ConnectionEnd.client,s=o?"server finished":"client finished",u=e.session.sp,c=12,l=al;if(n=l(u.master_secret,s,n.getBytes(),c),n.getBytes()!==a)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.decrypt_error}});e.session.md5.update(i),e.session.sha1.update(i),(e.session.resuming&&o||!e.session.resuming&&!o)&&(U.queue(e,U.createRecord(e,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,U.queue(e,U.createRecord(e,{type:U.ContentType.handshake,data:U.createFinished(e)}))),e.expect=o?s4:h4,e.handshaking=!1,++e.handshakes,e.peerCertificate=o?e.session.serverCertificate:e.session.clientCertificate,U.flush(e),e.isConnected=!0,e.connected(e),e.process()},U.handleAlert=function(e,t){var r=t.fragment,n={level:r.getByte(),description:r.getByte()},i;switch(n.description){case U.Alert.Description.close_notify:i="Connection closed.";break;case U.Alert.Description.unexpected_message:i="Unexpected message.";break;case U.Alert.Description.bad_record_mac:i="Bad record MAC.";break;case U.Alert.Description.decryption_failed:i="Decryption failed.";break;case U.Alert.Description.record_overflow:i="Record overflow.";break;case U.Alert.Description.decompression_failure:i="Decompression failed.";break;case U.Alert.Description.handshake_failure:i="Handshake failure.";break;case U.Alert.Description.bad_certificate:i="Bad certificate.";break;case U.Alert.Description.unsupported_certificate:i="Unsupported certificate.";break;case U.Alert.Description.certificate_revoked:i="Certificate revoked.";break;case U.Alert.Description.certificate_expired:i="Certificate expired.";break;case U.Alert.Description.certificate_unknown:i="Certificate unknown.";break;case U.Alert.Description.illegal_parameter:i="Illegal parameter.";break;case U.Alert.Description.unknown_ca:i="Unknown certificate authority.";break;case U.Alert.Description.access_denied:i="Access denied.";break;case U.Alert.Description.decode_error:i="Decode error.";break;case U.Alert.Description.decrypt_error:i="Decrypt error.";break;case U.Alert.Description.export_restriction:i="Export restriction.";break;case U.Alert.Description.protocol_version:i="Unsupported protocol version.";break;case U.Alert.Description.insufficient_security:i="Insufficient security.";break;case U.Alert.Description.internal_error:i="Internal error.";break;case U.Alert.Description.user_canceled:i="User canceled.";break;case U.Alert.Description.no_renegotiation:i="Renegotiation not supported.";break;default:i="Unknown error.";break}if(n.description===U.Alert.Description.close_notify)return e.close();e.error(e,{message:i,send:!1,origin:e.entity===U.ConnectionEnd.client?"server":"client",alert:n}),e.process()},U.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=ye.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var a=r.bytes(i+4);r.read+=4,n in sl[e.entity][e.expect]?(e.entity===U.ConnectionEnd.server&&!e.open&&!e.fail&&(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:ye.md.md5.create(),sha1:ye.md.sha1.create()}),n!==U.HandshakeType.hello_request&&n!==U.HandshakeType.certificate_verify&&n!==U.HandshakeType.finished&&(e.session.md5.update(a),e.session.sha1.update(a)),sl[e.entity][e.expect][n](e,t,i)):U.handleUnexpected(e,t)},U.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},U.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt16(),a=r.getBytes(i);if(n===U.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>a.length)return e.process();U.queue(e,U.createRecord(e,{type:U.ContentType.heartbeat,data:U.createHeartbeat(U.HeartbeatMessageType.heartbeat_response,a)})),U.flush(e)}else if(n===U.HeartbeatMessageType.heartbeat_response){if(a!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,ye.util.createBuffer(a))}e.process()};var r4=0,n4=1,U_=2,i4=3,a4=4,$_=5,o4=6,s4=7,u4=8,c4=0,l4=1,Np=2,f4=3,Bp=4,d4=5,h4=6,F=U.handleUnexpected,j_=U.handleChangeCipherSpec,Ft=U.handleAlert,tr=U.handleHandshake,K_=U.handleApplicationData,kt=U.handleHeartbeat,Dp=[];Dp[U.ConnectionEnd.client]=[[F,Ft,tr,F,kt],[F,Ft,tr,F,kt],[F,Ft,tr,F,kt],[F,Ft,tr,F,kt],[F,Ft,tr,F,kt],[j_,Ft,F,F,kt],[F,Ft,tr,F,kt],[F,Ft,tr,K_,kt],[F,Ft,tr,F,kt]],Dp[U.ConnectionEnd.server]=[[F,Ft,tr,F,kt],[F,Ft,tr,F,kt],[F,Ft,tr,F,kt],[F,Ft,tr,F,kt],[j_,Ft,F,F,kt],[F,Ft,tr,F,kt],[F,Ft,tr,K_,kt],[F,Ft,tr,F,kt]];var fi=U.handleHelloRequest,p4=U.handleServerHello,q_=U.handleCertificate,V_=U.handleServerKeyExchange,Fp=U.handleCertificateRequest,ol=U.handleServerHelloDone,G_=U.handleFinished,sl=[];sl[U.ConnectionEnd.client]=[[F,F,p4,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F],[fi,F,F,F,F,F,F,F,F,F,F,q_,V_,Fp,ol,F,F,F,F,F,F],[fi,F,F,F,F,F,F,F,F,F,F,F,V_,Fp,ol,F,F,F,F,F,F],[fi,F,F,F,F,F,F,F,F,F,F,F,F,Fp,ol,F,F,F,F,F,F],[fi,F,F,F,F,F,F,F,F,F,F,F,F,F,ol,F,F,F,F,F,F],[fi,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F],[fi,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,G_],[fi,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F],[fi,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F]];var g4=U.handleClientHello,y4=U.handleClientKeyExchange,v4=U.handleCertificateVerify;sl[U.ConnectionEnd.server]=[[F,g4,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F],[F,F,F,F,F,F,F,F,F,F,F,q_,F,F,F,F,F,F,F,F,F],[F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,y4,F,F,F,F],[F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,v4,F,F,F,F,F],[F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F],[F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,G_],[F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F],[F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F]],U.generateKeys=function(e,t){var r=al,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,a=e.version.major===U.Versions.TLS_1_0.major&&e.version.minor===U.Versions.TLS_1_0.minor;a&&(i+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",n,i),s={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return a&&(s.client_write_IV=o.getBytes(t.fixed_iv_length),s.server_write_IV=o.getBytes(t.fixed_iv_length)),s},U.createConnectionState=function(e){var t=e.entity===U.ConnectionEnd.client,r=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(o){return!0},compressionState:null,compressFunction:function(o){return!0},updateSequenceNumber:function(){a.sequenceNumber[1]===4294967295?(a.sequenceNumber[1]=0,++a.sequenceNumber[0]):++a.sequenceNumber[1]}};return a},n={read:r(),write:r()};if(n.read.update=function(a,o){return n.read.cipherFunction(o,n.read)?n.read.compressFunction(a,o,n.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.decompression_failure}}):a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_record_mac}}),!a.fail},n.write.update=function(a,o){return n.write.compressFunction(a,o,n.write)?n.write.cipherFunction(o,n.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}),!a.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=U.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case U.CompressionMethod.none:break;case U.CompressionMethod.deflate:n.read.compressFunction=t4,n.write.compressFunction=e4;break;default:throw new Error("Unsupported compression algorithm.")}}return n},U.createRandom=function(){var e=new Date,t=+e+e.getTimezoneOffset()*6e4,r=ye.util.createBuffer();return r.putInt32(t),r.putBytes(ye.random.getBytes(28)),r},U.createRecord=function(e,t){if(!t.data)return null;var r={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return r},U.createAlert=function(e,t){var r=ye.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),U.createRecord(e,{type:U.ContentType.alert,data:r})},U.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=ye.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var n=e.cipherSuites[r];t.putByte(n.id[0]),t.putByte(n.id[1])}var i=t.length(),a=ye.util.createBuffer();a.putByte(U.CompressionMethod.none);var o=a.length(),s=ye.util.createBuffer();if(e.virtualHost){var u=ye.util.createBuffer();u.putByte(0),u.putByte(0);var c=ye.util.createBuffer();c.putByte(0),Nr(c,2,ye.util.createBuffer(e.virtualHost));var l=ye.util.createBuffer();Nr(l,2,c),Nr(u,2,l),s.putBuffer(u)}var f=s.length();f>0&&(f+=2);var d=e.session.id,g=d.length+1+2+4+28+2+i+1+o+f,h=ye.util.createBuffer();return h.putByte(U.HandshakeType.client_hello),h.putInt24(g),h.putByte(e.version.major),h.putByte(e.version.minor),h.putBytes(e.session.sp.client_random),Nr(h,1,ye.util.createBuffer(d)),Nr(h,2,t),Nr(h,1,a),f>0&&Nr(h,2,s),h},U.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=ye.util.createBuffer();return n.putByte(U.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),Nr(n,1,ye.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},U.createCertificate=function(e){var t=e.entity===U.ConnectionEnd.client,r=null;if(e.getCertificate){var n;t?n=e.session.certificateRequest:n=e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,n)}var i=ye.util.createBuffer();if(r!==null)try{ye.util.isArray(r)||(r=[r]);for(var a=null,o=0;o<r.length;++o){var s=ye.pem.decode(r[o])[0];if(s.type!=="CERTIFICATE"&&s.type!=="X509 CERTIFICATE"&&s.type!=="TRUSTED CERTIFICATE"){var u=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw u.headerType=s.type,u}if(s.procType&&s.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=ye.util.createBuffer(s.body);a===null&&(a=ye.asn1.fromDer(c.bytes(),!1));var l=ye.util.createBuffer();Nr(l,3,c),i.putBuffer(l)}r=ye.pki.certificateFromAsn1(a),t?e.session.clientCertificate=r:e.session.serverCertificate=r}catch(g){return e.error(e,{message:"Could not send certificate list.",cause:g,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate}})}var f=3+i.length(),d=ye.util.createBuffer();return d.putByte(U.HandshakeType.certificate),d.putInt24(f),Nr(d,3,i),d},U.createClientKeyExchange=function(e){var t=ye.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(ye.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var n=e.session.serverCertificate.publicKey;t=n.encrypt(r.pre_master_secret);var i=t.length+2,a=ye.util.createBuffer();return a.putByte(U.HandshakeType.client_key_exchange),a.putInt24(i),a.putInt16(t.length),a.putBytes(t),a},U.createServerKeyExchange=function(e){var t=ye.util.createBuffer();return t},U.getClientSignature=function(e,t){var r=ye.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(n,i,a){var o=null;if(n.getPrivateKey)try{o=n.getPrivateKey(n,n.session.clientCertificate),o=ye.pki.privateKeyFromPem(o)}catch(s){n.error(n,{message:"Could not get private key.",cause:s,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}})}o===null?n.error(n,{message:"No private key set.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}):i=o.sign(i,null),a(n,i)},e.getSignature(e,r,t)},U.createCertificateVerify=function(e,t){var r=t.length+2,n=ye.util.createBuffer();return n.putByte(U.HandshakeType.certificate_verify),n.putInt24(r),n.putInt16(t.length),n.putBytes(t),n},U.createCertificateRequest=function(e){var t=ye.util.createBuffer();t.putByte(1);var r=ye.util.createBuffer();for(var n in e.caStore.certs){var i=e.caStore.certs[n],a=ye.pki.distinguishedNameToAsn1(i.subject),o=ye.asn1.toDer(a);r.putInt16(o.length()),r.putBuffer(o)}var s=1+t.length()+2+r.length(),u=ye.util.createBuffer();return u.putByte(U.HandshakeType.certificate_request),u.putInt24(s),Nr(u,1,t),Nr(u,2,r),u},U.createServerHelloDone=function(e){var t=ye.util.createBuffer();return t.putByte(U.HandshakeType.server_hello_done),t.putInt24(0),t},U.createChangeCipherSpec=function(){var e=ye.util.createBuffer();return e.putByte(1),e},U.createFinished=function(e){var t=ye.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===U.ConnectionEnd.client,n=e.session.sp,i=12,a=al,o=r?"client finished":"server finished";t=a(n.master_secret,o,t.getBytes(),i);var s=ye.util.createBuffer();return s.putByte(U.HandshakeType.finished),s.putInt24(t.length()),s.putBuffer(t),s},U.createHeartbeat=function(e,t,r){typeof r>"u"&&(r=t.length);var n=ye.util.createBuffer();n.putByte(e),n.putInt16(r),n.putBytes(t);var i=n.length(),a=Math.max(16,i-r-3);return n.putBytes(ye.random.getBytes(a)),n},U.queue=function(e,t){if(!!t&&!(t.fragment.length()===0&&(t.type===U.ContentType.handshake||t.type===U.ContentType.alert||t.type===U.ContentType.change_cipher_spec))){if(t.type===U.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var n;if(t.fragment.length()<=U.MaxFragment)n=[t];else{n=[];for(var i=t.fragment.bytes();i.length>U.MaxFragment;)n.push(U.createRecord(e,{type:t.type,data:ye.util.createBuffer(i.slice(0,U.MaxFragment))})),i=i.slice(U.MaxFragment);i.length>0&&n.push(U.createRecord(e,{type:t.type,data:ye.util.createBuffer(i)}))}for(var a=0;a<n.length&&!e.fail;++a){var o=n[a],s=e.state.current.write;s.update(e,o)&&e.records.push(o)}}},U.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var kp=function(e){switch(e){case!0:return!0;case ye.pki.certificateError.bad_certificate:return U.Alert.Description.bad_certificate;case ye.pki.certificateError.unsupported_certificate:return U.Alert.Description.unsupported_certificate;case ye.pki.certificateError.certificate_revoked:return U.Alert.Description.certificate_revoked;case ye.pki.certificateError.certificate_expired:return U.Alert.Description.certificate_expired;case ye.pki.certificateError.certificate_unknown:return U.Alert.Description.certificate_unknown;case ye.pki.certificateError.unknown_ca:return U.Alert.Description.unknown_ca;default:return U.Alert.Description.bad_certificate}},m4=function(e){switch(e){case!0:return!0;case U.Alert.Description.bad_certificate:return ye.pki.certificateError.bad_certificate;case U.Alert.Description.unsupported_certificate:return ye.pki.certificateError.unsupported_certificate;case U.Alert.Description.certificate_revoked:return ye.pki.certificateError.certificate_revoked;case U.Alert.Description.certificate_expired:return ye.pki.certificateError.certificate_expired;case U.Alert.Description.certificate_unknown:return ye.pki.certificateError.certificate_unknown;case U.Alert.Description.unknown_ca:return ye.pki.certificateError.unknown_ca;default:return ye.pki.certificateError.bad_certificate}};U.verifyCertificateChain=function(e,t){try{var r={};for(var n in e.verifyOptions)r[n]=e.verifyOptions[n];r.verify=function(a,o,s){var u=kp(a),c=e.verify(e,a,o,s);if(c!==!0){if(typeof c=="object"&&!ye.util.isArray(c)){var l=new Error("The application rejected the certificate.");throw l.send=!0,l.alert={level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate},c.message&&(l.message=c.message),c.alert&&(l.alert.description=c.alert),l}c!==a&&(c=m4(c))}return c},ye.pki.verifyCertificateChain(e.caStore,t,r)}catch(a){var i=a;(typeof i!="object"||ye.util.isArray(i))&&(i={send:!0,alert:{level:U.Alert.Level.fatal,description:kp(a)}}),"send"in i||(i.send=!0),"alert"in i||(i.alert={level:U.Alert.Level.fatal,description:kp(i.error)}),e.error(e,i)}return!e.fail},U.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{r={},r.cache=e||{},r.capacity=Math.max(t||100,1),r.order=[];for(var n in e)r.order.length<=t?r.order.push(n):delete e[n];r.getSession=function(i){var a=null,o=null;if(i?o=ye.util.bytesToHex(i):r.order.length>0&&(o=r.order[0]),o!==null&&o in r.cache){a=r.cache[o],delete r.cache[o];for(var s in r.order)if(r.order[s]===o){r.order.splice(s,1);break}}return a},r.setSession=function(i,a){if(r.order.length===r.capacity){var o=r.order.shift();delete r.cache[o]}var o=ye.util.bytesToHex(i);r.order.push(o),r.cache[o]=a}}return r},U.createConnection=function(e){var t=null;e.caStore?ye.util.isArray(e.caStore)?t=ye.pki.createCaStore(e.caStore):t=e.caStore:t=ye.pki.createCaStore();var r=e.cipherSuites||null;if(r===null){r=[];for(var n in U.CipherSuites)r.push(U.CipherSuites[n])}var i=e.server?U.ConnectionEnd.server:U.ConnectionEnd.client,a=e.sessionCache?U.createSessionCache(e.sessionCache):null,o={version:{major:U.Version.major,minor:U.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:a,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(l,f,d,g){return f},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:ye.util.createBuffer(),tlsData:ye.util.createBuffer(),data:ye.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(l,f){f.origin=f.origin||(l.entity===U.ConnectionEnd.client?"client":"server"),f.send&&(U.queue(l,U.createAlert(l,f.alert)),U.flush(l));var d=f.fatal!==!1;d&&(l.fail=!0),e.error(l,f),d&&l.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};o.reset=function(l){o.version={major:U.Version.major,minor:U.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=o.entity===U.ConnectionEnd.client?r4:c4,o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(l||typeof l>"u"),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=U.createConnectionState(o)},o.reset();var s=function(l,f){var d=f.type-U.ContentType.change_cipher_spec,g=Dp[l.entity][l.expect];d in g?g[d](l,f):U.handleUnexpected(l,f)},u=function(l){var f=0,d=l.input,g=d.length();if(g<5)f=5-g;else{l.record={type:d.getByte(),version:{major:d.getByte(),minor:d.getByte()},length:d.getInt16(),fragment:ye.util.createBuffer(),ready:!1};var h=l.record.version.major===l.version.major;h&&l.session&&l.session.version&&(h=l.record.version.minor===l.version.minor),h||l.error(l,{message:"Incompatible TLS version.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}})}return f},c=function(l){var f=0,d=l.input,g=d.length();if(g<l.record.length)f=l.record.length-g;else{l.record.fragment.putBytes(d.getBytes(l.record.length)),d.compact();var h=l.state.current.read;h.update(l,l.record)&&(l.fragmented!==null&&(l.fragmented.type===l.record.type?(l.fragmented.fragment.putBuffer(l.record.fragment),l.record=l.fragmented):l.error(l,{message:"Invalid fragmented record.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unexpected_message}})),l.record.ready=!0)}return f};return o.handshake=function(l){if(o.entity!==U.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&o.handshakes===0&&(o.fail=!1),o.handshaking=!0,l=l||"";var f=null;l.length>0&&(o.sessionCache&&(f=o.sessionCache.getSession(l)),f===null&&(l="")),l.length===0&&o.sessionCache&&(f=o.sessionCache.getSession(),f!==null&&(l=f.id)),o.session={id:l,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:ye.md.md5.create(),sha1:ye.md.sha1.create()},f&&(o.version=f.version,o.session.sp=f.sp),o.session.sp.client_random=U.createRandom().getBytes(),o.open=!0,U.queue(o,U.createRecord(o,{type:U.ContentType.handshake,data:U.createClientHello(o)})),U.flush(o)}},o.process=function(l){var f=0;return l&&o.input.putBytes(l),o.fail||(o.record!==null&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),o.record===null&&(f=u(o)),!o.fail&&o.record!==null&&!o.record.ready&&(f=c(o)),!o.fail&&o.record!==null&&o.record.ready&&s(o,o.record)),f},o.prepare=function(l){return U.queue(o,U.createRecord(o,{type:U.ContentType.application_data,data:ye.util.createBuffer(l)})),U.flush(o)},o.prepareHeartbeatRequest=function(l,f){return l instanceof ye.util.ByteBuffer&&(l=l.bytes()),typeof f>"u"&&(f=l.length),o.expectedHeartbeatPayload=l,U.queue(o,U.createRecord(o,{type:U.ContentType.heartbeat,data:U.createHeartbeat(U.HeartbeatMessageType.heartbeat_request,l,f)})),U.flush(o)},o.close=function(l){if(!o.fail&&o.sessionCache&&o.session){var f={id:o.session.id,version:o.session.version,sp:o.session.sp};f.sp.keys=null,o.sessionCache.setSession(f.id,f)}o.open&&(o.open=!1,o.input.clear(),(o.isConnected||o.handshaking)&&(o.isConnected=o.handshaking=!1,U.queue(o,U.createAlert(o,{level:U.Alert.Level.warning,description:U.Alert.Description.close_notify})),U.flush(o)),o.closed(o)),o.reset(l)},o},ye.tls=ye.tls||{};for(var Up in U)typeof U[Up]!="function"&&(ye.tls[Up]=U[Up]);ye.tls.prf_tls1=al,ye.tls.hmac_sha1=ZD,ye.tls.createSessionCache=U.createSessionCache,ye.tls.createConnection=U.createConnection;var di=ke,Br=di.tls;Br.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=Br.BulkCipherAlgorithm.aes,e.cipher_type=Br.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=Br.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:H_},Br.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=Br.BulkCipherAlgorithm.aes,e.cipher_type=Br.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=Br.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:H_};function H_(e,t,r){var n=t.entity===di.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:di.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:di.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=S4,e.write.cipherFunction=E4,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=Br.hmac_sha1}function E4(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var i;e.version.minor===Br.Versions.TLS_1_0.minor?i=t.cipherState.init?null:t.cipherState.iv:i=di.random.getBytesSync(16),t.cipherState.init=!0;var a=t.cipherState.cipher;return a.start({iv:i}),e.version.minor>=Br.Versions.TLS_1_1.minor&&a.output.putBytes(i),a.update(e.fragment),a.finish(b4)&&(e.fragment=a.output,e.length=e.fragment.length(),r=!0),r}function b4(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function _4(e,t,r){var n=!0;if(r){for(var i=t.length(),a=t.last(),o=i-1-a;o<i-1;++o)n=n&&t.at(o)==a;n&&t.truncate(a+1)}return n}function S4(e,t){var r=!1,n;e.version.minor===Br.Versions.TLS_1_0.minor?n=t.cipherState.init?null:t.cipherState.iv:n=e.fragment.getBytes(16),t.cipherState.init=!0;var i=t.cipherState.cipher;i.start({iv:n}),i.update(e.fragment),r=i.finish(_4);var a=t.macLength,o=di.random.getBytesSync(a),s=i.output.length();s>=a?(e.fragment=i.output.getBytes(s-a),o=i.output.getBytes(a)):e.fragment=i.output.getBytes(),e.fragment=di.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=C4(t.macKey,o,u)&&r,r}function C4(e,t,r){var n=di.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var Ut=ke;Ut.debug=Ut.debug||{},Ut.debug.storage={},Ut.debug.get=function(e,t){var r;return typeof e>"u"?r=Ut.debug.storage:e in Ut.debug.storage&&(typeof t>"u"?r=Ut.debug.storage[e]:r=Ut.debug.storage[e][t]),r},Ut.debug.set=function(e,t,r){e in Ut.debug.storage||(Ut.debug.storage[e]={}),Ut.debug.storage[e][t]=r},Ut.debug.clear=function(e,t){typeof e>"u"?Ut.debug.storage={}:e in Ut.debug.storage&&(typeof t>"u"?delete Ut.debug.storage[e]:delete Ut.debug.storage[e][t])};var ct=ke,Gs=ct.sha512=ct.sha512||{};ct.md.sha512=ct.md.algorithms.sha512=Gs;var Y_=ct.sha384=ct.sha512.sha384=ct.sha512.sha384||{};Y_.create=function(){return Gs.create("SHA-384")},ct.md.sha384=ct.md.algorithms.sha384=Y_,ct.sha512.sha256=ct.sha512.sha256||{create:function(){return Gs.create("SHA-512/256")}},ct.md["sha512/256"]=ct.md.algorithms["sha512/256"]=ct.sha512.sha256,ct.sha512.sha224=ct.sha512.sha224||{create:function(){return Gs.create("SHA-512/224")}},ct.md["sha512/224"]=ct.md.algorithms["sha512/224"]=ct.sha512.sha224,Gs.create=function(e){if(W_||w4(),typeof e>"u"&&(e="SHA-512"),!(e in Qi))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=Qi[e],r=null,n=ct.util.createBuffer(),i=new Array(80),a=0;a<80;++a)i[a]=new Array(2);var o=64;switch(e){case"SHA-384":o=48;break;case"SHA-512/256":o=32;break;case"SHA-512/224":o=28;break}var s={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:o,messageLength:0,fullMessageLength:null,messageLengthSize:16};return s.start=function(){s.messageLength=0,s.fullMessageLength=s.messageLength128=[];for(var u=s.messageLengthSize/4,c=0;c<u;++c)s.fullMessageLength.push(0);n=ct.util.createBuffer(),r=new Array(t.length);for(var c=0;c<t.length;++c)r[c]=t[c].slice(0);return s},s.start(),s.update=function(u,c){c==="utf8"&&(u=ct.util.encodeUtf8(u));var l=u.length;s.messageLength+=l,l=[l/4294967296>>>0,l>>>0];for(var f=s.fullMessageLength.length-1;f>=0;--f)s.fullMessageLength[f]+=l[1],l[1]=l[0]+(s.fullMessageLength[f]/4294967296>>>0),s.fullMessageLength[f]=s.fullMessageLength[f]>>>0,l[0]=l[1]/4294967296>>>0;return n.putBytes(u),z_(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),s},s.digest=function(){var u=ct.util.createBuffer();u.putBytes(n.bytes());var c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize,l=c&s.blockLength-1;u.putBytes($p.substr(0,s.blockLength-l));for(var f,d,g=s.fullMessageLength[0]*8,h=0;h<s.fullMessageLength.length-1;++h)f=s.fullMessageLength[h+1]*8,d=f/4294967296>>>0,g+=d,u.putInt32(g>>>0),g=f>>>0;u.putInt32(g);for(var v=new Array(r.length),h=0;h<r.length;++h)v[h]=r[h].slice(0);z_(v,i,u);var p=ct.util.createBuffer(),y;e==="SHA-512"?y=v.length:e==="SHA-384"?y=v.length-2:y=v.length-4;for(var h=0;h<y;++h)p.putInt32(v[h][0]),(h!==y-1||e!=="SHA-512/224")&&p.putInt32(v[h][1]);return p},s};var $p=null,W_=!1,jp=null,Qi=null;function w4(){$p=String.fromCharCode(128),$p+=ct.util.fillString(String.fromCharCode(0),128),jp=[[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]],Qi={},Qi["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],Qi["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],Qi["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],Qi["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],W_=!0}function z_(e,t,r){for(var n,i,a,o,s,u,c,l,f,d,g,h,v,p,y,w,m,S,A,I,N,T,M,P,L,B,X,V,k,$,G,oe,se,de,le,Ee=r.length();Ee>=128;){for(k=0;k<16;++k)t[k][0]=r.getInt32()>>>0,t[k][1]=r.getInt32()>>>0;for(;k<80;++k)oe=t[k-2],$=oe[0],G=oe[1],n=(($>>>19|G<<13)^(G>>>29|$<<3)^$>>>6)>>>0,i=(($<<13|G>>>19)^(G<<3|$>>>29)^($<<26|G>>>6))>>>0,de=t[k-15],$=de[0],G=de[1],a=(($>>>1|G<<31)^($>>>8|G<<24)^$>>>7)>>>0,o=(($<<31|G>>>1)^($<<24|G>>>8)^($<<25|G>>>7))>>>0,se=t[k-7],le=t[k-16],G=i+se[1]+o+le[1],t[k][0]=n+se[0]+a+le[0]+(G/4294967296>>>0)>>>0,t[k][1]=G>>>0;for(v=e[0][0],p=e[0][1],y=e[1][0],w=e[1][1],m=e[2][0],S=e[2][1],A=e[3][0],I=e[3][1],N=e[4][0],T=e[4][1],M=e[5][0],P=e[5][1],L=e[6][0],B=e[6][1],X=e[7][0],V=e[7][1],k=0;k<80;++k)c=((N>>>14|T<<18)^(N>>>18|T<<14)^(T>>>9|N<<23))>>>0,l=((N<<18|T>>>14)^(N<<14|T>>>18)^(T<<23|N>>>9))>>>0,f=(L^N&(M^L))>>>0,d=(B^T&(P^B))>>>0,s=((v>>>28|p<<4)^(p>>>2|v<<30)^(p>>>7|v<<25))>>>0,u=((v<<4|p>>>28)^(p<<30|v>>>2)^(p<<25|v>>>7))>>>0,g=(v&y|m&(v^y))>>>0,h=(p&w|S&(p^w))>>>0,G=V+l+d+jp[k][1]+t[k][1],n=X+c+f+jp[k][0]+t[k][0]+(G/4294967296>>>0)>>>0,i=G>>>0,G=u+h,a=s+g+(G/4294967296>>>0)>>>0,o=G>>>0,X=L,V=B,L=M,B=P,M=N,P=T,G=I+i,N=A+n+(G/4294967296>>>0)>>>0,T=G>>>0,A=m,I=S,m=y,S=w,y=v,w=p,G=i+o,v=n+a+(G/4294967296>>>0)>>>0,p=G>>>0;G=e[0][1]+p,e[0][0]=e[0][0]+v+(G/4294967296>>>0)>>>0,e[0][1]=G>>>0,G=e[1][1]+w,e[1][0]=e[1][0]+y+(G/4294967296>>>0)>>>0,e[1][1]=G>>>0,G=e[2][1]+S,e[2][0]=e[2][0]+m+(G/4294967296>>>0)>>>0,e[2][1]=G>>>0,G=e[3][1]+I,e[3][0]=e[3][0]+A+(G/4294967296>>>0)>>>0,e[3][1]=G>>>0,G=e[4][1]+T,e[4][0]=e[4][0]+N+(G/4294967296>>>0)>>>0,e[4][1]=G>>>0,G=e[5][1]+P,e[5][0]=e[5][0]+M+(G/4294967296>>>0)>>>0,e[5][1]=G>>>0,G=e[6][1]+B,e[6][0]=e[6][0]+L+(G/4294967296>>>0)>>>0,e[6][1]=G>>>0,G=e[7][1]+V,e[7][0]=e[7][0]+X+(G/4294967296>>>0)>>>0,e[7][1]=G>>>0,Ee-=128}}var Kp={},T4=ke,Lt=T4.asn1;Kp.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Kp.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Lt.Class.UNIVERSAL,type:Lt.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]};var $t=ke,Q_=Kp,A4=Q_.publicKeyValidator,x4=Q_.privateKeyValidator;if(typeof R4>"u")var R4=$t.jsbn.BigInteger;var qp=$t.util.ByteBuffer,cr=typeof Buffer>"u"?Uint8Array:Buffer;$t.pki=$t.pki||{},$t.pki.ed25519=$t.ed25519=$t.ed25519||{};var Ge=$t.ed25519;Ge.constants={},Ge.constants.PUBLIC_KEY_BYTE_LENGTH=32,Ge.constants.PRIVATE_KEY_BYTE_LENGTH=64,Ge.constants.SEED_BYTE_LENGTH=32,Ge.constants.SIGN_BYTE_LENGTH=64,Ge.constants.HASH_BYTE_LENGTH=64,Ge.generateKeyPair=function(e){e=e||{};var t=e.seed;if(t===void 0)t=$t.random.getBytesSync(Ge.constants.SEED_BYTE_LENGTH);else if(typeof t=="string"){if(t.length!==Ge.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+Ge.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=Mn({message:t,encoding:"binary"});for(var r=new cr(Ge.constants.PUBLIC_KEY_BYTE_LENGTH),n=new cr(Ge.constants.PRIVATE_KEY_BYTE_LENGTH),i=0;i<32;++i)n[i]=t[i];return L4(r,n),{publicKey:r,privateKey:n}},Ge.privateKeyFromAsn1=function(e){var t={},r=[],n=$t.asn1.validate(e,x4,t,r);if(!n){var i=new Error("Invalid Key.");throw i.errors=r,i}var a=$t.asn1.derToOid(t.privateKeyOid),o=$t.oids.EdDSA25519;if(a!==o)throw new Error('Invalid OID "'+a+'"; OID must be "'+o+'".');var s=t.privateKey,u=Mn({message:$t.asn1.fromDer(s).value,encoding:"binary"});return{privateKeyBytes:u}},Ge.publicKeyFromAsn1=function(e){var t={},r=[],n=$t.asn1.validate(e,A4,t,r);if(!n){var i=new Error("Invalid Key.");throw i.errors=r,i}var a=$t.asn1.derToOid(t.publicKeyOid),o=$t.oids.EdDSA25519;if(a!==o)throw new Error('Invalid OID "'+a+'"; OID must be "'+o+'".');var s=t.ed25519PublicKey;if(s.length!==Ge.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return Mn({message:s,encoding:"binary"})},Ge.publicKeyFromPrivateKey=function(e){e=e||{};var t=Mn({message:e.privateKey,encoding:"binary"});if(t.length!==Ge.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Ge.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new cr(Ge.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},Ge.sign=function(e){e=e||{};var t=Mn(e),r=Mn({message:e.privateKey,encoding:"binary"});if(r.length===Ge.constants.SEED_BYTE_LENGTH){var n=Ge.generateKeyPair({seed:r});r=n.privateKey}else if(r.length!==Ge.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Ge.constants.SEED_BYTE_LENGTH+" or "+Ge.constants.PRIVATE_KEY_BYTE_LENGTH);var i=new cr(Ge.constants.SIGN_BYTE_LENGTH+t.length);P4(i,t,t.length,r);for(var a=new cr(Ge.constants.SIGN_BYTE_LENGTH),o=0;o<a.length;++o)a[o]=i[o];return a},Ge.verify=function(e){e=e||{};var t=Mn(e);if(e.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=Mn({message:e.signature,encoding:"binary"});if(r.length!==Ge.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+Ge.constants.SIGN_BYTE_LENGTH);var n=Mn({message:e.publicKey,encoding:"binary"});if(n.length!==Ge.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+Ge.constants.PUBLIC_KEY_BYTE_LENGTH);var i=new cr(Ge.constants.SIGN_BYTE_LENGTH+t.length),a=new cr(Ge.constants.SIGN_BYTE_LENGTH+t.length),o;for(o=0;o<Ge.constants.SIGN_BYTE_LENGTH;++o)i[o]=r[o];for(o=0;o<t.length;++o)i[o+Ge.constants.SIGN_BYTE_LENGTH]=t[o];return N4(a,i,i.length,n)>=0};function Mn(e){var t=e.message;if(t instanceof Uint8Array||t instanceof cr)return t;var r=e.encoding;if(t===void 0)if(e.md)t=e.md.digest().getBytes(),r="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof t=="string"&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.from(t,r);t=new qp(t,r)}else if(!(t instanceof qp))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.');for(var n=new cr(t.length()),i=0;i<n.length;++i)n[i]=t.at(i);return n}var Vp=Le(),ul=Le([1]),I4=Le([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),O4=Le([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),X_=Le([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),J_=Le([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Gp=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]),M4=Le([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Hs(e,t){var r=$t.md.sha512.create(),n=new qp(e);r.update(n.getBytes(t),"binary");var i=r.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(i,"binary");for(var a=new cr(Ge.constants.HASH_BYTE_LENGTH),o=0;o<64;++o)a[o]=i.charCodeAt(o);return a}function L4(e,t){var r=[Le(),Le(),Le(),Le()],n,i=Hs(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,zp(r,i),Wp(e,r),n=0;n<32;++n)t[n+32]=e[n];return 0}function P4(e,t,r,n){var i,a,o=new Float64Array(64),s=[Le(),Le(),Le(),Le()],u=Hs(n,32);u[0]&=248,u[31]&=127,u[31]|=64;var c=r+64;for(i=0;i<r;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=u[32+i];var l=Hs(e.subarray(32),r+32);for(Hp(l),zp(s,l),Wp(e,s),i=32;i<64;++i)e[i]=n[i];var f=Hs(e,r+64);for(Hp(f),i=32;i<64;++i)o[i]=0;for(i=0;i<32;++i)o[i]=l[i];for(i=0;i<32;++i)for(a=0;a<32;a++)o[i+a]+=f[i]*u[a];return Z_(e.subarray(32),o),c}function N4(e,t,r,n){var i,a,o=new cr(32),s=[Le(),Le(),Le(),Le()],u=[Le(),Le(),Le(),Le()];if(a=-1,r<64||B4(u,n))return-1;for(i=0;i<r;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=n[i];var c=Hs(e,r);if(Hp(c),iS(s,u,c),zp(u,t.subarray(32)),Yp(s,u),Wp(o,s),r-=64,rS(t,0,o,0)){for(i=0;i<r;++i)e[i]=0;return-1}for(i=0;i<r;++i)e[i]=t[i+64];return a=r,a}function Z_(e,t){var r,n,i,a;for(n=63;n>=32;--n){for(r=0,i=n-32,a=n-12;i<a;++i)t[i]+=r-16*t[n]*Gp[i-(n-32)],r=t[i]+128>>8,t[i]-=r*256;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*Gp[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*Gp[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=t[n]&255}function Hp(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;Z_(e,t)}function Yp(e,t){var r=Le(),n=Le(),i=Le(),a=Le(),o=Le(),s=Le(),u=Le(),c=Le(),l=Le();po(r,e[1],e[0]),po(l,t[1],t[0]),rt(r,r,l),ho(n,e[0],e[1]),ho(l,t[0],t[1]),rt(n,n,l),rt(i,e[3],t[3]),rt(i,i,O4),rt(a,e[2],t[2]),ho(a,a,a),po(o,n,r),po(s,a,i),ho(u,a,i),ho(c,n,r),rt(e[0],o,s),rt(e[1],c,u),rt(e[2],u,s),rt(e[3],o,c)}function eS(e,t,r){for(var n=0;n<4;++n)aS(e[n],t[n],r)}function Wp(e,t){var r=Le(),n=Le(),i=Le();U4(i,t[2]),rt(r,t[0],i),rt(n,t[1],i),cl(e,n),e[31]^=nS(r)<<7}function cl(e,t){var r,n,i,a=Le(),o=Le();for(r=0;r<16;++r)o[r]=t[r];for(Qp(o),Qp(o),Qp(o),n=0;n<2;++n){for(a[0]=o[0]-65517,r=1;r<15;++r)a[r]=o[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=o[15]-32767-(a[14]>>16&1),i=a[15]>>16&1,a[14]&=65535,aS(o,a,1-i)}for(r=0;r<16;r++)e[2*r]=o[r]&255,e[2*r+1]=o[r]>>8}function B4(e,t){var r=Le(),n=Le(),i=Le(),a=Le(),o=Le(),s=Le(),u=Le();return hi(e[2],ul),D4(e[1],t),Xi(i,e[1]),rt(a,i,I4),po(i,i,e[2]),ho(a,e[2],a),Xi(o,a),Xi(s,o),rt(u,s,o),rt(r,u,i),rt(r,r,a),F4(r,r),rt(r,r,i),rt(r,r,a),rt(r,r,a),rt(e[0],r,a),Xi(n,e[0]),rt(n,n,a),tS(n,i)&&rt(e[0],e[0],M4),Xi(n,e[0]),rt(n,n,a),tS(n,i)?-1:(nS(e[0])===t[31]>>7&&po(e[0],Vp,e[0]),rt(e[3],e[0],e[1]),0)}function D4(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function F4(e,t){var r=Le(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=250;n>=0;--n)Xi(r,r),n!==1&&rt(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function tS(e,t){var r=new cr(32),n=new cr(32);return cl(r,e),cl(n,t),rS(r,0,n,0)}function rS(e,t,r,n){return k4(e,t,r,n,32)}function k4(e,t,r,n,i){var a,o=0;for(a=0;a<i;++a)o|=e[t+a]^r[n+a];return(1&o-1>>>8)-1}function nS(e){var t=new cr(32);return cl(t,e),t[0]&1}function iS(e,t,r){var n,i;for(hi(e[0],Vp),hi(e[1],ul),hi(e[2],ul),hi(e[3],Vp),i=255;i>=0;--i)n=r[i/8|0]>>(i&7)&1,eS(e,t,n),Yp(t,e),Yp(e,e),eS(e,t,n)}function zp(e,t){var r=[Le(),Le(),Le(),Le()];hi(r[0],X_),hi(r[1],J_),hi(r[2],ul),rt(r[3],X_,J_),iS(e,r,t)}function hi(e,t){var r;for(r=0;r<16;r++)e[r]=t[r]|0}function U4(e,t){var r=Le(),n;for(n=0;n<16;++n)r[n]=t[n];for(n=253;n>=0;--n)Xi(r,r),n!==2&&n!==4&&rt(r,r,t);for(n=0;n<16;++n)e[n]=r[n]}function Qp(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-n*65536;e[0]+=n-1+37*(n-1)}function aS(e,t,r){for(var n,i=~(r-1),a=0;a<16;++a)n=i&(e[a]^t[a]),e[a]^=n,t[a]^=n}function Le(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function ho(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function po(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function Xi(e,t){rt(e,t,t)}function rt(e,t,r){var n,i,a=0,o=0,s=0,u=0,c=0,l=0,f=0,d=0,g=0,h=0,v=0,p=0,y=0,w=0,m=0,S=0,A=0,I=0,N=0,T=0,M=0,P=0,L=0,B=0,X=0,V=0,k=0,$=0,G=0,oe=0,se=0,de=r[0],le=r[1],Ee=r[2],pe=r[3],J=r[4],ne=r[5],q=r[6],z=r[7],W=r[8],_=r[9],x=r[10],E=r[11],R=r[12],K=r[13],Q=r[14],he=r[15];n=t[0],a+=n*de,o+=n*le,s+=n*Ee,u+=n*pe,c+=n*J,l+=n*ne,f+=n*q,d+=n*z,g+=n*W,h+=n*_,v+=n*x,p+=n*E,y+=n*R,w+=n*K,m+=n*Q,S+=n*he,n=t[1],o+=n*de,s+=n*le,u+=n*Ee,c+=n*pe,l+=n*J,f+=n*ne,d+=n*q,g+=n*z,h+=n*W,v+=n*_,p+=n*x,y+=n*E,w+=n*R,m+=n*K,S+=n*Q,A+=n*he,n=t[2],s+=n*de,u+=n*le,c+=n*Ee,l+=n*pe,f+=n*J,d+=n*ne,g+=n*q,h+=n*z,v+=n*W,p+=n*_,y+=n*x,w+=n*E,m+=n*R,S+=n*K,A+=n*Q,I+=n*he,n=t[3],u+=n*de,c+=n*le,l+=n*Ee,f+=n*pe,d+=n*J,g+=n*ne,h+=n*q,v+=n*z,p+=n*W,y+=n*_,w+=n*x,m+=n*E,S+=n*R,A+=n*K,I+=n*Q,N+=n*he,n=t[4],c+=n*de,l+=n*le,f+=n*Ee,d+=n*pe,g+=n*J,h+=n*ne,v+=n*q,p+=n*z,y+=n*W,w+=n*_,m+=n*x,S+=n*E,A+=n*R,I+=n*K,N+=n*Q,T+=n*he,n=t[5],l+=n*de,f+=n*le,d+=n*Ee,g+=n*pe,h+=n*J,v+=n*ne,p+=n*q,y+=n*z,w+=n*W,m+=n*_,S+=n*x,A+=n*E,I+=n*R,N+=n*K,T+=n*Q,M+=n*he,n=t[6],f+=n*de,d+=n*le,g+=n*Ee,h+=n*pe,v+=n*J,p+=n*ne,y+=n*q,w+=n*z,m+=n*W,S+=n*_,A+=n*x,I+=n*E,N+=n*R,T+=n*K,M+=n*Q,P+=n*he,n=t[7],d+=n*de,g+=n*le,h+=n*Ee,v+=n*pe,p+=n*J,y+=n*ne,w+=n*q,m+=n*z,S+=n*W,A+=n*_,I+=n*x,N+=n*E,T+=n*R,M+=n*K,P+=n*Q,L+=n*he,n=t[8],g+=n*de,h+=n*le,v+=n*Ee,p+=n*pe,y+=n*J,w+=n*ne,m+=n*q,S+=n*z,A+=n*W,I+=n*_,N+=n*x,T+=n*E,M+=n*R,P+=n*K,L+=n*Q,B+=n*he,n=t[9],h+=n*de,v+=n*le,p+=n*Ee,y+=n*pe,w+=n*J,m+=n*ne,S+=n*q,A+=n*z,I+=n*W,N+=n*_,T+=n*x,M+=n*E,P+=n*R,L+=n*K,B+=n*Q,X+=n*he,n=t[10],v+=n*de,p+=n*le,y+=n*Ee,w+=n*pe,m+=n*J,S+=n*ne,A+=n*q,I+=n*z,N+=n*W,T+=n*_,M+=n*x,P+=n*E,L+=n*R,B+=n*K,X+=n*Q,V+=n*he,n=t[11],p+=n*de,y+=n*le,w+=n*Ee,m+=n*pe,S+=n*J,A+=n*ne,I+=n*q,N+=n*z,T+=n*W,M+=n*_,P+=n*x,L+=n*E,B+=n*R,X+=n*K,V+=n*Q,k+=n*he,n=t[12],y+=n*de,w+=n*le,m+=n*Ee,S+=n*pe,A+=n*J,I+=n*ne,N+=n*q,T+=n*z,M+=n*W,P+=n*_,L+=n*x,B+=n*E,X+=n*R,V+=n*K,k+=n*Q,$+=n*he,n=t[13],w+=n*de,m+=n*le,S+=n*Ee,A+=n*pe,I+=n*J,N+=n*ne,T+=n*q,M+=n*z,P+=n*W,L+=n*_,B+=n*x,X+=n*E,V+=n*R,k+=n*K,$+=n*Q,G+=n*he,n=t[14],m+=n*de,S+=n*le,A+=n*Ee,I+=n*pe,N+=n*J,T+=n*ne,M+=n*q,P+=n*z,L+=n*W,B+=n*_,X+=n*x,V+=n*E,k+=n*R,$+=n*K,G+=n*Q,oe+=n*he,n=t[15],S+=n*de,A+=n*le,I+=n*Ee,N+=n*pe,T+=n*J,M+=n*ne,P+=n*q,L+=n*z,B+=n*W,X+=n*_,V+=n*x,k+=n*E,$+=n*R,G+=n*K,oe+=n*Q,se+=n*he,a+=38*A,o+=38*I,s+=38*N,u+=38*T,c+=38*M,l+=38*P,f+=38*L,d+=38*B,g+=38*X,h+=38*V,v+=38*k,p+=38*$,y+=38*G,w+=38*oe,m+=38*se,i=1,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,a+=i-1+37*(i-1),i=1,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,a+=i-1+37*(i-1),e[0]=a,e[1]=o,e[2]=s,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=d,e[8]=g,e[9]=h,e[10]=v,e[11]=p,e[12]=y,e[13]=w,e[14]=m,e[15]=S}var Sr=ke;Sr.kem=Sr.kem||{};var oS=Sr.jsbn.BigInteger;Sr.kem.rsa={},Sr.kem.rsa.create=function(e,t){t=t||{};var r=t.prng||Sr.random,n={};return n.encrypt=function(i,a){var o=Math.ceil(i.n.bitLength()/8),s;do s=new oS(Sr.util.bytesToHex(r.getBytesSync(o)),16).mod(i.n);while(s.compareTo(oS.ONE)<=0);s=Sr.util.hexToBytes(s.toString(16));var u=o-s.length;u>0&&(s=Sr.util.fillString(String.fromCharCode(0),u)+s);var c=i.encrypt(s,"NONE"),l=e.generate(s,a);return{encapsulation:c,key:l}},n.decrypt=function(i,a,o){var s=i.decrypt(a,"NONE");return e.generate(s,o)},n},Sr.kem.kdf1=function(e,t){sS(this,e,0,t||e.digestLength)},Sr.kem.kdf2=function(e,t){sS(this,e,1,t||e.digestLength)};function sS(e,t,r,n){e.generate=function(i,a){for(var o=new Sr.util.ByteBuffer,s=Math.ceil(a/n)+r,u=new Sr.util.ByteBuffer,c=r;c<s;++c){u.putInt32(c),t.start(),t.update(i+u.getBytes());var l=t.digest();o.putBytes(l.getBytes(n))}return o.truncate(o.length()-a),o.getBytes()}}var He=ke;He.log=He.log||{},He.log.levels=["none","error","warning","info","debug","verbose","max"];var ll={},Xp=[],Ys=null;He.log.LEVEL_LOCKED=1<<1,He.log.NO_LEVEL_CHECK=1<<2,He.log.INTERPOLATE=1<<3;for(var pi=0;pi<He.log.levels.length;++pi){var uS=He.log.levels[pi];ll[uS]={index:pi,name:uS.toUpperCase()}}He.log.logMessage=function(e){for(var t=ll[e.level].index,r=0;r<Xp.length;++r){var n=Xp[r];if(n.flags&He.log.NO_LEVEL_CHECK)n.f(e);else{var i=ll[n.level].index;t<=i&&n.f(n,e)}}},He.log.prepareStandard=function(e){"standard"in e||(e.standard=ll[e.level].name+" ["+e.category+"] "+e.message)},He.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]),e.full=He.util.format.apply(this,t)}},He.log.prepareStandardFull=function(e){"standardFull"in e||(He.log.prepareStandard(e),e.standardFull=e.standard)};for(var cS=["error","warning","info","debug","verbose"],pi=0;pi<cS.length;++pi)(function(t){He.log[t]=function(r,n){var i=Array.prototype.slice.call(arguments).slice(2),a={timestamp:new Date,level:t,category:r,message:n,arguments:i};He.log.logMessage(a)}})(cS[pi]);if(He.log.makeLogger=function(e){var t={flags:0,f:e};return He.log.setLevel(t,"none"),t},He.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&He.log.LEVEL_LOCKED))for(var n=0;n<He.log.levels.length;++n){var i=He.log.levels[n];if(t==i){e.level=t,r=!0;break}}return r},He.log.lock=function(e,t){typeof t>"u"||t?e.flags|=He.log.LEVEL_LOCKED:e.flags&=~He.log.LEVEL_LOCKED},He.log.addLogger=function(e){Xp.push(e)},typeof console<"u"&&"log"in console){var Ws;if(console.error&&console.warn&&console.info&&console.debug){var $4={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Jp=function(e,t){He.log.prepareStandard(t);var r=$4[t.level],n=[t.standard];n=n.concat(t.arguments.slice()),r.apply(console,n)};Ws=He.log.makeLogger(Jp)}else{var Jp=function(t,r){He.log.prepareStandardFull(r),console.log(r.standardFull)};Ws=He.log.makeLogger(Jp)}He.log.setLevel(Ws,"debug"),He.log.addLogger(Ws),Ys=Ws}else console={log:function(){}};if(Ys!==null){var fl=He.util.getQueryVariables();if("console.level"in fl&&He.log.setLevel(Ys,fl["console.level"].slice(-1)[0]),"console.lock"in fl){var j4=fl["console.lock"].slice(-1)[0];j4=="true"&&He.log.lock(Ys)}}He.log.consoleLogger=Ys;var K4={exports:{}};(function(e){e.exports=m3})(K4);var Te=ke,Z=Te.asn1,rr=Te.pkcs7=Te.pkcs7||{};rr.messageFromPem=function(e){var t=Te.pem.decode(e)[0];if(t.type!=="PKCS7"){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var n=Z.fromDer(t.body);return rr.messageFromAsn1(n)},rr.messageToPem=function(e,t){var r={type:"PKCS7",body:Z.toDer(e.toAsn1()).getBytes()};return Te.pem.encode(r,{maxline:t})},rr.messageFromAsn1=function(e){var t={},r=[];if(!Z.validate(e,rr.asn1.contentInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw n.errors=r,n}var i=Z.derToOid(t.contentType),a;switch(i){case Te.pki.oids.envelopedData:a=rr.createEnvelopedData();break;case Te.pki.oids.encryptedData:a=rr.createEncryptedData();break;case Te.pki.oids.signedData:a=rr.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return a.fromAsn1(t.content.value[0]),a},rr.createSignedData=function(){var e=null;return e={type:Te.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(n){if(e0(e,n,rr.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var i=e.rawCapture.certificates.value,a=0;a<i.length;++a)e.certificates.push(Te.pki.certificateFromAsn1(i[a]))},toAsn1:function(){e.contentInfo||e.sign();for(var n=[],i=0;i<e.certificates.length;++i)n.push(Te.pki.certificateToAsn1(e.certificates[i]));var a=[],o=Z.create(Z.Class.CONTEXT_SPECIFIC,0,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Z.integerToDer(e.version).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return n.length>0&&o.value[0].value.push(Z.create(Z.Class.CONTEXT_SPECIFIC,0,!0,n)),a.length>0&&o.value[0].value.push(Z.create(Z.Class.CONTEXT_SPECIFIC,1,!0,a)),o.value[0].value.push(Z.create(Z.Class.UNIVERSAL,Z.Type.SET,!0,e.signerInfos)),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.type).getBytes()),o])},addSigner:function(n){var i=n.issuer,a=n.serialNumber;if(n.certificate){var o=n.certificate;typeof o=="string"&&(o=Te.pki.certificateFromPem(o)),i=o.issuer.attributes,a=o.serialNumber}var s=n.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof s=="string"&&(s=Te.pki.privateKeyFromPem(s));var u=n.digestAlgorithm||Te.pki.oids.sha1;switch(u){case Te.pki.oids.sha1:case Te.pki.oids.sha256:case Te.pki.oids.sha384:case Te.pki.oids.sha512:case Te.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+u)}var c=n.authenticatedAttributes||[];if(c.length>0){for(var l=!1,f=!1,d=0;d<c.length;++d){var g=c[d];if(!l&&g.type===Te.pki.oids.contentType){if(l=!0,f)break;continue}if(!f&&g.type===Te.pki.oids.messageDigest){if(f=!0,l)break;continue}}if(!l||!f)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.")}e.signers.push({key:s,version:1,issuer:i,serialNumber:a,digestAlgorithm:u,signatureAlgorithm:Te.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(n){if(n=n||{},(typeof e.content!="object"||e.contentInfo===null)&&(e.contentInfo=Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(Te.pki.oids.data).getBytes())]),"content"in e)){var i;e.content instanceof Te.util.ByteBuffer?i=e.content.bytes():typeof e.content=="string"&&(i=Te.util.encodeUtf8(e.content)),n.detached?e.detachedContent=Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,i):e.contentInfo.value.push(Z.create(Z.Class.CONTEXT_SPECIFIC,0,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,i)]))}if(e.signers.length!==0){var a=t();r(a)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(n){typeof n=="string"&&(n=Te.pki.certificateFromPem(n)),e.certificates.push(n)},addCertificateRevokationList:function(n){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var n={},i=0;i<e.signers.length;++i){var a=e.signers[i],o=a.digestAlgorithm;o in n||(n[o]=Te.md[Te.pki.oids[o]].create()),a.authenticatedAttributes.length===0?a.md=n[o]:a.md=Te.md[Te.pki.oids[o]].create()}e.digestAlgorithmIdentifiers=[];for(var o in n)e.digestAlgorithmIdentifiers.push(Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(o).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.NULL,!1,"")]));return n}function r(n){var i;if(e.detachedContent?i=e.detachedContent:(i=e.contentInfo.value[1],i=i.value[0]),!i)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var a=Z.derToOid(e.contentInfo.value[0].value),o=Z.toDer(i);o.getByte(),Z.getBerValueLength(o),o=o.getBytes();for(var s in n)n[s].start().update(o);for(var u=new Date,c=0;c<e.signers.length;++c){var l=e.signers[c];if(l.authenticatedAttributes.length===0){if(a!==Te.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=Z.create(Z.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=Z.create(Z.Class.UNIVERSAL,Z.Type.SET,!0,[]),d=0;d<l.authenticatedAttributes.length;++d){var g=l.authenticatedAttributes[d];g.type===Te.pki.oids.messageDigest?g.value=n[l.digestAlgorithm].digest():g.type===Te.pki.oids.signingTime&&(g.value||(g.value=u)),f.value.push(Zp(g)),l.authenticatedAttributesAsn1.value.push(Zp(g))}o=Z.toDer(f).getBytes(),l.md.start().update(o)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=W4(e.signers)}},rr.createEncryptedData=function(){var e=null;return e={type:Te.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:Te.pki.oids["aes256-CBC"]},fromAsn1:function(t){e0(e,t,rr.asn1.encryptedDataValidator)},decrypt:function(t){t!==void 0&&(e.encryptedContent.key=t),lS(e)}},e},rr.createEnvelopedData=function(){var e=null;return e={type:Te.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:Te.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=e0(e,t,rr.asn1.envelopedDataValidator);e.recipients=G4(r.recipientInfos.value)},toAsn1:function(){return Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.type).getBytes()),Z.create(Z.Class.CONTEXT_SPECIFIC,0,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Z.integerToDer(e.version).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.SET,!0,H4(e.recipients)),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,z4(e.encryptedContent))])])])},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],a=i.issuer;if(i.serialNumber===t.serialNumber&&a.length===r.length){for(var o=!0,s=0;s<r.length;++s)if(a[s].type!==r[s].type||a[s].value!==r[s].value){o=!1;break}if(o)return i}}return null},decrypt:function(t,r){if(e.encryptedContent.key===void 0&&t!==void 0&&r!==void 0)switch(t.encryptedContent.algorithm){case Te.pki.oids.rsaEncryption:case Te.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=Te.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}lS(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:Te.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(e.encryptedContent.content===void 0){r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var n,i,a;switch(r){case Te.pki.oids["aes128-CBC"]:n=16,i=16,a=Te.aes.createEncryptionCipher;break;case Te.pki.oids["aes192-CBC"]:n=24,i=16,a=Te.aes.createEncryptionCipher;break;case Te.pki.oids["aes256-CBC"]:n=32,i=16,a=Te.aes.createEncryptionCipher;break;case Te.pki.oids["des-EDE3-CBC"]:n=24,i=8,a=Te.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(t===void 0)t=Te.util.createBuffer(Te.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=Te.util.createBuffer(Te.random.getBytes(i));var o=a(t);if(o.start(e.encryptedContent.parameter.copy()),o.update(e.content),!o.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=o.output}for(var s=0;s<e.recipients.length;++s){var u=e.recipients[s];if(u.encryptedContent.content===void 0)switch(u.encryptedContent.algorithm){case Te.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}},e};function q4(e){var t={},r=[];if(!Z.validate(e,rr.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:Te.pki.RDNAttributesAsArray(t.issuer),serialNumber:Te.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:Z.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function V4(e){return Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Z.integerToDer(e.version).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Te.pki.distinguishedNameToAsn1({attributes:e.issuer}),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Te.util.hexToBytes(e.serialNumber))]),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.encryptedContent.algorithm).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.NULL,!1,"")]),Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function G4(e){for(var t=[],r=0;r<e.length;++r)t.push(q4(e[r]));return t}function H4(e){for(var t=[],r=0;r<e.length;++r)t.push(V4(e[r]));return t}function Y4(e){var t=Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Z.integerToDer(e.version).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Te.pki.distinguishedNameToAsn1({attributes:e.issuer}),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Te.util.hexToBytes(e.serialNumber))]),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.digestAlgorithm).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.signatureAlgorithm).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.NULL,!1,"")])),t.value.push(Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=Z.create(Z.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n<e.unauthenticatedAttributes.length;++n){var i=e.unauthenticatedAttributes[n];r.values.push(Zp(i))}t.value.push(r)}return t}function W4(e){for(var t=[],r=0;r<e.length;++r)t.push(Y4(e[r]));return t}function Zp(e){var t;if(e.type===Te.pki.oids.contentType)t=Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.value).getBytes());else if(e.type===Te.pki.oids.messageDigest)t=Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===Te.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),n=new Date("2050-01-01T00:00:00Z"),i=e.value;if(typeof i=="string"){var a=Date.parse(i);isNaN(a)?i.length===13?i=Z.utcTimeToDate(i):i=Z.generalizedTimeToDate(i):i=new Date(a)}i>=r&&i<n?t=Z.create(Z.Class.UNIVERSAL,Z.Type.UTCTIME,!1,Z.dateToUtcTime(i)):t=Z.create(Z.Class.UNIVERSAL,Z.Type.GENERALIZEDTIME,!1,Z.dateToGeneralizedTime(i))}return Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.type).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.SET,!0,[t])])}function z4(e){return[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(Te.pki.oids.data).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(e.algorithm).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,e.parameter.getBytes())]),Z.create(Z.Class.CONTEXT_SPECIFIC,0,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,e.content.getBytes())])]}function e0(e,t,r){var n={},i=[];if(!Z.validate(t,r,n,i)){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw a.errors=a,a}var o=Z.derToOid(n.contentType);if(o!==Te.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(n.encryptedContent){var s="";if(Te.util.isArray(n.encryptedContent))for(var u=0;u<n.encryptedContent.length;++u){if(n.encryptedContent[u].type!==Z.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");s+=n.encryptedContent[u].value}else s=n.encryptedContent;e.encryptedContent={algorithm:Z.derToOid(n.encAlgorithm),parameter:Te.util.createBuffer(n.encParameter.value),content:Te.util.createBuffer(s)}}if(n.content){var s="";if(Te.util.isArray(n.content))for(var u=0;u<n.content.length;++u){if(n.content[u].type!==Z.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");s+=n.content[u].value}else s=n.content;e.content=Te.util.createBuffer(s)}return e.version=n.version.charCodeAt(0),e.rawCapture=n,n}function lS(e){if(e.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(e.content===void 0){var t;switch(e.encryptedContent.algorithm){case Te.pki.oids["aes128-CBC"]:case Te.pki.oids["aes192-CBC"]:case Te.pki.oids["aes256-CBC"]:t=Te.aes.createDecryptionCipher(e.encryptedContent.key);break;case Te.pki.oids.desCBC:case Te.pki.oids["des-EDE3-CBC"]:t=Te.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}var St=ke,dl=St.ssh=St.ssh||{};dl.privateKeyToPutty=function(e,t,r){r=r||"",t=t||"";var n="ssh-rsa",i=t===""?"none":"aes256-cbc",a="PuTTY-User-Key-File-2: "+n+`\r
|
|
95
|
-
`;a+="Encryption: "+i+`\r
|
|
96
|
-
`,a+="Comment: "+r+`\r
|
|
97
|
-
`;var o=St.util.createBuffer();go(o,n),hn(o,e.e),hn(o,e.n);var s=St.util.encode64(o.bytes(),64),u=Math.floor(s.length/66)+1;a+="Public-Lines: "+u+`\r
|
|
98
|
-
`,a+=s;var c=St.util.createBuffer();hn(c,e.d),hn(c,e.p),hn(c,e.q),hn(c,e.qInv);var l;if(!t)l=St.util.encode64(c.bytes(),64);else{var f=c.length()+16-1;f-=f%16;var d=hl(c.bytes());d.truncate(d.length()-f+c.length()),c.putBuffer(d);var g=St.util.createBuffer();g.putBuffer(hl("\0\0\0\0",t)),g.putBuffer(hl("\0\0\0",t));var h=St.aes.createEncryptionCipher(g.truncate(8),"CBC");h.start(St.util.createBuffer().fillWithByte(0,16)),h.update(c.copy()),h.finish();var v=h.output;v.truncate(16),l=St.util.encode64(v.bytes(),64)}u=Math.floor(l.length/66)+1,a+=`\r
|
|
1
|
+
(function(ee,ae){typeof exports=="object"&&typeof module<"u"?ae(exports,require("@certd/pipeline"),require("dayjs"),require("@certd/acme-client"),require("lodash")):typeof define=="function"&&define.amd?define(["exports","@certd/pipeline","dayjs","@certd/acme-client","lodash"],ae):(ee=typeof globalThis<"u"?globalThis:ee||self,ae(ee.CertdPluginCert={},ee.CertdPluginPipeline,ee.dayjs,ee.CertdAcmeClient,ee._))})(this,function(ee,ae,Mt,Si,Ti){"use strict";var _u=Object.defineProperty;var Nu=(ee,ae,Mt)=>ae in ee?_u(ee,ae,{enumerable:!0,configurable:!0,writable:!0,value:Mt}):ee[ae]=Mt;var Ce=(ee,ae,Mt)=>(Nu(ee,typeof ae!="symbol"?ae+"":ae,Mt),Mt);const en=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function Ai(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const ia=en(Mt),er=Ai(Si),Rr=en(Ti);function et(e,t,a,r){var n=arguments.length,s=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,a):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,a,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(n<3?i(s):n>3?i(t,a,s):i(t,a))||s);return n>3&&s&&Object.defineProperty(t,a,s),s}class Ii{constructor(t){Ce(this,"userContext");Ce(this,"logger");this.userContext=t.userContext,this.logger=t.logger,er.setLogger(a=>{this.logger.info(a)})}async getAccountConfig(t){return await this.userContext.getObj(this.buildAccountKey(t))||{}}buildAccountKey(t){return"acme.config."+t}async saveAccountConfig(t,a){await this.userContext.setObj(this.buildAccountKey(t),a)}async getAcmeClient(t,a=!1){const r=await this.getAccountConfig(t);r.key==null&&(r.key=await this.createNewKey(),await this.saveAccountConfig(t,r));const n=new er.Client({directoryUrl:a?er.directory.letsencrypt.staging:er.directory.letsencrypt.production,accountKey:r.key,accountUrl:r.accountUrl,backoffAttempts:20,backoffMin:5e3,backoffMax:1e4});if(r.accountUrl==null){const s={termsOfServiceAgreed:!0,contact:[`mailto:${t}`]};await n.createAccount(s),r.accountUrl=n.getAccountUrl(),await this.saveAccountConfig(t,r)}return n}async createNewKey(){return(await er.forge.createPrivateKey()).toString()}async challengeCreateFn(t,a,r,n){if(this.logger.info("Triggered challengeCreateFn()"),a.type==="http-01"){const s=`/var/www/html/.well-known/acme-challenge/${a.token}`,i=r;this.logger.info(`Creating challenge response for ${t.identifier.value} at path: ${s}`),this.logger.info(`Would write "${i}" to path "${s}"`)}else if(a.type==="dns-01"){const s=`_acme-challenge.${t.identifier.value}`,i=r;return this.logger.info(`Creating TXT record for ${t.identifier.value}: ${s}`),this.logger.info(`Would create TXT record "${s}" with value "${i}"`),await n.createRecord({fullRecord:s,type:"TXT",value:i})}}async challengeRemoveFn(t,a,r,n,s){if(this.logger.info("Triggered challengeRemoveFn()"),a.type==="http-01"){const i=`/var/www/html/.well-known/acme-challenge/${a.token}`;this.logger.info(`Removing challenge response for ${t.identifier.value} at path: ${i}`),this.logger.info(`Would remove file on path "${i}"`)}else if(a.type==="dns-01"){const i=`_acme-challenge.${t.identifier.value}`,o=r;this.logger.info(`Removing TXT record for ${t.identifier.value}: ${i}`),this.logger.info(`Would remove TXT record "${i}" with value "${o}"`);try{await s.removeRecord({fullRecord:i,type:"TXT",value:r,record:n})}catch(u){throw this.logger.error("\u5220\u9664\u89E3\u6790\u8BB0\u5F55\u51FA\u9519\uFF1A",u),u}}}async order(t){const{email:a,isTest:r,domains:n,csrInfo:s,dnsProvider:i}=t,o=await this.getAcmeClient(a,r),{commonName:u,altNames:l}=this.buildCommonNameByDomains(n),[f,c]=await er.forge.createCsr({commonName:u,...s,altNames:l});if(i==null)throw new Error("dnsProvider \u4E0D\u80FD\u4E3A\u7A7A");const m={crt:(await o.auto({csr:c,email:a,termsOfServiceAgreed:!0,challengePriority:["dns-01"],challengeCreateFn:async(y,x,S)=>await this.challengeCreateFn(y,x,S,i),challengeRemoveFn:async(y,x,S,A)=>await this.challengeRemoveFn(y,x,S,A,i)})).toString(),key:f.toString(),csr:c.toString()};return this.logger.debug(`CSR:
|
|
2
|
+
${m.csr}`),this.logger.debug(`Certificate:
|
|
3
|
+
${m.crt}`),this.logger.info("\u8BC1\u4E66\u7533\u8BF7\u6210\u529F"),m}buildCommonNameByDomains(t){if(typeof t=="string"&&(t=t.split(",")),t.length===0)throw new Error("domain can not be empty");const a=t[0];let r;return t.length>1&&(r=Rr.default.slice(t,1)),{commonName:a,altNames:r}}}const sa={};function tn(e,t){let a=sa[e];a==null&&(a={},sa[e]=a),a[t]=!0}function Bi(e){return sa[e]||{}}function bi(e,t){return typeof e=="object"&&e.constructor&&(e=e.constructor),t!=null&&tn(e,t),e}function _i(e,t,a,r){Rr.default.forEach(e,(n,s)=>{r&&r(n,s,t,a),a[s]!=null&&(t[s]=a[s])})}const Ni={target:bi,attachProperty:tn,getClassProperties:Bi,inject:_i},oa=new ae.Registry,rn="pipeline:dns-provider";function wi(e){return t=>{t=ae.Decorator.target(t);const a={},r=ae.Decorator.getClassProperties(t);for(const n in r){const s=Reflect.getMetadata(ae.AUTOWIRE_KEY,t,n);s&&(a[n]=s)}Rr.default.merge(e,{autowire:a}),Reflect.defineMetadata(rn,e,t),t.define=e,oa.register(e.name,{define:e,target:t})}}const Ht={},Ri=Object.freeze(Object.defineProperty({__proto__:null,default:Ht},Symbol.toStringTag,{value:"Module"}));var Li=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Di(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ki(e){var t=e.default;if(typeof t=="function"){var a=function(){return t.apply(this,arguments)};a.prototype=t.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(a,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}),a}var an={exports:{}},Y={options:{usePureJavaScript:!1}},ua={},Ui=ua,nn={};ua.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=Pi(e,t);else{var n=0,s=t.length,i=t.charAt(0),o=[0];for(n=0;n<e.length;++n){for(var u=0,l=e[n];u<o.length;++u)l+=o[u]<<8,o[u]=l%s,l=l/s|0;for(;l>0;)o.push(l%s),l=l/s|0}for(n=0;e[n]===0&&n<e.length-1;++n)r+=i;for(n=o.length-1;n>=0;--n)r+=t[o[n]]}if(a){var f=new RegExp(".{1,"+a+"}","g");r=r.match(f).join(`\r
|
|
4
|
+
`)}return r},ua.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=nn[t];if(!a){a=nn[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var n=t.length,s=t.charAt(0),i=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var u=0,l=o;u<i.length;++u)l+=i[u]*n,i[u]=l&255,l>>=8;for(;l>0;)i.push(l&255),l>>=8}for(var f=0;e[f]===s&&f<e.length-1;++f)i.push(0);return typeof Buffer<"u"?Buffer.from(i.reverse()):new Uint8Array(i.reverse())};function Pi(e,t){var a=0,r=t.length,n=t.charAt(0),s=[0];for(a=0;a<e.length();++a){for(var i=0,o=e.at(a);i<s.length;++i)o+=s[i]<<8,s[i]=o%r,o=o/r|0;for(;o>0;)s.push(o%r),o=o/r|0}var u="";for(a=0;e.at(a)===0&&a<e.length()-1;++a)u+=n;for(a=s.length-1;a>=0;--a)u+=t[s[a]];return u}var sn=Y,on=Ui,E=sn.util=sn.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){E.nextTick=process.nextTick,typeof setImmediate=="function"?E.setImmediate=setImmediate:E.setImmediate=E.nextTick;return}if(typeof setImmediate=="function"){E.setImmediate=function(){return setImmediate.apply(void 0,arguments)},E.nextTick=function(i){return setImmediate(i)};return}if(E.setImmediate=function(i){setTimeout(i,0)},typeof window<"u"&&typeof window.postMessage=="function"){let i=function(o){if(o.source===window&&o.data===e){o.stopPropagation();var u=t.slice();t.length=0,u.forEach(function(l){l()})}};var e="forge.setImmediate",t=[];E.setImmediate=function(o){t.push(o),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",i,!0)}if(typeof MutationObserver<"u"){var a=Date.now(),r=!0,n=document.createElement("div"),t=[];new MutationObserver(function(){var o=t.slice();t.length=0,o.forEach(function(u){u()})}).observe(n,{attributes:!0});var s=E.setImmediate;E.setImmediate=function(o){Date.now()-a>15?(a=Date.now(),s(o)):(t.push(o),t.length===1&&n.setAttribute("a",r=!r))}}E.nextTick=E.setImmediate})(),E.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,E.globalScope=function(){return E.isNodejs?Li:typeof self>"u"?window:self}(),E.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},E.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer},E.isArrayBufferView=function(e){return e&&E.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function mr(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}E.ByteBuffer=la;function la(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(E.isArrayBuffer(e)||E.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof la||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}E.ByteStringBuffer=la;var Vi=4096;E.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>Vi&&(this.data.substr(0,1),this._constructedStringLength=0)},E.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},E.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},E.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},E.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var a=this.data;t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return this.data=a,this._optimizeConstructedString(t),this},E.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},E.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(E.encodeUtf8(e))},E.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))},E.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))},E.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))},E.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))},E.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},E.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},E.ByteStringBuffer.prototype.putInt=function(e,t){mr(t);var a="";do t-=8,a+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(a)},E.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},E.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},E.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},E.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},E.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},E.ByteStringBuffer.prototype.getInt32=function(){var e=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,e},E.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},E.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},E.ByteStringBuffer.prototype.getInt32Le=function(){var e=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,e},E.ByteStringBuffer.prototype.getInt=function(e){mr(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t},E.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t},E.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t},E.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},E.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},E.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},E.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},E.ByteStringBuffer.prototype.copy=function(){var e=E.createBuffer(this.data);return e.read=this.read,e},E.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},E.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},E.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},E.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var a=this.data.charCodeAt(t);a<16&&(e+="0"),e+=a.toString(16)}return e},E.ByteStringBuffer.prototype.toString=function(){return E.decodeUtf8(this.bytes())};function Fi(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=E.isArrayBuffer(e),r=E.isArrayBufferView(e);if(a||r){a?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}E.DataBuffer=Fi,E.DataBuffer.prototype.length=function(){return this.write-this.read},E.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},E.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var a=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(a),this.data=new DataView(r.buffer),this},E.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},E.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var a=0;a<t;++a)this.data.setUint8(e);return this},E.DataBuffer.prototype.putBytes=function(e,t){if(E.isArrayBufferView(e)){var a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=a.byteLength-a.byteOffset;this.accommodate(r);var n=new Uint8Array(this.data.buffer,this.write);return n.set(a),this.write+=r,this}if(E.isArrayBuffer(e)){var a=new Uint8Array(e);this.accommodate(a.byteLength);var n=new Uint8Array(this.data.buffer);return n.set(a,this.write),this.write+=a.byteLength,this}if(e instanceof E.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&E.isArrayBufferView(e.data)){var a=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(a.byteLength);var n=new Uint8Array(e.data.byteLength,this.write);return n.set(a),this.write+=a.byteLength,this}if(e instanceof E.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var s;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.hex.decode(e,s,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.base64.decode(e,s,this.write),this;if(t==="utf8"&&(e=E.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.raw.decode(s),this;if(t==="utf16")return this.accommodate(e.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=E.text.utf16.encode(s),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},E.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},E.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},E.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},E.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},E.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},E.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},E.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},E.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},E.DataBuffer.prototype.putInt=function(e,t){mr(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this},E.DataBuffer.prototype.putSignedInt=function(e,t){return mr(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},E.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},E.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},E.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},E.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},E.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},E.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},E.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},E.DataBuffer.prototype.getInt=function(e){mr(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t},E.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t},E.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t},E.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},E.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},E.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},E.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},E.DataBuffer.prototype.copy=function(){return new E.DataBuffer(this)},E.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},E.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},E.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},E.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var a=this.data.getUint8(t);a<16&&(e+="0"),e+=a.toString(16)}return e},E.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return E.binary.raw.encode(t);if(e==="hex")return E.binary.hex.encode(t);if(e==="base64")return E.binary.base64.encode(t);if(e==="utf8")return E.text.utf8.decode(t);if(e==="utf16")return E.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},E.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=E.encodeUtf8(e)),new E.ByteBuffer(e)},E.fillString=function(e,t){for(var a="";t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return a},E.xorBytes=function(e,t,a){for(var r="",n="",s="",i=0,o=0;a>0;--a,++i)n=e.charCodeAt(i)^t.charCodeAt(i),o>=10&&(r+=s,s="",o=0),s+=String.fromCharCode(n),++o;return r+=s,r},E.hexToBytes=function(e){var t="",a=0;for(e.length&!0&&(a=1,t+=String.fromCharCode(parseInt(e[0],16)));a<e.length;a+=2)t+=String.fromCharCode(parseInt(e.substr(a,2),16));return t},E.bytesToHex=function(e){return E.createBuffer(e).toHex()},E.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var _t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Nt=[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],un="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";E.encode64=function(e,t){for(var a="",r="",n,s,i,o=0;o<e.length;)n=e.charCodeAt(o++),s=e.charCodeAt(o++),i=e.charCodeAt(o++),a+=_t.charAt(n>>2),a+=_t.charAt((n&3)<<4|s>>4),isNaN(s)?a+="==":(a+=_t.charAt((s&15)<<2|i>>6),a+=isNaN(i)?"=":_t.charAt(i&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
|
|
5
|
+
`,a=a.substr(t));return r+=a,r},E.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,n,s,i=0;i<e.length;)a=Nt[e.charCodeAt(i++)-43],r=Nt[e.charCodeAt(i++)-43],n=Nt[e.charCodeAt(i++)-43],s=Nt[e.charCodeAt(i++)-43],t+=String.fromCharCode(a<<2|r>>4),n!==64&&(t+=String.fromCharCode((r&15)<<4|n>>2),s!==64&&(t+=String.fromCharCode((n&3)<<6|s)));return t},E.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},E.decodeUtf8=function(e){return decodeURIComponent(escape(e))},E.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:on.encode,decode:on.decode}},E.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},E.binary.raw.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,s=0;s<e.length;++s)r[n++]=e.charCodeAt(s);return t?n-a:r},E.binary.hex.encode=E.bytesToHex,E.binary.hex.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2))),a=a||0;var n=0,s=a;for(e.length&1&&(n=1,r[s++]=parseInt(e[0],16));n<e.length;n+=2)r[s++]=parseInt(e.substr(n,2),16);return t?s-a:r},E.binary.base64.encode=function(e,t){for(var a="",r="",n,s,i,o=0;o<e.byteLength;)n=e[o++],s=e[o++],i=e[o++],a+=_t.charAt(n>>2),a+=_t.charAt((n&3)<<4|s>>4),isNaN(s)?a+="==":(a+=_t.charAt((s&15)<<2|i>>6),a+=isNaN(i)?"=":_t.charAt(i&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
|
|
6
|
+
`,a=a.substr(t));return r+=a,r},E.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),a=a||0;for(var n,s,i,o,u=0,l=a;u<e.length;)n=Nt[e.charCodeAt(u++)-43],s=Nt[e.charCodeAt(u++)-43],i=Nt[e.charCodeAt(u++)-43],o=Nt[e.charCodeAt(u++)-43],r[l++]=n<<2|s>>4,i!==64&&(r[l++]=(s&15)<<4|i>>2,o!==64&&(r[l++]=(i&3)<<6|o));return t?l-a:r.subarray(0,l)},E.binary.base58.encode=function(e,t){return E.binary.baseN.encode(e,un,t)},E.binary.base58.decode=function(e,t){return E.binary.baseN.decode(e,un,t)},E.text={utf8:{},utf16:{}},E.text.utf8.encode=function(e,t,a){e=E.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,s=0;s<e.length;++s)r[n++]=e.charCodeAt(s);return t?n-a:r},E.text.utf8.decode=function(e){return E.decodeUtf8(String.fromCharCode.apply(null,e))},E.text.utf16.encode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length*2));var n=new Uint16Array(r.buffer);a=a||0;for(var s=a,i=a,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o),s+=2;return t?s-a:r},E.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},E.deflate=function(e,t,a){if(t=E.decode64(e.deflate(E.encode64(t)).rval),a){var r=2,n=t.charCodeAt(1);n&32&&(r=6),t=t.substring(r,t.length-4)}return t},E.inflate=function(e,t,a){var r=e.inflate(E.encode64(t)).rval;return r===null?null:E.decode64(r)};var fa=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var r;if(a===null?r=e.removeItem(t):(a=E.encode64(JSON.stringify(a)),r=e.setItem(t,a)),typeof r<"u"&&r.rval!==!0){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}},ca=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(a.rval===null){if(a.error){var r=new Error(a.error.message);throw r.id=a.error.id,r.name=a.error.name,r}a=null}else a=a.rval;return a!==null&&(a=JSON.parse(E.decode64(a))),a},Oi=function(e,t,a,r){var n=ca(e,t);n===null&&(n={}),n[a]=r,fa(e,t,n)},Ki=function(e,t,a){var r=ca(e,t);return r!==null&&(r=a in r?r[a]:null),r},Mi=function(e,t,a){var r=ca(e,t);if(r!==null&&a in r){delete r[a];var n=!0;for(var s in r){n=!1;break}n&&(r=null),fa(e,t,r)}},Hi=function(e,t){fa(e,t,null)},Lr=function(e,t,a){var r=null;typeof a>"u"&&(a=["web","flash"]);var n,s=!1,i=null;for(var o in a){n=a[o];try{if(n==="flash"||n==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");r=e.apply(this,t),s=n==="flash"}(n==="web"||n==="both")&&(t[0]=localStorage,r=e.apply(this,t),s=!0)}catch(u){i=u}if(s)break}if(!s)throw i;return r};E.setItem=function(e,t,a,r,n){Lr(Oi,arguments,n)},E.getItem=function(e,t,a,r){return Lr(Ki,arguments,r)},E.removeItem=function(e,t,a,r){Lr(Mi,arguments,r)},E.clearItems=function(e,t,a){Lr(Hi,arguments,a)},E.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var a=t.exec(e),r=a===null?null:{full:e,scheme:a[1],host:a[2],port:a[3],path:a[4]};return r&&(r.fullHost=r.host,r.port?(r.port!==80&&r.scheme==="http"||r.port!==443&&r.scheme==="https")&&(r.fullHost+=":"+r.port):r.scheme==="http"?r.port=80:r.scheme==="https"&&(r.port=443),r.full=r.scheme+"://"+r.fullHost),r};var Dr=null;E.getQueryVariables=function(e){var t=function(r){for(var n={},s=r.split("&"),i=0;i<s.length;i++){var o=s[i].indexOf("="),u,l;o>0?(u=s[i].substring(0,o),l=s[i].substring(o+1)):(u=s[i],l=null),u in n||(n[u]=[]),!(u in Object.prototype)&&l!==null&&n[u].push(unescape(l))}return n},a;return typeof e>"u"?(Dr===null&&(typeof window<"u"&&window.location&&window.location.search?Dr=t(window.location.search.substring(1)):Dr={}),a=Dr):a=t(e),a},E.parseFragment=function(e){var t=e,a="",r=e.indexOf("?");r>0&&(t=e.substring(0,r),a=e.substring(r+1));var n=t.split("/");n.length>0&&n[0]===""&&n.shift();var s=a===""?{}:E.getQueryVariables(a);return{pathString:t,queryString:a,path:n,query:s}},E.makeRequest=function(e){var t=E.parseFragment(e),a={path:t.pathString,query:t.queryString,getPath:function(r){return typeof r>"u"?t.path:t.path[r]},getQuery:function(r,n){var s;return typeof r>"u"?s=t.query:(s=t.query[r],s&&typeof n<"u"&&(s=s[n])),s},getQueryLast:function(r,n){var s,i=a.getQuery(r);return i?s=i[i.length-1]:s=n,s}};return a},E.makeLink=function(e,t,a){e=jQuery.isArray(e)?e.join("/"):e;var r=jQuery.param(t||{});return a=a||"",e+(r.length>0?"?"+r:"")+(a.length>0?"#"+a:"")},E.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},E.format=function(e){for(var t=/%./g,a,r,n=0,s=[],i=0;a=t.exec(e);){r=e.substring(i,t.lastIndex-2),r.length>0&&s.push(r),i=t.lastIndex;var o=a[0][1];switch(o){case"s":case"o":n<arguments.length?s.push(arguments[n+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(e.substring(i)),s.join("")},E.formatNumber=function(e,t,a,r){var n=e,s=isNaN(t=Math.abs(t))?2:t,i=a===void 0?",":a,o=r===void 0?".":r,u=n<0?"-":"",l=parseInt(n=Math.abs(+n||0).toFixed(s),10)+"",f=l.length>3?l.length%3:0;return u+(f?l.substr(0,f)+o:"")+l.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?i+Math.abs(n-l).toFixed(s).slice(2):"")},E.formatSize=function(e){return e>=1073741824?e=E.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=E.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=E.formatNumber(e/1024,0)+" KiB":e=E.formatNumber(e,0)+" bytes",e},E.bytesFromIP=function(e){return e.indexOf(".")!==-1?E.bytesFromIPv4(e):e.indexOf(":")!==-1?E.bytesFromIPv6(e):null},E.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=E.createBuffer(),a=0;a<e.length;++a){var r=parseInt(e[a],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()},E.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(i){return i.length===0&&++t,!0});for(var a=(8-e.length+t)*2,r=E.createBuffer(),n=0;n<8;++n){if(!e[n]||e[n].length===0){r.fillWithByte(0,a),a=0;continue}var s=E.hexToBytes(e[n]);s.length<2&&r.putByte(0),r.putBytes(s)}return r.getBytes()},E.bytesToIP=function(e){return e.length===4?E.bytesToIPv4(e):e.length===16?E.bytesToIPv6(e):null},E.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],a=0;a<e.length;++a)t.push(e.charCodeAt(a));return t.join(".")},E.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],a=[],r=0,n=0;n<e.length;n+=2){for(var s=E.bytesToHex(e[n]+e[n+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var i=a[a.length-1],o=t.length;!i||o!==i.end+1?a.push({start:o,end:o}):(i.end=o,i.end-i.start>a[r].end-a[r].start&&(r=a.length-1))}t.push(s)}if(a.length>0){var u=a[r];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),u.start===0&&t.unshift(""),u.end===7&&t.push(""))}return t.join(":")},E.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in E&&!e.update)return t(null,E.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return E.cores=navigator.hardwareConcurrency,t(null,E.cores);if(typeof Worker>"u")return E.cores=1,t(null,E.cores);if(typeof Blob>"u")return E.cores=2,t(null,E.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(i){var o=Date.now(),u=o+4;self.postMessage({st:o,et:u})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16);function r(i,o,u){if(o===0){var l=Math.floor(i.reduce(function(f,c){return f+c},0)/i.length);return E.cores=Math.max(1,l),URL.revokeObjectURL(a),t(null,E.cores)}n(u,function(f,c){i.push(s(u,c)),r(i,o-1,u)})}function n(i,o){for(var u=[],l=[],f=0;f<i;++f){var c=new Worker(a);c.addEventListener("message",function(v){if(l.push(v.data),l.length===i){for(var m=0;m<i;++m)u[m].terminate();o(null,l)}}),u.push(c)}for(var f=0;f<i;++f)u[f].postMessage(f)}function s(i,o){for(var u=[],l=0;l<i;++l)for(var f=o[l],c=u[l]=[],v=0;v<i;++v)if(l!==v){var m=o[v];(f.st>m.st&&f.st<m.et||m.st>f.st&&m.st<f.et)&&c.push(v)}return u.reduce(function(y,x){return Math.max(y,x.length)},0)}};var Be=Y;Be.cipher=Be.cipher||{},Be.cipher.algorithms=Be.cipher.algorithms||{},Be.cipher.createCipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Be.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Be.cipher.BlockCipher({algorithm:a,key:t,decrypt:!1})},Be.cipher.createDecipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Be.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Be.cipher.BlockCipher({algorithm:a,key:t,decrypt:!0})},Be.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),Be.cipher.algorithms[e]=t},Be.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in Be.cipher.algorithms?Be.cipher.algorithms[e]:null};var ha=Be.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};ha.prototype.start=function(e){e=e||{};var t={};for(var a in e)t[a]=e[a];t.decrypt=this._decrypt,this._finish=!1,this._input=Be.util.createBuffer(),this.output=e.output||Be.util.createBuffer(),this.mode.start(t)},ha.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},ha.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(a){return e(this.blockSize,a,!1)},this.mode.unpad=function(a){return e(this.blockSize,a,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))};var be=Y;be.cipher=be.cipher||{};var j=be.cipher.modes=be.cipher.modes||{};j.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},j.ecb.prototype.start=function(e){},j.ecb.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])},j.ecb.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])},j.ecb.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0},j.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)},j.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},j.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=kr(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},j.cbc.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock},j.cbc.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)},j.cbc.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0},j.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)},j.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=be.util.createBuffer(),this._partialBytes=0},j.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=kr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},j.cfb.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0},j.cfb.prototype.decrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0},j.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=be.util.createBuffer(),this._partialBytes=0},j.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=kr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},j.ofb.prototype.encrypt=function(e,t,a){var r=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0},j.ofb.prototype.decrypt=j.ofb.prototype.encrypt,j.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=be.util.createBuffer(),this._partialBytes=0},j.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=kr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},j.ctr.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]);else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}Ur(this._inBlock)},j.ctr.prototype.decrypt=j.ctr.prototype.encrypt,j.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=be.util.createBuffer(),this._partialBytes=0,this._R=3774873600},j.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=be.util.createBuffer(e.iv);this._cipherLength=0;var a;if("additionalData"in e?a=be.util.createBuffer(e.additionalData):a=be.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=be.util.createBuffer(e.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 r=t.length();if(r===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(da(r*8)))}this._inBlock=this._j0.slice(0),Ur(this._inBlock),this._partialBytes=0,a=be.util.createBuffer(a),this._aDataLength=da(a.length()*8);var n=a.length()%this.blockSize;for(n&&a.fillWithByte(0,this.blockSize-n),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])},j.gcm.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s<=0||a){if(a){var i=r%this.blockSize;this._cipherLength+=i,this._partialOutput.truncate(this.blockSize-i)}else this._cipherLength+=this.blockSize;for(var n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Ur(this._inBlock)},j.gcm.prototype.decrypt=function(e,t,a){var r=e.length();if(r<this.blockSize&&!(a&&r>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Ur(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^this._hashBlock[n]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize},j.gcm.prototype.afterFinish=function(e,t){var a=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=be.util.createBuffer();var r=this._aDataLength.concat(da(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,r);var n=[];this.cipher.encrypt(this._j0,n);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^n[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a},j.gcm.prototype.multiply=function(e,t){for(var a=[0,0,0,0],r=t.slice(0),n=0;n<128;++n){var s=e[n/32|0]&1<<31-n%32;s&&(a[0]^=r[0],a[1]^=r[1],a[2]^=r[2],a[3]^=r[3]),this.pow(r,r)}return a},j.gcm.prototype.pow=function(e,t){for(var a=e[3]&1,r=3;r>0;--r)t[r]=e[r]>>>1|(e[r-1]&1)<<31;t[0]=e[0]>>>1,a&&(t[0]^=this._R)},j.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],a=0;a<32;++a){var r=a/8|0,n=e[r]>>>(7-a%8)*4&15,s=this._m[a][n];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t},j.gcm.prototype.ghash=function(e,t,a){return t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3],this.tableMultiply(t)},j.gcm.prototype.generateHashTable=function(e,t){for(var a=8/t,r=4*a,n=16*a,s=new Array(n),i=0;i<n;++i){var o=[0,0,0,0],u=i/r|0,l=(r-1-i%r)*t;o[u]=1<<t-1<<l,s[i]=this.generateSubHashTable(this.multiply(o,e),t)}return s},j.gcm.prototype.generateSubHashTable=function(e,t){var a=1<<t,r=a>>>1,n=new Array(a);n[r]=e.slice(0);for(var s=r>>>1;s>0;)this.pow(n[2*s],n[s]=[]),s>>=1;for(s=2;s<r;){for(var i=1;i<s;++i){var o=n[s],u=n[i];n[s+i]=[o[0]^u[0],o[1]^u[1],o[2]^u[2],o[3]^u[3]]}s*=2}for(n[0]=[0,0,0,0],s=r+1;s<a;++s){var l=n[s^r];n[s]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return n};function kr(e,t){if(typeof e=="string"&&(e=be.util.createBuffer(e)),be.util.isArray(e)&&e.length>4){var a=e;e=be.util.createBuffer();for(var r=0;r<a.length;++r)e.putByte(a[r])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!be.util.isArray(e)){for(var n=[],s=t/4,r=0;r<s;++r)n.push(e.getInt32());e=n}return e}function Ur(e){e[e.length-1]=e[e.length-1]+1&4294967295}function da(e){return[e/4294967296|0,e&4294967295]}var fe=Y;fe.aes=fe.aes||{},fe.aes.startEncrypting=function(e,t,a,r){var n=Pr({key:e,output:a,decrypt:!1,mode:r});return n.start(t),n},fe.aes.createEncryptionCipher=function(e,t){return Pr({key:e,output:null,decrypt:!1,mode:t})},fe.aes.startDecrypting=function(e,t,a,r){var n=Pr({key:e,output:a,decrypt:!0,mode:r});return n.start(t),n},fe.aes.createDecryptionCipher=function(e,t){return Pr({key:e,output:null,decrypt:!0,mode:t})},fe.aes.Algorithm=function(e,t){pa||fn();var a=this;a.name=e,a.mode=new t({blockSize:16,cipher:{encrypt:function(r,n){return ya(a._w,r,n,!1)},decrypt:function(r,n){return ya(a._w,r,n,!0)}}}),a._init=!1},fe.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,a;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=fe.util.createBuffer(t);else if(fe.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){a=t,t=fe.util.createBuffer();for(var r=0;r<a.length;++r)t.putByte(a[r])}if(!fe.util.isArray(t)){a=t,t=[];var n=a.length();if(n===16||n===24||n===32){n=n>>>2;for(var r=0;r<n;++r)t.push(a.getInt32())}}if(!fe.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var s=this.mode.name,i=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=cn(t,e.decrypt&&!i),this._init=!0}},fe.aes._expandKey=function(e,t){return pa||fn(),cn(e,t)},fe.aes._updateBlock=ya,tr("AES-ECB",fe.cipher.modes.ecb),tr("AES-CBC",fe.cipher.modes.cbc),tr("AES-CFB",fe.cipher.modes.cfb),tr("AES-OFB",fe.cipher.modes.ofb),tr("AES-CTR",fe.cipher.modes.ctr),tr("AES-GCM",fe.cipher.modes.gcm);function tr(e,t){var a=function(){return new fe.aes.Algorithm(e,t)};fe.cipher.registerAlgorithm(e,a)}var pa=!1,rr=4,je,va,ln,qt,pt;function fn(){pa=!0,ln=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;je=new Array(256),va=new Array(256),qt=new Array(4),pt=new Array(4);for(var t=0;t<4;++t)qt[t]=new Array(256),pt[t]=new Array(256);for(var a=0,r=0,n,s,i,o,u,l,f,t=0;t<256;++t){o=r^r<<1^r<<2^r<<3^r<<4,o=o>>8^o&255^99,je[a]=o,va[o]=a,u=e[o],n=e[a],s=e[n],i=e[s],l=u<<24^o<<16^o<<8^(o^u),f=(n^s^i)<<24^(a^i)<<16^(a^s^i)<<8^(a^n^i);for(var c=0;c<4;++c)qt[c][a]=l,pt[c][o]=f,l=l<<24|l>>>8,f=f<<24|f>>>8;a===0?a=r=1:(a=n^e[e[e[n^i]]],r^=e[e[r]])}}function cn(e,t){for(var a=e.slice(0),r,n=1,s=a.length,i=s+6+1,o=rr*i,u=s;u<o;++u)r=a[u-1],u%s===0?(r=je[r>>>16&255]<<24^je[r>>>8&255]<<16^je[r&255]<<8^je[r>>>24]^ln[n]<<24,n++):s>6&&u%s===4&&(r=je[r>>>24]<<24^je[r>>>16&255]<<16^je[r>>>8&255]<<8^je[r&255]),a[u]=a[u-s]^r;if(t){var l,f=pt[0],c=pt[1],v=pt[2],m=pt[3],y=a.slice(0);o=a.length;for(var u=0,x=o-rr;u<o;u+=rr,x-=rr)if(u===0||u===o-rr)y[u]=a[x],y[u+1]=a[x+3],y[u+2]=a[x+2],y[u+3]=a[x+1];else for(var S=0;S<rr;++S)l=a[x+S],y[u+(3&-S)]=f[je[l>>>24]]^c[je[l>>>16&255]]^v[je[l>>>8&255]]^m[je[l&255]];a=y}return a}function ya(e,t,a,r){var n=e.length/4-1,s,i,o,u,l;r?(s=pt[0],i=pt[1],o=pt[2],u=pt[3],l=va):(s=qt[0],i=qt[1],o=qt[2],u=qt[3],l=je);var f,c,v,m,y,x,S;f=t[0]^e[0],c=t[r?3:1]^e[1],v=t[2]^e[2],m=t[r?1:3]^e[3];for(var A=3,B=1;B<n;++B)y=s[f>>>24]^i[c>>>16&255]^o[v>>>8&255]^u[m&255]^e[++A],x=s[c>>>24]^i[v>>>16&255]^o[m>>>8&255]^u[f&255]^e[++A],S=s[v>>>24]^i[m>>>16&255]^o[f>>>8&255]^u[c&255]^e[++A],m=s[m>>>24]^i[f>>>16&255]^o[c>>>8&255]^u[v&255]^e[++A],f=y,c=x,v=S;a[0]=l[f>>>24]<<24^l[c>>>16&255]<<16^l[v>>>8&255]<<8^l[m&255]^e[++A],a[r?3:1]=l[c>>>24]<<24^l[v>>>16&255]<<16^l[m>>>8&255]<<8^l[f&255]^e[++A],a[2]=l[v>>>24]<<24^l[m>>>16&255]<<16^l[f>>>8&255]<<8^l[c&255]^e[++A],a[r?1:3]=l[m>>>24]<<24^l[f>>>16&255]<<16^l[c>>>8&255]<<8^l[v&255]^e[++A]}function Pr(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="AES-"+t,r;e.decrypt?r=fe.cipher.createDecipher(a,e.key):r=fe.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof fe.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}var Cr=Y;Cr.pki=Cr.pki||{};var ga=Cr.pki.oids=Cr.oids=Cr.oids||{};function w(e,t){ga[e]=t,ga[t]=e}function ne(e,t){ga[e]=t}w("1.2.840.113549.1.1.1","rsaEncryption"),w("1.2.840.113549.1.1.4","md5WithRSAEncryption"),w("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),w("1.2.840.113549.1.1.7","RSAES-OAEP"),w("1.2.840.113549.1.1.8","mgf1"),w("1.2.840.113549.1.1.9","pSpecified"),w("1.2.840.113549.1.1.10","RSASSA-PSS"),w("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),w("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),w("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),w("1.3.101.112","EdDSA25519"),w("1.2.840.10040.4.3","dsa-with-sha1"),w("1.3.14.3.2.7","desCBC"),w("1.3.14.3.2.26","sha1"),w("2.16.840.1.101.3.4.2.1","sha256"),w("2.16.840.1.101.3.4.2.2","sha384"),w("2.16.840.1.101.3.4.2.3","sha512"),w("1.2.840.113549.2.5","md5"),w("1.2.840.113549.1.7.1","data"),w("1.2.840.113549.1.7.2","signedData"),w("1.2.840.113549.1.7.3","envelopedData"),w("1.2.840.113549.1.7.4","signedAndEnvelopedData"),w("1.2.840.113549.1.7.5","digestedData"),w("1.2.840.113549.1.7.6","encryptedData"),w("1.2.840.113549.1.9.1","emailAddress"),w("1.2.840.113549.1.9.2","unstructuredName"),w("1.2.840.113549.1.9.3","contentType"),w("1.2.840.113549.1.9.4","messageDigest"),w("1.2.840.113549.1.9.5","signingTime"),w("1.2.840.113549.1.9.6","counterSignature"),w("1.2.840.113549.1.9.7","challengePassword"),w("1.2.840.113549.1.9.8","unstructuredAddress"),w("1.2.840.113549.1.9.14","extensionRequest"),w("1.2.840.113549.1.9.20","friendlyName"),w("1.2.840.113549.1.9.21","localKeyId"),w("1.2.840.113549.1.9.22.1","x509Certificate"),w("1.2.840.113549.1.12.10.1.1","keyBag"),w("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),w("1.2.840.113549.1.12.10.1.3","certBag"),w("1.2.840.113549.1.12.10.1.4","crlBag"),w("1.2.840.113549.1.12.10.1.5","secretBag"),w("1.2.840.113549.1.12.10.1.6","safeContentsBag"),w("1.2.840.113549.1.5.13","pkcs5PBES2"),w("1.2.840.113549.1.5.12","pkcs5PBKDF2"),w("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),w("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),w("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),w("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),w("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),w("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),w("1.2.840.113549.2.7","hmacWithSHA1"),w("1.2.840.113549.2.8","hmacWithSHA224"),w("1.2.840.113549.2.9","hmacWithSHA256"),w("1.2.840.113549.2.10","hmacWithSHA384"),w("1.2.840.113549.2.11","hmacWithSHA512"),w("1.2.840.113549.3.7","des-EDE3-CBC"),w("2.16.840.1.101.3.4.1.2","aes128-CBC"),w("2.16.840.1.101.3.4.1.22","aes192-CBC"),w("2.16.840.1.101.3.4.1.42","aes256-CBC"),w("2.5.4.3","commonName"),w("2.5.4.5","serialName"),w("2.5.4.6","countryName"),w("2.5.4.7","localityName"),w("2.5.4.8","stateOrProvinceName"),w("2.5.4.9","streetAddress"),w("2.5.4.10","organizationName"),w("2.5.4.11","organizationalUnitName"),w("2.5.4.13","description"),w("2.5.4.15","businessCategory"),w("2.5.4.17","postalCode"),w("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),w("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),w("2.16.840.1.113730.1.1","nsCertType"),w("2.16.840.1.113730.1.13","nsComment"),ne("2.5.29.1","authorityKeyIdentifier"),ne("2.5.29.2","keyAttributes"),ne("2.5.29.3","certificatePolicies"),ne("2.5.29.4","keyUsageRestriction"),ne("2.5.29.5","policyMapping"),ne("2.5.29.6","subtreesConstraint"),ne("2.5.29.7","subjectAltName"),ne("2.5.29.8","issuerAltName"),ne("2.5.29.9","subjectDirectoryAttributes"),ne("2.5.29.10","basicConstraints"),ne("2.5.29.11","nameConstraints"),ne("2.5.29.12","policyConstraints"),ne("2.5.29.13","basicConstraints"),w("2.5.29.14","subjectKeyIdentifier"),w("2.5.29.15","keyUsage"),ne("2.5.29.16","privateKeyUsagePeriod"),w("2.5.29.17","subjectAltName"),w("2.5.29.18","issuerAltName"),w("2.5.29.19","basicConstraints"),ne("2.5.29.20","cRLNumber"),ne("2.5.29.21","cRLReason"),ne("2.5.29.22","expirationDate"),ne("2.5.29.23","instructionCode"),ne("2.5.29.24","invalidityDate"),ne("2.5.29.25","cRLDistributionPoints"),ne("2.5.29.26","issuingDistributionPoint"),ne("2.5.29.27","deltaCRLIndicator"),ne("2.5.29.28","issuingDistributionPoint"),ne("2.5.29.29","certificateIssuer"),ne("2.5.29.30","nameConstraints"),w("2.5.29.31","cRLDistributionPoints"),w("2.5.29.32","certificatePolicies"),ne("2.5.29.33","policyMappings"),ne("2.5.29.34","policyConstraints"),w("2.5.29.35","authorityKeyIdentifier"),ne("2.5.29.36","policyConstraints"),w("2.5.29.37","extKeyUsage"),ne("2.5.29.46","freshestCRL"),ne("2.5.29.54","inhibitAnyPolicy"),w("1.3.6.1.4.1.11129.2.4.2","timestampList"),w("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),w("1.3.6.1.5.5.7.3.1","serverAuth"),w("1.3.6.1.5.5.7.3.2","clientAuth"),w("1.3.6.1.5.5.7.3.3","codeSigning"),w("1.3.6.1.5.5.7.3.4","emailProtection"),w("1.3.6.1.5.5.7.3.8","timeStamping");var de=Y,P=de.asn1=de.asn1||{};P.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},P.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},P.create=function(e,t,a,r,n){if(de.util.isArray(r)){for(var s=[],i=0;i<r.length;++i)r[i]!==void 0&&s.push(r[i]);r=s}var o={tagClass:e,type:t,constructed:a,composed:a||de.util.isArray(r),value:r};return n&&"bitStringContents"in n&&(o.bitStringContents=n.bitStringContents,o.original=P.copy(o)),o},P.copy=function(e,t){var a;if(de.util.isArray(e)){a=[];for(var r=0;r<e.length;++r)a.push(P.copy(e[r],t));return a}return typeof e=="string"?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:P.copy(e.value,t)},t&&!t.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)},P.equals=function(e,t,a){if(de.util.isArray(e)){if(!de.util.isArray(t)||e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!P.equals(e[r],t[r]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var n=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&P.equals(e.value,t.value);return a&&a.includeBitStringContents&&(n=n&&e.bitStringContents===t.bitStringContents),n},P.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var a,r=t&128;return r?a=e.getInt((t&127)<<3):a=t,a}};function Er(e,t,a){if(a>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=a,r}}var qi=function(e,t){var a=e.getByte();if(t--,a!==128){var r,n=a&128;if(!n)r=a;else{var s=a&127;Er(e,t,s),r=e.getInt(s<<3)}if(r<0)throw new Error("Negative length: "+r);return r}};P.fromDer=function(e,t){return t===void 0&&(t={strict:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),typeof e=="string"&&(e=de.util.createBuffer(e)),Vr(e,e.length(),0,t)};function Vr(e,t,a,r){var n;Er(e,t,2);var s=e.getByte();t--;var i=s&192,o=s&31;n=e.length();var u=qi(e,t);if(t-=n-e.length(),u!==void 0&&u>t){if(r.strict){var l=new Error("Too few bytes to read ASN.1 value.");throw l.available=e.length(),l.remaining=t,l.requested=u,l}u=t}var f,c,v=(s&32)===32;if(v)if(f=[],u===void 0)for(;;){if(Er(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}n=e.length(),f.push(Vr(e,t,a+1,r)),t-=n-e.length()}else for(;u>0;)n=e.length(),f.push(Vr(e,u,a+1,r)),t-=n-e.length(),u-=n-e.length();if(f===void 0&&i===P.Class.UNIVERSAL&&o===P.Type.BITSTRING&&(c=e.bytes(u)),f===void 0&&r.decodeBitStrings&&i===P.Class.UNIVERSAL&&o===P.Type.BITSTRING&&u>1){var m=e.read,y=t,x=0;if(o===P.Type.BITSTRING&&(Er(e,t,1),x=e.getByte(),t--),x===0)try{n=e.length();var S={verbose:r.verbose,strict:!0,decodeBitStrings:!0},A=Vr(e,t,a+1,S),B=n-e.length();t-=B,o==P.Type.BITSTRING&&B++;var N=A.tagClass;B===u&&(N===P.Class.UNIVERSAL||N===P.Class.CONTEXT_SPECIFIC)&&(f=[A])}catch{}f===void 0&&(e.read=m,t=y)}if(f===void 0){if(u===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");u=t}if(o===P.Type.BMPSTRING)for(f="";u>0;u-=2)Er(e,t,2),f+=String.fromCharCode(e.getInt16()),t-=2;else f=e.getBytes(u)}var F=c===void 0?null:{bitStringContents:c};return P.create(i,o,v,f,F)}P.toDer=function(e){var t=de.util.createBuffer(),a=e.tagClass|e.type,r=de.util.createBuffer(),n=!1;if("bitStringContents"in e&&(n=!0,e.original&&(n=P.equals(e,e.original))),n)r.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:r.putByte(0);for(var s=0;s<e.value.length;++s)e.value[s]!==void 0&&r.putBuffer(P.toDer(e.value[s]))}else if(e.type===P.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)r.putInt16(e.value.charCodeAt(s));else e.type===P.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&(e.value.charCodeAt(1)&128)===0||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?r.putBytes(e.value.substr(1)):r.putBytes(e.value);if(t.putByte(a),r.length()<=127)t.putByte(r.length()&127);else{var i=r.length(),o="";do o+=String.fromCharCode(i&255),i=i>>>8;while(i>0);t.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)t.putByte(o.charCodeAt(s))}return t.putBuffer(r),t},P.oidToDer=function(e){var t=e.split("."),a=de.util.createBuffer();a.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var r,n,s,i,o=2;o<t.length;++o){r=!0,n=[],s=parseInt(t[o],10);do i=s&127,s=s>>>7,r||(i|=128),n.push(i),r=!1;while(s>0);for(var u=n.length-1;u>=0;--u)a.putByte(n[u])}return a},P.derToOid=function(e){var t;typeof e=="string"&&(e=de.util.createBuffer(e));var a=e.getByte();t=Math.floor(a/40)+"."+a%40;for(var r=0;e.length()>0;)a=e.getByte(),r=r<<7,a&128?r+=a&127:(t+="."+(r+a),r=0);return t},P.utcTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,2),10);a=a>=50?1900+a:2e3+a;var r=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var u=e.charAt(10),l=10;u!=="+"&&u!=="-"&&(o=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,0),l&&(u=e.charAt(l),u==="+"||u==="-")){var f=parseInt(e.substr(l+1,2),10),c=parseInt(e.substr(l+4,2),10),v=f*60+c;v*=6e4,u==="+"?t.setTime(+t-v):t.setTime(+t+v)}return t},P.generalizedTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),u=0,l=0,f=!1;e.charAt(e.length-1)==="Z"&&(f=!0);var c=e.length-5,v=e.charAt(c);if(v==="+"||v==="-"){var m=parseInt(e.substr(c+1,2),10),y=parseInt(e.substr(c+4,2),10);l=m*60+y,l*=6e4,v==="+"&&(l*=-1),f=!0}return e.charAt(14)==="."&&(u=parseFloat(e.substr(14),10)*1e3),f?(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,u),t.setTime(+t+l)):(t.setFullYear(a,r,n),t.setHours(s,i,o,u)),t},P.dateToUtcTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push((""+e.getUTCFullYear()).substr(2)),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t},P.dateToGeneralizedTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push(""+e.getUTCFullYear()),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t},P.integerToDer=function(e){var t=de.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=e,a},P.derToInteger=function(e){typeof e=="string"&&(e=de.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},P.validate=function(e,t,a,r){var n=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(n=!0,t.value&&de.util.isArray(t.value))for(var s=0,i=0;n&&i<t.value.length;++i)n=t.value[i].optional||!1,e.value[s]&&(n=P.validate(e.value[s],t.value[i],a,r),n?++s:t.value[i].optional&&(n=!0)),!n&&r&&r.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(n&&a&&(t.capture&&(a[t.capture]=e.value),t.captureAsn1&&(a[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(a[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)a[t.captureBitStringValue]="";else{var o=e.bitStringContents.charCodeAt(0);if(o!==0)throw new Error("captureBitStringValue only supported for zero unused bits");a[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else r&&r.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');else r&&(e.tagClass!==t.tagClass&&r.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&r.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));return n};var hn=/[^\\u0000-\\u00ff]/;P.prettyPrint=function(e,t,a){var r="";t=t||0,a=a||2,t>0&&(r+=`
|
|
7
|
+
`);for(var n="",s=0;s<t*a;++s)n+=" ";switch(r+=n+"Tag: ",e.tagClass){case P.Class.UNIVERSAL:r+="Universal:";break;case P.Class.APPLICATION:r+="Application:";break;case P.Class.CONTEXT_SPECIFIC:r+="Context-Specific:";break;case P.Class.PRIVATE:r+="Private:";break}if(e.tagClass===P.Class.UNIVERSAL)switch(r+=e.type,e.type){case P.Type.NONE:r+=" (None)";break;case P.Type.BOOLEAN:r+=" (Boolean)";break;case P.Type.INTEGER:r+=" (Integer)";break;case P.Type.BITSTRING:r+=" (Bit string)";break;case P.Type.OCTETSTRING:r+=" (Octet string)";break;case P.Type.NULL:r+=" (Null)";break;case P.Type.OID:r+=" (Object Identifier)";break;case P.Type.ODESC:r+=" (Object Descriptor)";break;case P.Type.EXTERNAL:r+=" (External or Instance of)";break;case P.Type.REAL:r+=" (Real)";break;case P.Type.ENUMERATED:r+=" (Enumerated)";break;case P.Type.EMBEDDED:r+=" (Embedded PDV)";break;case P.Type.UTF8:r+=" (UTF8)";break;case P.Type.ROID:r+=" (Relative Object Identifier)";break;case P.Type.SEQUENCE:r+=" (Sequence)";break;case P.Type.SET:r+=" (Set)";break;case P.Type.PRINTABLESTRING:r+=" (Printable String)";break;case P.Type.IA5String:r+=" (IA5String (ASCII))";break;case P.Type.UTCTIME:r+=" (UTC time)";break;case P.Type.GENERALIZEDTIME:r+=" (Generalized time)";break;case P.Type.BMPSTRING:r+=" (BMP String)";break}else r+=e.type;if(r+=`
|
|
8
|
+
`,r+=n+"Constructed: "+e.constructed+`
|
|
9
|
+
`,e.composed){for(var i=0,o="",s=0;s<e.value.length;++s)e.value[s]!==void 0&&(i+=1,o+=P.prettyPrint(e.value[s],t+1,a),s+1<e.value.length&&(o+=","));r+=n+"Sub values: "+i+o}else{if(r+=n+"Value: ",e.type===P.Type.OID){var u=P.derToOid(e.value);r+=u,de.pki&&de.pki.oids&&u in de.pki.oids&&(r+=" ("+de.pki.oids[u]+") ")}if(e.type===P.Type.INTEGER)try{r+=P.derToInteger(e.value)}catch{r+="0x"+de.util.bytesToHex(e.value)}else if(e.type===P.Type.BITSTRING){if(e.value.length>1?r+="0x"+de.util.bytesToHex(e.value.slice(1)):r+="(none)",e.value.length>0){var l=e.value.charCodeAt(0);l==1?r+=" (1 unused bit shown)":l>1&&(r+=" ("+l+" unused bits shown)")}}else e.type===P.Type.OCTETSTRING?(hn.test(e.value)||(r+="("+e.value+") "),r+="0x"+de.util.bytesToHex(e.value)):e.type===P.Type.UTF8?r+=de.util.decodeUtf8(e.value):e.type===P.Type.PRINTABLESTRING||e.type===P.Type.IA5String?r+=e.value:hn.test(e.value)?r+="0x"+de.util.bytesToHex(e.value):e.value.length===0?r+="[null]":r+=e.value}return r};var Fr=Y,Gi=Fr.md=Fr.md||{};Fr.md.algorithms=Fr.md.algorithms||{};var At=Y,Qi=At.hmac=At.hmac||{};Qi.create=function(){var e=null,t=null,a=null,r=null,n={};return n.start=function(s,i){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in At.md.algorithms)t=At.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else t=s;if(i===null)i=e;else{if(typeof i=="string")i=At.util.createBuffer(i);else if(At.util.isArray(i)){var o=i;i=At.util.createBuffer();for(var u=0;u<o.length;++u)i.putByte(o[u])}var l=i.length();l>t.blockLength&&(t.start(),t.update(i.bytes()),i=t.digest()),a=At.util.createBuffer(),r=At.util.createBuffer(),l=i.length();for(var u=0;u<l;++u){var o=i.at(u);a.putByte(54^o),r.putByte(92^o)}if(l<t.blockLength)for(var o=t.blockLength-l,u=0;u<o;++u)a.putByte(54),r.putByte(92);e=i,a=a.bytes(),r=r.bytes()}t.start(),t.update(a)},n.update=function(s){t.update(s)},n.getMac=function(){var s=t.digest().bytes();return t.start(),t.update(r),t.update(s),t.digest()},n.digest=n.getMac,n};var yt=Y,dn=yt.md5=yt.md5||{};yt.md.md5=yt.md.algorithms.md5=dn,dn.create=function(){pn||zi();var e=null,t=yt.util.createBuffer(),a=new Array(16),r={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=yt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=yt.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),vn(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=yt.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(ma.substr(0,r.blockLength-i));for(var o,u=0,l=r.fullMessageLength.length-1;l>=0;--l)o=r.fullMessageLength[l]*8+u,u=o/4294967296>>>0,n.putInt32Le(o>>>0);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};vn(f,a,n);var c=yt.util.createBuffer();return c.putInt32Le(f.h0),c.putInt32Le(f.h1),c.putInt32Le(f.h2),c.putInt32Le(f.h3),c},r};var ma=null,Or=null,xr=null,ar=null,pn=!1;function zi(){ma=String.fromCharCode(128),ma+=yt.util.fillString(String.fromCharCode(0),64),Or=[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],xr=[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],ar=new Array(64);for(var e=0;e<64;++e)ar[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);pn=!0}function vn(e,t,a){for(var r,n,s,i,o,u,l,f,c=a.length();c>=64;){for(n=e.h0,s=e.h1,i=e.h2,o=e.h3,f=0;f<16;++f)t[f]=a.getInt32Le(),u=o^s&(i^o),r=n+u+ar[f]+t[f],l=xr[f],n=o,o=i,i=s,s+=r<<l|r>>>32-l;for(;f<32;++f)u=i^o&(s^i),r=n+u+ar[f]+t[Or[f]],l=xr[f],n=o,o=i,i=s,s+=r<<l|r>>>32-l;for(;f<48;++f)u=s^i^o,r=n+u+ar[f]+t[Or[f]],l=xr[f],n=o,o=i,i=s,s+=r<<l|r>>>32-l;for(;f<64;++f)u=i^(s|~o),r=n+u+ar[f]+t[Or[f]],l=xr[f],n=o,o=i,i=s,s+=r<<l|r>>>32-l;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,c-=64}}var Kr=Y,yn=Kr.pem=Kr.pem||{};yn.encode=function(e,t){t=t||{};var a="-----BEGIN "+e.type+`-----\r
|
|
10
|
+
`,r;if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=Mr(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=Mr(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=Mr(r)),e.headers)for(var n=0;n<e.headers.length;++n)a+=Mr(e.headers[n]);return e.procType&&(a+=`\r
|
|
11
|
+
`),a+=Kr.util.encode64(e.body,t.maxline||64)+`\r
|
|
12
|
+
`,a+="-----END "+e.type+`-----\r
|
|
13
|
+
`,a},yn.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,n=/\r?\n/,s;s=a.exec(e),!!s;){var i={type:s[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:Kr.util.decode64(s[3])};if(t.push(i),!!s[2]){for(var o=s[2].split(n),u=0;s&&u<o.length;){for(var l=o[u].replace(/\s+$/,""),f=u+1;f<o.length;++f){var c=o[f];if(!/\s/.test(c[0]))break;l+=c,u=f}if(s=l.match(r),s){for(var v={name:s[1],values:[]},m=s[2].split(","),y=0;y<m.length;++y)v.values.push(Yi(m[y]));if(i.procType)if(!i.contentDomain&&v.name==="Content-Domain")i.contentDomain=m[0]||"";else if(!i.dekInfo&&v.name==="DEK-Info"){if(v.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');i.dekInfo={algorithm:m[0],parameters:m[1]||null}}else i.headers.push(v);else{if(v.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(v.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');i.procType={version:m[0],type:m[1]}}}++u}if(i.procType==="ENCRYPTED"&&!i.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function Mr(e){for(var t=e.name+": ",a=[],r=function(u,l){return" "+l},n=0;n<e.values.length;++n)a.push(e.values[n].replace(/^(\S+\r\n)/,r));t+=a.join(",")+`\r
|
|
14
|
+
`;for(var s=0,i=-1,n=0;n<t.length;++n,++s)if(s>65&&i!==-1){var o=t[i];o===","?(++i,t=t.substr(0,i)+`\r
|
|
15
|
+
`+t.substr(i)):t=t.substr(0,i)+`\r
|
|
16
|
+
`+o+t.substr(i+1),s=n-i-1,i=-1,++n}else(t[n]===" "||t[n]===" "||t[n]===",")&&(i=n);return t}function Yi(e){return e.replace(/^\s+/,"")}var pe=Y;pe.des=pe.des||{},pe.des.startEncrypting=function(e,t,a,r){var n=Hr({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n},pe.des.createEncryptionCipher=function(e,t){return Hr({key:e,output:null,decrypt:!1,mode:t})},pe.des.startDecrypting=function(e,t,a,r){var n=Hr({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n},pe.des.createDecryptionCipher=function(e,t){return Hr({key:e,output:null,decrypt:!0,mode:t})},pe.des.Algorithm=function(e,t){var a=this;a.name=e,a.mode=new t({blockSize:8,cipher:{encrypt:function(r,n){return gn(a._keys,r,n,!1)},decrypt:function(r,n){return gn(a._keys,r,n,!0)}}}),a._init=!1},pe.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=pe.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=rs(t),this._init=!0}},gt("DES-ECB",pe.cipher.modes.ecb),gt("DES-CBC",pe.cipher.modes.cbc),gt("DES-CFB",pe.cipher.modes.cfb),gt("DES-OFB",pe.cipher.modes.ofb),gt("DES-CTR",pe.cipher.modes.ctr),gt("3DES-ECB",pe.cipher.modes.ecb),gt("3DES-CBC",pe.cipher.modes.cbc),gt("3DES-CFB",pe.cipher.modes.cfb),gt("3DES-OFB",pe.cipher.modes.ofb),gt("3DES-CTR",pe.cipher.modes.ctr);function gt(e,t){var a=function(){return new pe.des.Algorithm(e,t)};pe.cipher.registerAlgorithm(e,a)}var Wi=[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],ji=[-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],Xi=[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],$i=[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],Zi=[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],Ji=[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],es=[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],ts=[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 rs(e){for(var t=[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],r=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],i=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[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],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],c=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],v=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],m=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],x=e.length()>8?3:1,S=[],A=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],B=0,N,F=0;F<x;F++){var D=e.getInt32(),R=e.getInt32();N=(D>>>4^R)&252645135,R^=N,D^=N<<4,N=(R>>>-16^D)&65535,D^=N,R^=N<<-16,N=(D>>>2^R)&858993459,R^=N,D^=N<<2,N=(R>>>-16^D)&65535,D^=N,R^=N<<-16,N=(D>>>1^R)&1431655765,R^=N,D^=N<<1,N=(R>>>8^D)&16711935,D^=N,R^=N<<8,N=(D>>>1^R)&1431655765,R^=N,D^=N<<1,N=D<<8|R>>>20&240,D=R<<24|R<<8&16711680|R>>>8&65280|R>>>24&240,R=N;for(var z=0;z<A.length;++z){A[z]?(D=D<<2|D>>>26,R=R<<2|R>>>26):(D=D<<1|D>>>27,R=R<<1|R>>>27),D&=-15,R&=-15;var J=t[D>>>28]|a[D>>>24&15]|r[D>>>20&15]|n[D>>>16&15]|s[D>>>12&15]|i[D>>>8&15]|o[D>>>4&15],ie=u[R>>>28]|l[R>>>24&15]|f[R>>>20&15]|c[R>>>16&15]|v[R>>>12&15]|m[R>>>8&15]|y[R>>>4&15];N=(ie>>>16^J)&65535,S[B++]=J^N,S[B++]=ie^N<<16}}return S}function gn(e,t,a,r){var n=e.length===32?3:9,s;n===3?s=r?[30,-2,-2]:[0,32,2]:s=r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var i,o=t[0],u=t[1];i=(o>>>4^u)&252645135,u^=i,o^=i<<4,i=(o>>>16^u)&65535,u^=i,o^=i<<16,i=(u>>>2^o)&858993459,o^=i,u^=i<<2,i=(u>>>8^o)&16711935,o^=i,u^=i<<8,i=(o>>>1^u)&1431655765,u^=i,o^=i<<1,o=o<<1|o>>>31,u=u<<1|u>>>31;for(var l=0;l<n;l+=3){for(var f=s[l+1],c=s[l+2],v=s[l];v!=f;v+=c){var m=u^e[v],y=(u>>>4|u<<28)^e[v+1];i=o,o=u,u=i^(ji[m>>>24&63]|$i[m>>>16&63]|Ji[m>>>8&63]|ts[m&63]|Wi[y>>>24&63]|Xi[y>>>16&63]|Zi[y>>>8&63]|es[y&63])}i=o,o=u,u=i}o=o>>>1|o<<31,u=u>>>1|u<<31,i=(o>>>1^u)&1431655765,u^=i,o^=i<<1,i=(u>>>8^o)&16711935,o^=i,u^=i<<8,i=(u>>>2^o)&858993459,o^=i,u^=i<<2,i=(o>>>16^u)&65535,u^=i,o^=i<<16,i=(o>>>4^u)&252645135,u^=i,o^=i<<4,a[0]=o,a[1]=u}function Hr(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="DES-"+t,r;e.decrypt?r=pe.cipher.createDecipher(a,e.key):r=pe.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof pe.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}const Ca=ki(Ri);var Xe=Y,as=Xe.pkcs5=Xe.pkcs5||{},It;Xe.util.isNodejs&&!Xe.options.usePureJavaScript&&(It=Ca),Xe.pbkdf2=as.pbkdf2=function(e,t,a,r,n,s){if(typeof n=="function"&&(s=n,n=null),Xe.util.isNodejs&&!Xe.options.usePureJavaScript&&It.pbkdf2&&(n===null||typeof n!="object")&&(It.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),s?It.pbkdf2Sync.length===4?It.pbkdf2(e,t,a,r,function(N,F){if(N)return s(N);s(null,F.toString("binary"))}):It.pbkdf2(e,t,a,r,n,function(N,F){if(N)return s(N);s(null,F.toString("binary"))}):It.pbkdf2Sync.length===4?It.pbkdf2Sync(e,t,a,r).toString("binary"):It.pbkdf2Sync(e,t,a,r,n).toString("binary");if((typeof n>"u"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in Xe.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=Xe.md[n].create()}var i=n.digestLength;if(r>4294967295*i){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var u=Math.ceil(r/i),l=r-(u-1)*i,f=Xe.hmac.create();f.start(n,e);var c="",v,m,y;if(!s){for(var x=1;x<=u;++x){f.start(null,null),f.update(t),f.update(Xe.util.int32ToBytes(x)),v=y=f.digest().getBytes();for(var S=2;S<=a;++S)f.start(null,null),f.update(y),m=f.digest().getBytes(),v=Xe.util.xorBytes(v,m,i),y=m;c+=x<u?v:v.substr(0,l)}return c}var x=1,S;function A(){if(x>u)return s(null,c);f.start(null,null),f.update(t),f.update(Xe.util.int32ToBytes(x)),v=y=f.digest().getBytes(),S=2,B()}function B(){if(S<=a)return f.start(null,null),f.update(y),m=f.digest().getBytes(),v=Xe.util.xorBytes(v,m,i),y=m,++S,Xe.util.setImmediate(B);c+=x<u?v:v.substr(0,l),++x,A()}A()};var mt=Y,mn=mt.sha256=mt.sha256||{};mt.md.sha256=mt.md.algorithms.sha256=mn,mn.create=function(){Cn||ns();var e=null,t=mt.util.createBuffer(),a=new Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=mt.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=mt.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),xn(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=mt.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Ea.substr(0,r.blockLength-i));for(var o,u,l=r.fullMessageLength[0]*8,f=0;f<r.fullMessageLength.length-1;++f)o=r.fullMessageLength[f+1]*8,u=o/4294967296>>>0,l+=u,n.putInt32(l>>>0),l=o>>>0;n.putInt32(l);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};xn(c,a,n);var v=mt.util.createBuffer();return v.putInt32(c.h0),v.putInt32(c.h1),v.putInt32(c.h2),v.putInt32(c.h3),v.putInt32(c.h4),v.putInt32(c.h5),v.putInt32(c.h6),v.putInt32(c.h7),v},r};var Ea=null,Cn=!1,En=null;function ns(){Ea=String.fromCharCode(128),Ea+=mt.util.fillString(String.fromCharCode(0),64),En=[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],Cn=!0}function xn(e,t,a){for(var r,n,s,i,o,u,l,f,c,v,m,y,x,S,A,B=a.length();B>=64;){for(l=0;l<16;++l)t[l]=a.getInt32();for(;l<64;++l)r=t[l-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,n=t[l-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[l]=r+t[l-7]+n+t[l-16]|0;for(f=e.h0,c=e.h1,v=e.h2,m=e.h3,y=e.h4,x=e.h5,S=e.h6,A=e.h7,l=0;l<64;++l)i=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),o=S^y&(x^S),s=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),u=f&c|v&(f^c),r=A+i+o+En[l]+t[l],n=s+u,A=S,S=x,x=y,y=m+r>>>0,m=v,v=c,c=f,f=r+n>>>0;e.h0=e.h0+f|0,e.h1=e.h1+c|0,e.h2=e.h2+v|0,e.h3=e.h3+m|0,e.h4=e.h4+y|0,e.h5=e.h5+x|0,e.h6=e.h6+S|0,e.h7=e.h7+A|0,B-=64}}var Ct=Y,qr=null;Ct.util.isNodejs&&!Ct.options.usePureJavaScript&&!process.versions["node-webkit"]&&(qr=Ca);var is=Ct.prng=Ct.prng||{};is.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},a=e.md,r=new Array(32),n=0;n<32;++n)r[n]=a.create();t.pools=r,t.pool=0,t.generate=function(l,f){if(!f)return t.generateSync(l);var c=t.plugin.cipher,v=t.plugin.increment,m=t.plugin.formatKey,y=t.plugin.formatSeed,x=Ct.util.createBuffer();t.key=null,S();function S(A){if(A)return f(A);if(x.length()>=l)return f(null,x.getBytes(l));if(t.generated>1048575&&(t.key=null),t.key===null)return Ct.util.nextTick(function(){s(S)});var B=c(t.key,t.seed);t.generated+=B.length,x.putBytes(B),t.key=m(c(t.key,v(t.seed))),t.seed=y(c(t.key,t.seed)),Ct.util.setImmediate(S)}},t.generateSync=function(l){var f=t.plugin.cipher,c=t.plugin.increment,v=t.plugin.formatKey,m=t.plugin.formatSeed;t.key=null;for(var y=Ct.util.createBuffer();y.length()<l;){t.generated>1048575&&(t.key=null),t.key===null&&i();var x=f(t.key,t.seed);t.generated+=x.length,y.putBytes(x),t.key=v(f(t.key,c(t.seed))),t.seed=m(f(t.key,t.seed))}return y.getBytes(l)};function s(l){if(t.pools[0].messageLength>=32)return o(),l();var f=32-t.pools[0].messageLength<<5;t.seedFile(f,function(c,v){if(c)return l(c);t.collect(v),o(),l()})}function i(){if(t.pools[0].messageLength>=32)return o();var l=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(l)),o()}function o(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var l=t.plugin.md.create();l.update(t.keyBytes);for(var f=1,c=0;c<32;++c)t.reseeds%f===0&&(l.update(t.pools[c].digest().getBytes()),t.pools[c].start()),f=f<<1;t.keyBytes=l.digest().getBytes(),l.start(),l.update(t.keyBytes);var v=l.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(v),t.generated=0}function u(l){var f=null,c=Ct.util.globalScope,v=c.crypto||c.msCrypto;v&&v.getRandomValues&&(f=function(D){return v.getRandomValues(D)});var m=Ct.util.createBuffer();if(f)for(;m.length()<l;){var y=Math.max(1,Math.min(l-m.length(),65536)/4),x=new Uint32Array(Math.floor(y));try{f(x);for(var S=0;S<x.length;++S)m.putInt32(x[S])}catch(D){if(!(typeof QuotaExceededError<"u"&&D instanceof QuotaExceededError))throw D}}if(m.length()<l)for(var A,B,N,F=Math.floor(Math.random()*65536);m.length()<l;){B=16807*(F&65535),A=16807*(F>>16),B+=(A&32767)<<16,B+=A>>15,B=(B&2147483647)+(B>>31),F=B&4294967295;for(var S=0;S<3;++S)N=F>>>(S<<3),N^=Math.floor(Math.random()*256),m.putByte(String.fromCharCode(N&255))}return m.getBytes(l)}return qr?(t.seedFile=function(l,f){qr.randomBytes(l,function(c,v){if(c)return f(c);f(null,v.toString())})},t.seedFileSync=function(l){return qr.randomBytes(l).toString()}):(t.seedFile=function(l,f){try{f(null,u(l))}catch(c){f(c)}},t.seedFileSync=u),t.collect=function(l){for(var f=l.length,c=0;c<f;++c)t.pools[t.pool].update(l.substr(c,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(l,f){for(var c="",v=0;v<f;v+=8)c+=String.fromCharCode(l>>v&255);t.collect(c)},t.registerWorker=function(l){if(l===self)t.seedFile=function(c,v){function m(y){var x=y.data;x.forge&&x.forge.prng&&(self.removeEventListener("message",m),v(x.forge.prng.err,x.forge.prng.bytes))}self.addEventListener("message",m),self.postMessage({forge:{prng:{needed:c}}})};else{var f=function(c){var v=c.data;v.forge&&v.forge.prng&&t.seedFile(v.forge.prng.needed,function(m,y){l.postMessage({forge:{prng:{err:m,bytes:y}}})})};l.addEventListener("message",f)}},t};var _e=Y;(function(){if(_e.random&&_e.random.getBytes){_e.random;return}(function(e){var t={},a=new Array(4),r=_e.util.createBuffer();t.formatKey=function(c){var v=_e.util.createBuffer(c);return c=new Array(4),c[0]=v.getInt32(),c[1]=v.getInt32(),c[2]=v.getInt32(),c[3]=v.getInt32(),_e.aes._expandKey(c,!1)},t.formatSeed=function(c){var v=_e.util.createBuffer(c);return c=new Array(4),c[0]=v.getInt32(),c[1]=v.getInt32(),c[2]=v.getInt32(),c[3]=v.getInt32(),c},t.cipher=function(c,v){return _e.aes._updateBlock(c,v,a,!1),r.putInt32(a[0]),r.putInt32(a[1]),r.putInt32(a[2]),r.putInt32(a[3]),r.getBytes()},t.increment=function(c){return++c[3],c},t.md=_e.md.sha256;function n(){var c=_e.prng.create(t);return c.getBytes=function(v,m){return c.generate(v,m)},c.getBytesSync=function(v){return c.generate(v)},c}var s=n(),i=null,o=_e.util.globalScope,u=o.crypto||o.msCrypto;if(u&&u.getRandomValues&&(i=function(c){return u.getRandomValues(c)}),_e.options.usePureJavaScript||!_e.util.isNodejs&&!i){if(s.collectInt(+new Date,32),typeof navigator<"u"){var l="";for(var f in navigator)try{typeof navigator[f]=="string"&&(l+=navigator[f])}catch{}s.collect(l),l=null}e&&(e().mousemove(function(c){s.collectInt(c.clientX,16),s.collectInt(c.clientY,16)}),e().keypress(function(c){s.collectInt(c.charCode,8)}))}if(!_e.random)_e.random=s;else for(var f in s)_e.random[f]=s[f];_e.random.createInstance=n,_e.random})(typeof jQuery<"u"?jQuery:null)})();var tt=Y,xa=[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],Sn=[1,2,3,5],ss=function(e,t){return e<<t&65535|(e&65535)>>16-t},os=function(e,t){return(e&65535)>>t|e<<16-t&65535};tt.rc2=tt.rc2||{},tt.rc2.expandKey=function(e,t){typeof e=="string"&&(e=tt.util.createBuffer(e)),t=t||128;var a=e,r=e.length(),n=t,s=Math.ceil(n/8),i=255>>(n&7),o;for(o=r;o<128;o++)a.putByte(xa[a.at(o-1)+a.at(o-r)&255]);for(a.setAt(128-s,xa[a.at(128-s)&i]),o=127-s;o>=0;o--)a.setAt(o,xa[a.at(o+1)^a.at(o+s)]);return a};var Tn=function(e,t,a){var r=!1,n=null,s=null,i=null,o,u,l,f,c=[];for(e=tt.rc2.expandKey(e,t),l=0;l<64;l++)c.push(e.getInt16Le());a?(o=function(y){for(l=0;l<4;l++)y[l]+=c[f]+(y[(l+3)%4]&y[(l+2)%4])+(~y[(l+3)%4]&y[(l+1)%4]),y[l]=ss(y[l],Sn[l]),f++},u=function(y){for(l=0;l<4;l++)y[l]+=c[y[(l+3)%4]&63]}):(o=function(y){for(l=3;l>=0;l--)y[l]=os(y[l],Sn[l]),y[l]-=c[f]+(y[(l+3)%4]&y[(l+2)%4])+(~y[(l+3)%4]&y[(l+1)%4]),f--},u=function(y){for(l=3;l>=0;l--)y[l]-=c[y[(l+3)%4]&63]});var v=function(y){var x=[];for(l=0;l<4;l++){var S=n.getInt16Le();i!==null&&(a?S^=i.getInt16Le():i.putInt16Le(S)),x.push(S&65535)}f=a?0:63;for(var A=0;A<y.length;A++)for(var B=0;B<y[A][0];B++)y[A][1](x);for(l=0;l<4;l++)i!==null&&(a?i.putInt16Le(x[l]):x[l]^=i.getInt16Le()),s.putInt16Le(x[l])},m=null;return m={start:function(y,x){y&&typeof y=="string"&&(y=tt.util.createBuffer(y)),r=!1,n=tt.util.createBuffer(),s=x||new tt.util.createBuffer,i=y,m.output=s},update:function(y){for(r||n.putBuffer(y);n.length()>=8;)v([[5,o],[1,u],[6,o],[1,u],[5,o]])},finish:function(y){var x=!0;if(a)if(y)x=y(8,n,!a);else{var S=n.length()===8?8:8-n.length();n.fillWithByte(S,S)}if(x&&(r=!0,m.update()),!a&&(x=n.length()===0,x))if(y)x=y(8,s,!a);else{var A=s.length(),B=s.at(A-1);B>A?x=!1:s.truncate(B)}return x}},m};tt.rc2.startEncrypting=function(e,t,a){var r=tt.rc2.createEncryptionCipher(e,128);return r.start(t,a),r},tt.rc2.createEncryptionCipher=function(e,t){return Tn(e,t,!0)},tt.rc2.startDecrypting=function(e,t,a){var r=tt.rc2.createDecryptionCipher(e,128);return r.start(t,a),r},tt.rc2.createDecryptionCipher=function(e,t){return Tn(e,t,!1)};var Sa=Y;Sa.jsbn=Sa.jsbn||{};var Bt;function b(e,t,a){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,a):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}Sa.jsbn.BigInteger=b;function te(){return new b(null)}function us(e,t,a,r,n,s){for(;--s>=0;){var i=t*this.data[e++]+a.data[r]+n;n=Math.floor(i/67108864),a.data[r++]=i&67108863}return n}function ls(e,t,a,r,n,s){for(var i=t&32767,o=t>>15;--s>=0;){var u=this.data[e]&32767,l=this.data[e++]>>15,f=o*u+l*i;u=i*u+((f&32767)<<15)+a.data[r]+(n&1073741823),n=(u>>>30)+(f>>>15)+o*l+(n>>>30),a.data[r++]=u&1073741823}return n}function An(e,t,a,r,n,s){for(var i=t&16383,o=t>>14;--s>=0;){var u=this.data[e]&16383,l=this.data[e++]>>14,f=o*u+l*i;u=i*u+((f&16383)<<14)+a.data[r]+n,n=(u>>28)+(f>>14)+o*l,a.data[r++]=u&268435455}return n}typeof navigator>"u"?(b.prototype.am=An,Bt=28):navigator.appName=="Microsoft Internet Explorer"?(b.prototype.am=ls,Bt=30):navigator.appName!="Netscape"?(b.prototype.am=us,Bt=26):(b.prototype.am=An,Bt=28),b.prototype.DB=Bt,b.prototype.DM=(1<<Bt)-1,b.prototype.DV=1<<Bt;var Ta=52;b.prototype.FV=Math.pow(2,Ta),b.prototype.F1=Ta-Bt,b.prototype.F2=2*Bt-Ta;var fs="0123456789abcdefghijklmnopqrstuvwxyz",Gr=new Array,nr,ut;for(nr="0".charCodeAt(0),ut=0;ut<=9;++ut)Gr[nr++]=ut;for(nr="a".charCodeAt(0),ut=10;ut<36;++ut)Gr[nr++]=ut;for(nr="A".charCodeAt(0),ut=10;ut<36;++ut)Gr[nr++]=ut;function In(e){return fs.charAt(e)}function Bn(e,t){var a=Gr[e.charCodeAt(t)];return a==null?-1:a}function cs(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function hs(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function wt(e){var t=te();return t.fromInt(e),t}function ds(e,t){var a;if(t==16)a=4;else if(t==8)a=3;else if(t==256)a=8;else if(t==2)a=1;else if(t==32)a=5;else if(t==4)a=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,s=0;--r>=0;){var i=a==8?e[r]&255:Bn(e,r);if(i<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,s==0?this.data[this.t++]=i:s+a>this.DB?(this.data[this.t-1]|=(i&(1<<this.DB-s)-1)<<s,this.data[this.t++]=i>>this.DB-s):this.data[this.t-1]|=i<<s,s+=a,s>=this.DB&&(s-=this.DB)}a==8&&(e[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),n&&b.ZERO.subTo(this,this)}function ps(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function vs(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var a=(1<<t)-1,r,n=!1,s="",i=this.t,o=this.DB-i*this.DB%t;if(i-- >0)for(o<this.DB&&(r=this.data[i]>>o)>0&&(n=!0,s=In(r));i>=0;)o<t?(r=(this.data[i]&(1<<o)-1)<<t-o,r|=this.data[--i]>>(o+=this.DB-t)):(r=this.data[i]>>(o-=t)&a,o<=0&&(o+=this.DB,--i)),r>0&&(n=!0),n&&(s+=In(r));return n?s:"0"}function ys(){var e=te();return b.ZERO.subTo(this,e),e}function gs(){return this.s<0?this.negate():this}function ms(e){var t=this.s-e.s;if(t!=0)return t;var a=this.t;if(t=a-e.t,t!=0)return this.s<0?-t:t;for(;--a>=0;)if((t=this.data[a]-e.data[a])!=0)return t;return 0}function Qr(e){var t=1,a;return(a=e>>>16)!=0&&(e=a,t+=16),(a=e>>8)!=0&&(e=a,t+=8),(a=e>>4)!=0&&(e=a,t+=4),(a=e>>2)!=0&&(e=a,t+=2),(a=e>>1)!=0&&(e=a,t+=1),t}function Cs(){return this.t<=0?0:this.DB*(this.t-1)+Qr(this.data[this.t-1]^this.s&this.DM)}function Es(e,t){var a;for(a=this.t-1;a>=0;--a)t.data[a+e]=this.data[a];for(a=e-1;a>=0;--a)t.data[a]=0;t.t=this.t+e,t.s=this.s}function xs(e,t){for(var a=e;a<this.t;++a)t.data[a-e]=this.data[a];t.t=Math.max(this.t-e,0),t.s=this.s}function Ss(e,t){var a=e%this.DB,r=this.DB-a,n=(1<<r)-1,s=Math.floor(e/this.DB),i=this.s<<a&this.DM,o;for(o=this.t-1;o>=0;--o)t.data[o+s+1]=this.data[o]>>r|i,i=(this.data[o]&n)<<a;for(o=s-1;o>=0;--o)t.data[o]=0;t.data[s]=i,t.t=this.t+s+1,t.s=this.s,t.clamp()}function Ts(e,t){t.s=this.s;var a=Math.floor(e/this.DB);if(a>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,s=(1<<r)-1;t.data[0]=this.data[a]>>r;for(var i=a+1;i<this.t;++i)t.data[i-a-1]|=(this.data[i]&s)<<n,t.data[i-a]=this.data[i]>>r;r>0&&(t.data[this.t-a-1]|=(this.s&s)<<n),t.t=this.t-a,t.clamp()}function As(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]-e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r-=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[a++]=this.DV+r:r>0&&(t.data[a++]=r),t.t=a,t.clamp()}function Is(e,t){var a=this.abs(),r=e.abs(),n=a.t;for(t.t=n+r.t;--n>=0;)t.data[n]=0;for(n=0;n<r.t;++n)t.data[n+a.t]=a.am(0,r.data[n],t,n,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&b.ZERO.subTo(t,t)}function Bs(e){for(var t=this.abs(),a=e.t=2*t.t;--a>=0;)e.data[a]=0;for(a=0;a<t.t-1;++a){var r=t.am(a,t.data[a],e,2*a,0,1);(e.data[a+t.t]+=t.am(a+1,2*t.data[a],e,2*a+1,r,t.t-a-1))>=t.DV&&(e.data[a+t.t]-=t.DV,e.data[a+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(a,t.data[a],e,2*a,0,1)),e.s=0,e.clamp()}function bs(e,t,a){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t!=null&&t.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=te());var s=te(),i=this.s,o=e.s,u=this.DB-Qr(r.data[r.t-1]);u>0?(r.lShiftTo(u,s),n.lShiftTo(u,a)):(r.copyTo(s),n.copyTo(a));var l=s.t,f=s.data[l-1];if(f!=0){var c=f*(1<<this.F1)+(l>1?s.data[l-2]>>this.F2:0),v=this.FV/c,m=(1<<this.F1)/c,y=1<<this.F2,x=a.t,S=x-l,A=t==null?te():t;for(s.dlShiftTo(S,A),a.compareTo(A)>=0&&(a.data[a.t++]=1,a.subTo(A,a)),b.ONE.dlShiftTo(l,A),A.subTo(s,s);s.t<l;)s.data[s.t++]=0;for(;--S>=0;){var B=a.data[--x]==f?this.DM:Math.floor(a.data[x]*v+(a.data[x-1]+y)*m);if((a.data[x]+=s.am(0,B,a,S,0,l))<B)for(s.dlShiftTo(S,A),a.subTo(A,a);a.data[x]<--B;)a.subTo(A,a)}t!=null&&(a.drShiftTo(l,t),i!=o&&b.ZERO.subTo(t,t)),a.t=l,a.clamp(),u>0&&a.rShiftTo(u,a),i<0&&b.ZERO.subTo(a,a)}}}function _s(e){var t=te();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(b.ZERO)>0&&e.subTo(t,t),t}function Gt(e){this.m=e}function Ns(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function ws(e){return e}function Rs(e){e.divRemTo(this.m,null,e)}function Ls(e,t,a){e.multiplyTo(t,a),this.reduce(a)}function Ds(e,t){e.squareTo(t),this.reduce(t)}Gt.prototype.convert=Ns,Gt.prototype.revert=ws,Gt.prototype.reduce=Rs,Gt.prototype.mulTo=Ls,Gt.prototype.sqrTo=Ds;function ks(){if(this.t<1)return 0;var e=this.data[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Qt(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Us(e){var t=te();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(b.ZERO)>0&&this.m.subTo(t,t),t}function Ps(e){var t=te();return e.copyTo(t),this.reduce(t),t}function Vs(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var a=e.data[t]&32767,r=a*this.mpl+((a*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(a=t+this.m.t,e.data[a]+=this.m.am(0,r,e,t,0,this.m.t);e.data[a]>=e.DV;)e.data[a]-=e.DV,e.data[++a]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Fs(e,t){e.squareTo(t),this.reduce(t)}function Os(e,t,a){e.multiplyTo(t,a),this.reduce(a)}Qt.prototype.convert=Us,Qt.prototype.revert=Ps,Qt.prototype.reduce=Vs,Qt.prototype.mulTo=Os,Qt.prototype.sqrTo=Fs;function Ks(){return(this.t>0?this.data[0]&1:this.s)==0}function Ms(e,t){if(e>4294967295||e<1)return b.ONE;var a=te(),r=te(),n=t.convert(this),s=Qr(e)-1;for(n.copyTo(a);--s>=0;)if(t.sqrTo(a,r),(e&1<<s)>0)t.mulTo(r,n,a);else{var i=a;a=r,r=i}return t.revert(a)}function Hs(e,t){var a;return e<256||t.isEven()?a=new Gt(t):a=new Qt(t),this.exp(e,a)}b.prototype.copyTo=cs,b.prototype.fromInt=hs,b.prototype.fromString=ds,b.prototype.clamp=ps,b.prototype.dlShiftTo=Es,b.prototype.drShiftTo=xs,b.prototype.lShiftTo=Ss,b.prototype.rShiftTo=Ts,b.prototype.subTo=As,b.prototype.multiplyTo=Is,b.prototype.squareTo=Bs,b.prototype.divRemTo=bs,b.prototype.invDigit=ks,b.prototype.isEven=Ks,b.prototype.exp=Ms,b.prototype.toString=vs,b.prototype.negate=ys,b.prototype.abs=gs,b.prototype.compareTo=ms,b.prototype.bitLength=Cs,b.prototype.mod=_s,b.prototype.modPowInt=Hs,b.ZERO=wt(0),b.ONE=wt(1);function qs(){var e=te();return this.copyTo(e),e}function Gs(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Qs(){return this.t==0?this.s:this.data[0]<<24>>24}function zs(){return this.t==0?this.s:this.data[0]<<16>>16}function Ys(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Ws(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function js(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),a=Math.pow(e,t),r=wt(a),n=te(),s=te(),i="";for(this.divRemTo(r,n,s);n.signum()>0;)i=(a+s.intValue()).toString(e).substr(1)+i,n.divRemTo(r,n,s);return s.intValue().toString(e)+i}function Xs(e,t){this.fromInt(0),t==null&&(t=10);for(var a=this.chunkSize(t),r=Math.pow(t,a),n=!1,s=0,i=0,o=0;o<e.length;++o){var u=Bn(e,o);if(u<0){e.charAt(o)=="-"&&this.signum()==0&&(n=!0);continue}i=t*i+u,++s>=a&&(this.dMultiply(r),this.dAddOffset(i,0),s=0,i=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(i,0)),n&&b.ZERO.subTo(this,this)}function $s(e,t,a){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(b.ONE.shiftLeft(e-1),Aa,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(b.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function Zs(){var e=this.t,t=new Array;t[0]=this.s;var a=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function Js(e){return this.compareTo(e)==0}function eo(e){return this.compareTo(e)<0?this:e}function to(e){return this.compareTo(e)>0?this:e}function ro(e,t,a){var r,n,s=Math.min(e.t,this.t);for(r=0;r<s;++r)a.data[r]=t(this.data[r],e.data[r]);if(e.t<this.t){for(n=e.s&this.DM,r=s;r<this.t;++r)a.data[r]=t(this.data[r],n);a.t=this.t}else{for(n=this.s&this.DM,r=s;r<e.t;++r)a.data[r]=t(n,e.data[r]);a.t=e.t}a.s=t(this.s,e.s),a.clamp()}function ao(e,t){return e&t}function no(e){var t=te();return this.bitwiseTo(e,ao,t),t}function Aa(e,t){return e|t}function io(e){var t=te();return this.bitwiseTo(e,Aa,t),t}function bn(e,t){return e^t}function so(e){var t=te();return this.bitwiseTo(e,bn,t),t}function _n(e,t){return e&~t}function oo(e){var t=te();return this.bitwiseTo(e,_n,t),t}function uo(){for(var e=te(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function lo(e){var t=te();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function fo(e){var t=te();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function co(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function ho(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+co(this.data[e]);return this.s<0?this.t*this.DB:-1}function po(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function vo(){for(var e=0,t=this.s&this.DM,a=0;a<this.t;++a)e+=po(this.data[a]^t);return e}function yo(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function go(e,t){var a=b.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a}function mo(e){return this.changeBit(e,Aa)}function Co(e){return this.changeBit(e,_n)}function Eo(e){return this.changeBit(e,bn)}function xo(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]+e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r+=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[a++]=r:r<-1&&(t.data[a++]=this.DV+r),t.t=a,t.clamp()}function So(e){var t=te();return this.addTo(e,t),t}function To(e){var t=te();return this.subTo(e,t),t}function Ao(e){var t=te();return this.multiplyTo(e,t),t}function Io(e){var t=te();return this.divRemTo(e,t,null),t}function Bo(e){var t=te();return this.divRemTo(e,null,t),t}function bo(e){var t=te(),a=te();return this.divRemTo(e,t,a),new Array(t,a)}function _o(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function No(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Sr(){}function Nn(e){return e}function wo(e,t,a){e.multiplyTo(t,a)}function Ro(e,t){e.squareTo(t)}Sr.prototype.convert=Nn,Sr.prototype.revert=Nn,Sr.prototype.mulTo=wo,Sr.prototype.sqrTo=Ro;function Lo(e){return this.exp(e,new Sr)}function Do(e,t,a){var r=Math.min(this.t+e.t,t);for(a.s=0,a.t=r;r>0;)a.data[--r]=0;var n;for(n=a.t-this.t;r<n;++r)a.data[r+this.t]=this.am(0,e.data[r],a,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e.data[r],a,r,0,t-r);a.clamp()}function ko(e,t,a){--t;var r=a.t=this.t+e.t-t;for(a.s=0;--r>=0;)a.data[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)a.data[this.t+r-t]=this.am(t-r,e.data[r],a,0,0,this.t+r-t);a.clamp(),a.drShiftTo(1,a)}function ir(e){this.r2=te(),this.q3=te(),b.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Uo(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=te();return e.copyTo(t),this.reduce(t),t}function Po(e){return e}function Vo(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Fo(e,t){e.squareTo(t),this.reduce(t)}function Oo(e,t,a){e.multiplyTo(t,a),this.reduce(a)}ir.prototype.convert=Uo,ir.prototype.revert=Po,ir.prototype.reduce=Vo,ir.prototype.mulTo=Oo,ir.prototype.sqrTo=Fo;function Ko(e,t){var a=e.bitLength(),r,n=wt(1),s;if(a<=0)return n;a<18?r=1:a<48?r=3:a<144?r=4:a<768?r=5:r=6,a<8?s=new Gt(t):t.isEven()?s=new ir(t):s=new Qt(t);var i=new Array,o=3,u=r-1,l=(1<<r)-1;if(i[1]=s.convert(this),r>1){var f=te();for(s.sqrTo(i[1],f);o<=l;)i[o]=te(),s.mulTo(f,i[o-2],i[o]),o+=2}var c=e.t-1,v,m=!0,y=te(),x;for(a=Qr(e.data[c])-1;c>=0;){for(a>=u?v=e.data[c]>>a-u&l:(v=(e.data[c]&(1<<a+1)-1)<<u-a,c>0&&(v|=e.data[c-1]>>this.DB+a-u)),o=r;(v&1)==0;)v>>=1,--o;if((a-=o)<0&&(a+=this.DB,--c),m)i[v].copyTo(n),m=!1;else{for(;o>1;)s.sqrTo(n,y),s.sqrTo(y,n),o-=2;o>0?s.sqrTo(n,y):(x=n,n=y,y=x),s.mulTo(y,i[v],n)}for(;c>=0&&(e.data[c]&1<<a)==0;)s.sqrTo(n,y),x=n,n=y,y=x,--a<0&&(a=this.DB-1,--c)}return s.revert(n)}function Mo(e){var t=this.s<0?this.negate():this.clone(),a=e.s<0?e.negate():e.clone();if(t.compareTo(a)<0){var r=t;t=a,a=r}var n=t.getLowestSetBit(),s=a.getLowestSetBit();if(s<0)return t;for(n<s&&(s=n),s>0&&(t.rShiftTo(s,t),a.rShiftTo(s,a));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=a.getLowestSetBit())>0&&a.rShiftTo(n,a),t.compareTo(a)>=0?(t.subTo(a,t),t.rShiftTo(1,t)):(a.subTo(t,a),a.rShiftTo(1,a));return s>0&&a.lShiftTo(s,a),a}function Ho(e){if(e<=0)return 0;var t=this.DV%e,a=this.s<0?e-1:0;if(this.t>0)if(t==0)a=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)a=(t*a+this.data[r])%e;return a}function qo(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return b.ZERO;for(var a=e.clone(),r=this.clone(),n=wt(1),s=wt(0),i=wt(0),o=wt(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),t?((!n.isEven()||!s.isEven())&&(n.addTo(this,n),s.subTo(e,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);a.compareTo(r)>=0?(a.subTo(r,a),t&&n.subTo(i,n),s.subTo(o,s)):(r.subTo(a,r),t&&i.subTo(n,i),o.subTo(s,o))}if(r.compareTo(b.ONE)!=0)return b.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var vt=[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],Go=(1<<26)/vt[vt.length-1];function Qo(e){var t,a=this.abs();if(a.t==1&&a.data[0]<=vt[vt.length-1]){for(t=0;t<vt.length;++t)if(a.data[0]==vt[t])return!0;return!1}if(a.isEven())return!1;for(t=1;t<vt.length;){for(var r=vt[t],n=t+1;n<vt.length&&r<Go;)r*=vt[n++];for(r=a.modInt(r);t<n;)if(r%vt[t++]==0)return!1}return a.millerRabin(e)}function zo(e){var t=this.subtract(b.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var r=t.shiftRight(a),n=Yo(),s,i=0;i<e;++i){do s=new b(this.bitLength(),n);while(s.compareTo(b.ONE)<=0||s.compareTo(t)>=0);var o=s.modPow(r,this);if(o.compareTo(b.ONE)!=0&&o.compareTo(t)!=0){for(var u=1;u++<a&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(b.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}function Yo(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}b.prototype.chunkSize=Ys,b.prototype.toRadix=js,b.prototype.fromRadix=Xs,b.prototype.fromNumber=$s,b.prototype.bitwiseTo=ro,b.prototype.changeBit=go,b.prototype.addTo=xo,b.prototype.dMultiply=_o,b.prototype.dAddOffset=No,b.prototype.multiplyLowerTo=Do,b.prototype.multiplyUpperTo=ko,b.prototype.modInt=Ho,b.prototype.millerRabin=zo,b.prototype.clone=qs,b.prototype.intValue=Gs,b.prototype.byteValue=Qs,b.prototype.shortValue=zs,b.prototype.signum=Ws,b.prototype.toByteArray=Zs,b.prototype.equals=Js,b.prototype.min=eo,b.prototype.max=to,b.prototype.and=no,b.prototype.or=io,b.prototype.xor=so,b.prototype.andNot=oo,b.prototype.not=uo,b.prototype.shiftLeft=lo,b.prototype.shiftRight=fo,b.prototype.getLowestSetBit=ho,b.prototype.bitCount=vo,b.prototype.testBit=yo,b.prototype.setBit=mo,b.prototype.clearBit=Co,b.prototype.flipBit=Eo,b.prototype.add=So,b.prototype.subtract=To,b.prototype.multiply=Ao,b.prototype.divide=Io,b.prototype.remainder=Bo,b.prototype.divideAndRemainder=bo,b.prototype.modPow=Ko,b.prototype.modInverse=qo,b.prototype.pow=Lo,b.prototype.gcd=Mo,b.prototype.isProbablePrime=Qo;var Et=Y,wn=Et.sha1=Et.sha1||{};Et.md.sha1=Et.md.algorithms.sha1=wn,wn.create=function(){Rn||Wo();var e=null,t=Et.util.createBuffer(),a=new Array(80),r={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=Et.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=Et.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),Ln(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=Et.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Ia.substr(0,r.blockLength-i));for(var o,u,l=r.fullMessageLength[0]*8,f=0;f<r.fullMessageLength.length-1;++f)o=r.fullMessageLength[f+1]*8,u=o/4294967296>>>0,l+=u,n.putInt32(l>>>0),l=o>>>0;n.putInt32(l);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};Ln(c,a,n);var v=Et.util.createBuffer();return v.putInt32(c.h0),v.putInt32(c.h1),v.putInt32(c.h2),v.putInt32(c.h3),v.putInt32(c.h4),v},r};var Ia=null,Rn=!1;function Wo(){Ia=String.fromCharCode(128),Ia+=Et.util.fillString(String.fromCharCode(0),64),Rn=!0}function Ln(e,t,a){for(var r,n,s,i,o,u,l,f,c=a.length();c>=64;){for(n=e.h0,s=e.h1,i=e.h2,o=e.h3,u=e.h4,f=0;f<16;++f)r=a.getInt32(),t[f]=r,l=o^s&(i^o),r=(n<<5|n>>>27)+l+u+1518500249+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<20;++f)r=t[f-3]^t[f-8]^t[f-14]^t[f-16],r=r<<1|r>>>31,t[f]=r,l=o^s&(i^o),r=(n<<5|n>>>27)+l+u+1518500249+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<32;++f)r=t[f-3]^t[f-8]^t[f-14]^t[f-16],r=r<<1|r>>>31,t[f]=r,l=s^i^o,r=(n<<5|n>>>27)+l+u+1859775393+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<40;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,l=s^i^o,r=(n<<5|n>>>27)+l+u+1859775393+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<60;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,l=s&i|o&(s^i),r=(n<<5|n>>>27)+l+u+2400959708+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<80;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,l=s^i^o,r=(n<<5|n>>>27)+l+u+3395469782+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,e.h4=e.h4+u|0,c-=64}}var xt=Y,Dn=xt.pkcs1=xt.pkcs1||{};Dn.encode_rsa_oaep=function(e,t,a){var r,n,s,i;typeof a=="string"?(r=a,n=arguments[3]||void 0,s=arguments[4]||void 0):a&&(r=a.label||void 0,n=a.seed||void 0,s=a.md||void 0,a.mgf1&&a.mgf1.md&&(i=a.mgf1.md)),s?s.start():s=xt.md.sha1.create(),i||(i=s);var o=Math.ceil(e.n.bitLength()/8),u=o-2*s.digestLength-2;if(t.length>u){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=u,l}r||(r=""),s.update(r,"raw");for(var f=s.digest(),c="",v=u-t.length,m=0;m<v;m++)c+="\0";var y=f.getBytes()+c+""+t;if(!n)n=xt.random.getBytes(s.digestLength);else if(n.length!==s.digestLength){var l=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw l.seedLength=n.length,l.digestLength=s.digestLength,l}var x=zr(n,o-s.digestLength-1,i),S=xt.util.xorBytes(y,x,y.length),A=zr(S,s.digestLength,i),B=xt.util.xorBytes(n,A,n.length);return"\0"+B+S},Dn.decode_rsa_oaep=function(e,t,a){var r,n,s;typeof a=="string"?(r=a,n=arguments[3]||void 0):a&&(r=a.label||void 0,n=a.md||void 0,a.mgf1&&a.mgf1.md&&(s=a.mgf1.md));var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var S=new Error("RSAES-OAEP encoded message length is invalid.");throw S.length=t.length,S.expectedLength=i,S}if(n===void 0?n=xt.md.sha1.create():n.start(),s||(s=n),i<2*n.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");r||(r=""),n.update(r,"raw");for(var o=n.digest().getBytes(),u=t.charAt(0),l=t.substring(1,n.digestLength+1),f=t.substring(1+n.digestLength),c=zr(f,n.digestLength,s),v=xt.util.xorBytes(l,c,l.length),m=zr(v,i-n.digestLength-1,s),y=xt.util.xorBytes(f,m,f.length),x=y.substring(0,n.digestLength),S=u!=="\0",A=0;A<n.digestLength;++A)S|=o.charAt(A)!==x.charAt(A);for(var B=1,N=n.digestLength,F=n.digestLength;F<y.length;F++){var D=y.charCodeAt(F),R=D&1^1,z=B?65534:0;S|=D&z,B=B&R,N+=B}if(S||y.charCodeAt(N)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(N+1)};function zr(e,t,a){a||(a=xt.md.sha1.create());for(var r="",n=Math.ceil(t/a.digestLength),s=0;s<n;++s){var i=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);a.start(),a.update(e+i),r+=a.digest().getBytes()}return r.substring(0,t)}var Rt=Y;(function(){if(Rt.prime){Rt.prime;return}var e=Rt.prime=Rt.prime||{},t=Rt.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],r=new t(null);r.fromInt(30);var n=function(c,v){return c|v};e.generateProbablePrime=function(c,v,m){typeof v=="function"&&(m=v,v={}),v=v||{};var y=v.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var x=v.prng||Rt.random,S={nextBytes:function(A){for(var B=x.getBytesSync(A.length),N=0;N<A.length;++N)A[N]=B.charCodeAt(N)}};if(y.name==="PRIMEINC")return s(c,S,y.options,m);throw new Error("Invalid prime generation algorithm: "+y.name)};function s(c,v,m,y){return"workers"in m?u(c,v,m,y):i(c,v,m,y)}function i(c,v,m,y){var x=l(c,v),S=0,A=f(x.bitLength());"millerRabinTests"in m&&(A=m.millerRabinTests);var B=10;"maxBlockTime"in m&&(B=m.maxBlockTime),o(x,c,v,S,A,B,y)}function o(c,v,m,y,x,S,A){var B=+new Date;do{if(c.bitLength()>v&&(c=l(v,m)),c.isProbablePrime(x))return A(null,c);c.dAddOffset(a[y++%8],0)}while(S<0||+new Date-B<S);Rt.util.setImmediate(function(){o(c,v,m,y,x,S,A)})}function u(c,v,m,y){if(typeof Worker>"u")return i(c,v,m,y);var x=l(c,v),S=m.workers,A=m.workLoad||100,B=A*30/8,N=m.workerScript||"forge/prime.worker.js";if(S===-1)return Rt.util.estimateCores(function(D,R){D&&(R=2),S=R-1,F()});F();function F(){S=Math.max(1,S);for(var D=[],R=0;R<S;++R)D[R]=new Worker(N);for(var R=0;R<S;++R)D[R].addEventListener("message",J);var z=!1;function J(ie){if(!z){var oe=ie.data;if(oe.found){for(var ue=0;ue<D.length;++ue)D[ue].terminate();return z=!0,y(null,new t(oe.prime,16))}x.bitLength()>c&&(x=l(c,v));var ve=x.toString(16);ie.target.postMessage({hex:ve,workLoad:A}),x.dAddOffset(B,0)}}}}function l(c,v){var m=new t(c,v),y=c-1;return m.testBit(y)||m.bitwiseTo(t.ONE.shiftLeft(y),n,m),m.dAddOffset(31-m.mod(r).byteValue(),0),m}function f(c){return c<=100?27:c<=150?18:c<=200?15:c<=250?12:c<=300?9:c<=350?8:c<=400?7:c<=500?6:c<=600?5:c<=800?4:c<=1250?3:2}})();var G=Y;if(typeof re>"u")var re=G.jsbn.BigInteger;var Ba=G.util.isNodejs?Ca:null,T=G.asn1,lt=G.util;G.pki=G.pki||{},G.pki.rsa=G.rsa=G.rsa||{};var Q=G.pki,jo=[6,4,2,4,2,4,6,2],Xo={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"}]},$o={name:"RSAPrivateKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Zo={name:"RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Jo=G.pki.rsa.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"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},e0=function(e){var t;if(e.algorithm in Q.oids)t=Q.oids[e.algorithm];else{var a=new Error("Unknown message digest algorithm.");throw a.algorithm=e.algorithm,a}var r=T.oidToDer(t).getBytes(),n=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]),s=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]);s.value.push(T.create(T.Class.UNIVERSAL,T.Type.OID,!1,r)),s.value.push(T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,""));var i=T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(s),n.value.push(i),T.toDer(n).getBytes()},kn=function(e,t,a){if(a)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(re.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(re.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var r;do r=new re(G.util.bytesToHex(G.random.getBytes(t.n.bitLength()/8)),16);while(r.compareTo(t.n)>=0||!r.gcd(t.n).equals(re.ONE));e=e.multiply(r.modPow(t.e,t.n)).mod(t.n);for(var n=e.mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);n.compareTo(s)<0;)n=n.add(t.p);var i=n.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return i=i.multiply(r.modInverse(t.n)).mod(t.n),i};Q.rsa.encrypt=function(e,t,a){var r=a,n,s=Math.ceil(t.n.bitLength()/8);a!==!1&&a!==!0?(r=a===2,n=Un(e,t,a)):(n=G.util.createBuffer(),n.putBytes(e));for(var i=new re(n.toHex(),16),o=kn(i,t,r),u=o.toString(16),l=G.util.createBuffer(),f=s-Math.ceil(u.length/2);f>0;)l.putByte(0),--f;return l.putBytes(G.util.hexToBytes(u)),l.getBytes()},Q.rsa.decrypt=function(e,t,a,r){var n=Math.ceil(t.n.bitLength()/8);if(e.length!==n){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=n,s}var i=new re(G.util.createBuffer(e).toHex(),16);if(i.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=kn(i,t,a),u=o.toString(16),l=G.util.createBuffer(),f=n-Math.ceil(u.length/2);f>0;)l.putByte(0),--f;return l.putBytes(G.util.hexToBytes(u)),r!==!1?Yr(l.getBytes(),t,a):l.getBytes()},Q.rsa.createKeyPairGenerationState=function(e,t,a){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,a=a||{};var r=a.prng||G.random,n={nextBytes:function(o){for(var u=r.getBytesSync(o.length),l=0;l<o.length;++l)o[l]=u.charCodeAt(l)}},s=a.algorithm||"PRIMEINC",i;if(s==="PRIMEINC")i={algorithm:s,state:0,bits:e,rng:n,eInt:t||65537,e:new re(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},i.e.fromInt(i.eInt);else throw new Error("Invalid key generation algorithm: "+s);return i},Q.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new re(null);a.fromInt(30);for(var r=0,n=function(c,v){return c|v},s=+new Date,i,o=0;e.keys===null&&(t<=0||o<t);){if(e.state===0){var u=e.p===null?e.pBits:e.qBits,l=u-1;e.pqState===0?(e.num=new re(u,e.rng),e.num.testBit(l)||e.num.bitwiseTo(re.ONE.shiftLeft(l),n,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),r=0,++e.pqState):e.pqState===1?e.num.bitLength()>u?e.pqState=0:e.num.isProbablePrime(r0(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(jo[r++%8],0):e.pqState===2?e.pqState=e.num.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(re.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var f=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)}}i=+new Date,o+=i-s,s=i}return e.keys!==null},Q.rsa.generateKeyPair=function(e,t,a,r){if(arguments.length===1?typeof e=="object"?(a=e,e=void 0):typeof e=="function"&&(r=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(r=t,t=void 0):typeof t!="number"&&(a=t,t=void 0):(a=e,r=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof a=="function"&&(r=a,a=void 0):(r=a,a=t,t=void 0)),a=a||{},e===void 0&&(e=a.bits||2048),t===void 0&&(t=a.e||65537),!G.options.usePureJavaScript&&!a.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(r){if(Pn("generateKeyPair"))return Ba.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,u,l){if(o)return r(o);r(null,{privateKey:Q.privateKeyFromPem(l),publicKey:Q.publicKeyFromPem(u)})});if(Vn("generateKey")&&Vn("exportKey"))return lt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:On(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return lt.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){r(o)}).then(function(o){if(o){var u=Q.privateKeyFromAsn1(T.fromDer(G.util.createBuffer(o)));r(null,{privateKey:u,publicKey:Q.setRsaPublicKey(u.n,u.e)})}});if(Fn("generateKey")&&Fn("exportKey")){var n=lt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:On(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(o){var u=o.target.result,l=lt.globalScope.msCrypto.subtle.exportKey("pkcs8",u.privateKey);l.oncomplete=function(f){var c=f.target.result,v=Q.privateKeyFromAsn1(T.fromDer(G.util.createBuffer(c)));r(null,{privateKey:v,publicKey:Q.setRsaPublicKey(v.n,v.e)})},l.onerror=function(f){r(f)}},n.onerror=function(o){r(o)};return}}else if(Pn("generateKeyPairSync")){var s=Ba.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Q.privateKeyFromPem(s.privateKey),publicKey:Q.publicKeyFromPem(s.publicKey)}}}var i=Q.rsa.createKeyPairGenerationState(e,t,a);if(!r)return Q.rsa.stepKeyPairGenerationState(i,0),i.keys;t0(i,a,r)},Q.setRsaPublicKey=Q.rsa.setPublicKey=function(e,t){var a={n:e,e:t};return a.encrypt=function(r,n,s){if(typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSAES-PKCS1-V1_5"),n==="RSAES-PKCS1-V1_5")n={encode:function(o,u,l){return Un(o,u,2).getBytes()}};else if(n==="RSA-OAEP"||n==="RSAES-OAEP")n={encode:function(o,u){return G.pkcs1.encode_rsa_oaep(u,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(n)!==-1)n={encode:function(o){return o}};else if(typeof n=="string")throw new Error('Unsupported encryption scheme: "'+n+'".');var i=n.encode(r,a,!0);return Q.rsa.encrypt(i,a,!0)},a.verify=function(r,n,s){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),s==="RSASSA-PKCS1-V1_5"?s={verify:function(o,u){u=Yr(u,a,!0);var l=T.fromDer(u);return o===l.value[1].value}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(o,u){return u=Yr(u,a,!0),o===u}});var i=Q.rsa.decrypt(n,a,!0,!1);return s.verify(r,i,a.n.bitLength())},a},Q.setRsaPrivateKey=Q.rsa.setPrivateKey=function(e,t,a,r,n,s,i,o){var u={n:e,e:t,d:a,p:r,q:n,dP:s,dQ:i,qInv:o};return u.decrypt=function(l,f,c){typeof f=="string"?f=f.toUpperCase():f===void 0&&(f="RSAES-PKCS1-V1_5");var v=Q.rsa.decrypt(l,u,!1,!1);if(f==="RSAES-PKCS1-V1_5")f={decode:Yr};else if(f==="RSA-OAEP"||f==="RSAES-OAEP")f={decode:function(m,y){return G.pkcs1.decode_rsa_oaep(y,m,c)}};else if(["RAW","NONE","NULL",null].indexOf(f)!==-1)f={decode:function(m){return m}};else throw new Error('Unsupported encryption scheme: "'+f+'".');return f.decode(v,u,!1)},u.sign=function(l,f){var c=!1;typeof f=="string"&&(f=f.toUpperCase()),f===void 0||f==="RSASSA-PKCS1-V1_5"?(f={encode:e0},c=1):(f==="NONE"||f==="NULL"||f===null)&&(f={encode:function(){return l}},c=1);var v=f.encode(l,u.n.bitLength());return Q.rsa.encrypt(v,u,c)},u},Q.wrapRsaPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(Q.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,T.toDer(e).getBytes())])},Q.privateKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,Xo,t,a)&&(e=T.fromDer(G.util.createBuffer(t.privateKey))),t={},a=[],!T.validate(e,$o,t,a)){var r=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw r.errors=a,r}var n,s,i,o,u,l,f,c;return n=G.util.createBuffer(t.privateKeyModulus).toHex(),s=G.util.createBuffer(t.privateKeyPublicExponent).toHex(),i=G.util.createBuffer(t.privateKeyPrivateExponent).toHex(),o=G.util.createBuffer(t.privateKeyPrime1).toHex(),u=G.util.createBuffer(t.privateKeyPrime2).toHex(),l=G.util.createBuffer(t.privateKeyExponent1).toHex(),f=G.util.createBuffer(t.privateKeyExponent2).toHex(),c=G.util.createBuffer(t.privateKeyCoefficient).toHex(),Q.setRsaPrivateKey(new re(n,16),new re(s,16),new re(i,16),new re(o,16),new re(u,16),new re(l,16),new re(f,16),new re(c,16))},Q.privateKeyToAsn1=Q.privateKeyToRSAPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.e)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.d)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.p)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.q)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.dP)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.dQ)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.qInv))])},Q.publicKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,Jo,t,a)){var r=T.derToOid(t.publicKeyOid);if(r!==Q.oids.rsaEncryption){var n=new Error("Cannot read public key. Unknown OID.");throw n.oid=r,n}e=t.rsaPublicKey}if(a=[],!T.validate(e,Zo,t,a)){var n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw n.errors=a,n}var s=G.util.createBuffer(t.publicKeyModulus).toHex(),i=G.util.createBuffer(t.publicKeyExponent).toHex();return Q.setRsaPublicKey(new re(s,16),new re(i,16))},Q.publicKeyToAsn1=Q.publicKeyToSubjectPublicKeyInfo=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(Q.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.BITSTRING,!1,[Q.publicKeyToRSAPublicKey(e)])])},Q.publicKeyToRSAPublicKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,St(e.e))])};function Un(e,t,a){var r=G.util.createBuffer(),n=Math.ceil(t.n.bitLength()/8);if(e.length>n-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=n-11,s}r.putByte(0),r.putByte(a);var i=n-3-e.length,o;if(a===0||a===1){o=a===0?0:255;for(var u=0;u<i;++u)r.putByte(o)}else for(;i>0;){for(var l=0,f=G.random.getBytes(i),u=0;u<i;++u)o=f.charCodeAt(u),o===0?++l:r.putByte(o);i=l}return r.putByte(0),r.putBytes(e),r}function Yr(e,t,a,r){var n=Math.ceil(t.n.bitLength()/8),s=G.util.createBuffer(e),i=s.getByte(),o=s.getByte();if(i!==0||a&&o!==0&&o!==1||!a&&o!=2||a&&o===0&&typeof r>"u")throw new Error("Encryption block is invalid.");var u=0;if(o===0){u=n-3-r;for(var l=0;l<u;++l)if(s.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(o===1)for(u=0;s.length()>1;){if(s.getByte()!==255){--s.read;break}++u}else if(o===2)for(u=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++u}var f=s.getByte();if(f!==0||u!==n-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function t0(e,t,a){typeof t=="function"&&(a=t,t={}),t=t||{};var r={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(r.prng=t.prng),n();function n(){s(e.pBits,function(o,u){if(o)return a(o);if(e.p=u,e.q!==null)return i(o,e.q);s(e.qBits,i)})}function s(o,u){G.prime.generateProbablePrime(o,r,u)}function i(o,u){if(o)return a(o);if(e.q=u,e.p.compareTo(e.q)<0){var l=e.p;e.p=e.q,e.q=l}if(e.p.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.p=null,n();return}if(e.q.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.q=null,s(e.qBits,i);return}if(e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(re.ONE)!==0){e.p=e.q=null,n();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,s(e.qBits,i);return}var f=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}}function St(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var a=G.util.hexToBytes(t);return a.length>1&&(a.charCodeAt(0)===0&&(a.charCodeAt(1)&128)===0||a.charCodeAt(0)===255&&(a.charCodeAt(1)&128)===128)?a.substr(1):a}function r0(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function Pn(e){return G.util.isNodejs&&typeof Ba[e]=="function"}function Vn(e){return typeof lt.globalScope<"u"&&typeof lt.globalScope.crypto=="object"&&typeof lt.globalScope.crypto.subtle=="object"&&typeof lt.globalScope.crypto.subtle[e]=="function"}function Fn(e){return typeof lt.globalScope<"u"&&typeof lt.globalScope.msCrypto=="object"&&typeof lt.globalScope.msCrypto.subtle=="object"&&typeof lt.globalScope.msCrypto.subtle[e]=="function"}function On(e){for(var t=G.util.hexToBytes(e.toString(16)),a=new Uint8Array(t.length),r=0;r<t.length;++r)a[r]=t.charCodeAt(r);return a}var O=Y;if(typeof a0>"u")var a0=O.jsbn.BigInteger;var I=O.asn1,W=O.pki=O.pki||{};W.pbe=O.pbe=O.pbe||{};var zt=W.oids,n0={name:"EncryptedPrivateKeyInfo",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},i0={name:"PBES2Algorithms",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},s0={name:"pkcs-12PbeParams",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"iterations"}]};W.encryptPrivateKeyInfo=function(e,t,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||"aes128",a.prfAlgorithm=a.prfAlgorithm||"sha1";var r=O.random.getBytesSync(a.saltSize),n=a.count,s=I.integerToDer(n),i,o,u;if(a.algorithm.indexOf("aes")===0||a.algorithm==="des"){var l,f,c;switch(a.algorithm){case"aes128":i=16,l=16,f=zt["aes128-CBC"],c=O.aes.createEncryptionCipher;break;case"aes192":i=24,l=16,f=zt["aes192-CBC"],c=O.aes.createEncryptionCipher;break;case"aes256":i=32,l=16,f=zt["aes256-CBC"],c=O.aes.createEncryptionCipher;break;case"des":i=8,l=8,f=zt.desCBC,c=O.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=a.algorithm,v}var m="hmacWith"+a.prfAlgorithm.toUpperCase(),y=Hn(m),x=O.pkcs5.pbkdf2(t,r,n,i,y),S=O.random.getBytesSync(l),A=c(x);A.start(S),A.update(I.toDer(e)),A.finish(),u=A.output.getBytes();var B=o0(r,s,i,m);o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(zt.pkcs5PBES2).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(zt.pkcs5PBKDF2).getBytes()),B]),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(f).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,S)])])])}else if(a.algorithm==="3des"){i=24;var N=new O.util.ByteBuffer(r),x=W.pbe.generatePkcs12Key(t,N,1,n,i),S=W.pbe.generatePkcs12Key(t,N,2,n,i),A=O.des.createEncryptionCipher(x);A.start(S),A.update(I.toDer(e)),A.finish(),u=A.output.getBytes(),o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(zt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,r),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,s.getBytes())])])}else{var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=a.algorithm,v}var F=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[o,I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,u)]);return F},W.decryptPrivateKeyInfo=function(e,t){var a=null,r={},n=[];if(!I.validate(e,n0,r,n)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=I.derToOid(r.encryptionOid),o=W.pbe.getCipher(i,r.encryptionParams,t),u=O.util.createBuffer(r.encryptedData);return o.update(u),o.finish()&&(a=I.fromDer(o.output)),a},W.encryptedPrivateKeyToPem=function(e,t){var a={type:"ENCRYPTED PRIVATE KEY",body:I.toDer(e).getBytes()};return O.pem.encode(a,{maxline:t})},W.encryptedPrivateKeyFromPem=function(e){var t=O.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var a=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return I.fromDer(t.body)},W.encryptRsaPrivateKey=function(e,t,a){if(a=a||{},!a.legacy){var r=W.wrapRsaPrivateKey(W.privateKeyToAsn1(e));return r=W.encryptPrivateKeyInfo(r,t,a),W.encryptedPrivateKeyToPem(r)}var n,s,i,o;switch(a.algorithm){case"aes128":n="AES-128-CBC",i=16,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes192":n="AES-192-CBC",i=24,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes256":n="AES-256-CBC",i=32,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"3des":n="DES-EDE3-CBC",i=24,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;case"des":n="DES-CBC",i=8,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;default:var u=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+a.algorithm+'".');throw u.algorithm=a.algorithm,u}var l=O.pbe.opensslDeriveBytes(t,s.substr(0,8),i),f=o(l);f.start(s),f.update(I.toDer(W.privateKeyToAsn1(e))),f.finish();var c={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:n,parameters:O.util.bytesToHex(s).toUpperCase()},body:f.output.getBytes()};return O.pem.encode(c)},W.decryptRsaPrivateKey=function(e,t){var a=null,r=O.pem.decode(e)[0];if(r.type!=="ENCRYPTED PRIVATE KEY"&&r.type!=="PRIVATE KEY"&&r.type!=="RSA PRIVATE KEY"){var n=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw n.headerType=n,n}if(r.procType&&r.procType.type==="ENCRYPTED"){var s,i;switch(r.dekInfo.algorithm){case"DES-CBC":s=8,i=O.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,i=O.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,i=O.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,i=O.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,i=O.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,i=function(c){return O.rc2.createDecryptionCipher(c,40)};break;case"RC2-64-CBC":s=8,i=function(c){return O.rc2.createDecryptionCipher(c,64)};break;case"RC2-128-CBC":s=16,i=function(c){return O.rc2.createDecryptionCipher(c,128)};break;default:var n=new Error('Could not decrypt private key; unsupported encryption algorithm "'+r.dekInfo.algorithm+'".');throw n.algorithm=r.dekInfo.algorithm,n}var o=O.util.hexToBytes(r.dekInfo.parameters),u=O.pbe.opensslDeriveBytes(t,o.substr(0,8),s),l=i(u);if(l.start(o),l.update(O.util.createBuffer(r.body)),l.finish())a=l.output.getBytes();else return a}else a=r.body;return r.type==="ENCRYPTED PRIVATE KEY"?a=W.decryptPrivateKeyInfo(I.fromDer(a),t):a=I.fromDer(a),a!==null&&(a=W.privateKeyFromAsn1(a)),a},W.pbe.generatePkcs12Key=function(e,t,a,r,n,s){var i,o;if(typeof s>"u"||s===null){if(!("sha1"in O.md))throw new Error('"sha1" hash algorithm unavailable.');s=O.md.sha1.create()}var u=s.digestLength,l=s.blockLength,f=new O.util.ByteBuffer,c=new O.util.ByteBuffer;if(e!=null){for(o=0;o<e.length;o++)c.putInt16(e.charCodeAt(o));c.putInt16(0)}var v=c.length(),m=t.length(),y=new O.util.ByteBuffer;y.fillWithByte(a,l);var x=l*Math.ceil(m/l),S=new O.util.ByteBuffer;for(o=0;o<x;o++)S.putByte(t.at(o%m));var A=l*Math.ceil(v/l),B=new O.util.ByteBuffer;for(o=0;o<A;o++)B.putByte(c.at(o%v));var N=S;N.putBuffer(B);for(var F=Math.ceil(n/u),D=1;D<=F;D++){var R=new O.util.ByteBuffer;R.putBytes(y.bytes()),R.putBytes(N.bytes());for(var z=0;z<r;z++)s.start(),s.update(R.getBytes()),R=s.digest();var J=new O.util.ByteBuffer;for(o=0;o<l;o++)J.putByte(R.at(o%u));var ie=Math.ceil(m/l)+Math.ceil(v/l),oe=new O.util.ByteBuffer;for(i=0;i<ie;i++){var ue=new O.util.ByteBuffer(N.getBytes(l)),ve=511;for(o=J.length()-1;o>=0;o--)ve=ve>>8,ve+=J.at(o)+ue.at(o),ue.setAt(o,ve&255);oe.putBuffer(ue)}N=oe,f.putBuffer(R)}return f.truncate(f.length()-n),f},W.pbe.getCipher=function(e,t,a){switch(e){case W.oids.pkcs5PBES2:return W.pbe.getCipherForPBES2(e,t,a);case W.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case W.oids["pbewithSHAAnd40BitRC2-CBC"]:return W.pbe.getCipherForPKCS12PBE(e,t,a);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},W.pbe.getCipherForPBES2=function(e,t,a){var r={},n=[];if(!I.validate(t,i0,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}if(e=I.derToOid(r.kdfOid),e!==W.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=e,s.supportedOids=["pkcs5PBKDF2"],s}if(e=I.derToOid(r.encOid),e!==W.oids["aes128-CBC"]&&e!==W.oids["aes192-CBC"]&&e!==W.oids["aes256-CBC"]&&e!==W.oids["des-EDE3-CBC"]&&e!==W.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=e,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var i=r.kdfSalt,o=O.util.createBuffer(r.kdfIterationCount);o=o.getInt(o.length()<<3);var u,l;switch(W.oids[e]){case"aes128-CBC":u=16,l=O.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,l=O.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,l=O.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,l=O.des.createDecryptionCipher;break;case"desCBC":u=8,l=O.des.createDecryptionCipher;break}var f=Mn(r.prfOid),c=O.pkcs5.pbkdf2(a,i,o,u,f),v=r.encIv,m=l(c);return m.start(v),m},W.pbe.getCipherForPKCS12PBE=function(e,t,a){var r={},n=[];if(!I.validate(t,s0,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=O.util.createBuffer(r.salt),o=O.util.createBuffer(r.iterations);o=o.getInt(o.length()<<3);var u,l,f;switch(e){case W.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,l=8,f=O.des.startDecrypting;break;case W.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,l=8,f=function(x,S){var A=O.rc2.createDecryptionCipher(x,40);return A.start(S,null),A};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var c=Mn(r.prfOid),v=W.pbe.generatePkcs12Key(a,i,1,o,u,c);c.start();var m=W.pbe.generatePkcs12Key(a,i,2,o,l,c);return f(v,m)},W.pbe.opensslDeriveBytes=function(e,t,a,r){if(typeof r>"u"||r===null){if(!("md5"in O.md))throw new Error('"md5" hash algorithm unavailable.');r=O.md.md5.create()}t===null&&(t="");for(var n=[Kn(r,e+t)],s=16,i=1;s<a;++i,s+=16)n.push(Kn(r,n[i-1]+e+t));return n.join("").substr(0,a)};function Kn(e,t){return e.start().update(t).digest().getBytes()}function Mn(e){var t;if(!e)t="hmacWithSHA1";else if(t=W.oids[I.derToOid(e)],!t){var a=new Error("Unsupported PRF OID.");throw a.oid=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}return Hn(t)}function Hn(e){var t=O.md;switch(e){case"hmacWithSHA224":t=O.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function o0(e,t,a,r){var n=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,e),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,t.getBytes())]);return r!=="hmacWithSHA1"&&n.value.push(I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,O.util.hexToBytes(a.toString(16))),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(W.oids[r]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.NULL,!1,"")])),n}var sr=Y,V=sr.asn1,or=sr.pkcs7asn1=sr.pkcs7asn1||{};sr.pkcs7=sr.pkcs7||{},sr.pkcs7.asn1=or;var qn={name:"ContentInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};or.contentInfoValidator=qn;var Gn={name:"EncryptedContentInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};or.envelopedDataValidator={name:"EnvelopedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(Gn)},or.encryptedDataValidator={name:"EncryptedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"}].concat(Gn)};var u0={name:"SignerInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:V.Class.UNIVERSAL,type:V.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:V.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};or.signedDataValidator={name:"SignedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},qn,{name:"SignedData.Certificates",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:V.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,capture:"signerInfos",optional:!0,value:[u0]}]},or.recipientInfoValidator={name:"RecipientInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:V.Class.UNIVERSAL,type:V.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]};var Yt=Y;Yt.mgf=Yt.mgf||{};var l0=Yt.mgf.mgf1=Yt.mgf1=Yt.mgf1||{};l0.create=function(e){var t={generate:function(a,r){for(var n=new Yt.util.ByteBuffer,s=Math.ceil(r/e.digestLength),i=0;i<s;i++){var o=new Yt.util.ByteBuffer;o.putInt32(i),e.start(),e.update(a+o.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}};return t};var Wr=Y;Wr.mgf=Wr.mgf||{},Wr.mgf.mgf1=Wr.mgf1;var Wt=Y,f0=Wt.pss=Wt.pss||{};f0.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,a=e.mgf,r=t.digestLength,n=e.salt||null;typeof n=="string"&&(n=Wt.util.createBuffer(n));var s;if("saltLength"in e)s=e.saltLength;else if(n!==null)s=n.length();else throw new Error("Salt length not specified or specific salt not given.");if(n!==null&&n.length()!==s)throw new Error("Given salt length does not match length of given salt.");var i=e.prng||Wt.random,o={};return o.encode=function(u,l){var f,c=l-1,v=Math.ceil(c/8),m=u.digest().getBytes();if(v<r+s+2)throw new Error("Message is too long to encrypt.");var y;n===null?y=i.getBytesSync(s):y=n.bytes();var x=new Wt.util.ByteBuffer;x.fillWithByte(0,8),x.putBytes(m),x.putBytes(y),t.start(),t.update(x.getBytes());var S=t.digest().getBytes(),A=new Wt.util.ByteBuffer;A.fillWithByte(0,v-s-r-2),A.putByte(1),A.putBytes(y);var B=A.getBytes(),N=v-r-1,F=a.generate(S,N),D="";for(f=0;f<N;f++)D+=String.fromCharCode(B.charCodeAt(f)^F.charCodeAt(f));var R=65280>>8*v-c&255;return D=String.fromCharCode(D.charCodeAt(0)&~R)+D.substr(1),D+S+String.fromCharCode(188)},o.verify=function(u,l,f){var c,v=f-1,m=Math.ceil(v/8);if(l=l.substr(-m),m<r+s+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(l.charCodeAt(m-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=m-r-1,x=l.substr(0,y),S=l.substr(y,r),A=65280>>8*m-v&255;if((x.charCodeAt(0)&A)!==0)throw new Error("Bits beyond keysize not zero as expected.");var B=a.generate(S,y),N="";for(c=0;c<y;c++)N+=String.fromCharCode(x.charCodeAt(c)^B.charCodeAt(c));N=String.fromCharCode(N.charCodeAt(0)&~A)+N.substr(1);var F=m-r-s-2;for(c=0;c<F;c++)if(N.charCodeAt(c)!==0)throw new Error("Leftmost octets not zero as expected");if(N.charCodeAt(F)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var D=N.substr(-s),R=new Wt.util.ByteBuffer;R.fillWithByte(0,8),R.putBytes(u),R.putBytes(D),t.start(),t.update(R.getBytes());var z=t.digest().getBytes();return S===z},o};var k=Y,h=k.asn1,L=k.pki=k.pki||{},q=L.oids,ye={};ye.CN=q.commonName,ye.commonName="CN",ye.C=q.countryName,ye.countryName="C",ye.L=q.localityName,ye.localityName="L",ye.ST=q.stateOrProvinceName,ye.stateOrProvinceName="ST",ye.O=q.organizationName,ye.organizationName="O",ye.OU=q.organizationalUnitName,ye.organizationalUnitName="OU",ye.E=q.emailAddress,ye.emailAddress="E";var Qn=k.pki.rsa.publicKeyValidator,c0={name:"Certificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Qn,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},h0={name:"rsapss",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},d0={name:"CertificationRequestInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Qn,{name:"CertificationRequestInfo.attributes",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0}]}]}]},p0={name:"CertificationRequest",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[d0,{name:"CertificationRequest.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};L.RDNAttributesAsArray=function(e,t){for(var a=[],r,n,s,i=0;i<e.value.length;++i){r=e.value[i];for(var o=0;o<r.value.length;++o)s={},n=r.value[o],s.type=h.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in q&&(s.name=q[s.type],s.name in ye&&(s.shortName=ye[s.name])),t&&(t.update(s.type),t.update(s.value)),a.push(s)}return a},L.CRIAttributesAsArray=function(e){for(var t=[],a=0;a<e.length;++a)for(var r=e[a],n=h.derToOid(r.value[0].value),s=r.value[1].value,i=0;i<s.length;++i){var o={};if(o.type=n,o.value=s[i].value,o.valueTagClass=s[i].type,o.type in q&&(o.name=q[o.type],o.name in ye&&(o.shortName=ye[o.name])),o.type===q.extensionRequest){o.extensions=[];for(var u=0;u<o.value.length;++u)o.extensions.push(L.certificateExtensionFromAsn1(o.value[u]))}t.push(o)}return t};function Lt(e,t){typeof t=="string"&&(t={shortName:t});for(var a=null,r,n=0;a===null&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}var jr=function(e,t,a){var r={};if(e!==q["RSASSA-PSS"])return r;a&&(r={hash:{algorithmOid:q.sha1},mgf:{algorithmOid:q.mgf1,hash:{algorithmOid:q.sha1}},saltLength:20});var n={},s=[];if(!h.validate(t,h0,n,s)){var i=new Error("Cannot read RSASSA-PSS parameter block.");throw i.errors=s,i}return n.hashOid!==void 0&&(r.hash=r.hash||{},r.hash.algorithmOid=h.derToOid(n.hashOid)),n.maskGenOid!==void 0&&(r.mgf=r.mgf||{},r.mgf.algorithmOid=h.derToOid(n.maskGenOid),r.mgf.hash=r.mgf.hash||{},r.mgf.hash.algorithmOid=h.derToOid(n.maskGenHashOid)),n.saltLength!==void 0&&(r.saltLength=n.saltLength.charCodeAt(0)),r};L.certificateFromPem=function(e,t,a){var r=k.pem.decode(e)[0];if(r.type!=="CERTIFICATE"&&r.type!=="X509 CERTIFICATE"&&r.type!=="TRUSTED CERTIFICATE"){var n=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=h.fromDer(r.body,a);return L.certificateFromAsn1(s,t)},L.certificateToPem=function(e,t){var a={type:"CERTIFICATE",body:h.toDer(L.certificateToAsn1(e)).getBytes()};return k.pem.encode(a,{maxline:t})},L.publicKeyFromPem=function(e){var t=k.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var a=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var r=h.fromDer(t.body);return L.publicKeyFromAsn1(r)},L.publicKeyToPem=function(e,t){var a={type:"PUBLIC KEY",body:h.toDer(L.publicKeyToAsn1(e)).getBytes()};return k.pem.encode(a,{maxline:t})},L.publicKeyToRSAPublicKeyPem=function(e,t){var a={type:"RSA PUBLIC KEY",body:h.toDer(L.publicKeyToRSAPublicKey(e)).getBytes()};return k.pem.encode(a,{maxline:t})},L.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||k.md.sha1.create(),r=t.type||"RSAPublicKey",n;switch(r){case"RSAPublicKey":n=h.toDer(L.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":n=h.toDer(L.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}a.start(),a.update(n);var s=a.digest();if(t.encoding==="hex"){var i=s.toHex();return t.delimiter?i.match(/.{2}/g).join(t.delimiter):i}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s},L.certificationRequestFromPem=function(e,t,a){var r=k.pem.decode(e)[0];if(r.type!=="CERTIFICATE REQUEST"){var n=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=h.fromDer(r.body,a);return L.certificationRequestFromAsn1(s,t)},L.certificationRequestToPem=function(e,t){var a={type:"CERTIFICATE REQUEST",body:h.toDer(L.certificationRequestToAsn1(e)).getBytes()};return k.pem.encode(a,{maxline:t})},L.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return Lt(e.issuer,t)},e.issuer.addField=function(t){ft([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return Lt(e.subject,t)},e.subject.addField=function(t){ft([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,a){ft(t),e.subject.attributes=t,delete e.subject.uniqueId,a&&(e.subject.uniqueId=a),e.subject.hash=null},e.setIssuer=function(t,a){ft(t),e.issuer.attributes=t,delete e.issuer.uniqueId,a&&(e.issuer.uniqueId=a),e.issuer.hash=null},e.setExtensions=function(t){for(var a=0;a<t.length;++a)zn(t[a],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var a=null,r,n=0;a===null&&n<e.extensions.length;++n)r=e.extensions[n],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(a=r);return a},e.sign=function(t,a){e.md=a||k.md.sha1.create();var r=q[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.tbsCertificate=L.getTBSCertificate(e);var s=h.toDer(e.tbsCertificate);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var a=!1;if(!e.issued(t)){var r=t.issuer,n=e.subject,s=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 s.expectedIssuer=r.attributes,s.actualIssuer=n.attributes,s}var i=t.md;if(i===null){if(t.signatureOid in q){var o=q[t.signatureOid];switch(o){case"sha1WithRSAEncryption":i=k.md.sha1.create();break;case"md5WithRSAEncryption":i=k.md.md5.create();break;case"sha256WithRSAEncryption":i=k.md.sha256.create();break;case"sha384WithRSAEncryption":i=k.md.sha384.create();break;case"sha512WithRSAEncryption":i=k.md.sha512.create();break;case"RSASSA-PSS":i=k.md.sha256.create();break}}if(i===null){var s=new Error("Could not compute certificate digest. Unknown signature OID.");throw s.signatureOid=t.signatureOid,s}var u=t.tbsCertificate||L.getTBSCertificate(t),l=h.toDer(u);i.update(l.getBytes())}if(i!==null){var f;switch(t.signatureOid){case q.sha1WithRSAEncryption:f=void 0;break;case q["RSASSA-PSS"]:var c,v;if(c=q[t.signatureParameters.mgf.hash.algorithmOid],c===void 0||k.md[c]===void 0){var s=new Error("Unsupported MGF hash function.");throw s.oid=t.signatureParameters.mgf.hash.algorithmOid,s.name=c,s}if(v=q[t.signatureParameters.mgf.algorithmOid],v===void 0||k.mgf[v]===void 0){var s=new Error("Unsupported MGF function.");throw s.oid=t.signatureParameters.mgf.algorithmOid,s.name=v,s}if(v=k.mgf[v].create(k.md[c].create()),c=q[t.signatureParameters.hash.algorithmOid],c===void 0||k.md[c]===void 0)throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:c};f=k.pss.create(k.md[c].create(),v,t.signatureParameters.saltLength);break}a=e.publicKey.verify(i.digest().getBytes(),t.signature,f)}return a},e.isIssuer=function(t){var a=!1,r=e.issuer,n=t.subject;if(r.hash&&n.hash)a=r.hash===n.hash;else if(r.attributes.length===n.attributes.length){a=!0;for(var s,i,o=0;a&&o<r.attributes.length;++o)s=r.attributes[o],i=n.attributes[o],(s.type!==i.type||s.value!==i.value)&&(a=!1)}return a},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return L.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=q.subjectKeyIdentifier,a=0;a<e.extensions.length;++a){var r=e.extensions[a];if(r.id===t){var n=e.generateSubjectKeyIdentifier().getBytes();return k.util.hexToBytes(r.subjectKeyIdentifier)===n}}return!1},e},L.certificateFromAsn1=function(e,t){var a={},r=[];if(!h.validate(e,c0,a,r)){var n=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw n.errors=r,n}var s=h.derToOid(a.publicKeyOid);if(s!==L.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=L.createCertificate();i.version=a.certVersion?a.certVersion.charCodeAt(0):0;var o=k.util.createBuffer(a.certSerialNumber);i.serialNumber=o.toHex(),i.signatureOid=k.asn1.derToOid(a.certSignatureOid),i.signatureParameters=jr(i.signatureOid,a.certSignatureParams,!0),i.siginfo.algorithmOid=k.asn1.derToOid(a.certinfoSignatureOid),i.siginfo.parameters=jr(i.siginfo.algorithmOid,a.certinfoSignatureParams,!1),i.signature=a.certSignature;var u=[];if(a.certValidity1UTCTime!==void 0&&u.push(h.utcTimeToDate(a.certValidity1UTCTime)),a.certValidity2GeneralizedTime!==void 0&&u.push(h.generalizedTimeToDate(a.certValidity2GeneralizedTime)),a.certValidity3UTCTime!==void 0&&u.push(h.utcTimeToDate(a.certValidity3UTCTime)),a.certValidity4GeneralizedTime!==void 0&&u.push(h.generalizedTimeToDate(a.certValidity4GeneralizedTime)),u.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(u.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(i.validity.notBefore=u[0],i.validity.notAfter=u[1],i.tbsCertificate=a.tbsCertificate,t){if(i.md=null,i.signatureOid in q){var s=q[i.signatureOid];switch(s){case"sha1WithRSAEncryption":i.md=k.md.sha1.create();break;case"md5WithRSAEncryption":i.md=k.md.md5.create();break;case"sha256WithRSAEncryption":i.md=k.md.sha256.create();break;case"sha384WithRSAEncryption":i.md=k.md.sha384.create();break;case"sha512WithRSAEncryption":i.md=k.md.sha512.create();break;case"RSASSA-PSS":i.md=k.md.sha256.create();break}}if(i.md===null){var n=new Error("Could not compute certificate digest. Unknown signature OID.");throw n.signatureOid=i.signatureOid,n}var l=h.toDer(i.tbsCertificate);i.md.update(l.getBytes())}var f=k.md.sha1.create();i.issuer.getField=function(v){return Lt(i.issuer,v)},i.issuer.addField=function(v){ft([v]),i.issuer.attributes.push(v)},i.issuer.attributes=L.RDNAttributesAsArray(a.certIssuer,f),a.certIssuerUniqueId&&(i.issuer.uniqueId=a.certIssuerUniqueId),i.issuer.hash=f.digest().toHex();var c=k.md.sha1.create();return i.subject.getField=function(v){return Lt(i.subject,v)},i.subject.addField=function(v){ft([v]),i.subject.attributes.push(v)},i.subject.attributes=L.RDNAttributesAsArray(a.certSubject,c),a.certSubjectUniqueId&&(i.subject.uniqueId=a.certSubjectUniqueId),i.subject.hash=c.digest().toHex(),a.certExtensions?i.extensions=L.certificateExtensionsFromAsn1(a.certExtensions):i.extensions=[],i.publicKey=L.publicKeyFromAsn1(a.subjectPublicKeyInfo),i},L.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var r=e.value[a],n=0;n<r.value.length;++n)t.push(L.certificateExtensionFromAsn1(r.value[n]));return t},L.certificateExtensionFromAsn1=function(e){var t={};if(t.id=h.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===h.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in q){if(t.name=q[t.id],t.name==="keyUsage"){var a=h.fromDer(t.value),r=0,n=0;a.value.length>1&&(r=a.value.charCodeAt(1),n=a.value.length>2?a.value.charCodeAt(2):0),t.digitalSignature=(r&128)===128,t.nonRepudiation=(r&64)===64,t.keyEncipherment=(r&32)===32,t.dataEncipherment=(r&16)===16,t.keyAgreement=(r&8)===8,t.keyCertSign=(r&4)===4,t.cRLSign=(r&2)===2,t.encipherOnly=(r&1)===1,t.decipherOnly=(n&128)===128}else if(t.name==="basicConstraints"){var a=h.fromDer(t.value);a.value.length>0&&a.value[0].type===h.Type.BOOLEAN?t.cA=a.value[0].value.charCodeAt(0)!==0:t.cA=!1;var s=null;a.value.length>0&&a.value[0].type===h.Type.INTEGER?s=a.value[0].value:a.value.length>1&&(s=a.value[1].value),s!==null&&(t.pathLenConstraint=h.derToInteger(s))}else if(t.name==="extKeyUsage")for(var a=h.fromDer(t.value),i=0;i<a.value.length;++i){var o=h.derToOid(a.value[i].value);o in q?t[q[o]]=!0:t[o]=!0}else if(t.name==="nsCertType"){var a=h.fromDer(t.value),r=0;a.value.length>1&&(r=a.value.charCodeAt(1)),t.client=(r&128)===128,t.server=(r&64)===64,t.email=(r&32)===32,t.objsign=(r&16)===16,t.reserved=(r&8)===8,t.sslCA=(r&4)===4,t.emailCA=(r&2)===2,t.objCA=(r&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var u,a=h.fromDer(t.value),l=0;l<a.value.length;++l){u=a.value[l];var f={type:u.type,value:u.value};switch(t.altNames.push(f),u.type){case 1:case 2:case 6:break;case 7:f.ip=k.util.bytesToIP(u.value);break;case 8:f.oid=h.derToOid(u.value);break}}}else if(t.name==="subjectKeyIdentifier"){var a=h.fromDer(t.value);t.subjectKeyIdentifier=k.util.bytesToHex(a.value)}}return t},L.certificationRequestFromAsn1=function(e,t){var a={},r=[];if(!h.validate(e,p0,a,r)){var n=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw n.errors=r,n}var s=h.derToOid(a.publicKeyOid);if(s!==L.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=L.createCertificationRequest();if(i.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,i.signatureOid=k.asn1.derToOid(a.csrSignatureOid),i.signatureParameters=jr(i.signatureOid,a.csrSignatureParams,!0),i.siginfo.algorithmOid=k.asn1.derToOid(a.csrSignatureOid),i.siginfo.parameters=jr(i.siginfo.algorithmOid,a.csrSignatureParams,!1),i.signature=a.csrSignature,i.certificationRequestInfo=a.certificationRequestInfo,t){if(i.md=null,i.signatureOid in q){var s=q[i.signatureOid];switch(s){case"sha1WithRSAEncryption":i.md=k.md.sha1.create();break;case"md5WithRSAEncryption":i.md=k.md.md5.create();break;case"sha256WithRSAEncryption":i.md=k.md.sha256.create();break;case"sha384WithRSAEncryption":i.md=k.md.sha384.create();break;case"sha512WithRSAEncryption":i.md=k.md.sha512.create();break;case"RSASSA-PSS":i.md=k.md.sha256.create();break}}if(i.md===null){var n=new Error("Could not compute certification request digest. Unknown signature OID.");throw n.signatureOid=i.signatureOid,n}var o=h.toDer(i.certificationRequestInfo);i.md.update(o.getBytes())}var u=k.md.sha1.create();return i.subject.getField=function(l){return Lt(i.subject,l)},i.subject.addField=function(l){ft([l]),i.subject.attributes.push(l)},i.subject.attributes=L.RDNAttributesAsArray(a.certificationRequestInfoSubject,u),i.subject.hash=u.digest().toHex(),i.publicKey=L.publicKeyFromAsn1(a.subjectPublicKeyInfo),i.getAttribute=function(l){return Lt(i,l)},i.addAttribute=function(l){ft([l]),i.attributes.push(l)},i.attributes=L.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),i},L.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return Lt(e.subject,t)},e.subject.addField=function(t){ft([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return Lt(e,t)},e.addAttribute=function(t){ft([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){ft(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){ft(t),e.attributes=t},e.sign=function(t,a){e.md=a||k.md.sha1.create();var r=q[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.certificationRequestInfo=L.getCertificationRequestInfo(e);var s=h.toDer(e.certificationRequestInfo);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,a=e.md;if(a===null){if(e.signatureOid in q){var r=q[e.signatureOid];switch(r){case"sha1WithRSAEncryption":a=k.md.sha1.create();break;case"md5WithRSAEncryption":a=k.md.md5.create();break;case"sha256WithRSAEncryption":a=k.md.sha256.create();break;case"sha384WithRSAEncryption":a=k.md.sha384.create();break;case"sha512WithRSAEncryption":a=k.md.sha512.create();break;case"RSASSA-PSS":a=k.md.sha256.create();break}}if(a===null){var n=new Error("Could not compute certification request digest. Unknown signature OID.");throw n.signatureOid=e.signatureOid,n}var s=e.certificationRequestInfo||L.getCertificationRequestInfo(e),i=h.toDer(s);a.update(i.getBytes())}if(a!==null){var o;switch(e.signatureOid){case q.sha1WithRSAEncryption:break;case q["RSASSA-PSS"]:var u,l;if(u=q[e.signatureParameters.mgf.hash.algorithmOid],u===void 0||k.md[u]===void 0){var n=new Error("Unsupported MGF hash function.");throw n.oid=e.signatureParameters.mgf.hash.algorithmOid,n.name=u,n}if(l=q[e.signatureParameters.mgf.algorithmOid],l===void 0||k.mgf[l]===void 0){var n=new Error("Unsupported MGF function.");throw n.oid=e.signatureParameters.mgf.algorithmOid,n.name=l,n}if(l=k.mgf[l].create(k.md[u].create()),u=q[e.signatureParameters.hash.algorithmOid],u===void 0||k.md[u]===void 0){var n=new Error("Unsupported RSASSA-PSS hash function.");throw n.oid=e.signatureParameters.hash.algorithmOid,n.name=u,n}o=k.pss.create(k.md[u].create(),l,e.signatureParameters.saltLength);break}t=e.publicKey.verify(a.digest().getBytes(),e.signature,o)}return t},e};function ur(e){for(var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),a,r,n=e.attributes,s=0;s<n.length;++s){a=n[s];var i=a.value,o=h.Type.PRINTABLESTRING;"valueTagClass"in a&&(o=a.valueTagClass,o===h.Type.UTF8&&(i=k.util.encodeUtf8(i))),r=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.type).getBytes()),h.create(h.Class.UNIVERSAL,o,!1,i)])]),t.value.push(r)}return t}function ft(e){for(var t,a=0;a<e.length;++a){if(t=e[a],typeof t.name>"u"&&(t.type&&t.type in L.oids?t.name=L.oids[t.type]:t.shortName&&t.shortName in ye&&(t.name=L.oids[ye[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in L.oids)t.type=L.oids[t.name];else{var r=new Error("Attribute type not specified.");throw r.attribute=t,r}if(typeof t.shortName>"u"&&t.name&&t.name in ye&&(t.shortName=ye[t.name]),t.type===q.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=h.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(L.certificateExtensionToAsn1(zn(t.extensions[n])))}if(typeof t.value>"u"){var r=new Error("Attribute value not specified.");throw r.attribute=t,r}}}function zn(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in L.oids&&(e.name=L.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in L.oids)e.id=L.oids[e.name];else{var a=new Error("Extension ID not specified.");throw a.extension=e,a}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var r=0,n=0,s=0;e.digitalSignature&&(n|=128,r=7),e.nonRepudiation&&(n|=64,r=6),e.keyEncipherment&&(n|=32,r=5),e.dataEncipherment&&(n|=16,r=4),e.keyAgreement&&(n|=8,r=3),e.keyCertSign&&(n|=4,r=2),e.cRLSign&&(n|=2,r=1),e.encipherOnly&&(n|=1,r=0),e.decipherOnly&&(s|=128,r=7);var i=String.fromCharCode(r);s!==0?i+=String.fromCharCode(n)+String.fromCharCode(s):n!==0&&(i+=String.fromCharCode(n)),e.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,i)}else if(e.name==="basicConstraints")e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var o=e.value.value;for(var u in e)e[u]===!0&&(u in q?o.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(q[u]).getBytes())):u.indexOf(".")!==-1&&o.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(u).getBytes())))}else if(e.name==="nsCertType"){var r=0,n=0;e.client&&(n|=128,r=7),e.server&&(n|=64,r=6),e.email&&(n|=32,r=5),e.objsign&&(n|=16,r=4),e.reserved&&(n|=8,r=3),e.sslCA&&(n|=4,r=2),e.emailCA&&(n|=2,r=1),e.objCA&&(n|=1,r=0);var i=String.fromCharCode(r);n!==0&&(i+=String.fromCharCode(n)),e.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,i)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);for(var l,f=0;f<e.altNames.length;++f){l=e.altNames[f];var i=l.value;if(l.type===7&&l.ip){if(i=k.util.bytesFromIP(l.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else l.type===8&&(l.oid?i=h.oidToDer(h.oidToDer(l.oid)):i=h.oidToDer(i));e.value.value.push(h.create(h.Class.CONTEXT_SPECIFIC,l.type,!1,i))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=h.create(h.Class.UNIVERSAL,h.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var c=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=c.toHex(),e.value=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,c.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var o=e.value.value;if(e.keyIdentifier){var v=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;o.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!1,v))}if(e.authorityCertIssuer){var m=[h.create(h.Class.CONTEXT_SPECIFIC,4,!0,[ur(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];o.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var y=k.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);o.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(e.name==="cRLDistributionPoints"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);for(var o=e.value.value,x=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),S=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]),l,f=0;f<e.altNames.length;++f){l=e.altNames[f];var i=l.value;if(l.type===7&&l.ip){if(i=k.util.bytesFromIP(l.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else l.type===8&&(l.oid?i=h.oidToDer(h.oidToDer(l.oid)):i=h.oidToDer(i));S.value.push(h.create(h.Class.CONTEXT_SPECIFIC,l.type,!1,i))}x.value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[S])),o.push(x)}if(typeof e.value>"u"){var a=new Error("Extension value not specified.");throw a.extension=e,a}return e}function ba(e,t){switch(e){case q["RSASSA-PSS"]:var a=[];return t.hash.algorithmOid!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.mgf.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.mgf.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(t.saltLength).getBytes())])),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,a);default:return h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")}}function v0(e){var t=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var a=e.attributes,r=0;r<a.length;++r){var n=a[r],s=n.value,i=h.Type.UTF8;"valueTagClass"in n&&(i=n.valueTagClass),i===h.Type.UTF8&&(s=k.util.encodeUtf8(s));var o=!1;"valueConstructed"in n&&(o=n.valueConstructed);var u=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(n.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,i,o,s)])]);t.value.push(u)}return t}var y0=new Date("1950-01-01T00:00:00Z"),g0=new Date("2050-01-01T00:00:00Z");function Yn(e){return e>=y0&&e<g0?h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(e)):h.create(h.Class.UNIVERSAL,h.Type.GENERALIZEDTIME,!1,h.dateToGeneralizedTime(e))}L.getTBSCertificate=function(e){var t=Yn(e.validity.notBefore),a=Yn(e.validity.notAfter),r=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes())]),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,k.util.hexToBytes(e.serialNumber)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.siginfo.algorithmOid).getBytes()),ba(e.siginfo.algorithmOid,e.siginfo.parameters)]),ur(e.issuer),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,a]),ur(e.subject),L.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&r.value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&r.value.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&r.value.push(L.certificateExtensionsToAsn1(e.extensions)),r},L.getCertificationRequestInfo=function(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),ur(e.subject),L.publicKeyToAsn1(e.publicKey),v0(e)]);return t},L.distinguishedNameToAsn1=function(e){return ur(e)},L.certificateToAsn1=function(e){var t=e.tbsCertificate||L.getTBSCertificate(e);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureOid).getBytes()),ba(e.signatureOid,e.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},L.certificateExtensionsToAsn1=function(e){var t=h.create(h.Class.CONTEXT_SPECIFIC,3,!0,[]),a=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);t.value.push(a);for(var r=0;r<e.length;++r)a.value.push(L.certificateExtensionToAsn1(e[r]));return t},L.certificateExtensionToAsn1=function(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.id).getBytes())),e.critical&&t.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,String.fromCharCode(255)));var a=e.value;return typeof e.value!="string"&&(a=h.toDer(a).getBytes()),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,a)),t},L.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||L.getCertificationRequestInfo(e);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureOid).getBytes()),ba(e.signatureOid,e.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},L.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(i){var o=a(i.issuer);return o},t.addCertificate=function(i){if(typeof i=="string"&&(i=k.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))if(i.subject.hash in t.certs){var o=t.certs[i.subject.hash];k.util.isArray(o)||(o=[o]),o.push(i),t.certs[i.subject.hash]=o}else t.certs[i.subject.hash]=i},t.hasCertificate=function(i){typeof i=="string"&&(i=k.pki.certificateFromPem(i));var o=a(i.subject);if(!o)return!1;k.util.isArray(o)||(o=[o]);for(var u=h.toDer(L.certificateToAsn1(i)).getBytes(),l=0;l<o.length;++l){var f=h.toDer(L.certificateToAsn1(o[l])).getBytes();if(u===f)return!0}return!1},t.listAllCertificates=function(){var i=[];for(var o in t.certs)if(t.certs.hasOwnProperty(o)){var u=t.certs[o];if(!k.util.isArray(u))i.push(u);else for(var l=0;l<u.length;++l)i.push(u[l])}return i},t.removeCertificate=function(i){var o;if(typeof i=="string"&&(i=k.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))return null;var u=a(i.subject);if(!k.util.isArray(u))return o=t.certs[i.subject.hash],delete t.certs[i.subject.hash],o;for(var l=h.toDer(L.certificateToAsn1(i)).getBytes(),f=0;f<u.length;++f){var c=h.toDer(L.certificateToAsn1(u[f])).getBytes();l===c&&(o=u[f],u.splice(f,1))}return u.length===0&&delete t.certs[i.subject.hash],o};function a(i){return r(i),t.certs[i.hash]||null}function r(i){if(!i.hash){var o=k.md.sha1.create();i.attributes=L.RDNAttributesAsArray(ur(i),o),i.hash=o.digest().toHex()}}if(e)for(var n=0;n<e.length;++n){var s=e[n];t.addCertificate(s)}return t},L.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"},L.verifyCertificateChain=function(e,t,a){typeof a=="function"&&(a={verify:a}),a=a||{},t=t.slice(0);var r=t.slice(0),n=a.validityCheckDate;typeof n>"u"&&(n=new Date);var s=!0,i=null,o=0;do{var u=t.shift(),l=null,f=!1;if(n&&(n<u.validity.notBefore||n>u.validity.notAfter)&&(i={message:"Certificate is not valid yet or has expired.",error:L.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:n}),i===null){if(l=t[0]||e.getIssuer(u),l===null&&u.isIssuer(u)&&(f=!0,l=u),l){var c=l;k.util.isArray(c)||(c=[c]);for(var v=!1;!v&&c.length>0;){l=c.shift();try{v=l.verify(u)}catch{}}v||(i={message:"Certificate signature is invalid.",error:L.certificateError.bad_certificate})}i===null&&(!l||f)&&!e.hasCertificate(u)&&(i={message:"Certificate is not trusted.",error:L.certificateError.unknown_ca})}if(i===null&&l&&!u.isIssuer(l)&&(i={message:"Certificate issuer is invalid.",error:L.certificateError.bad_certificate}),i===null)for(var m={keyUsage:!0,basicConstraints:!0},y=0;i===null&&y<u.extensions.length;++y){var x=u.extensions[y];x.critical&&!(x.name in m)&&(i={message:"Certificate has an unsupported critical extension.",error:L.certificateError.unsupported_certificate})}if(i===null&&(!s||t.length===0&&(!l||f))){var S=u.getExtension("basicConstraints"),A=u.getExtension("keyUsage");if(A!==null&&(!A.keyCertSign||S===null)&&(i={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:L.certificateError.bad_certificate}),i===null&&S!==null&&!S.cA&&(i={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:L.certificateError.bad_certificate}),i===null&&A!==null&&"pathLenConstraint"in S){var B=o-1;B>S.pathLenConstraint&&(i={message:"Certificate basicConstraints pathLenConstraint violated.",error:L.certificateError.bad_certificate})}}var N=i===null?!0:i.error,F=a.verify?a.verify(N,o,r):N;if(F===!0)i=null;else throw N===!0&&(i={message:"The application rejected the certificate.",error:L.certificateError.bad_certificate}),(F||F===0)&&(typeof F=="object"&&!k.util.isArray(F)?(F.message&&(i.message=F.message),F.error&&(i.error=F.error)):typeof F=="string"&&(i.error=F)),i;s=!1,++o}while(t.length>0);return!0};var ce=Y,g=ce.asn1,X=ce.pki,Tr=ce.pkcs12=ce.pkcs12||{},Wn={name:"ContentInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:g.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},m0={name:"PFX",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"version"},Wn,{name:"PFX.macData",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:g.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},C0={name:"SafeBag",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:g.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:g.Class.UNIVERSAL,type:g.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},E0={name:"Attribute",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:g.Class.UNIVERSAL,type:g.Type.SET,constructed:!0,capture:"values"}]},x0={name:"CertBag",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:g.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:g.Class.UNIVERSAL,type:g.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Ar(e,t,a,r){for(var n=[],s=0;s<e.length;s++)for(var i=0;i<e[s].safeBags.length;i++){var o=e[s].safeBags[i];if(!(r!==void 0&&o.type!==r)){if(t===null){n.push(o);continue}o.attributes[t]!==void 0&&o.attributes[t].indexOf(a)>=0&&n.push(o)}}return n}Tr.pkcs12FromAsn1=function(e,t,a){typeof t=="string"?(a=t,t=!0):t===void 0&&(t=!0);var r={},n=[];if(!g.validate(e,m0,r,n)){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var i={version:r.version.charCodeAt(0),safeContents:[],getBags:function(S){var A={},B;return"localKeyId"in S?B=S.localKeyId:"localKeyIdHex"in S&&(B=ce.util.hexToBytes(S.localKeyIdHex)),B===void 0&&!("friendlyName"in S)&&"bagType"in S&&(A[S.bagType]=Ar(i.safeContents,null,null,S.bagType)),B!==void 0&&(A.localKeyId=Ar(i.safeContents,"localKeyId",B,S.bagType)),"friendlyName"in S&&(A.friendlyName=Ar(i.safeContents,"friendlyName",S.friendlyName,S.bagType)),A},getBagsByFriendlyName:function(S,A){return Ar(i.safeContents,"friendlyName",S,A)},getBagsByLocalKeyId:function(S,A){return Ar(i.safeContents,"localKeyId",S,A)}};if(r.version.charCodeAt(0)!==3){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=r.version.charCodeAt(0),s}if(g.derToOid(r.contentType)!==X.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=g.derToOid(r.contentType),s}var o=r.content.value[0];if(o.tagClass!==g.Class.UNIVERSAL||o.type!==g.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=_a(o),r.mac){var u=null,l=0,f=g.derToOid(r.macAlgorithm);switch(f){case X.oids.sha1:u=ce.md.sha1.create(),l=20;break;case X.oids.sha256:u=ce.md.sha256.create(),l=32;break;case X.oids.sha384:u=ce.md.sha384.create(),l=48;break;case X.oids.sha512:u=ce.md.sha512.create(),l=64;break;case X.oids.md5:u=ce.md.md5.create(),l=16;break}if(u===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+f);var c=new ce.util.ByteBuffer(r.macSalt),v="macIterations"in r?parseInt(ce.util.bytesToHex(r.macIterations),16):1,m=Tr.generateKey(a,c,3,v,l,u),y=ce.hmac.create();y.start(u,m),y.update(o.value);var x=y.getMac();if(x.getBytes()!==r.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return S0(i,o.value,t,a),i};function _a(e){if(e.composed||e.constructed){for(var t=ce.util.createBuffer(),a=0;a<e.value.length;++a)t.putBytes(e.value[a].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function S0(e,t,a,r){if(t=g.fromDer(t,a),t.tagClass!==g.Class.UNIVERSAL||t.type!==g.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var n=0;n<t.value.length;n++){var s=t.value[n],i={},o=[];if(!g.validate(s,Wn,i,o)){var u=new Error("Cannot read ContentInfo.");throw u.errors=o,u}var l={encrypted:!1},f=null,c=i.content.value[0];switch(g.derToOid(i.contentType)){case X.oids.data:if(c.tagClass!==g.Class.UNIVERSAL||c.type!==g.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");f=_a(c).value;break;case X.oids.encryptedData:f=T0(c,r),l.encrypted=!0;break;default:var u=new Error("Unsupported PKCS#12 contentType.");throw u.contentType=g.derToOid(i.contentType),u}l.safeBags=A0(f,a,r),e.safeContents.push(l)}}function T0(e,t){var a={},r=[];if(!g.validate(e,ce.pkcs7.asn1.encryptedDataValidator,a,r)){var n=new Error("Cannot read EncryptedContentInfo.");throw n.errors=r,n}var s=g.derToOid(a.contentType);if(s!==X.oids.data){var n=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw n.oid=s,n}s=g.derToOid(a.encAlgorithm);var i=X.pbe.getCipher(s,a.encParameter,t),o=_a(a.encryptedContentAsn1),u=ce.util.createBuffer(o.value);if(i.update(u),!i.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return i.output.getBytes()}function A0(e,t,a){if(!t&&e.length===0)return[];if(e=g.fromDer(e,t),e.tagClass!==g.Class.UNIVERSAL||e.type!==g.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var r=[],n=0;n<e.value.length;n++){var s=e.value[n],i={},o=[];if(!g.validate(s,C0,i,o)){var u=new Error("Cannot read SafeBag.");throw u.errors=o,u}var l={type:g.derToOid(i.bagId),attributes:I0(i.bagAttributes)};r.push(l);var f,c,v=i.bagValue.value[0];switch(l.type){case X.oids.pkcs8ShroudedKeyBag:if(v=X.decryptPrivateKeyInfo(v,a),v===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case X.oids.keyBag:try{l.key=X.privateKeyFromAsn1(v)}catch{l.key=null,l.asn1=v}continue;case X.oids.certBag:f=x0,c=function(){if(g.derToOid(i.certId)!==X.oids.x509Certificate){var y=new Error("Unsupported certificate type, only X.509 supported.");throw y.oid=g.derToOid(i.certId),y}var x=g.fromDer(i.cert,t);try{l.cert=X.certificateFromAsn1(x,!0)}catch{l.cert=null,l.asn1=x}};break;default:var u=new Error("Unsupported PKCS#12 SafeBag type.");throw u.oid=l.type,u}if(f!==void 0&&!g.validate(v,f,i,o)){var u=new Error("Cannot read PKCS#12 "+f.name);throw u.errors=o,u}c()}return r}function I0(e){var t={};if(e!==void 0)for(var a=0;a<e.length;++a){var r={},n=[];if(!g.validate(e[a],E0,r,n)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=n,s}var i=g.derToOid(r.oid);if(X.oids[i]!==void 0){t[X.oids[i]]=[];for(var o=0;o<r.values.length;++o)t[X.oids[i]].push(r.values[o].value)}}return t}Tr.toPkcs12Asn1=function(e,t,a,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||r.encAlgorithm||"aes128","useMac"in r||(r.useMac=!0),"localKeyId"in r||(r.localKeyId=null),"generateLocalKeyId"in r||(r.generateLocalKeyId=!0);var n=r.localKeyId,s;if(n!==null)n=ce.util.hexToBytes(n);else if(r.generateLocalKeyId)if(t){var i=ce.util.isArray(t)?t[0]:t;typeof i=="string"&&(i=X.certificateFromPem(i));var o=ce.md.sha1.create();o.update(g.toDer(X.certificateToAsn1(i)).getBytes()),n=o.digest().getBytes()}else n=ce.random.getBytes(20);var u=[];n!==null&&u.push(g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.localKeyId).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,n)])])),"friendlyName"in r&&u.push(g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.friendlyName).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,g.Type.BMPSTRING,!1,r.friendlyName)])])),u.length>0&&(s=g.create(g.Class.UNIVERSAL,g.Type.SET,!0,u));var l=[],f=[];t!==null&&(ce.util.isArray(t)?f=t:f=[t]);for(var c=[],v=0;v<f.length;++v){t=f[v],typeof t=="string"&&(t=X.certificateFromPem(t));var m=v===0?s:void 0,y=X.certificateToAsn1(t),x=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.certBag).getBytes()),g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.x509Certificate).getBytes()),g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(y).getBytes())])])]),m]);c.push(x)}if(c.length>0){var S=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,c),A=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.data).getBytes()),g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(S).getBytes())])]);l.push(A)}var B=null;if(e!==null){var N=X.wrapRsaPrivateKey(X.privateKeyToAsn1(e));a===null?B=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.keyBag).getBytes()),g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[N]),s]):B=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.pkcs8ShroudedKeyBag).getBytes()),g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[X.encryptPrivateKeyInfo(N,a,r)]),s]);var F=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[B]),D=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.data).getBytes()),g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(F).getBytes())])]);l.push(D)}var R=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,l),z;if(r.useMac){var o=ce.md.sha1.create(),J=new ce.util.ByteBuffer(ce.random.getBytes(r.saltSize)),ie=r.count,e=Tr.generateKey(a,J,3,ie,20),oe=ce.hmac.create();oe.start(o,e),oe.update(g.toDer(R).getBytes());var ue=oe.getMac();z=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.sha1).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,ue.getBytes())]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,J.getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(ie).getBytes())])}return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(3).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(X.oids.data).getBytes()),g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(R).getBytes())])]),z])},Tr.generateKey=ce.pbe.generatePkcs12Key;var Dt=Y,Na=Dt.asn1,lr=Dt.pki=Dt.pki||{};lr.pemToDer=function(e){var t=Dt.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return Dt.util.createBuffer(t.body)},lr.privateKeyFromPem=function(e){var t=Dt.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var a=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var r=Na.fromDer(t.body);return lr.privateKeyFromAsn1(r)},lr.privateKeyToPem=function(e,t){var a={type:"RSA PRIVATE KEY",body:Na.toDer(lr.privateKeyToAsn1(e)).getBytes()};return Dt.pem.encode(a,{maxline:t})},lr.privateKeyInfoToPem=function(e,t){var a={type:"PRIVATE KEY",body:Na.toDer(e).getBytes()};return Dt.pem.encode(a,{maxline:t})};var _=Y,Xr=function(e,t,a,r){var n=_.util.createBuffer(),s=e.length>>1,i=s+(e.length&1),o=e.substr(0,i),u=e.substr(s,i),l=_.util.createBuffer(),f=_.hmac.create();a=t+a;var c=Math.ceil(r/16),v=Math.ceil(r/20);f.start("MD5",o);var m=_.util.createBuffer();l.putBytes(a);for(var y=0;y<c;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+a),m.putBuffer(f.digest());f.start("SHA1",u);var x=_.util.createBuffer();l.clear(),l.putBytes(a);for(var y=0;y<v;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+a),x.putBuffer(f.digest());return n.putBytes(_.util.xorBytes(m.getBytes(),x.getBytes(),r)),n},B0=function(e,t,a){var r=_.hmac.create();r.start("SHA1",e);var n=_.util.createBuffer();return n.putInt32(t[0]),n.putInt32(t[1]),n.putByte(a.type),n.putByte(a.version.major),n.putByte(a.version.minor),n.putInt16(a.length),n.putBytes(a.fragment.bytes()),r.update(n.getBytes()),r.digest().getBytes()},b0=function(e,t,a){var r=!1;try{var n=e.deflate(t.fragment.getBytes());t.fragment=_.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},_0=function(e,t,a){var r=!1;try{var n=e.inflate(t.fragment.getBytes());t.fragment=_.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},nt=function(e,t){var a=0;switch(t){case 1:a=e.getByte();break;case 2:a=e.getInt16();break;case 3:a=e.getInt24();break;case 4:a=e.getInt32();break}return _.util.createBuffer(e.getBytes(a))},ct=function(e,t,a){e.putInt(a.length(),t<<3),e.putBuffer(a)},p={};p.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},p.SupportedVersions=[p.Versions.TLS_1_1,p.Versions.TLS_1_0],p.Version=p.SupportedVersions[0],p.MaxFragment=16384-1024,p.ConnectionEnd={server:0,client:1},p.PRFAlgorithm={tls_prf_sha256:0},p.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},p.CipherType={stream:0,block:1,aead:2},p.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},p.CompressionMethod={none:0,deflate:1},p.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},p.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},p.Alert={},p.Alert.Level={warning:1,fatal:2},p.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},p.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},p.CipherSuites={},p.getCipherSuite=function(e){var t=null;for(var a in p.CipherSuites){var r=p.CipherSuites[a];if(r.id[0]===e.charCodeAt(0)&&r.id[1]===e.charCodeAt(1)){t=r;break}}return t},p.handleUnexpected=function(e,t){var a=!e.open&&e.entity===p.ConnectionEnd.client;a||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unexpected_message}})},p.handleHelloRequest=function(e,t,a){!e.handshaking&&e.handshakes>0&&(p.queue(e,p.createAlert(e,{level:p.Alert.Level.warning,description:p.Alert.Description.no_renegotiation})),p.flush(e)),e.process()},p.parseHelloMessage=function(e,t,a){var r=null,n=e.entity===p.ConnectionEnd.client;if(a<38)e.error(e,{message:n?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});else{var s=t.fragment,i=s.length();if(r={version:{major:s.getByte(),minor:s.getByte()},random:_.util.createBuffer(s.getBytes(32)),session_id:nt(s,1),extensions:[]},n?(r.cipher_suite=s.getBytes(2),r.compression_method=s.getByte()):(r.cipher_suites=nt(s,2),r.compression_methods=nt(s,1)),i=a-(i-s.length()),i>0){for(var o=nt(s,2);o.length()>0;)r.extensions.push({type:[o.getByte(),o.getByte()],data:nt(o,2)});if(!n)for(var u=0;u<r.extensions.length;++u){var l=r.extensions[u];if(l.type[0]===0&&l.type[1]===0)for(var f=nt(l.data,2);f.length()>0;){var c=f.getByte();if(c!==0)break;e.session.extensions.server_name.serverNameList.push(nt(f,2).getBytes())}}}if(e.session.version&&(r.version.major!==e.session.version.major||r.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}});if(n)e.session.cipherSuite=p.getCipherSuite(r.cipher_suite);else for(var v=_.util.createBuffer(r.cipher_suites.bytes());v.length()>0&&(e.session.cipherSuite=p.getCipherSuite(v.getBytes(2)),e.session.cipherSuite===null););if(e.session.cipherSuite===null)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.handshake_failure},cipherSuite:_.util.bytesToHex(r.cipher_suite)});n?e.session.compressionMethod=r.compression_method:e.session.compressionMethod=p.CompressionMethod.none}return r},p.createSecurityParameters=function(e,t){var a=e.entity===p.ConnectionEnd.client,r=t.random.bytes(),n=a?e.session.sp.client_random:r,s=a?r:p.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:p.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:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:s}},p.handleServerHello=function(e,t,a){var r=p.parseHelloMessage(e,t,a);if(!e.fail){if(r.version.minor<=e.version.minor)e.version.minor=r.version.minor;else return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}});e.session.version=e.version;var n=r.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=Xn,e.session.resuming=!0,e.session.sp.server_random=r.random.bytes()):(e.expect=w0,e.session.resuming=!1,p.createSecurityParameters(e,r)),e.session.id=n,e.process()}},p.handleClientHello=function(e,t,a){var r=p.parseHelloMessage(e,t,a);if(!e.fail){var n=r.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(n),s===null?n="":(s.version.major!==r.version.major||s.version.minor>r.version.minor)&&(s=null,n="")),n.length===0&&(n=_.random.getBytes(32)),e.session.id=n,e.session.clientHelloVersion=r.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var i,o=1;o<p.SupportedVersions.length&&(i=p.SupportedVersions[o],!(i.minor<=r.version.minor));++o);e.version={major:i.major,minor:i.minor},e.session.version=e.version}s!==null?(e.expect=Ra,e.session.resuming=!0,e.session.sp.client_random=r.random.bytes()):(e.expect=e.verifyClient!==!1?V0:wa,e.session.resuming=!1,p.createSecurityParameters(e,r)),e.open=!0,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerHello(e)})),e.session.resuming?(p.queue(e,p.createRecord(e,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),e.state.pending=p.createConnectionState(e),e.state.current.write=e.state.pending.write,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createFinished(e)}))):(p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificate(e)})),e.fail||(p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerKeyExchange(e)})),e.verifyClient!==!1&&p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificateRequest(e)})),p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerHelloDone(e)})))),p.flush(e),e.process()}},p.handleCertificate=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_list:nt(r,3)},s,i,o=[];try{for(;n.certificate_list.length()>0;)s=nt(n.certificate_list,3),i=_.asn1.fromDer(s),s=_.pki.certificateFromAsn1(i,!0),o.push(s)}catch(l){return e.error(e,{message:"Could not parse certificate list.",cause:l,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate}})}var u=e.entity===p.ConnectionEnd.client;(u||e.verifyClient===!0)&&o.length===0?e.error(e,{message:u?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}}):o.length===0?e.expect=u?jn:wa:(u?e.session.serverCertificate=o[0]:e.session.clientCertificate=o[0],p.verifyCertificateChain(e,o)&&(e.expect=u?jn:wa)),e.process()},p.handleServerKeyExchange=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unsupported_certificate}});e.expect=R0,e.process()},p.handleClientKeyExchange=function(e,t,a){if(a<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unsupported_certificate}});var r=t.fragment,n={enc_pre_master_secret:nt(r,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=_.pki.privateKeyFromPem(s)}catch(u){e.error(e,{message:"Could not get private key.",cause:u,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}})}if(s===null)return e.error(e,{message:"No private key set.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}});try{var i=e.session.sp;i.pre_master_secret=s.decrypt(n.enc_pre_master_secret);var o=e.session.clientHelloVersion;if(o.major!==i.pre_master_secret.charCodeAt(0)||o.minor!==i.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{i.pre_master_secret=_.random.getBytes(48)}e.expect=Ra,e.session.clientCertificate!==null&&(e.expect=F0),e.process()},p.handleCertificateRequest=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_types:nt(r,1),certificate_authorities:nt(r,2)};e.session.certificateRequest=n,e.expect=L0,e.process()},p.handleCertificateVerify=function(e,t,a){if(a<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s={signature:nt(r,2).getBytes()},i=_.util.createBuffer();i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest()),i=i.getBytes();try{var o=e.session.clientCertificate;if(!o.publicKey.verify(i,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(n),e.session.sha1.update(n)}catch{return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.handshake_failure}})}e.expect=Ra,e.process()},p.handleServerHelloDone=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.record_overflow}});if(e.serverCertificate===null){var r={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.insufficient_security}},n=0,s=e.verify(e,r.alert.description,n,[]);if(s!==!0)return(s||s===0)&&(typeof s=="object"&&!_.util.isArray(s)?(s.message&&(r.message=s.message),s.alert&&(r.alert.description=s.alert)):typeof s=="number"&&(r.alert.description=s)),e.error(e,r)}e.session.certificateRequest!==null&&(t=p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificate(e)}),p.queue(e,t)),t=p.createRecord(e,{type:p.ContentType.handshake,data:p.createClientKeyExchange(e)}),p.queue(e,t),e.expect=U0;var i=function(o,u){o.session.certificateRequest!==null&&o.session.clientCertificate!==null&&p.queue(o,p.createRecord(o,{type:p.ContentType.handshake,data:p.createCertificateVerify(o,u)})),p.queue(o,p.createRecord(o,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),o.state.pending=p.createConnectionState(o),o.state.current.write=o.state.pending.write,p.queue(o,p.createRecord(o,{type:p.ContentType.handshake,data:p.createFinished(o)})),o.expect=Xn,p.flush(o),o.process()};if(e.session.certificateRequest===null||e.session.clientCertificate===null)return i(e,null);p.getClientSignature(e,i)},p.handleChangeCipherSpec=function(e,t){if(t.fragment.getByte()!==1)return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var a=e.entity===p.ConnectionEnd.client;(e.session.resuming&&a||!e.session.resuming&&!a)&&(e.state.pending=p.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&a||e.session.resuming&&!a)&&(e.state.pending=null),e.expect=a?D0:O0,e.process()},p.handleFinished=function(e,t,a){var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s=t.fragment.getBytes();r=_.util.createBuffer(),r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest());var i=e.entity===p.ConnectionEnd.client,o=i?"server finished":"client finished",u=e.session.sp,l=12,f=Xr;if(r=f(u.master_secret,o,r.getBytes(),l),r.getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.decrypt_error}});e.session.md5.update(n),e.session.sha1.update(n),(e.session.resuming&&i||!e.session.resuming&&!i)&&(p.queue(e,p.createRecord(e,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createFinished(e)}))),e.expect=i?k0:K0,e.handshaking=!1,++e.handshakes,e.peerCertificate=i?e.session.serverCertificate:e.session.clientCertificate,p.flush(e),e.isConnected=!0,e.connected(e),e.process()},p.handleAlert=function(e,t){var a=t.fragment,r={level:a.getByte(),description:a.getByte()},n;switch(r.description){case p.Alert.Description.close_notify:n="Connection closed.";break;case p.Alert.Description.unexpected_message:n="Unexpected message.";break;case p.Alert.Description.bad_record_mac:n="Bad record MAC.";break;case p.Alert.Description.decryption_failed:n="Decryption failed.";break;case p.Alert.Description.record_overflow:n="Record overflow.";break;case p.Alert.Description.decompression_failure:n="Decompression failed.";break;case p.Alert.Description.handshake_failure:n="Handshake failure.";break;case p.Alert.Description.bad_certificate:n="Bad certificate.";break;case p.Alert.Description.unsupported_certificate:n="Unsupported certificate.";break;case p.Alert.Description.certificate_revoked:n="Certificate revoked.";break;case p.Alert.Description.certificate_expired:n="Certificate expired.";break;case p.Alert.Description.certificate_unknown:n="Certificate unknown.";break;case p.Alert.Description.illegal_parameter:n="Illegal parameter.";break;case p.Alert.Description.unknown_ca:n="Unknown certificate authority.";break;case p.Alert.Description.access_denied:n="Access denied.";break;case p.Alert.Description.decode_error:n="Decode error.";break;case p.Alert.Description.decrypt_error:n="Decrypt error.";break;case p.Alert.Description.export_restriction:n="Export restriction.";break;case p.Alert.Description.protocol_version:n="Unsupported protocol version.";break;case p.Alert.Description.insufficient_security:n="Insufficient security.";break;case p.Alert.Description.internal_error:n="Internal error.";break;case p.Alert.Description.user_canceled:n="User canceled.";break;case p.Alert.Description.no_renegotiation:n="Renegotiation not supported.";break;default:n="Unknown error.";break}if(r.description===p.Alert.Description.close_notify)return e.close();e.error(e,{message:n,send:!1,origin:e.entity===p.ConnectionEnd.client?"server":"client",alert:r}),e.process()},p.handleHandshake=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt24();if(n>a.length())return e.fragmented=t,t.fragment=_.util.createBuffer(),a.read-=4,e.process();e.fragmented=null,a.read-=4;var s=a.bytes(n+4);a.read+=4,r in Zr[e.entity][e.expect]?(e.entity===p.ConnectionEnd.server&&!e.open&&!e.fail&&(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:_.md.md5.create(),sha1:_.md.sha1.create()}),r!==p.HandshakeType.hello_request&&r!==p.HandshakeType.certificate_verify&&r!==p.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),Zr[e.entity][e.expect][r](e,t,n)):p.handleUnexpected(e,t)},p.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},p.handleHeartbeat=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt16(),s=a.getBytes(n);if(r===p.HeartbeatMessageType.heartbeat_request){if(e.handshaking||n>s.length)return e.process();p.queue(e,p.createRecord(e,{type:p.ContentType.heartbeat,data:p.createHeartbeat(p.HeartbeatMessageType.heartbeat_response,s)})),p.flush(e)}else if(r===p.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,_.util.createBuffer(s))}e.process()};var N0=0,w0=1,jn=2,R0=3,L0=4,Xn=5,D0=6,k0=7,U0=8,P0=0,V0=1,wa=2,F0=3,Ra=4,O0=5,K0=6,d=p.handleUnexpected,$n=p.handleChangeCipherSpec,we=p.handleAlert,$e=p.handleHandshake,Zn=p.handleApplicationData,Re=p.handleHeartbeat,La=[];La[p.ConnectionEnd.client]=[[d,we,$e,d,Re],[d,we,$e,d,Re],[d,we,$e,d,Re],[d,we,$e,d,Re],[d,we,$e,d,Re],[$n,we,d,d,Re],[d,we,$e,d,Re],[d,we,$e,Zn,Re],[d,we,$e,d,Re]],La[p.ConnectionEnd.server]=[[d,we,$e,d,Re],[d,we,$e,d,Re],[d,we,$e,d,Re],[d,we,$e,d,Re],[$n,we,d,d,Re],[d,we,$e,d,Re],[d,we,$e,Zn,Re],[d,we,$e,d,Re]];var kt=p.handleHelloRequest,M0=p.handleServerHello,Jn=p.handleCertificate,ei=p.handleServerKeyExchange,Da=p.handleCertificateRequest,$r=p.handleServerHelloDone,ti=p.handleFinished,Zr=[];Zr[p.ConnectionEnd.client]=[[d,d,M0,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[kt,d,d,d,d,d,d,d,d,d,d,Jn,ei,Da,$r,d,d,d,d,d,d],[kt,d,d,d,d,d,d,d,d,d,d,d,ei,Da,$r,d,d,d,d,d,d],[kt,d,d,d,d,d,d,d,d,d,d,d,d,Da,$r,d,d,d,d,d,d],[kt,d,d,d,d,d,d,d,d,d,d,d,d,d,$r,d,d,d,d,d,d],[kt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[kt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,ti],[kt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[kt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d]];var H0=p.handleClientHello,q0=p.handleClientKeyExchange,G0=p.handleCertificateVerify;Zr[p.ConnectionEnd.server]=[[d,H0,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,Jn,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,q0,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,G0,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,ti],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d]],p.generateKeys=function(e,t){var a=Xr,r=t.client_random+t.server_random;e.session.resuming||(t.master_secret=a(t.pre_master_secret,"master secret",r,48).bytes(),t.pre_master_secret=null),r=t.server_random+t.client_random;var n=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===p.Versions.TLS_1_0.major&&e.version.minor===p.Versions.TLS_1_0.minor;s&&(n+=2*t.fixed_iv_length);var i=a(t.master_secret,"key expansion",r,n),o={client_write_MAC_key:i.getBytes(t.mac_key_length),server_write_MAC_key:i.getBytes(t.mac_key_length),client_write_key:i.getBytes(t.enc_key_length),server_write_key:i.getBytes(t.enc_key_length)};return s&&(o.client_write_IV=i.getBytes(t.fixed_iv_length),o.server_write_IV=i.getBytes(t.fixed_iv_length)),o},p.createConnectionState=function(e){var t=e.entity===p.ConnectionEnd.client,a=function(){var s={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(i){return!0},compressionState:null,compressFunction:function(i){return!0},updateSequenceNumber:function(){s.sequenceNumber[1]===4294967295?(s.sequenceNumber[1]=0,++s.sequenceNumber[0]):++s.sequenceNumber[1]}};return s},r={read:a(),write:a()};if(r.read.update=function(s,i){return r.read.cipherFunction(i,r.read)?r.read.compressFunction(s,i,r.read)||s.error(s,{message:"Could not decompress record.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.decompression_failure}}):s.error(s,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_record_mac}}),!s.fail},r.write.update=function(s,i){return r.write.compressFunction(s,i,r.write)?r.write.cipherFunction(i,r.write)||s.error(s,{message:"Could not encrypt record.",send:!1,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}):s.error(s,{message:"Could not compress record.",send:!1,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}),!s.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=p.generateKeys(e,n),r.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,r.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(r,e,n),n.compression_algorithm){case p.CompressionMethod.none:break;case p.CompressionMethod.deflate:r.read.compressFunction=_0,r.write.compressFunction=b0;break;default:throw new Error("Unsupported compression algorithm.")}}return r},p.createRandom=function(){var e=new Date,t=+e+e.getTimezoneOffset()*6e4,a=_.util.createBuffer();return a.putInt32(t),a.putBytes(_.random.getBytes(28)),a},p.createRecord=function(e,t){if(!t.data)return null;var a={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return a},p.createAlert=function(e,t){var a=_.util.createBuffer();return a.putByte(t.level),a.putByte(t.description),p.createRecord(e,{type:p.ContentType.alert,data:a})},p.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=_.util.createBuffer(),a=0;a<e.cipherSuites.length;++a){var r=e.cipherSuites[a];t.putByte(r.id[0]),t.putByte(r.id[1])}var n=t.length(),s=_.util.createBuffer();s.putByte(p.CompressionMethod.none);var i=s.length(),o=_.util.createBuffer();if(e.virtualHost){var u=_.util.createBuffer();u.putByte(0),u.putByte(0);var l=_.util.createBuffer();l.putByte(0),ct(l,2,_.util.createBuffer(e.virtualHost));var f=_.util.createBuffer();ct(f,2,l),ct(u,2,f),o.putBuffer(u)}var c=o.length();c>0&&(c+=2);var v=e.session.id,m=v.length+1+2+4+28+2+n+1+i+c,y=_.util.createBuffer();return y.putByte(p.HandshakeType.client_hello),y.putInt24(m),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),ct(y,1,_.util.createBuffer(v)),ct(y,2,t),ct(y,1,s),c>0&&ct(y,2,o),y},p.createServerHello=function(e){var t=e.session.id,a=t.length+1+2+4+28+2+1,r=_.util.createBuffer();return r.putByte(p.HandshakeType.server_hello),r.putInt24(a),r.putByte(e.version.major),r.putByte(e.version.minor),r.putBytes(e.session.sp.server_random),ct(r,1,_.util.createBuffer(t)),r.putByte(e.session.cipherSuite.id[0]),r.putByte(e.session.cipherSuite.id[1]),r.putByte(e.session.compressionMethod),r},p.createCertificate=function(e){var t=e.entity===p.ConnectionEnd.client,a=null;if(e.getCertificate){var r;t?r=e.session.certificateRequest:r=e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,r)}var n=_.util.createBuffer();if(a!==null)try{_.util.isArray(a)||(a=[a]);for(var s=null,i=0;i<a.length;++i){var o=_.pem.decode(a[i])[0];if(o.type!=="CERTIFICATE"&&o.type!=="X509 CERTIFICATE"&&o.type!=="TRUSTED CERTIFICATE"){var u=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw u.headerType=o.type,u}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var l=_.util.createBuffer(o.body);s===null&&(s=_.asn1.fromDer(l.bytes(),!1));var f=_.util.createBuffer();ct(f,3,l),n.putBuffer(f)}a=_.pki.certificateFromAsn1(s),t?e.session.clientCertificate=a:e.session.serverCertificate=a}catch(m){return e.error(e,{message:"Could not send certificate list.",cause:m,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate}})}var c=3+n.length(),v=_.util.createBuffer();return v.putByte(p.HandshakeType.certificate),v.putInt24(c),ct(v,3,n),v},p.createClientKeyExchange=function(e){var t=_.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(_.random.getBytes(46));var a=e.session.sp;a.pre_master_secret=t.getBytes();var r=e.session.serverCertificate.publicKey;t=r.encrypt(a.pre_master_secret);var n=t.length+2,s=_.util.createBuffer();return s.putByte(p.HandshakeType.client_key_exchange),s.putInt24(n),s.putInt16(t.length),s.putBytes(t),s},p.createServerKeyExchange=function(e){var t=_.util.createBuffer();return t},p.getClientSignature=function(e,t){var a=_.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes(),e.getSignature=e.getSignature||function(r,n,s){var i=null;if(r.getPrivateKey)try{i=r.getPrivateKey(r,r.session.clientCertificate),i=_.pki.privateKeyFromPem(i)}catch(o){r.error(r,{message:"Could not get private key.",cause:o,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}})}i===null?r.error(r,{message:"No private key set.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}):n=i.sign(n,null),s(r,n)},e.getSignature(e,a,t)},p.createCertificateVerify=function(e,t){var a=t.length+2,r=_.util.createBuffer();return r.putByte(p.HandshakeType.certificate_verify),r.putInt24(a),r.putInt16(t.length),r.putBytes(t),r},p.createCertificateRequest=function(e){var t=_.util.createBuffer();t.putByte(1);var a=_.util.createBuffer();for(var r in e.caStore.certs){var n=e.caStore.certs[r],s=_.pki.distinguishedNameToAsn1(n.subject),i=_.asn1.toDer(s);a.putInt16(i.length()),a.putBuffer(i)}var o=1+t.length()+2+a.length(),u=_.util.createBuffer();return u.putByte(p.HandshakeType.certificate_request),u.putInt24(o),ct(u,1,t),ct(u,2,a),u},p.createServerHelloDone=function(e){var t=_.util.createBuffer();return t.putByte(p.HandshakeType.server_hello_done),t.putInt24(0),t},p.createChangeCipherSpec=function(){var e=_.util.createBuffer();return e.putByte(1),e},p.createFinished=function(e){var t=_.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var a=e.entity===p.ConnectionEnd.client,r=e.session.sp,n=12,s=Xr,i=a?"client finished":"server finished";t=s(r.master_secret,i,t.getBytes(),n);var o=_.util.createBuffer();return o.putByte(p.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o},p.createHeartbeat=function(e,t,a){typeof a>"u"&&(a=t.length);var r=_.util.createBuffer();r.putByte(e),r.putInt16(a),r.putBytes(t);var n=r.length(),s=Math.max(16,n-a-3);return r.putBytes(_.random.getBytes(s)),r},p.queue=function(e,t){if(!!t&&!(t.fragment.length()===0&&(t.type===p.ContentType.handshake||t.type===p.ContentType.alert||t.type===p.ContentType.change_cipher_spec))){if(t.type===p.ContentType.handshake){var a=t.fragment.bytes();e.session.md5.update(a),e.session.sha1.update(a),a=null}var r;if(t.fragment.length()<=p.MaxFragment)r=[t];else{r=[];for(var n=t.fragment.bytes();n.length>p.MaxFragment;)r.push(p.createRecord(e,{type:t.type,data:_.util.createBuffer(n.slice(0,p.MaxFragment))})),n=n.slice(p.MaxFragment);n.length>0&&r.push(p.createRecord(e,{type:t.type,data:_.util.createBuffer(n)}))}for(var s=0;s<r.length&&!e.fail;++s){var i=r[s],o=e.state.current.write;o.update(e,i)&&e.records.push(i)}}},p.flush=function(e){for(var t=0;t<e.records.length;++t){var a=e.records[t];e.tlsData.putByte(a.type),e.tlsData.putByte(a.version.major),e.tlsData.putByte(a.version.minor),e.tlsData.putInt16(a.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var ka=function(e){switch(e){case!0:return!0;case _.pki.certificateError.bad_certificate:return p.Alert.Description.bad_certificate;case _.pki.certificateError.unsupported_certificate:return p.Alert.Description.unsupported_certificate;case _.pki.certificateError.certificate_revoked:return p.Alert.Description.certificate_revoked;case _.pki.certificateError.certificate_expired:return p.Alert.Description.certificate_expired;case _.pki.certificateError.certificate_unknown:return p.Alert.Description.certificate_unknown;case _.pki.certificateError.unknown_ca:return p.Alert.Description.unknown_ca;default:return p.Alert.Description.bad_certificate}},Q0=function(e){switch(e){case!0:return!0;case p.Alert.Description.bad_certificate:return _.pki.certificateError.bad_certificate;case p.Alert.Description.unsupported_certificate:return _.pki.certificateError.unsupported_certificate;case p.Alert.Description.certificate_revoked:return _.pki.certificateError.certificate_revoked;case p.Alert.Description.certificate_expired:return _.pki.certificateError.certificate_expired;case p.Alert.Description.certificate_unknown:return _.pki.certificateError.certificate_unknown;case p.Alert.Description.unknown_ca:return _.pki.certificateError.unknown_ca;default:return _.pki.certificateError.bad_certificate}};p.verifyCertificateChain=function(e,t){try{var a={};for(var r in e.verifyOptions)a[r]=e.verifyOptions[r];a.verify=function(s,i,o){var u=ka(s),l=e.verify(e,s,i,o);if(l!==!0){if(typeof l=="object"&&!_.util.isArray(l)){var f=new Error("The application rejected the certificate.");throw f.send=!0,f.alert={level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate},l.message&&(f.message=l.message),l.alert&&(f.alert.description=l.alert),f}l!==s&&(l=Q0(l))}return l},_.pki.verifyCertificateChain(e.caStore,t,a)}catch(s){var n=s;(typeof n!="object"||_.util.isArray(n))&&(n={send:!0,alert:{level:p.Alert.Level.fatal,description:ka(s)}}),"send"in n||(n.send=!0),"alert"in n||(n.alert={level:p.Alert.Level.fatal,description:ka(n.error)}),e.error(e,n)}return!e.fail},p.createSessionCache=function(e,t){var a=null;if(e&&e.getSession&&e.setSession&&e.order)a=e;else{a={},a.cache=e||{},a.capacity=Math.max(t||100,1),a.order=[];for(var r in e)a.order.length<=t?a.order.push(r):delete e[r];a.getSession=function(n){var s=null,i=null;if(n?i=_.util.bytesToHex(n):a.order.length>0&&(i=a.order[0]),i!==null&&i in a.cache){s=a.cache[i],delete a.cache[i];for(var o in a.order)if(a.order[o]===i){a.order.splice(o,1);break}}return s},a.setSession=function(n,s){if(a.order.length===a.capacity){var i=a.order.shift();delete a.cache[i]}var i=_.util.bytesToHex(n);a.order.push(i),a.cache[i]=s}}return a},p.createConnection=function(e){var t=null;e.caStore?_.util.isArray(e.caStore)?t=_.pki.createCaStore(e.caStore):t=e.caStore:t=_.pki.createCaStore();var a=e.cipherSuites||null;if(a===null){a=[];for(var r in p.CipherSuites)a.push(p.CipherSuites[r])}var n=e.server?p.ConnectionEnd.server:p.ConnectionEnd.client,s=e.sessionCache?p.createSessionCache(e.sessionCache):null,i={version:{major:p.Version.major,minor:p.Version.minor},entity:n,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:a,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(f,c,v,m){return c},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:_.util.createBuffer(),tlsData:_.util.createBuffer(),data:_.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(f,c){c.origin=c.origin||(f.entity===p.ConnectionEnd.client?"client":"server"),c.send&&(p.queue(f,p.createAlert(f,c.alert)),p.flush(f));var v=c.fatal!==!1;v&&(f.fail=!0),e.error(f,c),v&&f.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};i.reset=function(f){i.version={major:p.Version.major,minor:p.Version.minor},i.record=null,i.session=null,i.peerCertificate=null,i.state={pending:null,current:null},i.expect=i.entity===p.ConnectionEnd.client?N0:P0,i.fragmented=null,i.records=[],i.open=!1,i.handshakes=0,i.handshaking=!1,i.isConnected=!1,i.fail=!(f||typeof f>"u"),i.input.clear(),i.tlsData.clear(),i.data.clear(),i.state.current=p.createConnectionState(i)},i.reset();var o=function(f,c){var v=c.type-p.ContentType.change_cipher_spec,m=La[f.entity][f.expect];v in m?m[v](f,c):p.handleUnexpected(f,c)},u=function(f){var c=0,v=f.input,m=v.length();if(m<5)c=5-m;else{f.record={type:v.getByte(),version:{major:v.getByte(),minor:v.getByte()},length:v.getInt16(),fragment:_.util.createBuffer(),ready:!1};var y=f.record.version.major===f.version.major;y&&f.session&&f.session.version&&(y=f.record.version.minor===f.version.minor),y||f.error(f,{message:"Incompatible TLS version.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}})}return c},l=function(f){var c=0,v=f.input,m=v.length();if(m<f.record.length)c=f.record.length-m;else{f.record.fragment.putBytes(v.getBytes(f.record.length)),v.compact();var y=f.state.current.read;y.update(f,f.record)&&(f.fragmented!==null&&(f.fragmented.type===f.record.type?(f.fragmented.fragment.putBuffer(f.record.fragment),f.record=f.fragmented):f.error(f,{message:"Invalid fragmented record.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unexpected_message}})),f.record.ready=!0)}return c};return i.handshake=function(f){if(i.entity!==p.ConnectionEnd.client)i.error(i,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(i.handshaking)i.error(i,{message:"Handshake already in progress.",fatal:!1});else{i.fail&&!i.open&&i.handshakes===0&&(i.fail=!1),i.handshaking=!0,f=f||"";var c=null;f.length>0&&(i.sessionCache&&(c=i.sessionCache.getSession(f)),c===null&&(f="")),f.length===0&&i.sessionCache&&(c=i.sessionCache.getSession(),c!==null&&(f=c.id)),i.session={id:f,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:_.md.md5.create(),sha1:_.md.sha1.create()},c&&(i.version=c.version,i.session.sp=c.sp),i.session.sp.client_random=p.createRandom().getBytes(),i.open=!0,p.queue(i,p.createRecord(i,{type:p.ContentType.handshake,data:p.createClientHello(i)})),p.flush(i)}},i.process=function(f){var c=0;return f&&i.input.putBytes(f),i.fail||(i.record!==null&&i.record.ready&&i.record.fragment.isEmpty()&&(i.record=null),i.record===null&&(c=u(i)),!i.fail&&i.record!==null&&!i.record.ready&&(c=l(i)),!i.fail&&i.record!==null&&i.record.ready&&o(i,i.record)),c},i.prepare=function(f){return p.queue(i,p.createRecord(i,{type:p.ContentType.application_data,data:_.util.createBuffer(f)})),p.flush(i)},i.prepareHeartbeatRequest=function(f,c){return f instanceof _.util.ByteBuffer&&(f=f.bytes()),typeof c>"u"&&(c=f.length),i.expectedHeartbeatPayload=f,p.queue(i,p.createRecord(i,{type:p.ContentType.heartbeat,data:p.createHeartbeat(p.HeartbeatMessageType.heartbeat_request,f,c)})),p.flush(i)},i.close=function(f){if(!i.fail&&i.sessionCache&&i.session){var c={id:i.session.id,version:i.session.version,sp:i.session.sp};c.sp.keys=null,i.sessionCache.setSession(c.id,c)}i.open&&(i.open=!1,i.input.clear(),(i.isConnected||i.handshaking)&&(i.isConnected=i.handshaking=!1,p.queue(i,p.createAlert(i,{level:p.Alert.Level.warning,description:p.Alert.Description.close_notify})),p.flush(i)),i.closed(i)),i.reset(f)},i},_.tls=_.tls||{};for(var Ua in p)typeof p[Ua]!="function"&&(_.tls[Ua]=p[Ua]);_.tls.prf_tls1=Xr,_.tls.hmac_sha1=B0,_.tls.createSessionCache=p.createSessionCache,_.tls.createConnection=p.createConnection;var Ut=Y,ht=Ut.tls;ht.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=ht.BulkCipherAlgorithm.aes,e.cipher_type=ht.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=ht.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:ri},ht.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=ht.BulkCipherAlgorithm.aes,e.cipher_type=ht.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=ht.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:ri};function ri(e,t,a){var r=t.entity===Ut.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:Ut.cipher.createDecipher("AES-CBC",r?a.keys.server_write_key:a.keys.client_write_key),iv:r?a.keys.server_write_IV:a.keys.client_write_IV},e.write.cipherState={init:!1,cipher:Ut.cipher.createCipher("AES-CBC",r?a.keys.client_write_key:a.keys.server_write_key),iv:r?a.keys.client_write_IV:a.keys.server_write_IV},e.read.cipherFunction=j0,e.write.cipherFunction=z0,e.read.macLength=e.write.macLength=a.mac_length,e.read.macFunction=e.write.macFunction=ht.hmac_sha1}function z0(e,t){var a=!1,r=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(r),t.updateSequenceNumber();var n;e.version.minor===ht.Versions.TLS_1_0.minor?n=t.cipherState.init?null:t.cipherState.iv:n=Ut.random.getBytesSync(16),t.cipherState.init=!0;var s=t.cipherState.cipher;return s.start({iv:n}),e.version.minor>=ht.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(Y0)&&(e.fragment=s.output,e.length=e.fragment.length(),a=!0),a}function Y0(e,t,a){if(!a){var r=e-t.length()%e;t.fillWithByte(r-1,r)}return!0}function W0(e,t,a){var r=!0;if(a){for(var n=t.length(),s=t.last(),i=n-1-s;i<n-1;++i)r=r&&t.at(i)==s;r&&t.truncate(s+1)}return r}function j0(e,t){var a=!1,r;e.version.minor===ht.Versions.TLS_1_0.minor?r=t.cipherState.init?null:t.cipherState.iv:r=e.fragment.getBytes(16),t.cipherState.init=!0;var n=t.cipherState.cipher;n.start({iv:r}),n.update(e.fragment),a=n.finish(W0);var s=t.macLength,i=Ut.random.getBytesSync(s),o=n.output.length();o>=s?(e.fragment=n.output.getBytes(o-s),i=n.output.getBytes(s)):e.fragment=n.output.getBytes(),e.fragment=Ut.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=X0(t.macKey,i,u)&&a,a}function X0(e,t,a){var r=Ut.hmac.create();return r.start("SHA1",e),r.update(t),t=r.digest().getBytes(),r.start(null,null),r.update(a),a=r.digest().getBytes(),t===a}var Le=Y;Le.debug=Le.debug||{},Le.debug.storage={},Le.debug.get=function(e,t){var a;return typeof e>"u"?a=Le.debug.storage:e in Le.debug.storage&&(typeof t>"u"?a=Le.debug.storage[e]:a=Le.debug.storage[e][t]),a},Le.debug.set=function(e,t,a){e in Le.debug.storage||(Le.debug.storage[e]={}),Le.debug.storage[e][t]=a},Le.debug.clear=function(e,t){typeof e>"u"?Le.debug.storage={}:e in Le.debug.storage&&(typeof t>"u"?delete Le.debug.storage[e]:delete Le.debug.storage[e][t])};var he=Y,Ir=he.sha512=he.sha512||{};he.md.sha512=he.md.algorithms.sha512=Ir;var ai=he.sha384=he.sha512.sha384=he.sha512.sha384||{};ai.create=function(){return Ir.create("SHA-384")},he.md.sha384=he.md.algorithms.sha384=ai,he.sha512.sha256=he.sha512.sha256||{create:function(){return Ir.create("SHA-512/256")}},he.md["sha512/256"]=he.md.algorithms["sha512/256"]=he.sha512.sha256,he.sha512.sha224=he.sha512.sha224||{create:function(){return Ir.create("SHA-512/224")}},he.md["sha512/224"]=he.md.algorithms["sha512/224"]=he.sha512.sha224,Ir.create=function(e){if(ni||$0(),typeof e>"u"&&(e="SHA-512"),!(e in jt))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=jt[e],a=null,r=he.util.createBuffer(),n=new Array(80),s=0;s<80;++s)n[s]=new Array(2);var i=64;switch(e){case"SHA-384":i=48;break;case"SHA-512/256":i=32;break;case"SHA-512/224":i=28;break}var o={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:i,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var u=o.messageLengthSize/4,l=0;l<u;++l)o.fullMessageLength.push(0);r=he.util.createBuffer(),a=new Array(t.length);for(var l=0;l<t.length;++l)a[l]=t[l].slice(0);return o},o.start(),o.update=function(u,l){l==="utf8"&&(u=he.util.encodeUtf8(u));var f=u.length;o.messageLength+=f,f=[f/4294967296>>>0,f>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=f[1],f[1]=f[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,f[0]=f[1]/4294967296>>>0;return r.putBytes(u),ii(a,n,r),(r.read>2048||r.length()===0)&&r.compact(),o},o.digest=function(){var u=he.util.createBuffer();u.putBytes(r.bytes());var l=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,f=l&o.blockLength-1;u.putBytes(Pa.substr(0,o.blockLength-f));for(var c,v,m=o.fullMessageLength[0]*8,y=0;y<o.fullMessageLength.length-1;++y)c=o.fullMessageLength[y+1]*8,v=c/4294967296>>>0,m+=v,u.putInt32(m>>>0),m=c>>>0;u.putInt32(m);for(var x=new Array(a.length),y=0;y<a.length;++y)x[y]=a[y].slice(0);ii(x,n,u);var S=he.util.createBuffer(),A;e==="SHA-512"?A=x.length:e==="SHA-384"?A=x.length-2:A=x.length-4;for(var y=0;y<A;++y)S.putInt32(x[y][0]),(y!==A-1||e!=="SHA-512/224")&&S.putInt32(x[y][1]);return S},o};var Pa=null,ni=!1,Va=null,jt=null;function $0(){Pa=String.fromCharCode(128),Pa+=he.util.fillString(String.fromCharCode(0),128),Va=[[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]],jt={},jt["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],jt["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],jt["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],jt["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],ni=!0}function ii(e,t,a){for(var r,n,s,i,o,u,l,f,c,v,m,y,x,S,A,B,N,F,D,R,z,J,ie,oe,ue,ve,ot,dt,le,Se,M,Jt,gr,Te,Ae,Ie=a.length();Ie>=128;){for(le=0;le<16;++le)t[le][0]=a.getInt32()>>>0,t[le][1]=a.getInt32()>>>0;for(;le<80;++le)Jt=t[le-2],Se=Jt[0],M=Jt[1],r=((Se>>>19|M<<13)^(M>>>29|Se<<3)^Se>>>6)>>>0,n=((Se<<13|M>>>19)^(M<<3|Se>>>29)^(Se<<26|M>>>6))>>>0,Te=t[le-15],Se=Te[0],M=Te[1],s=((Se>>>1|M<<31)^(Se>>>8|M<<24)^Se>>>7)>>>0,i=((Se<<31|M>>>1)^(Se<<24|M>>>8)^(Se<<25|M>>>7))>>>0,gr=t[le-7],Ae=t[le-16],M=n+gr[1]+i+Ae[1],t[le][0]=r+gr[0]+s+Ae[0]+(M/4294967296>>>0)>>>0,t[le][1]=M>>>0;for(x=e[0][0],S=e[0][1],A=e[1][0],B=e[1][1],N=e[2][0],F=e[2][1],D=e[3][0],R=e[3][1],z=e[4][0],J=e[4][1],ie=e[5][0],oe=e[5][1],ue=e[6][0],ve=e[6][1],ot=e[7][0],dt=e[7][1],le=0;le<80;++le)l=((z>>>14|J<<18)^(z>>>18|J<<14)^(J>>>9|z<<23))>>>0,f=((z<<18|J>>>14)^(z<<14|J>>>18)^(J<<23|z>>>9))>>>0,c=(ue^z&(ie^ue))>>>0,v=(ve^J&(oe^ve))>>>0,o=((x>>>28|S<<4)^(S>>>2|x<<30)^(S>>>7|x<<25))>>>0,u=((x<<4|S>>>28)^(S<<30|x>>>2)^(S<<25|x>>>7))>>>0,m=(x&A|N&(x^A))>>>0,y=(S&B|F&(S^B))>>>0,M=dt+f+v+Va[le][1]+t[le][1],r=ot+l+c+Va[le][0]+t[le][0]+(M/4294967296>>>0)>>>0,n=M>>>0,M=u+y,s=o+m+(M/4294967296>>>0)>>>0,i=M>>>0,ot=ue,dt=ve,ue=ie,ve=oe,ie=z,oe=J,M=R+n,z=D+r+(M/4294967296>>>0)>>>0,J=M>>>0,D=N,R=F,N=A,F=B,A=x,B=S,M=n+i,x=r+s+(M/4294967296>>>0)>>>0,S=M>>>0;M=e[0][1]+S,e[0][0]=e[0][0]+x+(M/4294967296>>>0)>>>0,e[0][1]=M>>>0,M=e[1][1]+B,e[1][0]=e[1][0]+A+(M/4294967296>>>0)>>>0,e[1][1]=M>>>0,M=e[2][1]+F,e[2][0]=e[2][0]+N+(M/4294967296>>>0)>>>0,e[2][1]=M>>>0,M=e[3][1]+R,e[3][0]=e[3][0]+D+(M/4294967296>>>0)>>>0,e[3][1]=M>>>0,M=e[4][1]+J,e[4][0]=e[4][0]+z+(M/4294967296>>>0)>>>0,e[4][1]=M>>>0,M=e[5][1]+oe,e[5][0]=e[5][0]+ie+(M/4294967296>>>0)>>>0,e[5][1]=M>>>0,M=e[6][1]+ve,e[6][0]=e[6][0]+ue+(M/4294967296>>>0)>>>0,e[6][1]=M>>>0,M=e[7][1]+dt,e[7][0]=e[7][0]+ot+(M/4294967296>>>0)>>>0,e[7][1]=M>>>0,Ie-=128}}var Fa={},Z0=Y,Ne=Z0.asn1;Fa.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Fa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Ne.Class.UNIVERSAL,type:Ne.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]};var De=Y,si=Fa,J0=si.publicKeyValidator,eu=si.privateKeyValidator;if(typeof tu>"u")var tu=De.jsbn.BigInteger;var Oa=De.util.ByteBuffer,rt=typeof Buffer>"u"?Uint8Array:Buffer;De.pki=De.pki||{},De.pki.ed25519=De.ed25519=De.ed25519||{};var $=De.ed25519;$.constants={},$.constants.PUBLIC_KEY_BYTE_LENGTH=32,$.constants.PRIVATE_KEY_BYTE_LENGTH=64,$.constants.SEED_BYTE_LENGTH=32,$.constants.SIGN_BYTE_LENGTH=64,$.constants.HASH_BYTE_LENGTH=64,$.generateKeyPair=function(e){e=e||{};var t=e.seed;if(t===void 0)t=De.random.getBytesSync($.constants.SEED_BYTE_LENGTH);else if(typeof t=="string"){if(t.length!==$.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+$.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=bt({message:t,encoding:"binary"});for(var a=new rt($.constants.PUBLIC_KEY_BYTE_LENGTH),r=new rt($.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)r[n]=t[n];return iu(a,r),{publicKey:a,privateKey:r}},$.privateKeyFromAsn1=function(e){var t={},a=[],r=De.asn1.validate(e,eu,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=De.asn1.derToOid(t.privateKeyOid),i=De.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.privateKey,u=bt({message:De.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:u}},$.publicKeyFromAsn1=function(e){var t={},a=[],r=De.asn1.validate(e,J0,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=De.asn1.derToOid(t.publicKeyOid),i=De.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.ed25519PublicKey;if(o.length!==$.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return bt({message:o,encoding:"binary"})},$.publicKeyFromPrivateKey=function(e){e=e||{};var t=bt({message:e.privateKey,encoding:"binary"});if(t.length!==$.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+$.constants.PRIVATE_KEY_BYTE_LENGTH);for(var a=new rt($.constants.PUBLIC_KEY_BYTE_LENGTH),r=0;r<a.length;++r)a[r]=t[32+r];return a},$.sign=function(e){e=e||{};var t=bt(e),a=bt({message:e.privateKey,encoding:"binary"});if(a.length===$.constants.SEED_BYTE_LENGTH){var r=$.generateKeyPair({seed:a});a=r.privateKey}else if(a.length!==$.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+$.constants.SEED_BYTE_LENGTH+" or "+$.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new rt($.constants.SIGN_BYTE_LENGTH+t.length);su(n,t,t.length,a);for(var s=new rt($.constants.SIGN_BYTE_LENGTH),i=0;i<s.length;++i)s[i]=n[i];return s},$.verify=function(e){e=e||{};var t=bt(e);if(e.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var a=bt({message:e.signature,encoding:"binary"});if(a.length!==$.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+$.constants.SIGN_BYTE_LENGTH);var r=bt({message:e.publicKey,encoding:"binary"});if(r.length!==$.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+$.constants.PUBLIC_KEY_BYTE_LENGTH);var n=new rt($.constants.SIGN_BYTE_LENGTH+t.length),s=new rt($.constants.SIGN_BYTE_LENGTH+t.length),i;for(i=0;i<$.constants.SIGN_BYTE_LENGTH;++i)n[i]=a[i];for(i=0;i<t.length;++i)n[i+$.constants.SIGN_BYTE_LENGTH]=t[i];return ou(s,n,n.length,r)>=0};function bt(e){var t=e.message;if(t instanceof Uint8Array||t instanceof rt)return t;var a=e.encoding;if(t===void 0)if(e.md)t=e.md.digest().getBytes(),a="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof t=="string"&&!a)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.from(t,a);t=new Oa(t,a)}else if(!(t instanceof Oa))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.');for(var r=new rt(t.length()),n=0;n<r.length;++n)r[n]=t.at(n);return r}var Ka=H(),Jr=H([1]),ru=H([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),au=H([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),oi=H([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),ui=H([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Ma=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]),nu=H([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Br(e,t){var a=De.md.sha512.create(),r=new Oa(e);a.update(r.getBytes(t),"binary");var n=a.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(n,"binary");for(var s=new rt($.constants.HASH_BYTE_LENGTH),i=0;i<64;++i)s[i]=n.charCodeAt(i);return s}function iu(e,t){var a=[H(),H(),H(),H()],r,n=Br(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,Qa(a,n),Ga(e,a),r=0;r<32;++r)t[r+32]=e[r];return 0}function su(e,t,a,r){var n,s,i=new Float64Array(64),o=[H(),H(),H(),H()],u=Br(r,32);u[0]&=248,u[31]&=127,u[31]|=64;var l=a+64;for(n=0;n<a;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=u[32+n];var f=Br(e.subarray(32),a+32);for(Ha(f),Qa(o,f),Ga(e,o),n=32;n<64;++n)e[n]=r[n];var c=Br(e,a+64);for(Ha(c),n=32;n<64;++n)i[n]=0;for(n=0;n<32;++n)i[n]=f[n];for(n=0;n<32;++n)for(s=0;s<32;s++)i[n+s]+=c[n]*u[s];return li(e.subarray(32),i),l}function ou(e,t,a,r){var n,s,i=new rt(32),o=[H(),H(),H(),H()],u=[H(),H(),H(),H()];if(s=-1,a<64||uu(u,r))return-1;for(n=0;n<a;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=r[n];var l=Br(e,a);if(Ha(l),pi(o,u,l),Qa(u,t.subarray(32)),qa(o,u),Ga(i,o),a-=64,hi(t,0,i,0)){for(n=0;n<a;++n)e[n]=0;return-1}for(n=0;n<a;++n)e[n]=t[n+64];return s=a,s}function li(e,t){var a,r,n,s;for(r=63;r>=32;--r){for(a=0,n=r-32,s=r-12;n<s;++n)t[n]+=a-16*t[r]*Ma[n-(r-32)],a=t[n]+128>>8,t[n]-=a*256;t[n]+=a,t[r]=0}for(a=0,n=0;n<32;++n)t[n]+=a-(t[31]>>4)*Ma[n],a=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=a*Ma[n];for(r=0;r<32;++r)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function Ha(e){for(var t=new Float64Array(64),a=0;a<64;++a)t[a]=e[a],e[a]=0;li(e,t)}function qa(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),u=H(),l=H(),f=H();cr(a,e[1],e[0]),cr(f,t[1],t[0]),se(a,a,f),fr(r,e[0],e[1]),fr(f,t[0],t[1]),se(r,r,f),se(n,e[3],t[3]),se(n,n,au),se(s,e[2],t[2]),fr(s,s,s),cr(i,r,a),cr(o,s,n),fr(u,s,n),fr(l,r,a),se(e[0],i,o),se(e[1],l,u),se(e[2],u,o),se(e[3],i,l)}function fi(e,t,a){for(var r=0;r<4;++r)vi(e[r],t[r],a)}function Ga(e,t){var a=H(),r=H(),n=H();hu(n,t[2]),se(a,t[0],n),se(r,t[1],n),ea(e,r),e[31]^=di(a)<<7}function ea(e,t){var a,r,n,s=H(),i=H();for(a=0;a<16;++a)i[a]=t[a];for(za(i),za(i),za(i),r=0;r<2;++r){for(s[0]=i[0]-65517,a=1;a<15;++a)s[a]=i[a]-65535-(s[a-1]>>16&1),s[a-1]&=65535;s[15]=i[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,vi(i,s,1-n)}for(a=0;a<16;a++)e[2*a]=i[a]&255,e[2*a+1]=i[a]>>8}function uu(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),u=H();return Pt(e[2],Jr),lu(e[1],t),Xt(n,e[1]),se(s,n,ru),cr(n,n,e[2]),fr(s,e[2],s),Xt(i,s),Xt(o,i),se(u,o,i),se(a,u,n),se(a,a,s),fu(a,a),se(a,a,n),se(a,a,s),se(a,a,s),se(e[0],a,s),Xt(r,e[0]),se(r,r,s),ci(r,n)&&se(e[0],e[0],nu),Xt(r,e[0]),se(r,r,s),ci(r,n)?-1:(di(e[0])===t[31]>>7&&cr(e[0],Ka,e[0]),se(e[3],e[0],e[1]),0)}function lu(e,t){var a;for(a=0;a<16;++a)e[a]=t[2*a]+(t[2*a+1]<<8);e[15]&=32767}function fu(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)Xt(a,a),r!==1&&se(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function ci(e,t){var a=new rt(32),r=new rt(32);return ea(a,e),ea(r,t),hi(a,0,r,0)}function hi(e,t,a,r){return cu(e,t,a,r,32)}function cu(e,t,a,r,n){var s,i=0;for(s=0;s<n;++s)i|=e[t+s]^a[r+s];return(1&i-1>>>8)-1}function di(e){var t=new rt(32);return ea(t,e),t[0]&1}function pi(e,t,a){var r,n;for(Pt(e[0],Ka),Pt(e[1],Jr),Pt(e[2],Jr),Pt(e[3],Ka),n=255;n>=0;--n)r=a[n/8|0]>>(n&7)&1,fi(e,t,r),qa(t,e),qa(e,e),fi(e,t,r)}function Qa(e,t){var a=[H(),H(),H(),H()];Pt(a[0],oi),Pt(a[1],ui),Pt(a[2],Jr),se(a[3],oi,ui),pi(e,a,t)}function Pt(e,t){var a;for(a=0;a<16;a++)e[a]=t[a]|0}function hu(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)Xt(a,a),r!==2&&r!==4&&se(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function za(e){var t,a,r=1;for(t=0;t<16;++t)a=e[t]+r+65535,r=Math.floor(a/65536),e[t]=a-r*65536;e[0]+=r-1+37*(r-1)}function vi(e,t,a){for(var r,n=~(a-1),s=0;s<16;++s)r=n&(e[s]^t[s]),e[s]^=r,t[s]^=r}function H(e){var t,a=new Float64Array(16);if(e)for(t=0;t<e.length;++t)a[t]=e[t];return a}function fr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]+a[r]}function cr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]-a[r]}function Xt(e,t){se(e,t,t)}function se(e,t,a){var r,n,s=0,i=0,o=0,u=0,l=0,f=0,c=0,v=0,m=0,y=0,x=0,S=0,A=0,B=0,N=0,F=0,D=0,R=0,z=0,J=0,ie=0,oe=0,ue=0,ve=0,ot=0,dt=0,le=0,Se=0,M=0,Jt=0,gr=0,Te=a[0],Ae=a[1],Ie=a[2],Pe=a[3],Ve=a[4],Fe=a[5],Oe=a[6],Ke=a[7],Me=a[8],He=a[9],qe=a[10],Ge=a[11],Qe=a[12],ze=a[13],Ye=a[14],We=a[15];r=t[0],s+=r*Te,i+=r*Ae,o+=r*Ie,u+=r*Pe,l+=r*Ve,f+=r*Fe,c+=r*Oe,v+=r*Ke,m+=r*Me,y+=r*He,x+=r*qe,S+=r*Ge,A+=r*Qe,B+=r*ze,N+=r*Ye,F+=r*We,r=t[1],i+=r*Te,o+=r*Ae,u+=r*Ie,l+=r*Pe,f+=r*Ve,c+=r*Fe,v+=r*Oe,m+=r*Ke,y+=r*Me,x+=r*He,S+=r*qe,A+=r*Ge,B+=r*Qe,N+=r*ze,F+=r*Ye,D+=r*We,r=t[2],o+=r*Te,u+=r*Ae,l+=r*Ie,f+=r*Pe,c+=r*Ve,v+=r*Fe,m+=r*Oe,y+=r*Ke,x+=r*Me,S+=r*He,A+=r*qe,B+=r*Ge,N+=r*Qe,F+=r*ze,D+=r*Ye,R+=r*We,r=t[3],u+=r*Te,l+=r*Ae,f+=r*Ie,c+=r*Pe,v+=r*Ve,m+=r*Fe,y+=r*Oe,x+=r*Ke,S+=r*Me,A+=r*He,B+=r*qe,N+=r*Ge,F+=r*Qe,D+=r*ze,R+=r*Ye,z+=r*We,r=t[4],l+=r*Te,f+=r*Ae,c+=r*Ie,v+=r*Pe,m+=r*Ve,y+=r*Fe,x+=r*Oe,S+=r*Ke,A+=r*Me,B+=r*He,N+=r*qe,F+=r*Ge,D+=r*Qe,R+=r*ze,z+=r*Ye,J+=r*We,r=t[5],f+=r*Te,c+=r*Ae,v+=r*Ie,m+=r*Pe,y+=r*Ve,x+=r*Fe,S+=r*Oe,A+=r*Ke,B+=r*Me,N+=r*He,F+=r*qe,D+=r*Ge,R+=r*Qe,z+=r*ze,J+=r*Ye,ie+=r*We,r=t[6],c+=r*Te,v+=r*Ae,m+=r*Ie,y+=r*Pe,x+=r*Ve,S+=r*Fe,A+=r*Oe,B+=r*Ke,N+=r*Me,F+=r*He,D+=r*qe,R+=r*Ge,z+=r*Qe,J+=r*ze,ie+=r*Ye,oe+=r*We,r=t[7],v+=r*Te,m+=r*Ae,y+=r*Ie,x+=r*Pe,S+=r*Ve,A+=r*Fe,B+=r*Oe,N+=r*Ke,F+=r*Me,D+=r*He,R+=r*qe,z+=r*Ge,J+=r*Qe,ie+=r*ze,oe+=r*Ye,ue+=r*We,r=t[8],m+=r*Te,y+=r*Ae,x+=r*Ie,S+=r*Pe,A+=r*Ve,B+=r*Fe,N+=r*Oe,F+=r*Ke,D+=r*Me,R+=r*He,z+=r*qe,J+=r*Ge,ie+=r*Qe,oe+=r*ze,ue+=r*Ye,ve+=r*We,r=t[9],y+=r*Te,x+=r*Ae,S+=r*Ie,A+=r*Pe,B+=r*Ve,N+=r*Fe,F+=r*Oe,D+=r*Ke,R+=r*Me,z+=r*He,J+=r*qe,ie+=r*Ge,oe+=r*Qe,ue+=r*ze,ve+=r*Ye,ot+=r*We,r=t[10],x+=r*Te,S+=r*Ae,A+=r*Ie,B+=r*Pe,N+=r*Ve,F+=r*Fe,D+=r*Oe,R+=r*Ke,z+=r*Me,J+=r*He,ie+=r*qe,oe+=r*Ge,ue+=r*Qe,ve+=r*ze,ot+=r*Ye,dt+=r*We,r=t[11],S+=r*Te,A+=r*Ae,B+=r*Ie,N+=r*Pe,F+=r*Ve,D+=r*Fe,R+=r*Oe,z+=r*Ke,J+=r*Me,ie+=r*He,oe+=r*qe,ue+=r*Ge,ve+=r*Qe,ot+=r*ze,dt+=r*Ye,le+=r*We,r=t[12],A+=r*Te,B+=r*Ae,N+=r*Ie,F+=r*Pe,D+=r*Ve,R+=r*Fe,z+=r*Oe,J+=r*Ke,ie+=r*Me,oe+=r*He,ue+=r*qe,ve+=r*Ge,ot+=r*Qe,dt+=r*ze,le+=r*Ye,Se+=r*We,r=t[13],B+=r*Te,N+=r*Ae,F+=r*Ie,D+=r*Pe,R+=r*Ve,z+=r*Fe,J+=r*Oe,ie+=r*Ke,oe+=r*Me,ue+=r*He,ve+=r*qe,ot+=r*Ge,dt+=r*Qe,le+=r*ze,Se+=r*Ye,M+=r*We,r=t[14],N+=r*Te,F+=r*Ae,D+=r*Ie,R+=r*Pe,z+=r*Ve,J+=r*Fe,ie+=r*Oe,oe+=r*Ke,ue+=r*Me,ve+=r*He,ot+=r*qe,dt+=r*Ge,le+=r*Qe,Se+=r*ze,M+=r*Ye,Jt+=r*We,r=t[15],F+=r*Te,D+=r*Ae,R+=r*Ie,z+=r*Pe,J+=r*Ve,ie+=r*Fe,oe+=r*Oe,ue+=r*Ke,ve+=r*Me,ot+=r*He,dt+=r*qe,le+=r*Ge,Se+=r*Qe,M+=r*ze,Jt+=r*Ye,gr+=r*We,s+=38*D,i+=38*R,o+=38*z,u+=38*J,l+=38*ie,f+=38*oe,c+=38*ue,v+=38*ve,m+=38*ot,y+=38*dt,x+=38*le,S+=38*Se,A+=38*M,B+=38*Jt,N+=38*gr,n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=m+n+65535,n=Math.floor(r/65536),m=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=S+n+65535,n=Math.floor(r/65536),S=r-n*65536,r=A+n+65535,n=Math.floor(r/65536),A=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=N+n+65535,n=Math.floor(r/65536),N=r-n*65536,r=F+n+65535,n=Math.floor(r/65536),F=r-n*65536,s+=n-1+37*(n-1),n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=m+n+65535,n=Math.floor(r/65536),m=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=S+n+65535,n=Math.floor(r/65536),S=r-n*65536,r=A+n+65535,n=Math.floor(r/65536),A=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=N+n+65535,n=Math.floor(r/65536),N=r-n*65536,r=F+n+65535,n=Math.floor(r/65536),F=r-n*65536,s+=n-1+37*(n-1),e[0]=s,e[1]=i,e[2]=o,e[3]=u,e[4]=l,e[5]=f,e[6]=c,e[7]=v,e[8]=m,e[9]=y,e[10]=x,e[11]=S,e[12]=A,e[13]=B,e[14]=N,e[15]=F}var it=Y;it.kem=it.kem||{};var yi=it.jsbn.BigInteger;it.kem.rsa={},it.kem.rsa.create=function(e,t){t=t||{};var a=t.prng||it.random,r={};return r.encrypt=function(n,s){var i=Math.ceil(n.n.bitLength()/8),o;do o=new yi(it.util.bytesToHex(a.getBytesSync(i)),16).mod(n.n);while(o.compareTo(yi.ONE)<=0);o=it.util.hexToBytes(o.toString(16));var u=i-o.length;u>0&&(o=it.util.fillString(String.fromCharCode(0),u)+o);var l=n.encrypt(o,"NONE"),f=e.generate(o,s);return{encapsulation:l,key:f}},r.decrypt=function(n,s,i){var o=n.decrypt(s,"NONE");return e.generate(o,i)},r},it.kem.kdf1=function(e,t){gi(this,e,0,t||e.digestLength)},it.kem.kdf2=function(e,t){gi(this,e,1,t||e.digestLength)};function gi(e,t,a,r){e.generate=function(n,s){for(var i=new it.util.ByteBuffer,o=Math.ceil(s/r)+a,u=new it.util.ByteBuffer,l=a;l<o;++l){u.putInt32(l),t.start(),t.update(n+u.getBytes());var f=t.digest();i.putBytes(f.getBytes(r))}return i.truncate(i.length()-s),i.getBytes()}}var Z=Y;Z.log=Z.log||{},Z.log.levels=["none","error","warning","info","debug","verbose","max"];var ta={},Ya=[],br=null;Z.log.LEVEL_LOCKED=1<<1,Z.log.NO_LEVEL_CHECK=1<<2,Z.log.INTERPOLATE=1<<3;for(var Vt=0;Vt<Z.log.levels.length;++Vt){var mi=Z.log.levels[Vt];ta[mi]={index:Vt,name:mi.toUpperCase()}}Z.log.logMessage=function(e){for(var t=ta[e.level].index,a=0;a<Ya.length;++a){var r=Ya[a];if(r.flags&Z.log.NO_LEVEL_CHECK)r.f(e);else{var n=ta[r.level].index;t<=n&&r.f(r,e)}}},Z.log.prepareStandard=function(e){"standard"in e||(e.standard=ta[e.level].name+" ["+e.category+"] "+e.message)},Z.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]),e.full=Z.util.format.apply(this,t)}},Z.log.prepareStandardFull=function(e){"standardFull"in e||(Z.log.prepareStandard(e),e.standardFull=e.standard)};for(var Ci=["error","warning","info","debug","verbose"],Vt=0;Vt<Ci.length;++Vt)(function(t){Z.log[t]=function(a,r){var n=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:t,category:a,message:r,arguments:n};Z.log.logMessage(s)}})(Ci[Vt]);if(Z.log.makeLogger=function(e){var t={flags:0,f:e};return Z.log.setLevel(t,"none"),t},Z.log.setLevel=function(e,t){var a=!1;if(e&&!(e.flags&Z.log.LEVEL_LOCKED))for(var r=0;r<Z.log.levels.length;++r){var n=Z.log.levels[r];if(t==n){e.level=t,a=!0;break}}return a},Z.log.lock=function(e,t){typeof t>"u"||t?e.flags|=Z.log.LEVEL_LOCKED:e.flags&=~Z.log.LEVEL_LOCKED},Z.log.addLogger=function(e){Ya.push(e)},typeof console<"u"&&"log"in console){var _r;if(console.error&&console.warn&&console.info&&console.debug){var du={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Wa=function(e,t){Z.log.prepareStandard(t);var a=du[t.level],r=[t.standard];r=r.concat(t.arguments.slice()),a.apply(console,r)};_r=Z.log.makeLogger(Wa)}else{var Wa=function(t,a){Z.log.prepareStandardFull(a),console.log(a.standardFull)};_r=Z.log.makeLogger(Wa)}Z.log.setLevel(_r,"debug"),Z.log.addLogger(_r),br=_r}else console={log:function(){}};if(br!==null){var ra=Z.util.getQueryVariables();if("console.level"in ra&&Z.log.setLevel(br,ra["console.level"].slice(-1)[0]),"console.lock"in ra){var pu=ra["console.lock"].slice(-1)[0];pu=="true"&&Z.log.lock(br)}}Z.log.consoleLogger=br;var vu={exports:{}};(function(e){e.exports=Gi})(vu);var U=Y,C=U.asn1,Ze=U.pkcs7=U.pkcs7||{};Ze.messageFromPem=function(e){var t=U.pem.decode(e)[0];if(t.type!=="PKCS7"){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var r=C.fromDer(t.body);return Ze.messageFromAsn1(r)},Ze.messageToPem=function(e,t){var a={type:"PKCS7",body:C.toDer(e.toAsn1()).getBytes()};return U.pem.encode(a,{maxline:t})},Ze.messageFromAsn1=function(e){var t={},a=[];if(!C.validate(e,Ze.asn1.contentInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw r.errors=a,r}var n=C.derToOid(t.contentType),s;switch(n){case U.pki.oids.envelopedData:s=Ze.createEnvelopedData();break;case U.pki.oids.encryptedData:s=Ze.createEncryptedData();break;case U.pki.oids.signedData:s=Ze.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return s.fromAsn1(t.content.value[0]),s},Ze.createSignedData=function(){var e=null;return e={type:U.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(r){if(Xa(e,r,Ze.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,s=0;s<n.length;++s)e.certificates.push(U.pki.certificateFromAsn1(n[s]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(U.pki.certificateToAsn1(e.certificates[n]));var s=[],i=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&i.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,r)),s.length>0&&i.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,1,!0,s)),i.value[0].value.push(C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.signerInfos)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),i])},addSigner:function(r){var n=r.issuer,s=r.serialNumber;if(r.certificate){var i=r.certificate;typeof i=="string"&&(i=U.pki.certificateFromPem(i)),n=i.issuer.attributes,s=i.serialNumber}var o=r.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=U.pki.privateKeyFromPem(o));var u=r.digestAlgorithm||U.pki.oids.sha1;switch(u){case U.pki.oids.sha1:case U.pki.oids.sha256:case U.pki.oids.sha384:case U.pki.oids.sha512:case U.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+u)}var l=r.authenticatedAttributes||[];if(l.length>0){for(var f=!1,c=!1,v=0;v<l.length;++v){var m=l[v];if(!f&&m.type===U.pki.oids.contentType){if(f=!0,c)break;continue}if(!c&&m.type===U.pki.oids.messageDigest){if(c=!0,f)break;continue}}if(!f||!c)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.")}e.signers.push({key:o,version:1,issuer:n,serialNumber:s,digestAlgorithm:u,signatureAlgorithm:U.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:l,unauthenticatedAttributes:[]})},sign:function(r){if(r=r||{},(typeof e.content!="object"||e.contentInfo===null)&&(e.contentInfo=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(U.pki.oids.data).getBytes())]),"content"in e)){var n;e.content instanceof U.util.ByteBuffer?n=e.content.bytes():typeof e.content=="string"&&(n=U.util.encodeUtf8(e.content)),r.detached?e.detachedContent=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n)]))}if(e.signers.length!==0){var s=t();a(s)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(r){typeof r=="string"&&(r=U.pki.certificateFromPem(r)),e.certificates.push(r)},addCertificateRevokationList:function(r){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var r={},n=0;n<e.signers.length;++n){var s=e.signers[n],i=s.digestAlgorithm;i in r||(r[i]=U.md[U.pki.oids[i]].create()),s.authenticatedAttributes.length===0?s.md=r[i]:s.md=U.md[U.pki.oids[i]].create()}e.digestAlgorithmIdentifiers=[];for(var i in r)e.digestAlgorithmIdentifiers.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(i).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]));return r}function a(r){var n;if(e.detachedContent?n=e.detachedContent:(n=e.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=C.derToOid(e.contentInfo.value[0].value),i=C.toDer(n);i.getByte(),C.getBerValueLength(i),i=i.getBytes();for(var o in r)r[o].start().update(i);for(var u=new Date,l=0;l<e.signers.length;++l){var f=e.signers[l];if(f.authenticatedAttributes.length===0){if(s!==U.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var c=C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[]),v=0;v<f.authenticatedAttributes.length;++v){var m=f.authenticatedAttributes[v];m.type===U.pki.oids.messageDigest?m.value=r[f.digestAlgorithm].digest():m.type===U.pki.oids.signingTime&&(m.value||(m.value=u)),c.value.push(ja(m)),f.authenticatedAttributesAsn1.value.push(ja(m))}i=C.toDer(c).getBytes(),f.md.start().update(i)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=xu(e.signers)}},Ze.createEncryptedData=function(){var e=null;return e={type:U.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:U.pki.oids["aes256-CBC"]},fromAsn1:function(t){Xa(e,t,Ze.asn1.encryptedDataValidator)},decrypt:function(t){t!==void 0&&(e.encryptedContent.key=t),Ei(e)}},e},Ze.createEnvelopedData=function(){var e=null;return e={type:U.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:U.pki.oids["aes256-CBC"]},fromAsn1:function(t){var a=Xa(e,t,Ze.asn1.envelopedDataValidator);e.recipients=mu(a.recipientInfos.value)},toAsn1:function(){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,Cu(e.recipients)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,Su(e.encryptedContent))])])])},findRecipient:function(t){for(var a=t.issuer.attributes,r=0;r<e.recipients.length;++r){var n=e.recipients[r],s=n.issuer;if(n.serialNumber===t.serialNumber&&s.length===a.length){for(var i=!0,o=0;o<a.length;++o)if(s[o].type!==a[o].type||s[o].value!==a[o].value){i=!1;break}if(i)return n}}return null},decrypt:function(t,a){if(e.encryptedContent.key===void 0&&t!==void 0&&a!==void 0)switch(t.encryptedContent.algorithm){case U.pki.oids.rsaEncryption:case U.pki.oids.desCBC:var r=a.decrypt(t.encryptedContent.content);e.encryptedContent.key=U.util.createBuffer(r);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}Ei(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:U.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,a){if(e.encryptedContent.content===void 0){a=a||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var r,n,s;switch(a){case U.pki.oids["aes128-CBC"]:r=16,n=16,s=U.aes.createEncryptionCipher;break;case U.pki.oids["aes192-CBC"]:r=24,n=16,s=U.aes.createEncryptionCipher;break;case U.pki.oids["aes256-CBC"]:r=32,n=16,s=U.aes.createEncryptionCipher;break;case U.pki.oids["des-EDE3-CBC"]:r=24,n=8,s=U.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+a)}if(t===void 0)t=U.util.createBuffer(U.random.getBytes(r));else if(t.length()!=r)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+r+".");e.encryptedContent.algorithm=a,e.encryptedContent.key=t,e.encryptedContent.parameter=U.util.createBuffer(U.random.getBytes(n));var i=s(t);if(i.start(e.encryptedContent.parameter.copy()),i.update(e.content),!i.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=i.output}for(var o=0;o<e.recipients.length;++o){var u=e.recipients[o];if(u.encryptedContent.content===void 0)switch(u.encryptedContent.algorithm){case U.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}},e};function yu(e){var t={},a=[];if(!C.validate(e,Ze.asn1.recipientInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw r.errors=a,r}return{version:t.version.charCodeAt(0),issuer:U.pki.RDNAttributesAsArray(t.issuer),serialNumber:U.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:C.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function gu(e){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[U.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,U.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.encryptedContent.algorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function mu(e){for(var t=[],a=0;a<e.length;++a)t.push(yu(e[a]));return t}function Cu(e){for(var t=[],a=0;a<e.length;++a)t.push(gu(e[a]));return t}function Eu(e){var t=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[U.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,U.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.digestAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.signatureAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var a=C.create(C.Class.CONTEXT_SPECIFIC,1,!0,[]),r=0;r<e.unauthenticatedAttributes.length;++r){var n=e.unauthenticatedAttributes[r];a.values.push(ja(n))}t.value.push(a)}return t}function xu(e){for(var t=[],a=0;a<e.length;++a)t.push(Eu(e[a]));return t}function ja(e){var t;if(e.type===U.pki.oids.contentType)t=C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.value).getBytes());else if(e.type===U.pki.oids.messageDigest)t=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===U.pki.oids.signingTime){var a=new Date("1950-01-01T00:00:00Z"),r=new Date("2050-01-01T00:00:00Z"),n=e.value;if(typeof n=="string"){var s=Date.parse(n);isNaN(s)?n.length===13?n=C.utcTimeToDate(n):n=C.generalizedTimeToDate(n):n=new Date(s)}n>=a&&n<r?t=C.create(C.Class.UNIVERSAL,C.Type.UTCTIME,!1,C.dateToUtcTime(n)):t=C.create(C.Class.UNIVERSAL,C.Type.GENERALIZEDTIME,!1,C.dateToGeneralizedTime(n))}return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[t])])}function Su(e){return[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(U.pki.oids.data).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.algorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.parameter.getBytes())]),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.content.getBytes())])]}function Xa(e,t,a){var r={},n=[];if(!C.validate(t,a,r,n)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}var i=C.derToOid(r.contentType);if(i!==U.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(r.encryptedContent){var o="";if(U.util.isArray(r.encryptedContent))for(var u=0;u<r.encryptedContent.length;++u){if(r.encryptedContent[u].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=r.encryptedContent[u].value}else o=r.encryptedContent;e.encryptedContent={algorithm:C.derToOid(r.encAlgorithm),parameter:U.util.createBuffer(r.encParameter.value),content:U.util.createBuffer(o)}}if(r.content){var o="";if(U.util.isArray(r.content))for(var u=0;u<r.content.length;++u){if(r.content[u].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=r.content[u].value}else o=r.content;e.content=U.util.createBuffer(o)}return e.version=r.version.charCodeAt(0),e.rawCapture=r,r}function Ei(e){if(e.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(e.content===void 0){var t;switch(e.encryptedContent.algorithm){case U.pki.oids["aes128-CBC"]:case U.pki.oids["aes192-CBC"]:case U.pki.oids["aes256-CBC"]:t=U.aes.createDecryptionCipher(e.encryptedContent.key);break;case U.pki.oids.desCBC:case U.pki.oids["des-EDE3-CBC"]:t=U.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}var Ee=Y,aa=Ee.ssh=Ee.ssh||{};aa.privateKeyToPutty=function(e,t,a){a=a||"",t=t||"";var r="ssh-rsa",n=t===""?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: "+r+`\r
|
|
17
|
+
`;s+="Encryption: "+n+`\r
|
|
18
|
+
`,s+="Comment: "+a+`\r
|
|
19
|
+
`;var i=Ee.util.createBuffer();hr(i,r),Tt(i,e.e),Tt(i,e.n);var o=Ee.util.encode64(i.bytes(),64),u=Math.floor(o.length/66)+1;s+="Public-Lines: "+u+`\r
|
|
20
|
+
`,s+=o;var l=Ee.util.createBuffer();Tt(l,e.d),Tt(l,e.p),Tt(l,e.q),Tt(l,e.qInv);var f;if(!t)f=Ee.util.encode64(l.bytes(),64);else{var c=l.length()+16-1;c-=c%16;var v=na(l.bytes());v.truncate(v.length()-c+l.length()),l.putBuffer(v);var m=Ee.util.createBuffer();m.putBuffer(na("\0\0\0\0",t)),m.putBuffer(na("\0\0\0",t));var y=Ee.aes.createEncryptionCipher(m.truncate(8),"CBC");y.start(Ee.util.createBuffer().fillWithByte(0,16)),y.update(l.copy()),y.finish();var x=y.output;x.truncate(16),f=Ee.util.encode64(x.bytes(),64)}u=Math.floor(f.length/66)+1,s+=`\r
|
|
99
21
|
Private-Lines: `+u+`\r
|
|
100
|
-
`,
|
|
101
|
-
Private-MAC: `+
|
|
102
|
-
`,
|
|
103
|
-
`),
|
|
22
|
+
`,s+=f;var S=na("putty-private-key-file-mac-key",t),A=Ee.util.createBuffer();hr(A,r),hr(A,n),hr(A,a),A.putInt32(i.length()),A.putBuffer(i),A.putInt32(l.length()),A.putBuffer(l);var B=Ee.hmac.create();return B.start("sha1",S),B.update(A.bytes()),s+=`\r
|
|
23
|
+
Private-MAC: `+B.digest().toHex()+`\r
|
|
24
|
+
`,s},aa.publicKeyToOpenSSH=function(e,t){var a="ssh-rsa";t=t||"";var r=Ee.util.createBuffer();return hr(r,a),Tt(r,e.e),Tt(r,e.n),a+" "+Ee.util.encode64(r.bytes())+" "+t},aa.privateKeyToOpenSSH=function(e,t){return t?Ee.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):Ee.pki.privateKeyToPem(e)},aa.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||Ee.md.md5.create(),r="ssh-rsa",n=Ee.util.createBuffer();hr(n,r),Tt(n,e.e),Tt(n,e.n),a.start(),a.update(n.getBytes());var s=a.digest();if(t.encoding==="hex"){var i=s.toHex();return t.delimiter?i.match(/.{2}/g).join(t.delimiter):i}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};function Tt(e,t){var a=t.toString(16);a[0]>="8"&&(a="00"+a);var r=Ee.util.hexToBytes(a);e.putInt32(r.length),e.putBytes(r)}function hr(e,t){e.putInt32(t.length),e.putString(t)}function na(){for(var e=Ee.md.sha1.create(),t=arguments.length,a=0;a<t;++a)e.update(arguments[a]);return e.digest()}var st=Y,dr="forge.task",$a={},Tu=0;st.debug.set(dr,"tasks",$a);var Je={};st.debug.set(dr,"queues",Je);var xi="?",Au=30,Iu=20,Ft="ready",xe="running",Ue="blocked",ke="sleeping",ge="done",me="error",$t="stop",Ot="start",pr="block",Nr="unblock",vr="sleep",wr="wakeup",Zt="cancel",yr="fail",K={};K[Ft]={},K[Ft][$t]=Ft,K[Ft][Ot]=xe,K[Ft][Zt]=ge,K[Ft][yr]=me,K[xe]={},K[xe][$t]=Ft,K[xe][Ot]=xe,K[xe][pr]=Ue,K[xe][Nr]=xe,K[xe][vr]=ke,K[xe][wr]=xe,K[xe][Zt]=ge,K[xe][yr]=me,K[Ue]={},K[Ue][$t]=Ue,K[Ue][Ot]=Ue,K[Ue][pr]=Ue,K[Ue][Nr]=Ue,K[Ue][vr]=Ue,K[Ue][wr]=Ue,K[Ue][Zt]=ge,K[Ue][yr]=me,K[ke]={},K[ke][$t]=ke,K[ke][Ot]=ke,K[ke][pr]=ke,K[ke][Nr]=ke,K[ke][vr]=ke,K[ke][wr]=ke,K[ke][Zt]=ge,K[ke][yr]=me,K[ge]={},K[ge][$t]=ge,K[ge][Ot]=ge,K[ge][pr]=ge,K[ge][Nr]=ge,K[ge][vr]=ge,K[ge][wr]=ge,K[ge][Zt]=ge,K[ge][yr]=me,K[me]={},K[me][$t]=me,K[me][Ot]=me,K[me][pr]=me,K[me][Nr]=me,K[me][vr]=me,K[me][wr]=me,K[me][Zt]=me,K[me][yr]=me;var at=function(e){this.id=-1,this.name=e.name||xi,this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=Ft,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=Tu++,$a[this.id]=this};at.prototype.debug=function(e){e=e||"",st.log.debug(dr,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",Je)},at.prototype.next=function(e,t){typeof e=="function"&&(t=e,e=this.name);var a=new at({run:t,name:e,parent:this});return a.state=xe,a.type=this.type,a.successCallback=this.successCallback||null,a.failureCallback=this.failureCallback||null,this.subtasks.push(a),this},at.prototype.parallel=function(e,t){return st.util.isArray(e)&&(t=e,e=this.name),this.next(e,function(a){var r=a;r.block(t.length);for(var n=function(u,l){st.task.start({type:u,run:function(f){t[l](f)},success:function(f){r.unblock()},failure:function(f){r.unblock()}})},s=0;s<t.length;s++){var i=e+"__parallel-"+a.id+"-"+s,o=s;n(i,o)}})},at.prototype.stop=function(){this.state=K[this.state][$t]},at.prototype.start=function(){this.error=!1,this.state=K[this.state][Ot],this.state===xe&&(this.start=new Date,this.run(this),Kt(this,0))},at.prototype.block=function(e){e=typeof e>"u"?1:e,this.blocks+=e,this.blocks>0&&(this.state=K[this.state][pr])},at.prototype.unblock=function(e){return e=typeof e>"u"?1:e,this.blocks-=e,this.blocks===0&&this.state!==ge&&(this.state=xe,Kt(this,0)),this.blocks},at.prototype.sleep=function(e){e=typeof e>"u"?0:e,this.state=K[this.state][vr];var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=xe,Kt(t,0)},e)},at.prototype.wait=function(e){e.wait(this)},at.prototype.wakeup=function(){this.state===ke&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=xe,Kt(this,0))},at.prototype.cancel=function(){this.state=K[this.state][Zt],this.permitsNeeded=0,this.timeoutId!==null&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},at.prototype.fail=function(e){if(this.error=!0,Za(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,Kt(e,0);else{if(this.parent!==null){for(var t=this.parent;t.parent!==null;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;Za(t,!0)}this.failureCallback&&this.failureCallback(this)}};var Bu=function(e){e.error=!1,e.state=K[e.state][Ot],setTimeout(function(){e.state===xe&&(e.swapTime=+new Date,e.run(e),Kt(e,0))},0)},Kt=function(e,t){var a=t>Au||+new Date-e.swapTime>Iu,r=function(n){if(n++,e.state===xe)if(a&&(e.swapTime=+new Date),e.subtasks.length>0){var s=e.subtasks.shift();s.error=e.error,s.swapTime=e.swapTime,s.userData=e.userData,s.run(s),s.error||Kt(s,n)}else Za(e),e.error||e.parent!==null&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,Kt(e.parent,n))};a?setTimeout(r,0):r(t)},Za=function(e,t){e.state=ge,delete $a[e.id],e.parent===null&&(e.type in Je?Je[e.type].length===0?st.log.error(dr,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):Je[e.type][0]!==e?st.log.error(dr,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(Je[e.type].shift(),Je[e.type].length===0?delete Je[e.type]:Je[e.type][0].start()):st.log.error(dr,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};st.task=st.task||{},st.task.start=function(e){var t=new at({run:e.run,name:e.name||xi});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in Je?Je[e.type].push(t):(Je[t.type]=[t],Bu(t))},st.task.cancel=function(e){e in Je&&(Je[e]=[Je[e][0]])},st.task.createCondition=function(){var e={tasks:{}};return e.wait=function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},e.notify=function(){var t=e.tasks;e.tasks={};for(var a in t)t[a].unblock()},e},function(e){e.exports=Y}(an);const bu=Di(an.exports);class Ja{constructor(t){Ce(this,"crt");Ce(this,"key");Ce(this,"csr");Ce(this,"detail");Ce(this,"expires");this.crt=t.crt,this.key=t.key,this.csr=t.csr;const{detail:a,expires:r}=this.getCrtDetail(this.crt);this.detail=a,this.expires=r.getTime()}toCertInfo(){return{crt:this.crt,key:this.key,csr:this.csr}}getCrtDetail(t){const r=bu.pki.certificateFromPem(t.toString()),n=r.validity.notAfter;return{detail:r,expires:n}}saveToFile(t,a){a==null&&(a=Ht.join(Ht.tmpdir(),"/certd/tmp/",Math.floor(Math.random()*1e6)+"",`cert.${t}`));const r=Ht.dirname(a);return Ht.existsSync(r)||Ht.mkdirSync(r,{recursive:!0}),Ht.writeFileSync(a,this[t]),a}}ee.CertApplyPlugin=class extends ae.AbstractTaskPlugin{constructor(){super(...arguments);Ce(this,"domains");Ce(this,"email");Ce(this,"dnsProviderType");Ce(this,"dnsProviderAccess");Ce(this,"renewDays");Ce(this,"forceUpdate");Ce(this,"csrInfo");Ce(this,"acme");Ce(this,"logger");Ce(this,"userContext");Ce(this,"accessService");Ce(this,"http");Ce(this,"lastStatus");Ce(this,"cert")}async onInstance(){this.acme=new Ii({userContext:this.userContext,logger:this.logger})}async execute(){const a=await this.condition();if(a!=null)return this.output(a);const r=await this.doCertApply();if(r!=null)this.output(r.toCertInfo()),this.clearLastStatus();else throw new Error("\u7533\u8BF7\u8BC1\u4E66\u5931\u8D25")}output(a){this.cert=a}async condition(){var o,u;if(this.forceUpdate)return null;let a=!1;const r=JSON.stringify((u=(o=this.lastStatus)==null?void 0:o.input)==null?void 0:u.domains),n=JSON.stringify(this.domains);r!==n&&(a=!0);let s;try{s=await this.readLastCert()}catch(l){this.logger.warn("\u8BFB\u53D6cert\u5931\u8D25\uFF1A",l)}if(s==null)return this.logger.info("\u8FD8\u672A\u7533\u8BF7\u8FC7\uFF0C\u51C6\u5907\u7533\u8BF7\u65B0\u8BC1\u4E66"),null;if(a)return this.logger.info("\u8F93\u5165\u53C2\u6570\u53D8\u66F4\uFF0C\u7533\u8BF7\u65B0\u8BC1\u4E66"),null;const i=this.isWillExpire(s.expires,this.renewDays);return i.isWillExpire?(this.logger.info("\u5373\u5C06\u8FC7\u671F\uFF0C\u5F00\u59CB\u66F4\u65B0\u8BC1\u4E66"),null):(this.logger.info(`\u8BC1\u4E66\u8FD8\u672A\u8FC7\u671F\uFF1A\u8FC7\u671F\u65F6\u95F4${ia.default(s.expires).format("YYYY-MM-DD HH:mm:ss")},\u5269\u4F59${i.leftDays}\u5929`),s)}async doCertApply(){const a=this.email,r=this.domains,n=this.dnsProviderType,s=this.dnsProviderAccess,i=Rr.default.merge({country:"CN",state:"GuangDong",locality:"ShengZhen",organization:"CertD Org.",organizationUnit:"IT Department",emailAddress:a},this.csrInfo);this.logger.info("\u5F00\u59CB\u7533\u8BF7\u8BC1\u4E66,",a,r);const o=oa.get(n),u=o.target,l=o.define,f=await this.accessService.getById(s),c=new u,v={access:f,logger:this.logger,http:this.http};Ni.inject(l.autowire,c,v),await c.onInstance();const m=await this.acme.order({email:a,domains:r,dnsProvider:c,csrInfo:i,isTest:!1}),y=this.formatCerts(m);return new Ja(y)}formatCert(a){return a=a.replace(/\r/g,""),a=a.replace(/\n\n/g,`
|
|
25
|
+
`),a=a.replace(/\n$/g,""),a}formatCerts(a){return{crt:this.formatCert(a.crt),key:this.formatCert(a.key),csr:this.formatCert(a.csr)}}async readLastCert(){var r,n,s;const a=(s=(n=(r=this.lastStatus)==null?void 0:r.status)==null?void 0:n.output)==null?void 0:s.cert;if(a!=null)return new Ja(a)}isWillExpire(a,r=20){if(a==null)throw new Error("\u8FC7\u671F\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A");const n=ia.default(a).diff(ia.default(),"day");return{isWillExpire:n<r,leftDays:n}}},et([ae.TaskInput({title:"\u57DF\u540D",component:{name:"a-select",vModel:"value",mode:"tags",open:!1},required:!0,col:{span:24},helper:`\u652F\u6301\u901A\u914D\u7B26\u57DF\u540D\uFF0C\u4F8B\u5982\uFF1A *.foo.com \u3001 *.test.handsfree.work
|
|
104
26
|
\u652F\u6301\u591A\u4E2A\u57DF\u540D\u3001\u591A\u4E2A\u5B50\u57DF\u540D\u3001\u591A\u4E2A\u901A\u914D\u7B26\u57DF\u540D\u6253\u5230\u4E00\u4E2A\u8BC1\u4E66\u4E0A\uFF08\u57DF\u540D\u5FC5\u987B\u662F\u5728\u540C\u4E00\u4E2ADNS\u63D0\u4F9B\u5546\u89E3\u6790\uFF09
|
|
105
27
|
\u591A\u7EA7\u5B50\u57DF\u540D\u8981\u5206\u6210\u591A\u4E2A\u57DF\u540D\u8F93\u5165\uFF08*.foo.com\u7684\u8BC1\u4E66\u4E0D\u80FD\u7528\u4E8Exxx.yyy.foo.com\uFF09
|
|
106
|
-
\u8F93\u5165\u4E00\u4E2A\u56DE\u8F66\u4E4B\u540E\uFF0C\u518D\u8F93\u5165\u4E0B\u4E00\u4E2A`})]
|
|
28
|
+
\u8F93\u5165\u4E00\u4E2A\u56DE\u8F66\u4E4B\u540E\uFF0C\u518D\u8F93\u5165\u4E0B\u4E00\u4E2A`})],ee.CertApplyPlugin.prototype,"domains",void 0),et([ae.TaskInput({title:"\u90AE\u7BB1",component:{name:"a-input",vModel:"value"},required:!0,helper:"\u8BF7\u8F93\u5165\u90AE\u7BB1"})],ee.CertApplyPlugin.prototype,"email",void 0),et([ae.TaskInput({title:"DNS\u63D0\u4F9B\u5546",component:{name:"pi-dns-provider-selector"},required:!0,helper:"\u8BF7\u9009\u62E9dns\u89E3\u6790\u63D0\u4F9B\u5546"})],ee.CertApplyPlugin.prototype,"dnsProviderType",void 0),et([ae.TaskInput({title:"DNS\u89E3\u6790\u6388\u6743",component:{name:"pi-access-selector"},required:!0,helper:"\u8BF7\u9009\u62E9dns\u89E3\u6790\u63D0\u4F9B\u5546\u6388\u6743"})],ee.CertApplyPlugin.prototype,"dnsProviderAccess",void 0),et([ae.TaskInput({title:"\u66F4\u65B0\u5929\u6570",component:{name:"a-input-number",vModel:"value"},required:!0,helper:"\u5230\u671F\u524D\u591A\u5C11\u5929\u540E\u66F4\u65B0\u8BC1\u4E66"})],ee.CertApplyPlugin.prototype,"renewDays",void 0),et([ae.TaskInput({title:"\u5F3A\u5236\u66F4\u65B0",component:{name:"a-switch",vModel:"checked"},helper:"\u662F\u5426\u5F3A\u5236\u91CD\u65B0\u7533\u8BF7\u8BC1\u4E66"})],ee.CertApplyPlugin.prototype,"forceUpdate",void 0),et([ae.TaskInput({title:"CsrInfo"})],ee.CertApplyPlugin.prototype,"csrInfo",void 0),et([ae.Autowire()],ee.CertApplyPlugin.prototype,"logger",void 0),et([ae.Autowire()],ee.CertApplyPlugin.prototype,"userContext",void 0),et([ae.Autowire()],ee.CertApplyPlugin.prototype,"accessService",void 0),et([ae.Autowire()],ee.CertApplyPlugin.prototype,"http",void 0),et([ae.Autowire()],ee.CertApplyPlugin.prototype,"lastStatus",void 0),et([ae.TaskOutput({title:"\u57DF\u540D\u8BC1\u4E66"})],ee.CertApplyPlugin.prototype,"cert",void 0),ee.CertApplyPlugin=et([ae.IsTaskPlugin({name:"CertApply",title:"\u8BC1\u4E66\u7533\u8BF7",desc:"\u514D\u8D39\u901A\u914D\u7B26\u57DF\u540D\u8BC1\u4E66\u7533\u8BF7\uFF0C\u652F\u6301\u591A\u4E2A\u57DF\u540D\u6253\u5230\u540C\u4E00\u4E2A\u8BC1\u4E66\u4E0A",default:{input:{renewDays:20,forceUpdate:!1},strategy:{runStrategy:ae.RunStrategy.AlwaysRun}}})],ee.CertApplyPlugin),new ee.CertApplyPlugin,ee.CertReader=Ja,ee.DNS_PROVIDER_CLASS_KEY=rn,ee.IsDnsProvider=wi,ee.dnsProviderRegistry=oa,Object.defineProperties(ee,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|