@sourcegraph/amp 0.0.1764081384-g1961a8 → 0.0.1764086485-g394076
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +18 -18
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4032,20 +4032,20 @@ ${Y.error.stderr}`;return Z}case"connected":{let Z=J.tools;if(Z instanceof Error
|
|
|
4032
4032
|
`),W=!0}K=await H6(G.isWorkspaceTrusted());for(let L of O){let w=LG8(L,K),I=q.get(L.name);if(w!==I)process.stdout.write(w+`
|
|
4033
4033
|
`),q.set(L.name,w),V=!0}if(O.every((L)=>{if(L.status.type==="connection-failed"||L.status.type==="disabled")return!0;if(L.status.type==="connected"&&L.tools instanceof Error)return!0;if(L.status.type==="connected"&&Array.isArray(L.tools)&&L.tools.length>0)return!0;return!1})&&O.length>0)U.unsubscribe(),H()},error:(N)=>{z(N)}});setTimeout(()=>{if(U.unsubscribe(),!V)z(Error("Timeout waiting for MCP servers"));else H()},30000)}),process.exit(0)}catch(G){process.stderr.write((G instanceof Error?G.message:String(G))+`
|
|
4034
4034
|
`),process.exit(1)}finally{if(X)await X.asyncDispose()}}var g96=G1(()=>{g0()});var I56=h((fk9,l61)=>{var Jq8=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{},U4=function(J){var Q=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,Y=0,X={},G={manual:J.Prism&&J.Prism.manual,disableWorkerMessageHandler:J.Prism&&J.Prism.disableWorkerMessageHandler,util:{encode:function M(L){if(L instanceof Z)return new Z(L.type,M(L.content),L.alias);else if(Array.isArray(L))return L.map(M);else return L.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(M){return Object.prototype.toString.call(M).slice(8,-1)},objId:function(M){if(!M.__id)Object.defineProperty(M,"__id",{value:++Y});return M.__id},clone:function M(L,w){w=w||{};var I,P;switch(G.util.type(L)){case"Object":if(P=G.util.objId(L),w[P])return w[P];I={},w[P]=I;for(var R in L)if(L.hasOwnProperty(R))I[R]=M(L[R],w);return I;case"Array":if(P=G.util.objId(L),w[P])return w[P];return I=[],w[P]=I,L.forEach(function(j,y){I[y]=M(j,w)}),I;default:return L}},getLanguage:function(M){while(M){var L=Q.exec(M.className);if(L)return L[1].toLowerCase();M=M.parentElement}return"none"},setLanguage:function(M,L){M.className=M.className.replace(RegExp(Q,"gi"),""),M.classList.add("language-"+L)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw Error()}catch(I){var M=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(I.stack)||[])[1];if(M){var L=document.getElementsByTagName("script");for(var w in L)if(L[w].src==M)return L[w]}return null}},isActive:function(M,L,w){var I="no-"+L;while(M){var P=M.classList;if(P.contains(L))return!0;if(P.contains(I))return!1;M=M.parentElement}return!!w}},languages:{plain:X,plaintext:X,text:X,txt:X,extend:function(M,L){var w=G.util.clone(G.languages[M]);for(var I in L)w[I]=L[I];return w},insertBefore:function(M,L,w,I){I=I||G.languages;var P=I[M],R={};for(var j in P)if(P.hasOwnProperty(j)){if(j==L){for(var y in w)if(w.hasOwnProperty(y))R[y]=w[y]}if(!w.hasOwnProperty(j))R[j]=P[j]}var f=I[M];return I[M]=R,G.languages.DFS(G.languages,function(g,p){if(p===f&&g!=M)this[g]=R}),R},DFS:function M(L,w,I,P){P=P||{};var R=G.util.objId;for(var j in L)if(L.hasOwnProperty(j)){w.call(L,j,L[j],I||j);var y=L[j],f=G.util.type(y);if(f==="Object"&&!P[R(y)])P[R(y)]=!0,M(y,w,null,P);else if(f==="Array"&&!P[R(y)])P[R(y)]=!0,M(y,w,j,P)}}},plugins:{},highlightAll:function(M,L){G.highlightAllUnder(document,M,L)},highlightAllUnder:function(M,L,w){var I={callback:w,container:M,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};G.hooks.run("before-highlightall",I),I.elements=Array.prototype.slice.apply(I.container.querySelectorAll(I.selector)),G.hooks.run("before-all-elements-highlight",I);for(var P=0,R;R=I.elements[P++];)G.highlightElement(R,L===!0,I.callback)},highlightElement:function(M,L,w){var I=G.util.getLanguage(M),P=G.languages[I];G.util.setLanguage(M,I);var R=M.parentElement;if(R&&R.nodeName.toLowerCase()==="pre")G.util.setLanguage(R,I);var j=M.textContent,y={element:M,language:I,grammar:P,code:j};function f(p){y.highlightedCode=p,G.hooks.run("before-insert",y),y.element.innerHTML=y.highlightedCode,G.hooks.run("after-highlight",y),G.hooks.run("complete",y),w&&w.call(y.element)}if(G.hooks.run("before-sanity-check",y),R=y.element.parentElement,R&&R.nodeName.toLowerCase()==="pre"&&!R.hasAttribute("tabindex"))R.setAttribute("tabindex","0");if(!y.code){G.hooks.run("complete",y),w&&w.call(y.element);return}if(G.hooks.run("before-highlight",y),!y.grammar){f(G.util.encode(y.code));return}if(L&&J.Worker){var g=new Worker(G.filename);g.onmessage=function(p){f(p.data)},g.postMessage(JSON.stringify({language:y.language,code:y.code,immediateClose:!0}))}else f(G.highlight(y.code,y.grammar,y.language))},highlight:function(M,L,w){var I={code:M,grammar:L,language:w};if(G.hooks.run("before-tokenize",I),!I.grammar)throw Error('The language "'+I.language+'" has no grammar.');return I.tokens=G.tokenize(I.code,I.grammar),G.hooks.run("after-tokenize",I),Z.stringify(G.util.encode(I.tokens),I.language)},tokenize:function(M,L){var w=L.rest;if(w){for(var I in w)L[I]=w[I];delete L.rest}var P=new K;return W(P,P.head,M),V(M,P,L,P.head,0),z(P)},hooks:{all:{},add:function(M,L){var w=G.hooks.all;w[M]=w[M]||[],w[M].push(L)},run:function(M,L){var w=G.hooks.all[M];if(!w||!w.length)return;for(var I=0,P;P=w[I++];)P(L)}},Token:Z};J.Prism=G;function Z(M,L,w,I){this.type=M,this.content=L,this.alias=w,this.length=(I||"").length|0}Z.stringify=function M(L,w){if(typeof L=="string")return L;if(Array.isArray(L)){var I="";return L.forEach(function(f){I+=M(f,w)}),I}var P={type:L.type,content:M(L.content,w),tag:"span",classes:["token",L.type],attributes:{},language:w},R=L.alias;if(R)if(Array.isArray(R))Array.prototype.push.apply(P.classes,R);else P.classes.push(R);G.hooks.run("wrap",P);var j="";for(var y in P.attributes)j+=" "+y+'="'+(P.attributes[y]||"").replace(/"/g,""")+'"';return"<"+P.tag+' class="'+P.classes.join(" ")+'"'+j+">"+P.content+"</"+P.tag+">"};function q(M,L,w,I){M.lastIndex=L;var P=M.exec(w);if(P&&I&&P[1]){var R=P[1].length;P.index+=R,P[0]=P[0].slice(R)}return P}function V(M,L,w,I,P,R){for(var j in w){if(!w.hasOwnProperty(j)||!w[j])continue;var y=w[j];y=Array.isArray(y)?y:[y];for(var f=0;f<y.length;++f){if(R&&R.cause==j+","+f)return;var g=y[f],p=g.inside,b=!!g.lookbehind,i=!!g.greedy,J1=g.alias;if(i&&!g.pattern.global){var n=g.pattern.toString().match(/[imsuy]*$/)[0];g.pattern=RegExp(g.pattern.source,n+"g")}var m=g.pattern||g;for(var s=I.next,q1=P;s!==L.tail;q1+=s.value.length,s=s.next){if(R&&q1>=R.reach)break;var W1=s.value;if(L.length>M.length)return;if(W1 instanceof Z)continue;var r=1,o;if(i){if(o=q(m,q1,M,b),!o||o.index>=M.length)break;var t=o.index,l=o.index+o[0].length,z1=q1;z1+=s.value.length;while(t>=z1)s=s.next,z1+=s.value.length;if(z1-=s.value.length,q1=z1,s.value instanceof Z)continue;for(var j1=s;j1!==L.tail&&(z1<l||typeof j1.value==="string");j1=j1.next)r++,z1+=j1.value.length;r--,W1=M.slice(q1,z1),o.index-=q1}else if(o=q(m,0,W1,b),!o)continue;var t=o.index,y1=o[0],R1=W1.slice(0,t),D0=W1.slice(t+y1.length),T1=q1+W1.length;if(R&&T1>R.reach)R.reach=T1;var a1=s.prev;if(R1)a1=W(L,a1,R1),q1+=R1.length;H(L,a1,r);var F1=new Z(j,p?G.tokenize(y1,p):y1,J1,y1);if(s=W(L,a1,F1),D0)W(L,s,D0);if(r>1){var Y1={cause:j+","+f,reach:T1};if(V(M,L,w,s.prev,q1,Y1),R&&Y1.reach>R.reach)R.reach=Y1.reach}}}}}function K(){var M={value:null,prev:null,next:null},L={value:null,prev:M,next:null};M.next=L,this.head=M,this.tail=L,this.length=0}function W(M,L,w){var I=L.next,P={value:w,prev:L,next:I};return L.next=P,I.prev=P,M.length++,P}function H(M,L,w){var I=L.next;for(var P=0;P<w&&I!==M.tail;P++)I=I.next;L.next=I,I.prev=L,M.length-=P}function z(M){var L=[],w=M.head.next;while(w!==M.tail)L.push(w.value),w=w.next;return L}if(!J.document){if(!J.addEventListener)return G;if(!G.disableWorkerMessageHandler)J.addEventListener("message",function(M){var L=JSON.parse(M.data),w=L.language,I=L.code,P=L.immediateClose;if(J.postMessage(G.highlight(I,G.languages[w],w)),P)J.close()},!1);return G}var U=G.util.currentScript();if(U){if(G.filename=U.src,U.hasAttribute("data-manual"))G.manual=!0}function N(){if(!G.manual)G.highlightAll()}if(!G.manual){var O=document.readyState;if(O==="loading"||O==="interactive"&&U&&U.defer)document.addEventListener("DOMContentLoaded",N);else if(window.requestAnimationFrame)window.requestAnimationFrame(N);else window.setTimeout(N,16)}return G}(Jq8);if(typeof l61<"u"&&l61.exports)l61.exports=U4;if(typeof global<"u")global.Prism=U4;U4.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};U4.languages.markup.tag.inside["attr-value"].inside.entity=U4.languages.markup.entity;U4.languages.markup.doctype.inside["internal-subset"].inside=U4.languages.markup;U4.hooks.add("wrap",function(J){if(J.type==="entity")J.attributes.title=J.content.replace(/&/,"&")});Object.defineProperty(U4.languages.markup.tag,"addInlined",{value:function(Q,Y){var X={};X["language-"+Y]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:U4.languages[Y]},X.cdata=/^<!\[CDATA\[|\]\]>$/i;var G={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:X}};G["language-"+Y]={pattern:/[\s\S]+/,inside:U4.languages[Y]};var Z={};Z[Q]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return Q}),"i"),lookbehind:!0,greedy:!0,inside:G},U4.languages.insertBefore("markup","cdata",Z)}});Object.defineProperty(U4.languages.markup.tag,"addAttribute",{value:function(J,Q){U4.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+J+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[Q,"language-"+Q],inside:U4.languages[Q]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});U4.languages.html=U4.languages.markup;U4.languages.mathml=U4.languages.markup;U4.languages.svg=U4.languages.markup;U4.languages.xml=U4.languages.extend("markup",{});U4.languages.ssml=U4.languages.xml;U4.languages.atom=U4.languages.xml;U4.languages.rss=U4.languages.xml;(function(J){var Q=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;J.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+Q.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+Q.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+Q.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+Q.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:Q,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},J.languages.css.atrule.inside.rest=J.languages.css;var Y=J.languages.markup;if(Y)Y.tag.addInlined("style","css"),Y.tag.addAttribute("style","css")})(U4);U4.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};U4.languages.javascript=U4.languages.extend("clike",{"class-name":[U4.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});U4.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;U4.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:U4.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:U4.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:U4.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:U4.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:U4.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});U4.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:U4.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});U4.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});if(U4.languages.markup)U4.languages.markup.tag.addInlined("script","javascript"),U4.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript");U4.languages.js=U4.languages.javascript;(function(){if(typeof U4>"u"||typeof document>"u")return;if(!Element.prototype.matches)Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector;var J="Loading…",Q=function(U,N){return"✖ Error "+U+" while fetching file: "+N},Y="✖ Error: File does not exist or is empty",X={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},G="data-src-status",Z="loading",q="loaded",V="failed",K="pre[data-src]:not(["+G+'="'+q+'"]):not(['+G+'="'+Z+'"])';function W(U,N,O){var M=new XMLHttpRequest;M.open("GET",U,!0),M.onreadystatechange=function(){if(M.readyState==4)if(M.status<400&&M.responseText)N(M.responseText);else if(M.status>=400)O(Q(M.status,M.statusText));else O(Y)},M.send(null)}function H(U){var N=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(U||"");if(N){var O=Number(N[1]),M=N[2],L=N[3];if(!M)return[O,O];if(!L)return[O,void 0];return[O,Number(L)]}return}U4.hooks.add("before-highlightall",function(U){U.selector+=", "+K}),U4.hooks.add("before-sanity-check",function(U){var N=U.element;if(N.matches(K)){U.code="",N.setAttribute(G,Z);var O=N.appendChild(document.createElement("CODE"));O.textContent=J;var M=N.getAttribute("data-src"),L=U.language;if(L==="none"){var w=(/\.(\w+)$/.exec(M)||[,"none"])[1];L=X[w]||w}U4.util.setLanguage(O,L),U4.util.setLanguage(N,L);var I=U4.plugins.autoloader;if(I)I.loadLanguages(L);W(M,function(P){N.setAttribute(G,q);var R=H(N.getAttribute("data-range"));if(R){var j=P.split(/\r\n?|\n/g),y=R[0],f=R[1]==null?j.length:R[1];if(y<0)y+=j.length;if(y=Math.max(0,Math.min(y-1,j.length)),f<0)f+=j.length;if(f=Math.max(0,Math.min(f,j.length)),P=j.slice(y,f).join(`
|
|
4035
|
-
`),!N.hasAttribute("data-start"))N.setAttribute("data-start",String(y+1))}O.textContent=P,U4.highlightElement(O)},function(P){N.setAttribute(G,V),O.textContent=P})}}),U4.plugins.fileHighlight={highlight:function(N){var O=(N||document).querySelectorAll(K);for(var M=0,L;L=O[M++];)U4.highlightElement(L)}};var z=!1;U4.fileHighlight=function(){if(!z)console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),z=!0;U4.plugins.fileHighlight.highlight.apply(this,arguments)}})()});var m56={};v8(m56,{setTerminalFocused:()=>Fq8,initFocusTracking:()=>zq8,getTerminalFocused:()=>dR1});function zq8(J){let Q=(Y)=>{if(Y.type==="focus")pR1=Y.focused};J.onFocus(Q)}function dR1(){return pR1}function Fq8(J){pR1=J}var pR1=!0;var d56={};v8(d56,{initIdleTracking:()=>Uq8,getIsIdle:()=>cR1});function Uq8(J,Q=300000){p56=Q,s61=Date.now(),J.onKey(()=>{s61=Date.now()}),J.onMouse(()=>{s61=Date.now()})}function cR1(){return Date.now()-s61>=p56}var s61,p56=300000;var lR1=G1(()=>{s61=Date.now()});var e56=h((t56)=>{Object.defineProperty(t56,"__esModule",{value:!0});var Rq8=cE1(),Cq8=nE1(),Sq8=Jw1(),jq8=Xw1(),s56=Gw1(),_q8=[Rq8.default,Cq8.default,(0,Sq8.default)(),jq8.default,s56.metadataVocabulary,s56.contentVocabulary];t56.default=_q8});var J26=h((qx9,yq8)=>{yq8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Y26=h((vY,aR1)=>{Object.defineProperty(vY,"__esModule",{value:!0});vY.MissingRefError=vY.ValidationError=vY.CodeGen=vY.Name=vY.nil=vY.stringify=vY.str=vY._=vY.KeywordCxt=vY.Ajv=void 0;var vq8=dE1(),xq8=e56(),fq8=qw1(),Q26=J26(),hq8=["/properties"],t61="http://json-schema.org/draft-07/schema";class Mu extends vq8.default{_addVocabularies(){if(super._addVocabularies(),xq8.default.forEach((J)=>this.addVocabulary(J)),this.opts.discriminator)this.addKeyword(fq8.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let J=this.opts.$data?this.$dataMetaSchema(Q26,hq8):Q26;this.addMetaSchema(J,t61,!1),this.refs["http://json-schema.org/schema"]=t61}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(t61)?t61:void 0)}}vY.Ajv=Mu;aR1.exports=vY=Mu;aR1.exports.Ajv=Mu;Object.defineProperty(vY,"__esModule",{value:!0});vY.default=Mu;var bq8=lT();Object.defineProperty(vY,"KeywordCxt",{enumerable:!0,get:function(){return bq8.KeywordCxt}});var cR=L8();Object.defineProperty(vY,"_",{enumerable:!0,get:function(){return cR._}});Object.defineProperty(vY,"str",{enumerable:!0,get:function(){return cR.str}});Object.defineProperty(vY,"stringify",{enumerable:!0,get:function(){return cR.stringify}});Object.defineProperty(vY,"nil",{enumerable:!0,get:function(){return cR.nil}});Object.defineProperty(vY,"Name",{enumerable:!0,get:function(){return cR.Name}});Object.defineProperty(vY,"CodeGen",{enumerable:!0,get:function(){return cR.CodeGen}});var uq8=nh();Object.defineProperty(vY,"ValidationError",{enumerable:!0,get:function(){return uq8.default}});var gq8=iT();Object.defineProperty(vY,"MissingRefError",{enumerable:!0,get:function(){return gq8.default}})});class tR1{options;session=null;pendingThreadCollapse=null;clientID;constructor(J){this.options=J;this.clientID=aa0(J.clientID)}async start(){if(this.session){x.warn("Client already started");return}let J={clientID:this.clientID,presenceIntervalMs:this.options.presenceIntervalMs,getActiveThreads:this.options.getActiveThreads,getAuth:this.options.getAuth,signal:this.options.signal,autoConfirmReceipts:this.options.autoConfirmReceipts,onEvent:this.createEventHandler()};if(this.session=new _11(J),this.options.onStatusChange)this.session.status.subscribe((Q)=>{this.options.onStatusChange?.(Q)});await this.session.start()}stop(){if(!this.session){x.warn("Client not started");return}this.session.stop(),this.session=null}getSession(){return this.session}async setActiveThreads(J){if(!this.session)throw Error("Session not started");await this.session.setActiveThreads(J)}async confirmReceipt(J){if(!this.session)throw Error("Session not started");await this.session.confirmReceipt(J)}async restart(J){let Q={...this.options,...J};this.stop(),this.options=Q,await this.start()}async restartWithNewThread(J,Q,Y){if(!this.session){x.warn("Cannot restart: no active session");return}x.debug("Restarting session with new thread"),x.debug(`Setting active threads to [${J}, ${Q}] for browser detection`),await this.session.setActiveThreads([J,Q]),await this.session.confirmReceipt(Y),x.debug("Confirmed receipt before restart");let X=this.clientID;this.session.stop(),this.session=null;let G={clientID:X,presenceIntervalMs:this.options.presenceIntervalMs,getActiveThreads:this.options.getActiveThreads,getAuth:this.options.getAuth,signal:this.options.signal,autoConfirmReceipts:this.options.autoConfirmReceipts,onEvent:this.createEventHandler()};if(this.session=new _11(G),this.options.onStatusChange)this.session.status.subscribe((Z)=>{this.options.onStatusChange?.(Z)});await this.session.start(),x.debug(`Re-advertising active threads: [${J}, ${Q}]`),await this.session.setActiveThreads([J,Q]),this.pendingThreadCollapse={oldThreadID:J,newThreadID:Q},x.debug("Session restarted successfully with new thread")}createEventHandler(){return async(J)=>{switch(J.type){case"thread-message":{if(!J.payload||!("content"in J.payload)){x.warn("Received thread-message without valid payload");break}if(!this.options.onThreadMessage){x.warn("No onThreadMessage handler configured");break}let Q=J.payload,Y=J.id.threadID,X=J.id.v;await this.options.onThreadMessage(Q,Y,X);break}case"approve-tool":case"reject-tool":{if(!J.payload||!("toolUseID"in J.payload)){x.warn("Received tool approval without valid payload");break}if(!this.options.onToolApproval){x.warn("No onToolApproval handler configured");break}let Q=J.type==="approve-tool";await this.options.onToolApproval(J.payload.toolUseID,Q);break}case"start-new-thread":{if(!this.options.onStartNewThread){x.warn("No onStartNewThread handler configured");break}let Y=this.options.getActiveThreads()[0];if(!Y){x.warn("No old thread ID available for restart");break}let X=J.payload;try{let G=await this.options.onStartNewThread(X?.initialMessage,X?.agentMode);await this.restartWithNewThread(Y,G.threadID,J.id)}catch(G){x.error("Failed to handle start-new-thread:",G)}break}case"disconnect":{if(x.info("Disconnect action received"),this.options.onDisconnect)await this.options.onDisconnect();break}case"initialize-connection":{if(x.info("Initialize connection event received"),this.pendingThreadCollapse)x.info(`Collapsing active threads from [${this.pendingThreadCollapse.oldThreadID}, ${this.pendingThreadCollapse.newThreadID}] to [${this.pendingThreadCollapse.newThreadID}]`),await this.setActiveThreads([this.pendingThreadCollapse.newThreadID]).catch((Q)=>x.error("Failed to collapse active threads:",Q)),this.pendingThreadCollapse=null;if(this.options.onInitializeConnection)await this.options.onInitializeConnection();break}case"switch-thread":{if(!J.payload||!("threadID"in J.payload)){x.warn("Received switch-thread without valid payload");break}let Q=J.payload.threadID;if(x.info(`Switch thread request received for ${Q}`),await this.setActiveThreads([Q]),this.options.switchToThread)await this.options.switchToThread(Q);break}}}}}var F26=G1(()=>{H0();Lw1()});function e61(){return hB}async function U26(J){if(hB)x.warn("Global client already running, stopping existing client first"),eR1();return hB=new tR1(J),await hB.start(),hB}function eR1(){if(hB)hB.stop(),hB=null}var hB=null;var JC1=G1(()=>{H0();F26()});var B26={};v8(B26,{stopGlobalSession:()=>eR1,startAutomaticPresence:()=>QC1,getGlobalSession:()=>e61});async function QC1(J,Q,Y,X,G,Z,q,V){if(e61()){x.warn("Client already running");return}try{let W=await Q.getLatest(),H=await W.secrets.getToken("apiKey",W.settings.url);if(!H){x.warn("API key not found, skipping automatic presence");return}let z=W.settings.url;if(!z){x.warn("amp.url is not set, skipping automatic presence");return}let U=await U26({clientID:V,presenceIntervalMs:5000,getActiveThreads:()=>{let N=Y();return N?[N.thread.id]:[]},getAuth:async()=>({baseURL:new URL(z),apiKey:H}),onThreadMessage:async(N,O,M)=>{let L=Y();if(!L){x.warn("No worker available to handle thread-message");return}if(L.thread.queuedMessages&&L.thread.queuedMessages.length>0)await L.handle({type:"user:message-queue:dequeue"});await L.handle(M>1?{type:"user:message-queue:enqueue",message:{content:N.content,fileMentions:N.fileMentions,userState:N.userState,agentMode:N.agentMode,meta:N.meta,source:N.source}}:{type:"user:message",message:{content:N.content,fileMentions:N.fileMentions,userState:N.userState,agentMode:N.agentMode,meta:N.meta,source:N.source}})},onToolApproval:async(N,O)=>{let M=Y();if(!M){x.warn("No worker available to handle tool approval");return}if(M.thread.queuedMessages&&M.thread.queuedMessages.length>0)await M.handle({type:"user:message-queue:dequeue"});await M.handle({type:"user:tool-input",toolUse:N,value:{accepted:O}})},onStartNewThread:async(N,O)=>{let M=await Z();if(X(M),N)await M.handle({type:"user:message",message:{content:[{type:"text",text:N}]}});return x.debug(`Successfully created and switched to new thread: ${M.thread.id}`),{threadID:M.thread.id}},switchToThread:async(N)=>{x.debug("Switching to thread from web",{threadID:N});try{await J.threadSyncService.discoverThreads();let O=await q(N);X(O),x.debug("Successfully switched to thread from web",{threadID:N})}catch(O){throw x.error("Failed to switch thread from web",{error:O,threadID:N}),O}},onStatusChange:(N)=>{G.sendStatus(N)}});x.info(`Automatic presence started for client: ${U.clientID}`)}catch(W){x.error("Failed to start automatic presence:",W)}}var YC1=G1(()=>{H0();JC1();JC1()});var Q41=h((M26)=>{Object.defineProperty(M26,"__esModule",{value:!0});function XV8(J){var Q=new Uint32Array(1);return Q[0]=J[0]*1664525+1013904223,Q}M26.default=XV8});var I26=h((E26)=>{Object.defineProperty(E26,"__esModule",{value:!0});E26.makeNoise2D=void 0;var Y41=Q41(),ZV8=0.02127659574468085,ZC1=(Math.sqrt(3)-1)/2,qV8=(1/Math.sqrt(3)-1)/2;function L26(J,Q,Y){return{dx:-Q-J*ZC1,dy:-Y-J*ZC1,xsb:Q,ysb:Y}}function VV8(J){var Q=[];for(var Y=0;Y<Lu.length;Y+=4){var X=KV8[Lu[Y]],G=null,Z=null;for(var q=0;q<X.length;q+=3){if(Z=L26(X[q],X[q+1],X[q+2]),G===null)Q[Y/4]=Z;else G.next=Z;G=Z}Z.next=L26(Lu[Y+1],Lu[Y+2],Lu[Y+3])}var V=[];for(var Y=0;Y<GC1.length;Y+=2)V[GC1[Y]]=Q[GC1[Y+1]];var K=new Uint8Array(256),W=new Uint8Array(256),H=new Uint8Array(256);for(var Y=0;Y<256;Y++)H[Y]=Y;var z=new Uint32Array(1);z[0]=J,z=Y41.default(Y41.default(Y41.default(z)));for(var Y=255;Y>=0;Y--){z=Y41.default(z);var U=new Uint32Array(1);if(U[0]=(z[0]+31)%(Y+1),U[0]<0)U[0]+=Y+1;K[Y]=H[U[0]],W[Y]=K[Y]&14,H[U[0]]=H[Y]}return function(N,O){var M=(N+O)*qV8,L=N+M,w=O+M,I=Math.floor(L),P=Math.floor(w),R=(I+P)*ZC1,j=N-(I+R),y=O-(P+R),f=L-I,g=w-P,p=f+g,b=f-g+1|p<<1|p+g<<2|p+f<<4,i=0;for(var J1=V[b];J1!==void 0;J1=J1.next){var n=j+J1.dx,m=y+J1.dy,s=2-n*n-m*m;if(s>0){var q1=I+J1.xsb,W1=P+J1.ysb,r=K[q1&255],o=W[r+W1&255],l=A26[o]*n+A26[o+1]*m;i+=s*s*s*s*l}}return i*ZV8}}E26.makeNoise2D=VV8;var KV8=[[1,1,0,1,0,1,0,0,0],[1,1,0,1,0,1,2,1,1]],A26=[5,2,2,5,-5,2,-2,5,5,-2,2,-5,-5,-2,-2,-5],GC1=[0,1,1,0,4,1,17,0,20,2,21,2,22,5,23,5,26,4,39,3,42,4,43,3],Lu=[0,0,1,-1,0,0,-1,1,0,2,1,1,1,2,2,0,1,2,0,2,1,0,0,0]});var R26=h((P26)=>{Object.defineProperty(P26,"__esModule",{value:!0});P26.makeNoise3D=void 0;var $41=Q41(),WV8=0.009708737864077669,X41=(Math.sqrt(4)-1)/3,HV8=(1/Math.sqrt(4)-1)/3;function qC1(J,Q,Y,X){return{dx:-Q-J*X41,dy:-Y-J*X41,dz:-X-J*X41,xsb:Q,ysb:Y,zsb:X}}function zV8(J){var Q=[];for(var Y=0;Y<IK.length;Y+=9){var X=FV8[IK[Y]],G=null,Z=null;for(var q=0;q<X.length;q+=4){if(Z=qC1(X[q],X[q+1],X[q+2],X[q+3]),G===null)Q[Y/9]=Z;else G.next=Z;G=Z}Z.next=qC1(IK[Y+1],IK[Y+2],IK[Y+3],IK[Y+4]),Z.next.next=qC1(IK[Y+5],IK[Y+6],IK[Y+7],IK[Y+8])}var V=[];for(var Y=0;Y<KC1.length;Y+=2)V[KC1[Y]]=Q[KC1[Y+1]];var K=new Uint8Array(256),W=new Uint8Array(256),H=new Uint8Array(256);for(var Y=0;Y<256;Y++)H[Y]=Y;var z=new Uint32Array(1);z[0]=J,z=$41.default($41.default($41.default(z)));for(var Y=255;Y>=0;Y--){z=$41.default(z);var U=new Uint32Array(1);if(U[0]=(z[0]+31)%(Y+1),U[0]<0)U[0]+=Y+1;K[Y]=H[U[0]],W[Y]=K[Y]%24*3,H[U[0]]=H[Y]}return function(N,O,M){var L=(N+O+M)*HV8,w=N+L,I=O+L,P=M+L,R=Math.floor(w),j=Math.floor(I),y=Math.floor(P),f=(R+j+y)*X41,g=N-(R+f),p=O-(j+f),b=M-(y+f),i=w-R,J1=I-j,n=P-y,m=i+J1+n,s=J1-n+1|i-J1+1<<1|i-n+1<<2|m<<3|m+n<<5|m+J1<<7|m+i<<9,q1=0;for(var W1=V[s];W1!==void 0;W1=W1.next){var r=g+W1.dx,o=p+W1.dy,l=b+W1.dz,z1=2-r*r-o*o-l*l;if(z1>0){var j1=R+W1.xsb,t=j+W1.ysb,y1=y+W1.zsb,R1=K[j1&255],D0=K[R1+t&255],T1=W[D0+y1&255],a1=VC1[T1]*r+VC1[T1+1]*o+VC1[T1+2]*l;q1+=z1*z1*z1*z1*a1}}return q1*WV8}}P26.makeNoise3D=zV8;var FV8=[[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,1],[2,1,1,0,2,1,0,1,2,0,1,1,3,1,1,1],[1,1,0,0,1,0,1,0,1,0,0,1,2,1,1,0,2,1,0,1,2,0,1,1]],VC1=[-11,4,4,-4,11,4,-4,4,11,11,4,4,4,11,4,4,4,11,-11,-4,4,-4,-11,4,-4,-4,11,11,-4,4,4,-11,4,4,-4,11,-11,4,-4,-4,11,-4,-4,4,-11,11,4,-4,4,11,-4,4,4,-11,-11,-4,-4,-4,-11,-4,-4,-4,-11,11,-4,-4,4,-11,-4,4,-4,-11],KC1=[0,2,1,1,2,2,5,1,6,0,7,0,32,2,34,2,129,1,133,1,160,5,161,5,518,0,519,0,546,4,550,4,645,3,647,3,672,5,673,5,674,4,677,3,678,4,679,3,680,13,681,13,682,12,685,14,686,12,687,14,712,20,714,18,809,21,813,23,840,20,841,21,1198,19,1199,22,1226,18,1230,19,1325,23,1327,22,1352,15,1353,17,1354,15,1357,17,1358,16,1359,16,1360,11,1361,10,1362,11,1365,10,1366,9,1367,9,1392,11,1394,11,1489,10,1493,10,1520,8,1521,8,1878,9,1879,9,1906,7,1910,7,2005,6,2007,6,2032,8,2033,8,2034,7,2037,6,2038,7,2039,6],IK=[0,0,1,-1,0,0,1,0,-1,0,0,-1,1,0,0,0,1,-1,0,0,-1,0,1,0,0,-1,1,0,2,1,1,0,1,1,1,-1,0,2,1,0,1,1,1,-1,1,0,2,0,1,1,1,-1,1,1,1,3,2,1,0,3,1,2,0,1,3,2,0,1,3,1,0,2,1,3,0,2,1,3,0,1,2,1,1,1,0,0,2,2,0,0,1,1,0,1,0,2,0,2,0,1,1,0,0,1,2,0,0,2,2,0,0,0,0,1,1,-1,1,2,0,0,0,0,1,-1,1,1,2,0,0,0,0,1,1,1,-1,2,3,1,1,1,2,0,0,2,2,3,1,1,1,2,2,0,0,2,3,1,1,1,2,0,2,0,2,1,1,-1,1,2,0,0,2,2,1,1,-1,1,2,2,0,0,2,1,-1,1,1,2,0,0,2,2,1,-1,1,1,2,0,2,0,2,1,1,1,-1,2,2,0,0,2,1,1,1,-1,2,0,2,0]});var j26=h((C26)=>{Object.defineProperty(C26,"__esModule",{value:!0});C26.makeNoise4D=void 0;var G41=Q41(),UV8=0.03333333333333333,Au=(Math.sqrt(5)-1)/4,BV8=(1/Math.sqrt(5)-1)/4;function Z41(J,Q,Y,X,G){return{dx:-Q-J*Au,dy:-Y-J*Au,dz:-X-J*Au,dw:-G-J*Au,xsb:Q,ysb:Y,zsb:X,wsb:G}}function NV8(J){var Q=[];for(var Y=0;Y<BJ.length;Y+=16){var X=DV8[BJ[Y]],G=null,Z=null;for(var q=0;q<X.length;q+=5){if(Z=Z41(X[q],X[q+1],X[q+2],X[q+3],X[q+4]),G===null)Q[Y/16]=Z;else G.next=Z;G=Z}Z.next=Z41(BJ[Y+1],BJ[Y+2],BJ[Y+3],BJ[Y+4],BJ[Y+5]),Z.next.next=Z41(BJ[Y+6],BJ[Y+7],BJ[Y+8],BJ[Y+9],BJ[Y+10]),Z.next.next.next=Z41(BJ[Y+11],BJ[Y+12],BJ[Y+13],BJ[Y+14],BJ[Y+15])}var V=[];for(var Y=0;Y<WC1.length;Y+=2)V[WC1[Y]]=Q[WC1[Y+1]];var K=new Uint8Array(256),W=new Uint8Array(256),H=new Uint8Array(256);for(var Y=0;Y<256;Y++)H[Y]=Y;var z=new Uint32Array(1);z[0]=J,z=G41.default(G41.default(G41.default(z)));for(var Y=255;Y>=0;Y--){z=G41.default(z);var U=new Uint32Array(1);if(U[0]=(z[0]+31)%(Y+1),U[0]<0)U[0]+=Y+1;K[Y]=H[U[0]],W[Y]=K[Y]&252,H[U[0]]=H[Y]}return function(N,O,M,L){var w=(N+O+M+L)*BV8,I=N+w,P=O+w,R=M+w,j=L+w,y=Math.floor(I),f=Math.floor(P),g=Math.floor(R),p=Math.floor(j),b=(y+f+g+p)*Au,i=N-(y+b),J1=O-(f+b),n=M-(g+b),m=L-(p+b),s=I-y,q1=P-f,W1=R-g,r=j-p,o=s+q1+W1+r,l=W1-r+1|q1-W1+1<<1|q1-r+1<<2|s-q1+1<<3|s-W1+1<<4|s-r+1<<5|o<<6|o+r<<8|o+W1<<11|o+q1<<14|o+s<<17,z1=0;for(var j1=V[l];j1!==void 0;j1=j1.next){var t=i+j1.dx,y1=J1+j1.dy,R1=n+j1.dz,D0=m+j1.dw,T1=2-t*t-y1*y1-R1*R1-D0*D0;if(T1>0){var a1=y+j1.xsb,F1=f+j1.ysb,Y1=g+j1.zsb,O1=p+j1.wsb,L1=K[a1&255],E1=K[L1+F1&255],A1=K[E1+Y1&255],u1=W[A1+O1&255],v1=q41[u1]*t+q41[u1+1]*y1+q41[u1+2]*R1+q41[u1+3]*D0;z1+=T1*T1*T1*T1*v1}}return z1*UV8}}C26.makeNoise4D=NV8;var DV8=[[0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,4,1,1,1,1],[1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1]],q41=[3,1,1,1,1,3,1,1,1,1,3,1,1,1,1,3,-3,1,1,1,-1,3,1,1,-1,1,3,1,-1,1,1,3,3,-1,1,1,1,-3,1,1,1,-1,3,1,1,-1,1,3,-3,-1,1,1,-1,-3,1,1,-1,-1,3,1,-1,-1,1,3,3,1,-1,1,1,3,-1,1,1,1,-3,1,1,1,-1,3,-3,1,-1,1,-1,3,-1,1,-1,1,-3,1,-1,1,-1,3,3,-1,-1,1,1,-3,-1,1,1,-1,-3,1,1,-1,-1,3,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,3,1,1,-1,1,3,1,-1,1,1,3,-1,1,1,1,-3,-3,1,1,-1,-1,3,1,-1,-1,1,3,-1,-1,1,1,-3,3,-1,1,-1,1,-3,1,-1,1,-1,3,-1,1,-1,1,-3,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,3,1,-1,-1,1,3,-1,-1,1,1,-3,-1,1,1,-1,-3,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3],WC1=[0,3,1,2,2,3,5,2,6,1,7,1,8,3,9,2,10,3,13,2,16,3,18,3,22,1,23,1,24,3,26,3,33,2,37,2,38,1,39,1,41,2,45,2,54,1,55,1,56,0,57,0,58,0,59,0,60,0,61,0,62,0,63,0,256,3,258,3,264,3,266,3,272,3,274,3,280,3,282,3,2049,2,2053,2,2057,2,2061,2,2081,2,2085,2,2089,2,2093,2,2304,9,2305,9,2312,9,2313,9,16390,1,16391,1,16406,1,16407,1,16422,1,16423,1,16438,1,16439,1,16642,8,16646,8,16658,8,16662,8,18437,6,18439,6,18469,6,18471,6,18688,9,18689,9,18690,8,18693,6,18694,8,18695,6,18696,9,18697,9,18706,8,18710,8,18725,6,18727,6,131128,0,131129,0,131130,0,131131,0,131132,0,131133,0,131134,0,131135,0,131352,7,131354,7,131384,7,131386,7,133161,5,133165,5,133177,5,133181,5,133376,9,133377,9,133384,9,133385,9,133400,7,133402,7,133417,5,133421,5,133432,7,133433,5,133434,7,133437,5,147510,4,147511,4,147518,4,147519,4,147714,8,147718,8,147730,8,147734,8,147736,7,147738,7,147766,4,147767,4,147768,7,147770,7,147774,4,147775,4,149509,6,149511,6,149541,6,149543,6,149545,5,149549,5,149558,4,149559,4,149561,5,149565,5,149566,4,149567,4,149760,9,149761,9,149762,8,149765,6,149766,8,149767,6,149768,9,149769,9,149778,8,149782,8,149784,7,149786,7,149797,6,149799,6,149801,5,149805,5,149814,4,149815,4,149816,7,149817,5,149818,7,149821,5,149822,4,149823,4,149824,37,149825,37,149826,36,149829,34,149830,36,149831,34,149832,37,149833,37,149842,36,149846,36,149848,35,149850,35,149861,34,149863,34,149865,33,149869,33,149878,32,149879,32,149880,35,149881,33,149882,35,149885,33,149886,32,149887,32,150080,49,150082,48,150088,49,150098,48,150104,47,150106,47,151873,46,151877,45,151881,46,151909,45,151913,44,151917,44,152128,49,152129,46,152136,49,152137,46,166214,43,166215,42,166230,43,166247,42,166262,41,166263,41,166466,48,166470,43,166482,48,166486,43,168261,45,168263,42,168293,45,168295,42,168512,31,168513,28,168514,31,168517,28,168518,25,168519,25,280952,40,280953,39,280954,40,280957,39,280958,38,280959,38,281176,47,281178,47,281208,40,281210,40,282985,44,282989,44,283001,39,283005,39,283208,30,283209,27,283224,30,283241,27,283256,22,283257,22,297334,41,297335,41,297342,38,297343,38,297554,29,297558,24,297562,29,297590,24,297594,21,297598,21,299365,26,299367,23,299373,26,299383,23,299389,20,299391,20,299584,31,299585,28,299586,31,299589,28,299590,25,299591,25,299592,30,299593,27,299602,29,299606,24,299608,30,299610,29,299621,26,299623,23,299625,27,299629,26,299638,24,299639,23,299640,22,299641,22,299642,21,299645,20,299646,21,299647,20,299648,61,299649,60,299650,61,299653,60,299654,59,299655,59,299656,58,299657,57,299666,55,299670,54,299672,58,299674,55,299685,52,299687,51,299689,57,299693,52,299702,54,299703,51,299704,56,299705,56,299706,53,299709,50,299710,53,299711,50,299904,61,299906,61,299912,58,299922,55,299928,58,299930,55,301697,60,301701,60,301705,57,301733,52,301737,57,301741,52,301952,79,301953,79,301960,76,301961,76,316038,59,316039,59,316054,54,316071,51,316086,54,316087,51,316290,78,316294,78,316306,73,316310,73,318085,77,318087,77,318117,70,318119,70,318336,79,318337,79,318338,78,318341,77,318342,78,318343,77,430776,56,430777,56,430778,53,430781,50,430782,53,430783,50,431000,75,431002,72,431032,75,431034,72,432809,74,432813,69,432825,74,432829,69,433032,76,433033,76,433048,75,433065,74,433080,75,433081,74,447158,71,447159,68,447166,71,447167,68,447378,73,447382,73,447386,72,447414,71,447418,72,447422,71,449189,70,449191,70,449197,69,449207,68,449213,69,449215,68,449408,67,449409,67,449410,66,449413,64,449414,66,449415,64,449416,67,449417,67,449426,66,449430,66,449432,65,449434,65,449445,64,449447,64,449449,63,449453,63,449462,62,449463,62,449464,65,449465,63,449466,65,449469,63,449470,62,449471,62,449472,19,449473,19,449474,18,449477,16,449478,18,449479,16,449480,19,449481,19,449490,18,449494,18,449496,17,449498,17,449509,16,449511,16,449513,15,449517,15,449526,14,449527,14,449528,17,449529,15,449530,17,449533,15,449534,14,449535,14,449728,19,449729,19,449730,18,449734,18,449736,19,449737,19,449746,18,449750,18,449752,17,449754,17,449784,17,449786,17,451520,19,451521,19,451525,16,451527,16,451528,19,451529,19,451557,16,451559,16,451561,15,451565,15,451577,15,451581,15,451776,19,451777,19,451784,19,451785,19,465858,18,465861,16,465862,18,465863,16,465874,18,465878,18,465893,16,465895,16,465910,14,465911,14,465918,14,465919,14,466114,18,466118,18,466130,18,466134,18,467909,16,467911,16,467941,16,467943,16,468160,13,468161,13,468162,13,468163,13,468164,13,468165,13,468166,13,468167,13,580568,17,580570,17,580585,15,580589,15,580598,14,580599,14,580600,17,580601,15,580602,17,580605,15,580606,14,580607,14,580824,17,580826,17,580856,17,580858,17,582633,15,582637,15,582649,15,582653,15,582856,12,582857,12,582872,12,582873,12,582888,12,582889,12,582904,12,582905,12,596982,14,596983,14,596990,14,596991,14,597202,11,597206,11,597210,11,597214,11,597234,11,597238,11,597242,11,597246,11,599013,10,599015,10,599021,10,599023,10,599029,10,599031,10,599037,10,599039,10,599232,13,599233,13,599234,13,599235,13,599236,13,599237,13,599238,13,599239,13,599240,12,599241,12,599250,11,599254,11,599256,12,599257,12,599258,11,599262,11,599269,10,599271,10,599272,12,599273,12,599277,10,599279,10,599282,11,599285,10,599286,11,599287,10,599288,12,599289,12,599290,11,599293,10,599294,11,599295,10],BJ=[0,0,1,-1,0,0,0,1,0,-1,0,0,1,0,0,-1,0,0,-1,1,0,0,0,0,1,-1,0,0,0,1,0,-1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,-1,0,0,-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,2,1,1,0,0,1,1,1,-1,0,1,1,1,0,-1,0,2,1,0,1,0,1,1,-1,1,0,1,1,0,1,-1,0,2,0,1,1,0,1,-1,1,1,0,1,0,1,1,-1,0,2,1,0,0,1,1,1,-1,0,1,1,1,0,-1,1,0,2,0,1,0,1,1,-1,1,0,1,1,0,1,-1,1,0,2,0,0,1,1,1,-1,0,1,1,1,0,-1,1,1,1,4,2,1,1,0,4,1,2,1,0,4,1,1,2,0,1,4,2,1,0,1,4,1,2,0,1,4,1,1,0,2,1,4,2,0,1,1,4,1,0,2,1,4,1,0,1,2,1,4,0,2,1,1,4,0,1,2,1,4,0,1,1,2,1,2,1,1,0,0,3,2,1,0,0,3,1,2,0,0,1,2,1,0,1,0,3,2,0,1,0,3,1,0,2,0,1,2,0,1,1,0,3,0,2,1,0,3,0,1,2,0,1,2,1,0,0,1,3,2,0,0,1,3,1,0,0,2,1,2,0,1,0,1,3,0,2,0,1,3,0,1,0,2,1,2,0,0,1,1,3,0,0,2,1,3,0,0,1,2,2,3,1,1,1,0,2,1,1,1,-1,2,2,0,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,2,0,0,0,2,3,1,0,1,1,2,1,-1,1,1,2,2,0,0,0,2,3,1,1,1,0,2,1,1,1,-1,2,0,2,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,0,2,0,0,2,3,0,1,1,1,2,-1,1,1,1,2,0,2,0,0,2,3,1,1,1,0,2,1,1,1,-1,2,0,0,2,0,2,3,1,0,1,1,2,1,-1,1,1,2,0,0,2,0,2,3,0,1,1,1,2,-1,1,1,1,2,0,0,2,0,2,3,1,1,0,1,2,1,1,-1,1,2,0,0,0,2,2,3,1,0,1,1,2,1,-1,1,1,2,0,0,0,2,2,3,0,1,1,1,2,-1,1,1,1,2,0,0,0,2,2,1,1,1,-1,0,1,1,1,0,-1,0,0,0,0,0,2,1,1,-1,1,0,1,1,0,1,-1,0,0,0,0,0,2,1,-1,1,1,0,1,0,1,1,-1,0,0,0,0,0,2,1,1,-1,0,1,1,1,0,-1,1,0,0,0,0,0,2,1,-1,1,0,1,1,0,1,-1,1,0,0,0,0,0,2,1,-1,0,1,1,1,0,-1,1,1,0,0,0,0,0,2,1,1,1,-1,0,1,1,1,0,-1,2,2,0,0,0,2,1,1,-1,1,0,1,1,0,1,-1,2,2,0,0,0,2,1,1,-1,0,1,1,1,0,-1,1,2,2,0,0,0,2,1,1,1,-1,0,1,1,1,0,-1,2,0,2,0,0,2,1,-1,1,1,0,1,0,1,1,-1,2,0,2,0,0,2,1,-1,1,0,1,1,0,1,-1,1,2,0,2,0,0,2,1,1,-1,1,0,1,1,0,1,-1,2,0,0,2,0,2,1,-1,1,1,0,1,0,1,1,-1,2,0,0,2,0,2,1,-1,0,1,1,1,0,-1,1,1,2,0,0,2,0,2,1,1,-1,0,1,1,1,0,-1,1,2,0,0,0,2,2,1,-1,1,0,1,1,0,1,-1,1,2,0,0,0,2,2,1,-1,0,1,1,1,0,-1,1,1,2,0,0,0,2,3,1,1,0,0,0,2,2,0,0,0,2,1,1,1,-1,3,1,0,1,0,0,2,0,2,0,0,2,1,1,1,-1,3,1,0,0,1,0,2,0,0,2,0,2,1,1,1,-1,3,1,1,0,0,0,2,2,0,0,0,2,1,1,-1,1,3,1,0,1,0,0,2,0,2,0,0,2,1,1,-1,1,3,1,0,0,0,1,2,0,0,0,2,2,1,1,-1,1,3,1,1,0,0,0,2,2,0,0,0,2,1,-1,1,1,3,1,0,0,1,0,2,0,0,2,0,2,1,-1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,1,-1,1,1,3,1,0,1,0,0,2,0,2,0,0,2,-1,1,1,1,3,1,0,0,1,0,2,0,0,2,0,2,-1,1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,-1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,4,1,1,1,1,3,3,2,0,1,0,3,1,0,2,0,4,1,1,1,1,3,3,0,2,1,0,3,0,1,2,0,4,1,1,1,1,3,3,2,0,0,1,3,1,0,0,2,4,1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,4,1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,4,1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,1,-1,3,3,2,0,1,0,3,1,0,2,0,2,1,1,1,-1,3,3,0,2,1,0,3,0,1,2,0,2,1,1,1,-1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,-1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,1,-1,1,3,3,0,2,0,1,3,0,1,0,2,2,1,1,-1,1,3,3,2,0,1,0,3,1,0,2,0,2,1,-1,1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,-1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,1,-1,1,1,3,3,0,2,1,0,3,0,1,2,0,2,-1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,2,-1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,-1,1,1,1]});var _26=h((Eu)=>{Object.defineProperty(Eu,"__esModule",{value:!0});Eu.makeNoise4D=Eu.makeNoise3D=Eu.makeNoise2D=void 0;var OV8=I26();Object.defineProperty(Eu,"makeNoise2D",{enumerable:!0,get:function(){return OV8.makeNoise2D}});var MV8=R26();Object.defineProperty(Eu,"makeNoise3D",{enumerable:!0,get:function(){return MV8.makeNoise3D}});var LV8=j26();Object.defineProperty(Eu,"makeNoise4D",{enumerable:!0,get:function(){return LV8.makeNoise4D}})});var bQ6=h((OY5,hQ6)=>{hQ6.exports=I81;function I81(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}I81.prototype.go=function(J){if(this.pending<this.max)fQ6(this,J);else this.waiting.push(J)};I81.prototype.wait=function(J){if(this.pending===0)J(this.error);else this.listeners.push(J)};I81.prototype.hold=function(){return xQ6(this)};function xQ6(J){J.pending+=1;var Q=!1;return Y;function Y(G){if(Q)throw Error("callback called twice");if(Q=!0,J.error=J.error||G,J.pending-=1,J.waiting.length>0&&J.pending<J.max)fQ6(J,J.waiting.shift());else if(J.pending===0){var Z=J.listeners;J.listeners=[],Z.forEach(X)}}function X(G){G(J.error)}}function fQ6(J,Q){Q(xQ6(J))}});var gQ6=h((KF8)=>{var Jg=S1("fs"),P81=S1("util"),z_1=S1("stream"),uQ6=z_1.Readable,F_1=z_1.Writable,GF8=z_1.PassThrough,ZF8=bQ6(),T81=S1("events").EventEmitter;KF8.createFromBuffer=qF8;KF8.createFromFd=VF8;KF8.BufferSlicer=Kz;KF8.FdSlicer=Vz;P81.inherits(Vz,T81);function Vz(J,Q){Q=Q||{},T81.call(this),this.fd=J,this.pend=new ZF8,this.pend.max=1,this.refCount=0,this.autoClose=!!Q.autoClose}Vz.prototype.read=function(J,Q,Y,X,G){var Z=this;Z.pend.go(function(q){Jg.read(Z.fd,J,Q,Y,X,function(V,K,W){q(),G(V,K,W)})})};Vz.prototype.write=function(J,Q,Y,X,G){var Z=this;Z.pend.go(function(q){Jg.write(Z.fd,J,Q,Y,X,function(V,K,W){q(),G(V,K,W)})})};Vz.prototype.createReadStream=function(J){return new R81(this,J)};Vz.prototype.createWriteStream=function(J){return new C81(this,J)};Vz.prototype.ref=function(){this.refCount+=1};Vz.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");if(J.autoClose)Jg.close(J.fd,Q);function Q(Y){if(Y)J.emit("error",Y);else J.emit("close")}};P81.inherits(R81,uQ6);function R81(J,Q){Q=Q||{},uQ6.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end,this.pos=this.start,this.destroyed=!1}R81.prototype._read=function(J){var Q=this;if(Q.destroyed)return;var Y=Math.min(Q._readableState.highWaterMark,J);if(Q.endOffset!=null)Y=Math.min(Y,Q.endOffset-Q.pos);if(Y<=0){Q.destroyed=!0,Q.push(null),Q.context.unref();return}Q.context.pend.go(function(X){if(Q.destroyed)return X();var G=Buffer.allocUnsafe(Y);Jg.read(Q.context.fd,G,0,Y,Q.pos,function(Z,q){if(Z)Q.destroy(Z);else if(q===0)Q.destroyed=!0,Q.push(null),Q.context.unref();else Q.pos+=q,Q.push(G.slice(0,q));X()})})};R81.prototype.destroy=function(J){if(this.destroyed)return;J=J||Error("stream destroyed"),this.destroyed=!0,this.emit("error",J),this.context.unref()};P81.inherits(C81,F_1);function C81(J,Q){Q=Q||{},F_1.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end==null?1/0:+Q.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}C81.prototype._write=function(J,Q,Y){var X=this;if(X.destroyed)return;if(X.pos+J.length>X.endOffset){var G=Error("maximum file length exceeded");G.code="ETOOBIG",X.destroy(),Y(G);return}X.context.pend.go(function(Z){if(X.destroyed)return Z();Jg.write(X.context.fd,J,0,J.length,X.pos,function(q,V){if(q)X.destroy(),Z(),Y(q);else X.bytesWritten+=V,X.pos+=V,X.emit("progress"),Z(),Y()})})};C81.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=!0,this.context.unref()};P81.inherits(Kz,T81);function Kz(J,Q){T81.call(this),Q=Q||{},this.refCount=0,this.buffer=J,this.maxChunkSize=Q.maxChunkSize||Number.MAX_SAFE_INTEGER}Kz.prototype.read=function(J,Q,Y,X,G){if(!(0<=Q&&Q<=J.length))throw RangeError("offset outside buffer: 0 <= "+Q+" <= "+J.length);if(X<0)throw RangeError("position is negative: "+X);if(Q+Y>J.length)Y=J.length-Q;if(X+Y>this.buffer.length)Y=this.buffer.length-X;if(Y<=0){setImmediate(function(){G(null,0)});return}this.buffer.copy(J,Q,X,X+Y),setImmediate(function(){G(null,Y)})};Kz.prototype.write=function(J,Q,Y,X,G){J.copy(this.buffer,X,Q,Q+Y),setImmediate(function(){G(null,Y,J)})};Kz.prototype.createReadStream=function(J){J=J||{};var Q=new GF8(J);Q.destroyed=!1,Q.start=J.start||0,Q.endOffset=J.end,Q.pos=Q.endOffset||this.buffer.length;var Y=this.buffer.slice(Q.start,Q.pos),X=0;while(!0){var G=X+this.maxChunkSize;if(G>=Y.length){if(X<Y.length)Q.write(Y.slice(X,Y.length));break}Q.write(Y.slice(X,G)),X=G}return Q.end(),Q.destroy=function(){Q.destroyed=!0},Q};Kz.prototype.createWriteStream=function(J){var Q=this;J=J||{};var Y=new F_1(J);return Y.start=J.start||0,Y.endOffset=J.end==null?this.buffer.length:+J.end,Y.bytesWritten=0,Y.pos=Y.start,Y.destroyed=!1,Y._write=function(X,G,Z){if(Y.destroyed)return;var q=Y.pos+X.length;if(q>Y.endOffset){var V=Error("maximum file length exceeded");V.code="ETOOBIG",Y.destroyed=!0,Z(V);return}X.copy(Q.buffer,Y.pos,0,X.length),Y.bytesWritten+=X.length,Y.pos=q,Y.emit("progress"),Z()},Y.destroy=function(){Y.destroyed=!0},Y};Kz.prototype.ref=function(){this.refCount+=1};Kz.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")};function qF8(J,Q){return new Kz(J,Q)}function VF8(J,Q){return new Vz(J,Q)}});var dQ6=h((LY5,pQ6)=>{var rB=S1("buffer").Buffer,U_1=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array<"u")U_1=new Int32Array(U_1);function mQ6(J){if(rB.isBuffer(J))return J;var Q=typeof rB.alloc==="function"&&typeof rB.from==="function";if(typeof J==="number")return Q?rB.alloc(J):new rB(J);else if(typeof J==="string")return Q?rB.from(J):new rB(J);else throw Error("input must be buffer, number, or string, received "+typeof J)}function UF8(J){var Q=mQ6(4);return Q.writeInt32BE(J,0),Q}function B_1(J,Q){if(J=mQ6(J),rB.isBuffer(Q))Q=Q.readUInt32BE(0);var Y=~~Q^-1;for(var X=0;X<J.length;X++)Y=U_1[(Y^J[X])&255]^Y>>>8;return Y^-1}function N_1(){return UF8(B_1.apply(null,arguments))}N_1.signed=function(){return B_1.apply(null,arguments)};N_1.unsigned=function(){return B_1.apply(null,arguments)>>>0};pQ6.exports=N_1});function __1(J){let Q={},Y={};for(let X in J){if(!Object.hasOwn(J,X))continue;let G=J[X];switch(typeof G){case"number":Q[X]=G;break;case"boolean":Q[X]=G?1:0;break;case"object":{if(G===null||G===void 0){Y[X]=G;break}let{metadata:Z}=__1(G);for(let[q,V]of Object.entries(Z))Q[`${X}.${q}`]=V;Y[X]=G;break}default:Y[X]=G}}return{metadata:Q,sensitiveMetadata:Y}}function k_1(J,Q){let{metadata:Y,sensitiveMetadata:X}=__1(J.metadata||{});return{feature:J.feature,action:J.action,timestamp:Date.now()*1000,source:{client:Q},parameters:{...Object.keys(Y).length>0&&{metadata:Y},...Object.keys(X).length>0&&{sensitiveMetadata:X}}}}var HY6=()=>{};class y_1{configService;constructor(J){this.configService=J}recordEvent(J){let Q=k_1(J,"cli"),Y=JSON.stringify([Q]);To(Y,this.configService).catch((X)=>{x.error("Failed to send telemetry",{error:X,feature:J.feature,action:J.action})})}}var zY6=G1(()=>{H0();dZ();HY6()});var g81={};v8(g81,{recordEvent:()=>OL,recordAdEvent:()=>hs0,initializeCLITelemetry:()=>VU8});function VU8(J){if(FY6)return;let Q=new y_1(J);fs0(Q),FY6=!0}var FY6=!1;var m81=G1(()=>{kI1();zY6()});var LY6=h((eG5,MY6)=>{function UU8(){if(typeof window<"u"&&typeof window.process==="object"&&window.process.type==="renderer")return!0;if(typeof process<"u"&&typeof process.versions==="object"&&!!process.versions.electron)return!0;if(typeof navigator==="object"&&typeof navigator.userAgent==="string"&&navigator.userAgent.indexOf("Electron")>=0)return!0;return!1}MY6.exports=UU8});var m8=h((JZ5,AY6)=>{AY6.exports={options:{usePureJavaScript:!1}}});var IY6=h((QZ5,wY6)=>{var f_1={};wY6.exports=f_1;var EY6={};f_1.encode=function(J,Q,Y){if(typeof Q!=="string")throw TypeError('"alphabet" must be a string.');if(Y!==void 0&&typeof Y!=="number")throw TypeError('"maxline" must be a number.');var X="";if(!(J instanceof Uint8Array))X=BU8(J,Q);else{var G=0,Z=Q.length,q=Q.charAt(0),V=[0];for(G=0;G<J.length;++G){for(var K=0,W=J[G];K<V.length;++K)W+=V[K]<<8,V[K]=W%Z,W=W/Z|0;while(W>0)V.push(W%Z),W=W/Z|0}for(G=0;J[G]===0&&G<J.length-1;++G)X+=q;for(G=V.length-1;G>=0;--G)X+=Q[V[G]]}if(Y){var H=new RegExp(".{1,"+Y+"}","g");X=X.match(H).join(`\r
|
|
4036
|
-
`)}return X};f_1.decode=function(J,Q){if(typeof J!=="string")throw TypeError('"input" must be a string.');if(typeof Q!=="string")throw TypeError('"alphabet" must be a string.');var Y=EY6[Q];if(!Y){Y=EY6[Q]=[];for(var X=0;X<Q.length;++X)Y[Q.charCodeAt(X)]=X}J=J.replace(/\s/g,"");var G=Q.length,Z=Q.charAt(0),q=[0];for(var X=0;X<J.length;X++){var V=Y[J.charCodeAt(X)];if(V===void 0)return;for(var K=0,W=V;K<q.length;++K)W+=q[K]*G,q[K]=W&255,W>>=8;while(W>0)q.push(W&255),W>>=8}for(var H=0;J[H]===Z&&H<J.length-1;++H)q.push(0);if(typeof Buffer<"u")return Buffer.from(q.reverse());return new Uint8Array(q.reverse())};function BU8(J,Q){var Y=0,X=Q.length,G=Q.charAt(0),Z=[0];for(Y=0;Y<J.length();++Y){for(var q=0,V=J.at(Y);q<Z.length;++q)V+=Z[q]<<8,Z[q]=V%X,V=V/X|0;while(V>0)Z.push(V%X),V=V/X|0}var K="";for(Y=0;J.at(Y)===0&&Y<J.length()-1;++Y)K+=G;for(Y=Z.length-1;Y>=0;--Y)K+=Q[Z[Y]];return K}});var i9=h((YZ5,CY6)=>{var PY6=m8(),TY6=IY6(),G0=CY6.exports=PY6.util=PY6.util||{};(function(){if(typeof process<"u"&&process.nextTick){if(G0.nextTick=process.nextTick,typeof setImmediate==="function")G0.setImmediate=setImmediate;else G0.setImmediate=G0.nextTick;return}if(typeof setImmediate==="function"){G0.setImmediate=function(){return setImmediate.apply(void 0,arguments)},G0.nextTick=function(V){return setImmediate(V)};return}if(G0.setImmediate=function(V){setTimeout(V,0)},typeof window<"u"&&typeof window.postMessage==="function"){let V=function(K){if(K.source===window&&K.data===J){K.stopPropagation();var W=Q.slice();Q.length=0,W.forEach(function(H){H()})}};var q=V,J="forge.setImmediate",Q=[];G0.setImmediate=function(K){if(Q.push(K),Q.length===1)window.postMessage(J,"*")},window.addEventListener("message",V,!0)}if(typeof MutationObserver<"u"){var Y=Date.now(),X=!0,G=document.createElement("div"),Q=[];new MutationObserver(function(){var K=Q.slice();Q.length=0,K.forEach(function(W){W()})}).observe(G,{attributes:!0});var Z=G0.setImmediate;G0.setImmediate=function(K){if(Date.now()-Y>15)Y=Date.now(),Z(K);else if(Q.push(K),Q.length===1)G.setAttribute("a",X=!X)}}G0.nextTick=G0.setImmediate})();G0.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;G0.globalScope=function(){if(G0.isNodejs)return global;return typeof self>"u"?window:self}();G0.isArray=Array.isArray||function(J){return Object.prototype.toString.call(J)==="[object Array]"};G0.isArrayBuffer=function(J){return typeof ArrayBuffer<"u"&&J instanceof ArrayBuffer};G0.isArrayBufferView=function(J){return J&&G0.isArrayBuffer(J.buffer)&&J.byteLength!==void 0};function Gg(J){if(!(J===8||J===16||J===24||J===32))throw Error("Only 8, 16, 24, or 32 bits supported: "+J)}G0.ByteBuffer=h_1;function h_1(J){if(this.data="",this.read=0,typeof J==="string")this.data=J;else if(G0.isArrayBuffer(J)||G0.isArrayBufferView(J))if(typeof Buffer<"u"&&J instanceof Buffer)this.data=J.toString("binary");else{var Q=new Uint8Array(J);try{this.data=String.fromCharCode.apply(null,Q)}catch(X){for(var Y=0;Y<Q.length;++Y)this.putByte(Q[Y])}}else if(J instanceof h_1||typeof J==="object"&&typeof J.data==="string"&&typeof J.read==="number")this.data=J.data,this.read=J.read;this._constructedStringLength=0}G0.ByteStringBuffer=h_1;var NU8=4096;G0.ByteStringBuffer.prototype._optimizeConstructedString=function(J){if(this._constructedStringLength+=J,this._constructedStringLength>NU8)this.data.substr(0,1),this._constructedStringLength=0};G0.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};G0.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};G0.ByteStringBuffer.prototype.putByte=function(J){return this.putBytes(String.fromCharCode(J))};G0.ByteStringBuffer.prototype.fillWithByte=function(J,Q){J=String.fromCharCode(J);var Y=this.data;while(Q>0){if(Q&1)Y+=J;if(Q>>>=1,Q>0)J+=J}return this.data=Y,this._optimizeConstructedString(Q),this};G0.ByteStringBuffer.prototype.putBytes=function(J){return this.data+=J,this._optimizeConstructedString(J.length),this};G0.ByteStringBuffer.prototype.putString=function(J){return this.putBytes(G0.encodeUtf8(J))};G0.ByteStringBuffer.prototype.putInt16=function(J){return this.putBytes(String.fromCharCode(J>>8&255)+String.fromCharCode(J&255))};G0.ByteStringBuffer.prototype.putInt24=function(J){return this.putBytes(String.fromCharCode(J>>16&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J&255))};G0.ByteStringBuffer.prototype.putInt32=function(J){return this.putBytes(String.fromCharCode(J>>24&255)+String.fromCharCode(J>>16&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J&255))};G0.ByteStringBuffer.prototype.putInt16Le=function(J){return this.putBytes(String.fromCharCode(J&255)+String.fromCharCode(J>>8&255))};G0.ByteStringBuffer.prototype.putInt24Le=function(J){return this.putBytes(String.fromCharCode(J&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J>>16&255))};G0.ByteStringBuffer.prototype.putInt32Le=function(J){return this.putBytes(String.fromCharCode(J&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J>>16&255)+String.fromCharCode(J>>24&255))};G0.ByteStringBuffer.prototype.putInt=function(J,Q){Gg(Q);var Y="";do Q-=8,Y+=String.fromCharCode(J>>Q&255);while(Q>0);return this.putBytes(Y)};G0.ByteStringBuffer.prototype.putSignedInt=function(J,Q){if(J<0)J+=2<<Q-1;return this.putInt(J,Q)};G0.ByteStringBuffer.prototype.putBuffer=function(J){return this.putBytes(J.getBytes())};G0.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};G0.ByteStringBuffer.prototype.getInt16=function(){var J=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,J};G0.ByteStringBuffer.prototype.getInt24=function(){var J=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,J};G0.ByteStringBuffer.prototype.getInt32=function(){var J=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,J};G0.ByteStringBuffer.prototype.getInt16Le=function(){var J=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,J};G0.ByteStringBuffer.prototype.getInt24Le=function(){var J=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,J};G0.ByteStringBuffer.prototype.getInt32Le=function(){var J=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,J};G0.ByteStringBuffer.prototype.getInt=function(J){Gg(J);var Q=0;do Q=(Q<<8)+this.data.charCodeAt(this.read++),J-=8;while(J>0);return Q};G0.ByteStringBuffer.prototype.getSignedInt=function(J){var Q=this.getInt(J),Y=2<<J-2;if(Q>=Y)Q-=Y<<1;return Q};G0.ByteStringBuffer.prototype.getBytes=function(J){var Q;if(J)J=Math.min(this.length(),J),Q=this.data.slice(this.read,this.read+J),this.read+=J;else if(J===0)Q="";else Q=this.read===0?this.data:this.data.slice(this.read),this.clear();return Q};G0.ByteStringBuffer.prototype.bytes=function(J){return typeof J>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+J)};G0.ByteStringBuffer.prototype.at=function(J){return this.data.charCodeAt(this.read+J)};G0.ByteStringBuffer.prototype.setAt=function(J,Q){return this.data=this.data.substr(0,this.read+J)+String.fromCharCode(Q)+this.data.substr(this.read+J+1),this};G0.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};G0.ByteStringBuffer.prototype.copy=function(){var J=G0.createBuffer(this.data);return J.read=this.read,J};G0.ByteStringBuffer.prototype.compact=function(){if(this.read>0)this.data=this.data.slice(this.read),this.read=0;return this};G0.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};G0.ByteStringBuffer.prototype.truncate=function(J){var Q=Math.max(0,this.length()-J);return this.data=this.data.substr(this.read,Q),this.read=0,this};G0.ByteStringBuffer.prototype.toHex=function(){var J="";for(var Q=this.read;Q<this.data.length;++Q){var Y=this.data.charCodeAt(Q);if(Y<16)J+="0";J+=Y.toString(16)}return J};G0.ByteStringBuffer.prototype.toString=function(){return G0.decodeUtf8(this.bytes())};function DU8(J,Q){Q=Q||{},this.read=Q.readOffset||0,this.growSize=Q.growSize||1024;var Y=G0.isArrayBuffer(J),X=G0.isArrayBufferView(J);if(Y||X){if(Y)this.data=new DataView(J);else this.data=new DataView(J.buffer,J.byteOffset,J.byteLength);this.write="writeOffset"in Q?Q.writeOffset:this.data.byteLength;return}if(this.data=new DataView(new ArrayBuffer(0)),this.write=0,J!==null&&J!==void 0)this.putBytes(J);if("writeOffset"in Q)this.write=Q.writeOffset}G0.DataBuffer=DU8;G0.DataBuffer.prototype.length=function(){return this.write-this.read};G0.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};G0.DataBuffer.prototype.accommodate=function(J,Q){if(this.length()>=J)return this;Q=Math.max(Q||this.growSize,J);var Y=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),X=new Uint8Array(this.length()+Q);return X.set(Y),this.data=new DataView(X.buffer),this};G0.DataBuffer.prototype.putByte=function(J){return this.accommodate(1),this.data.setUint8(this.write++,J),this};G0.DataBuffer.prototype.fillWithByte=function(J,Q){this.accommodate(Q);for(var Y=0;Y<Q;++Y)this.data.setUint8(J);return this};G0.DataBuffer.prototype.putBytes=function(J,Q){if(G0.isArrayBufferView(J)){var Y=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),X=Y.byteLength-Y.byteOffset;this.accommodate(X);var G=new Uint8Array(this.data.buffer,this.write);return G.set(Y),this.write+=X,this}if(G0.isArrayBuffer(J)){var Y=new Uint8Array(J);this.accommodate(Y.byteLength);var G=new Uint8Array(this.data.buffer);return G.set(Y,this.write),this.write+=Y.byteLength,this}if(J instanceof G0.DataBuffer||typeof J==="object"&&typeof J.read==="number"&&typeof J.write==="number"&&G0.isArrayBufferView(J.data)){var Y=new Uint8Array(J.data.byteLength,J.read,J.length());this.accommodate(Y.byteLength);var G=new Uint8Array(J.data.byteLength,this.write);return G.set(Y),this.write+=Y.byteLength,this}if(J instanceof G0.ByteStringBuffer)J=J.data,Q="binary";if(Q=Q||"binary",typeof J==="string"){var Z;if(Q==="hex")return this.accommodate(Math.ceil(J.length/2)),Z=new Uint8Array(this.data.buffer,this.write),this.write+=G0.binary.hex.decode(J,Z,this.write),this;if(Q==="base64")return this.accommodate(Math.ceil(J.length/4)*3),Z=new Uint8Array(this.data.buffer,this.write),this.write+=G0.binary.base64.decode(J,Z,this.write),this;if(Q==="utf8")J=G0.encodeUtf8(J),Q="binary";if(Q==="binary"||Q==="raw")return this.accommodate(J.length),Z=new Uint8Array(this.data.buffer,this.write),this.write+=G0.binary.raw.decode(Z),this;if(Q==="utf16")return this.accommodate(J.length*2),Z=new Uint16Array(this.data.buffer,this.write),this.write+=G0.text.utf16.encode(Z),this;throw Error("Invalid encoding: "+Q)}throw Error("Invalid parameter: "+J)};G0.DataBuffer.prototype.putBuffer=function(J){return this.putBytes(J),J.clear(),this};G0.DataBuffer.prototype.putString=function(J){return this.putBytes(J,"utf16")};G0.DataBuffer.prototype.putInt16=function(J){return this.accommodate(2),this.data.setInt16(this.write,J),this.write+=2,this};G0.DataBuffer.prototype.putInt24=function(J){return this.accommodate(3),this.data.setInt16(this.write,J>>8&65535),this.data.setInt8(this.write,J>>16&255),this.write+=3,this};G0.DataBuffer.prototype.putInt32=function(J){return this.accommodate(4),this.data.setInt32(this.write,J),this.write+=4,this};G0.DataBuffer.prototype.putInt16Le=function(J){return this.accommodate(2),this.data.setInt16(this.write,J,!0),this.write+=2,this};G0.DataBuffer.prototype.putInt24Le=function(J){return this.accommodate(3),this.data.setInt8(this.write,J>>16&255),this.data.setInt16(this.write,J>>8&65535,!0),this.write+=3,this};G0.DataBuffer.prototype.putInt32Le=function(J){return this.accommodate(4),this.data.setInt32(this.write,J,!0),this.write+=4,this};G0.DataBuffer.prototype.putInt=function(J,Q){Gg(Q),this.accommodate(Q/8);do Q-=8,this.data.setInt8(this.write++,J>>Q&255);while(Q>0);return this};G0.DataBuffer.prototype.putSignedInt=function(J,Q){if(Gg(Q),this.accommodate(Q/8),J<0)J+=2<<Q-1;return this.putInt(J,Q)};G0.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};G0.DataBuffer.prototype.getInt16=function(){var J=this.data.getInt16(this.read);return this.read+=2,J};G0.DataBuffer.prototype.getInt24=function(){var J=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,J};G0.DataBuffer.prototype.getInt32=function(){var J=this.data.getInt32(this.read);return this.read+=4,J};G0.DataBuffer.prototype.getInt16Le=function(){var J=this.data.getInt16(this.read,!0);return this.read+=2,J};G0.DataBuffer.prototype.getInt24Le=function(){var J=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,J};G0.DataBuffer.prototype.getInt32Le=function(){var J=this.data.getInt32(this.read,!0);return this.read+=4,J};G0.DataBuffer.prototype.getInt=function(J){Gg(J);var Q=0;do Q=(Q<<8)+this.data.getInt8(this.read++),J-=8;while(J>0);return Q};G0.DataBuffer.prototype.getSignedInt=function(J){var Q=this.getInt(J),Y=2<<J-2;if(Q>=Y)Q-=Y<<1;return Q};G0.DataBuffer.prototype.getBytes=function(J){var Q;if(J)J=Math.min(this.length(),J),Q=this.data.slice(this.read,this.read+J),this.read+=J;else if(J===0)Q="";else Q=this.read===0?this.data:this.data.slice(this.read),this.clear();return Q};G0.DataBuffer.prototype.bytes=function(J){return typeof J>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+J)};G0.DataBuffer.prototype.at=function(J){return this.data.getUint8(this.read+J)};G0.DataBuffer.prototype.setAt=function(J,Q){return this.data.setUint8(J,Q),this};G0.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};G0.DataBuffer.prototype.copy=function(){return new G0.DataBuffer(this)};G0.DataBuffer.prototype.compact=function(){if(this.read>0){var J=new Uint8Array(this.data.buffer,this.read),Q=new Uint8Array(J.byteLength);Q.set(J),this.data=new DataView(Q),this.write-=this.read,this.read=0}return this};G0.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};G0.DataBuffer.prototype.truncate=function(J){return this.write=Math.max(0,this.length()-J),this.read=Math.min(this.read,this.write),this};G0.DataBuffer.prototype.toHex=function(){var J="";for(var Q=this.read;Q<this.data.byteLength;++Q){var Y=this.data.getUint8(Q);if(Y<16)J+="0";J+=Y.toString(16)}return J};G0.DataBuffer.prototype.toString=function(J){var Q=new Uint8Array(this.data,this.read,this.length());if(J=J||"utf8",J==="binary"||J==="raw")return G0.binary.raw.encode(Q);if(J==="hex")return G0.binary.hex.encode(Q);if(J==="base64")return G0.binary.base64.encode(Q);if(J==="utf8")return G0.text.utf8.decode(Q);if(J==="utf16")return G0.text.utf16.decode(Q);throw Error("Invalid encoding: "+J)};G0.createBuffer=function(J,Q){if(Q=Q||"raw",J!==void 0&&Q==="utf8")J=G0.encodeUtf8(J);return new G0.ByteBuffer(J)};G0.fillString=function(J,Q){var Y="";while(Q>0){if(Q&1)Y+=J;if(Q>>>=1,Q>0)J+=J}return Y};G0.xorBytes=function(J,Q,Y){var X="",G="",Z="",q=0,V=0;for(;Y>0;--Y,++q){if(G=J.charCodeAt(q)^Q.charCodeAt(q),V>=10)X+=Z,Z="",V=0;Z+=String.fromCharCode(G),++V}return X+=Z,X};G0.hexToBytes=function(J){var Q="",Y=0;if(J.length&!0)Y=1,Q+=String.fromCharCode(parseInt(J[0],16));for(;Y<J.length;Y+=2)Q+=String.fromCharCode(parseInt(J.substr(Y,2),16));return Q};G0.bytesToHex=function(J){return G0.createBuffer(J).toHex()};G0.int32ToBytes=function(J){return String.fromCharCode(J>>24&255)+String.fromCharCode(J>>16&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J&255)};var sB="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",tB=[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],RY6="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";G0.encode64=function(J,Q){var Y="",X="",G,Z,q,V=0;while(V<J.length){if(G=J.charCodeAt(V++),Z=J.charCodeAt(V++),q=J.charCodeAt(V++),Y+=sB.charAt(G>>2),Y+=sB.charAt((G&3)<<4|Z>>4),isNaN(Z))Y+="==";else Y+=sB.charAt((Z&15)<<2|q>>6),Y+=isNaN(q)?"=":sB.charAt(q&63);if(Q&&Y.length>Q)X+=Y.substr(0,Q)+`\r
|
|
4035
|
+
`),!N.hasAttribute("data-start"))N.setAttribute("data-start",String(y+1))}O.textContent=P,U4.highlightElement(O)},function(P){N.setAttribute(G,V),O.textContent=P})}}),U4.plugins.fileHighlight={highlight:function(N){var O=(N||document).querySelectorAll(K);for(var M=0,L;L=O[M++];)U4.highlightElement(L)}};var z=!1;U4.fileHighlight=function(){if(!z)console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),z=!0;U4.plugins.fileHighlight.highlight.apply(this,arguments)}})()});var m56={};v8(m56,{setTerminalFocused:()=>Fq8,initFocusTracking:()=>zq8,getTerminalFocused:()=>dR1});function zq8(J){let Q=(Y)=>{if(Y.type==="focus")pR1=Y.focused};J.onFocus(Q)}function dR1(){return pR1}function Fq8(J){pR1=J}var pR1=!0;var d56={};v8(d56,{initIdleTracking:()=>Uq8,getIsIdle:()=>cR1});function Uq8(J,Q=300000){p56=Q,s61=Date.now(),J.onKey(()=>{s61=Date.now()}),J.onMouse(()=>{s61=Date.now()})}function cR1(){return Date.now()-s61>=p56}var s61,p56=300000;var lR1=G1(()=>{s61=Date.now()});var e56=h((t56)=>{Object.defineProperty(t56,"__esModule",{value:!0});var Rq8=cE1(),Cq8=nE1(),Sq8=Jw1(),jq8=Xw1(),s56=Gw1(),_q8=[Rq8.default,Cq8.default,(0,Sq8.default)(),jq8.default,s56.metadataVocabulary,s56.contentVocabulary];t56.default=_q8});var J26=h((qx9,yq8)=>{yq8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Y26=h((vY,aR1)=>{Object.defineProperty(vY,"__esModule",{value:!0});vY.MissingRefError=vY.ValidationError=vY.CodeGen=vY.Name=vY.nil=vY.stringify=vY.str=vY._=vY.KeywordCxt=vY.Ajv=void 0;var vq8=dE1(),xq8=e56(),fq8=qw1(),Q26=J26(),hq8=["/properties"],t61="http://json-schema.org/draft-07/schema";class Mu extends vq8.default{_addVocabularies(){if(super._addVocabularies(),xq8.default.forEach((J)=>this.addVocabulary(J)),this.opts.discriminator)this.addKeyword(fq8.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let J=this.opts.$data?this.$dataMetaSchema(Q26,hq8):Q26;this.addMetaSchema(J,t61,!1),this.refs["http://json-schema.org/schema"]=t61}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(t61)?t61:void 0)}}vY.Ajv=Mu;aR1.exports=vY=Mu;aR1.exports.Ajv=Mu;Object.defineProperty(vY,"__esModule",{value:!0});vY.default=Mu;var bq8=lT();Object.defineProperty(vY,"KeywordCxt",{enumerable:!0,get:function(){return bq8.KeywordCxt}});var cR=L8();Object.defineProperty(vY,"_",{enumerable:!0,get:function(){return cR._}});Object.defineProperty(vY,"str",{enumerable:!0,get:function(){return cR.str}});Object.defineProperty(vY,"stringify",{enumerable:!0,get:function(){return cR.stringify}});Object.defineProperty(vY,"nil",{enumerable:!0,get:function(){return cR.nil}});Object.defineProperty(vY,"Name",{enumerable:!0,get:function(){return cR.Name}});Object.defineProperty(vY,"CodeGen",{enumerable:!0,get:function(){return cR.CodeGen}});var uq8=nh();Object.defineProperty(vY,"ValidationError",{enumerable:!0,get:function(){return uq8.default}});var gq8=iT();Object.defineProperty(vY,"MissingRefError",{enumerable:!0,get:function(){return gq8.default}})});class tR1{options;session=null;pendingThreadCollapse=null;clientID;constructor(J){this.options=J;this.clientID=aa0(J.clientID)}async start(){if(this.session){x.warn("Client already started");return}let J={clientID:this.clientID,presenceIntervalMs:this.options.presenceIntervalMs,getActiveThreads:this.options.getActiveThreads,getAuth:this.options.getAuth,signal:this.options.signal,autoConfirmReceipts:this.options.autoConfirmReceipts,onEvent:this.createEventHandler()};if(this.session=new _11(J),this.options.onStatusChange)this.session.status.subscribe((Q)=>{this.options.onStatusChange?.(Q)});await this.session.start()}stop(){if(!this.session){x.warn("Client not started");return}this.session.stop(),this.session=null}getSession(){return this.session}async setActiveThreads(J){if(!this.session)throw Error("Session not started");await this.session.setActiveThreads(J)}async confirmReceipt(J){if(!this.session)throw Error("Session not started");await this.session.confirmReceipt(J)}async restart(J){let Q={...this.options,...J};this.stop(),this.options=Q,await this.start()}async restartWithNewThread(J,Q,Y){if(!this.session){x.warn("Cannot restart: no active session");return}x.debug("Restarting session with new thread"),x.debug(`Setting active threads to [${J}, ${Q}] for browser detection`),await this.session.setActiveThreads([J,Q]),await this.session.confirmReceipt(Y),x.debug("Confirmed receipt before restart");let X=this.clientID;this.session.stop(),this.session=null;let G={clientID:X,presenceIntervalMs:this.options.presenceIntervalMs,getActiveThreads:this.options.getActiveThreads,getAuth:this.options.getAuth,signal:this.options.signal,autoConfirmReceipts:this.options.autoConfirmReceipts,onEvent:this.createEventHandler()};if(this.session=new _11(G),this.options.onStatusChange)this.session.status.subscribe((Z)=>{this.options.onStatusChange?.(Z)});await this.session.start(),x.debug(`Re-advertising active threads: [${J}, ${Q}]`),await this.session.setActiveThreads([J,Q]),this.pendingThreadCollapse={oldThreadID:J,newThreadID:Q},x.debug("Session restarted successfully with new thread")}createEventHandler(){return async(J)=>{switch(J.type){case"thread-message":{if(!J.payload||!("content"in J.payload)){x.warn("Received thread-message without valid payload");break}if(!this.options.onThreadMessage){x.warn("No onThreadMessage handler configured");break}let Q=J.payload,Y=J.id.threadID,X=J.id.v;await this.options.onThreadMessage(Q,Y,X);break}case"approve-tool":case"reject-tool":{if(!J.payload||!("toolUseID"in J.payload)){x.warn("Received tool approval without valid payload");break}if(!this.options.onToolApproval){x.warn("No onToolApproval handler configured");break}let Q=J.type==="approve-tool";await this.options.onToolApproval(J.payload.toolUseID,Q);break}case"start-new-thread":{if(!this.options.onStartNewThread){x.warn("No onStartNewThread handler configured");break}let Y=this.options.getActiveThreads()[0];if(!Y){x.warn("No old thread ID available for restart");break}let X=J.payload;try{let G=await this.options.onStartNewThread(X?.initialMessage,X?.agentMode);await this.restartWithNewThread(Y,G.threadID,J.id)}catch(G){x.error("Failed to handle start-new-thread:",G)}break}case"disconnect":{if(x.info("Disconnect action received"),this.options.onDisconnect)await this.options.onDisconnect();break}case"initialize-connection":{if(x.info("Initialize connection event received"),this.pendingThreadCollapse)x.info(`Collapsing active threads from [${this.pendingThreadCollapse.oldThreadID}, ${this.pendingThreadCollapse.newThreadID}] to [${this.pendingThreadCollapse.newThreadID}]`),await this.setActiveThreads([this.pendingThreadCollapse.newThreadID]).catch((Q)=>x.error("Failed to collapse active threads:",Q)),this.pendingThreadCollapse=null;if(this.options.onInitializeConnection)await this.options.onInitializeConnection();break}case"switch-thread":{if(!J.payload||!("threadID"in J.payload)){x.warn("Received switch-thread without valid payload");break}let Q=J.payload.threadID;if(x.info(`Switch thread request received for ${Q}`),await this.setActiveThreads([Q]),this.options.switchToThread)await this.options.switchToThread(Q);break}}}}}var F26=G1(()=>{H0();Lw1()});function e61(){return hB}async function U26(J){if(hB)x.warn("Global client already running, stopping existing client first"),eR1();return hB=new tR1(J),await hB.start(),hB}function eR1(){if(hB)hB.stop(),hB=null}var hB=null;var JC1=G1(()=>{H0();F26()});var B26={};v8(B26,{stopGlobalSession:()=>eR1,startAutomaticPresence:()=>QC1,getGlobalSession:()=>e61});async function QC1(J,Q,Y,X,G,Z,q,V){if(e61()){x.warn("Client already running");return}try{let W=await Q.getLatest(),H=await W.secrets.getToken("apiKey",W.settings.url);if(!H){x.warn("API key not found, skipping automatic presence");return}let z=W.settings.url;if(!z){x.warn("amp.url is not set, skipping automatic presence");return}let U=await U26({clientID:V,presenceIntervalMs:5000,getActiveThreads:()=>{let N=Y();return N?[N.thread.id]:[]},getAuth:async()=>({baseURL:new URL(z),apiKey:H}),onThreadMessage:async(N,O,M)=>{let L=Y();if(!L){x.warn("No worker available to handle thread-message");return}if(L.thread.queuedMessages&&L.thread.queuedMessages.length>0)await L.handle({type:"user:message-queue:dequeue"});await L.handle(M>1?{type:"user:message-queue:enqueue",message:{content:N.content,fileMentions:N.fileMentions,userState:N.userState,agentMode:N.agentMode,meta:N.meta,source:N.source}}:{type:"user:message",message:{content:N.content,fileMentions:N.fileMentions,userState:N.userState,agentMode:N.agentMode,meta:N.meta,source:N.source}})},onToolApproval:async(N,O)=>{let M=Y();if(!M){x.warn("No worker available to handle tool approval");return}if(M.thread.queuedMessages&&M.thread.queuedMessages.length>0)await M.handle({type:"user:message-queue:dequeue"});await M.handle({type:"user:tool-input",toolUse:N,value:{accepted:O}})},onStartNewThread:async(N,O)=>{let M=await Z();if(X(M),N)await M.handle({type:"user:message",message:{content:[{type:"text",text:N}]}});return x.debug(`Successfully created and switched to new thread: ${M.thread.id}`),{threadID:M.thread.id}},switchToThread:async(N)=>{x.debug("Switching to thread from web",{threadID:N});try{await J.threadSyncService.discoverThreads();let O=await q(N);X(O),x.debug("Successfully switched to thread from web",{threadID:N})}catch(O){throw x.error("Failed to switch thread from web",{error:O,threadID:N}),O}},onStatusChange:(N)=>{G.sendStatus(N)}});x.info(`Automatic presence started for client: ${U.clientID}`)}catch(W){x.error("Failed to start automatic presence:",W)}}var YC1=G1(()=>{H0();JC1();JC1()});var Q41=h((M26)=>{Object.defineProperty(M26,"__esModule",{value:!0});function XV8(J){var Q=new Uint32Array(1);return Q[0]=J[0]*1664525+1013904223,Q}M26.default=XV8});var I26=h((E26)=>{Object.defineProperty(E26,"__esModule",{value:!0});E26.makeNoise2D=void 0;var Y41=Q41(),ZV8=0.02127659574468085,ZC1=(Math.sqrt(3)-1)/2,qV8=(1/Math.sqrt(3)-1)/2;function L26(J,Q,Y){return{dx:-Q-J*ZC1,dy:-Y-J*ZC1,xsb:Q,ysb:Y}}function VV8(J){var Q=[];for(var Y=0;Y<Lu.length;Y+=4){var X=KV8[Lu[Y]],G=null,Z=null;for(var q=0;q<X.length;q+=3){if(Z=L26(X[q],X[q+1],X[q+2]),G===null)Q[Y/4]=Z;else G.next=Z;G=Z}Z.next=L26(Lu[Y+1],Lu[Y+2],Lu[Y+3])}var V=[];for(var Y=0;Y<GC1.length;Y+=2)V[GC1[Y]]=Q[GC1[Y+1]];var K=new Uint8Array(256),W=new Uint8Array(256),H=new Uint8Array(256);for(var Y=0;Y<256;Y++)H[Y]=Y;var z=new Uint32Array(1);z[0]=J,z=Y41.default(Y41.default(Y41.default(z)));for(var Y=255;Y>=0;Y--){z=Y41.default(z);var U=new Uint32Array(1);if(U[0]=(z[0]+31)%(Y+1),U[0]<0)U[0]+=Y+1;K[Y]=H[U[0]],W[Y]=K[Y]&14,H[U[0]]=H[Y]}return function(N,O){var M=(N+O)*qV8,L=N+M,w=O+M,I=Math.floor(L),P=Math.floor(w),R=(I+P)*ZC1,j=N-(I+R),y=O-(P+R),f=L-I,g=w-P,p=f+g,b=f-g+1|p<<1|p+g<<2|p+f<<4,i=0;for(var J1=V[b];J1!==void 0;J1=J1.next){var n=j+J1.dx,m=y+J1.dy,s=2-n*n-m*m;if(s>0){var q1=I+J1.xsb,W1=P+J1.ysb,r=K[q1&255],o=W[r+W1&255],l=A26[o]*n+A26[o+1]*m;i+=s*s*s*s*l}}return i*ZV8}}E26.makeNoise2D=VV8;var KV8=[[1,1,0,1,0,1,0,0,0],[1,1,0,1,0,1,2,1,1]],A26=[5,2,2,5,-5,2,-2,5,5,-2,2,-5,-5,-2,-2,-5],GC1=[0,1,1,0,4,1,17,0,20,2,21,2,22,5,23,5,26,4,39,3,42,4,43,3],Lu=[0,0,1,-1,0,0,-1,1,0,2,1,1,1,2,2,0,1,2,0,2,1,0,0,0]});var R26=h((P26)=>{Object.defineProperty(P26,"__esModule",{value:!0});P26.makeNoise3D=void 0;var $41=Q41(),WV8=0.009708737864077669,X41=(Math.sqrt(4)-1)/3,HV8=(1/Math.sqrt(4)-1)/3;function qC1(J,Q,Y,X){return{dx:-Q-J*X41,dy:-Y-J*X41,dz:-X-J*X41,xsb:Q,ysb:Y,zsb:X}}function zV8(J){var Q=[];for(var Y=0;Y<IK.length;Y+=9){var X=FV8[IK[Y]],G=null,Z=null;for(var q=0;q<X.length;q+=4){if(Z=qC1(X[q],X[q+1],X[q+2],X[q+3]),G===null)Q[Y/9]=Z;else G.next=Z;G=Z}Z.next=qC1(IK[Y+1],IK[Y+2],IK[Y+3],IK[Y+4]),Z.next.next=qC1(IK[Y+5],IK[Y+6],IK[Y+7],IK[Y+8])}var V=[];for(var Y=0;Y<KC1.length;Y+=2)V[KC1[Y]]=Q[KC1[Y+1]];var K=new Uint8Array(256),W=new Uint8Array(256),H=new Uint8Array(256);for(var Y=0;Y<256;Y++)H[Y]=Y;var z=new Uint32Array(1);z[0]=J,z=$41.default($41.default($41.default(z)));for(var Y=255;Y>=0;Y--){z=$41.default(z);var U=new Uint32Array(1);if(U[0]=(z[0]+31)%(Y+1),U[0]<0)U[0]+=Y+1;K[Y]=H[U[0]],W[Y]=K[Y]%24*3,H[U[0]]=H[Y]}return function(N,O,M){var L=(N+O+M)*HV8,w=N+L,I=O+L,P=M+L,R=Math.floor(w),j=Math.floor(I),y=Math.floor(P),f=(R+j+y)*X41,g=N-(R+f),p=O-(j+f),b=M-(y+f),i=w-R,J1=I-j,n=P-y,m=i+J1+n,s=J1-n+1|i-J1+1<<1|i-n+1<<2|m<<3|m+n<<5|m+J1<<7|m+i<<9,q1=0;for(var W1=V[s];W1!==void 0;W1=W1.next){var r=g+W1.dx,o=p+W1.dy,l=b+W1.dz,z1=2-r*r-o*o-l*l;if(z1>0){var j1=R+W1.xsb,t=j+W1.ysb,y1=y+W1.zsb,R1=K[j1&255],D0=K[R1+t&255],T1=W[D0+y1&255],a1=VC1[T1]*r+VC1[T1+1]*o+VC1[T1+2]*l;q1+=z1*z1*z1*z1*a1}}return q1*WV8}}P26.makeNoise3D=zV8;var FV8=[[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,1],[2,1,1,0,2,1,0,1,2,0,1,1,3,1,1,1],[1,1,0,0,1,0,1,0,1,0,0,1,2,1,1,0,2,1,0,1,2,0,1,1]],VC1=[-11,4,4,-4,11,4,-4,4,11,11,4,4,4,11,4,4,4,11,-11,-4,4,-4,-11,4,-4,-4,11,11,-4,4,4,-11,4,4,-4,11,-11,4,-4,-4,11,-4,-4,4,-11,11,4,-4,4,11,-4,4,4,-11,-11,-4,-4,-4,-11,-4,-4,-4,-11,11,-4,-4,4,-11,-4,4,-4,-11],KC1=[0,2,1,1,2,2,5,1,6,0,7,0,32,2,34,2,129,1,133,1,160,5,161,5,518,0,519,0,546,4,550,4,645,3,647,3,672,5,673,5,674,4,677,3,678,4,679,3,680,13,681,13,682,12,685,14,686,12,687,14,712,20,714,18,809,21,813,23,840,20,841,21,1198,19,1199,22,1226,18,1230,19,1325,23,1327,22,1352,15,1353,17,1354,15,1357,17,1358,16,1359,16,1360,11,1361,10,1362,11,1365,10,1366,9,1367,9,1392,11,1394,11,1489,10,1493,10,1520,8,1521,8,1878,9,1879,9,1906,7,1910,7,2005,6,2007,6,2032,8,2033,8,2034,7,2037,6,2038,7,2039,6],IK=[0,0,1,-1,0,0,1,0,-1,0,0,-1,1,0,0,0,1,-1,0,0,-1,0,1,0,0,-1,1,0,2,1,1,0,1,1,1,-1,0,2,1,0,1,1,1,-1,1,0,2,0,1,1,1,-1,1,1,1,3,2,1,0,3,1,2,0,1,3,2,0,1,3,1,0,2,1,3,0,2,1,3,0,1,2,1,1,1,0,0,2,2,0,0,1,1,0,1,0,2,0,2,0,1,1,0,0,1,2,0,0,2,2,0,0,0,0,1,1,-1,1,2,0,0,0,0,1,-1,1,1,2,0,0,0,0,1,1,1,-1,2,3,1,1,1,2,0,0,2,2,3,1,1,1,2,2,0,0,2,3,1,1,1,2,0,2,0,2,1,1,-1,1,2,0,0,2,2,1,1,-1,1,2,2,0,0,2,1,-1,1,1,2,0,0,2,2,1,-1,1,1,2,0,2,0,2,1,1,1,-1,2,2,0,0,2,1,1,1,-1,2,0,2,0]});var j26=h((C26)=>{Object.defineProperty(C26,"__esModule",{value:!0});C26.makeNoise4D=void 0;var G41=Q41(),UV8=0.03333333333333333,Au=(Math.sqrt(5)-1)/4,BV8=(1/Math.sqrt(5)-1)/4;function Z41(J,Q,Y,X,G){return{dx:-Q-J*Au,dy:-Y-J*Au,dz:-X-J*Au,dw:-G-J*Au,xsb:Q,ysb:Y,zsb:X,wsb:G}}function NV8(J){var Q=[];for(var Y=0;Y<BJ.length;Y+=16){var X=DV8[BJ[Y]],G=null,Z=null;for(var q=0;q<X.length;q+=5){if(Z=Z41(X[q],X[q+1],X[q+2],X[q+3],X[q+4]),G===null)Q[Y/16]=Z;else G.next=Z;G=Z}Z.next=Z41(BJ[Y+1],BJ[Y+2],BJ[Y+3],BJ[Y+4],BJ[Y+5]),Z.next.next=Z41(BJ[Y+6],BJ[Y+7],BJ[Y+8],BJ[Y+9],BJ[Y+10]),Z.next.next.next=Z41(BJ[Y+11],BJ[Y+12],BJ[Y+13],BJ[Y+14],BJ[Y+15])}var V=[];for(var Y=0;Y<WC1.length;Y+=2)V[WC1[Y]]=Q[WC1[Y+1]];var K=new Uint8Array(256),W=new Uint8Array(256),H=new Uint8Array(256);for(var Y=0;Y<256;Y++)H[Y]=Y;var z=new Uint32Array(1);z[0]=J,z=G41.default(G41.default(G41.default(z)));for(var Y=255;Y>=0;Y--){z=G41.default(z);var U=new Uint32Array(1);if(U[0]=(z[0]+31)%(Y+1),U[0]<0)U[0]+=Y+1;K[Y]=H[U[0]],W[Y]=K[Y]&252,H[U[0]]=H[Y]}return function(N,O,M,L){var w=(N+O+M+L)*BV8,I=N+w,P=O+w,R=M+w,j=L+w,y=Math.floor(I),f=Math.floor(P),g=Math.floor(R),p=Math.floor(j),b=(y+f+g+p)*Au,i=N-(y+b),J1=O-(f+b),n=M-(g+b),m=L-(p+b),s=I-y,q1=P-f,W1=R-g,r=j-p,o=s+q1+W1+r,l=W1-r+1|q1-W1+1<<1|q1-r+1<<2|s-q1+1<<3|s-W1+1<<4|s-r+1<<5|o<<6|o+r<<8|o+W1<<11|o+q1<<14|o+s<<17,z1=0;for(var j1=V[l];j1!==void 0;j1=j1.next){var t=i+j1.dx,y1=J1+j1.dy,R1=n+j1.dz,D0=m+j1.dw,T1=2-t*t-y1*y1-R1*R1-D0*D0;if(T1>0){var a1=y+j1.xsb,F1=f+j1.ysb,Y1=g+j1.zsb,O1=p+j1.wsb,L1=K[a1&255],E1=K[L1+F1&255],A1=K[E1+Y1&255],u1=W[A1+O1&255],v1=q41[u1]*t+q41[u1+1]*y1+q41[u1+2]*R1+q41[u1+3]*D0;z1+=T1*T1*T1*T1*v1}}return z1*UV8}}C26.makeNoise4D=NV8;var DV8=[[0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,4,1,1,1,1],[1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1]],q41=[3,1,1,1,1,3,1,1,1,1,3,1,1,1,1,3,-3,1,1,1,-1,3,1,1,-1,1,3,1,-1,1,1,3,3,-1,1,1,1,-3,1,1,1,-1,3,1,1,-1,1,3,-3,-1,1,1,-1,-3,1,1,-1,-1,3,1,-1,-1,1,3,3,1,-1,1,1,3,-1,1,1,1,-3,1,1,1,-1,3,-3,1,-1,1,-1,3,-1,1,-1,1,-3,1,-1,1,-1,3,3,-1,-1,1,1,-3,-1,1,1,-1,-3,1,1,-1,-1,3,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,3,1,1,-1,1,3,1,-1,1,1,3,-1,1,1,1,-3,-3,1,1,-1,-1,3,1,-1,-1,1,3,-1,-1,1,1,-3,3,-1,1,-1,1,-3,1,-1,1,-1,3,-1,1,-1,1,-3,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,3,1,-1,-1,1,3,-1,-1,1,1,-3,-1,1,1,-1,-3,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3],WC1=[0,3,1,2,2,3,5,2,6,1,7,1,8,3,9,2,10,3,13,2,16,3,18,3,22,1,23,1,24,3,26,3,33,2,37,2,38,1,39,1,41,2,45,2,54,1,55,1,56,0,57,0,58,0,59,0,60,0,61,0,62,0,63,0,256,3,258,3,264,3,266,3,272,3,274,3,280,3,282,3,2049,2,2053,2,2057,2,2061,2,2081,2,2085,2,2089,2,2093,2,2304,9,2305,9,2312,9,2313,9,16390,1,16391,1,16406,1,16407,1,16422,1,16423,1,16438,1,16439,1,16642,8,16646,8,16658,8,16662,8,18437,6,18439,6,18469,6,18471,6,18688,9,18689,9,18690,8,18693,6,18694,8,18695,6,18696,9,18697,9,18706,8,18710,8,18725,6,18727,6,131128,0,131129,0,131130,0,131131,0,131132,0,131133,0,131134,0,131135,0,131352,7,131354,7,131384,7,131386,7,133161,5,133165,5,133177,5,133181,5,133376,9,133377,9,133384,9,133385,9,133400,7,133402,7,133417,5,133421,5,133432,7,133433,5,133434,7,133437,5,147510,4,147511,4,147518,4,147519,4,147714,8,147718,8,147730,8,147734,8,147736,7,147738,7,147766,4,147767,4,147768,7,147770,7,147774,4,147775,4,149509,6,149511,6,149541,6,149543,6,149545,5,149549,5,149558,4,149559,4,149561,5,149565,5,149566,4,149567,4,149760,9,149761,9,149762,8,149765,6,149766,8,149767,6,149768,9,149769,9,149778,8,149782,8,149784,7,149786,7,149797,6,149799,6,149801,5,149805,5,149814,4,149815,4,149816,7,149817,5,149818,7,149821,5,149822,4,149823,4,149824,37,149825,37,149826,36,149829,34,149830,36,149831,34,149832,37,149833,37,149842,36,149846,36,149848,35,149850,35,149861,34,149863,34,149865,33,149869,33,149878,32,149879,32,149880,35,149881,33,149882,35,149885,33,149886,32,149887,32,150080,49,150082,48,150088,49,150098,48,150104,47,150106,47,151873,46,151877,45,151881,46,151909,45,151913,44,151917,44,152128,49,152129,46,152136,49,152137,46,166214,43,166215,42,166230,43,166247,42,166262,41,166263,41,166466,48,166470,43,166482,48,166486,43,168261,45,168263,42,168293,45,168295,42,168512,31,168513,28,168514,31,168517,28,168518,25,168519,25,280952,40,280953,39,280954,40,280957,39,280958,38,280959,38,281176,47,281178,47,281208,40,281210,40,282985,44,282989,44,283001,39,283005,39,283208,30,283209,27,283224,30,283241,27,283256,22,283257,22,297334,41,297335,41,297342,38,297343,38,297554,29,297558,24,297562,29,297590,24,297594,21,297598,21,299365,26,299367,23,299373,26,299383,23,299389,20,299391,20,299584,31,299585,28,299586,31,299589,28,299590,25,299591,25,299592,30,299593,27,299602,29,299606,24,299608,30,299610,29,299621,26,299623,23,299625,27,299629,26,299638,24,299639,23,299640,22,299641,22,299642,21,299645,20,299646,21,299647,20,299648,61,299649,60,299650,61,299653,60,299654,59,299655,59,299656,58,299657,57,299666,55,299670,54,299672,58,299674,55,299685,52,299687,51,299689,57,299693,52,299702,54,299703,51,299704,56,299705,56,299706,53,299709,50,299710,53,299711,50,299904,61,299906,61,299912,58,299922,55,299928,58,299930,55,301697,60,301701,60,301705,57,301733,52,301737,57,301741,52,301952,79,301953,79,301960,76,301961,76,316038,59,316039,59,316054,54,316071,51,316086,54,316087,51,316290,78,316294,78,316306,73,316310,73,318085,77,318087,77,318117,70,318119,70,318336,79,318337,79,318338,78,318341,77,318342,78,318343,77,430776,56,430777,56,430778,53,430781,50,430782,53,430783,50,431000,75,431002,72,431032,75,431034,72,432809,74,432813,69,432825,74,432829,69,433032,76,433033,76,433048,75,433065,74,433080,75,433081,74,447158,71,447159,68,447166,71,447167,68,447378,73,447382,73,447386,72,447414,71,447418,72,447422,71,449189,70,449191,70,449197,69,449207,68,449213,69,449215,68,449408,67,449409,67,449410,66,449413,64,449414,66,449415,64,449416,67,449417,67,449426,66,449430,66,449432,65,449434,65,449445,64,449447,64,449449,63,449453,63,449462,62,449463,62,449464,65,449465,63,449466,65,449469,63,449470,62,449471,62,449472,19,449473,19,449474,18,449477,16,449478,18,449479,16,449480,19,449481,19,449490,18,449494,18,449496,17,449498,17,449509,16,449511,16,449513,15,449517,15,449526,14,449527,14,449528,17,449529,15,449530,17,449533,15,449534,14,449535,14,449728,19,449729,19,449730,18,449734,18,449736,19,449737,19,449746,18,449750,18,449752,17,449754,17,449784,17,449786,17,451520,19,451521,19,451525,16,451527,16,451528,19,451529,19,451557,16,451559,16,451561,15,451565,15,451577,15,451581,15,451776,19,451777,19,451784,19,451785,19,465858,18,465861,16,465862,18,465863,16,465874,18,465878,18,465893,16,465895,16,465910,14,465911,14,465918,14,465919,14,466114,18,466118,18,466130,18,466134,18,467909,16,467911,16,467941,16,467943,16,468160,13,468161,13,468162,13,468163,13,468164,13,468165,13,468166,13,468167,13,580568,17,580570,17,580585,15,580589,15,580598,14,580599,14,580600,17,580601,15,580602,17,580605,15,580606,14,580607,14,580824,17,580826,17,580856,17,580858,17,582633,15,582637,15,582649,15,582653,15,582856,12,582857,12,582872,12,582873,12,582888,12,582889,12,582904,12,582905,12,596982,14,596983,14,596990,14,596991,14,597202,11,597206,11,597210,11,597214,11,597234,11,597238,11,597242,11,597246,11,599013,10,599015,10,599021,10,599023,10,599029,10,599031,10,599037,10,599039,10,599232,13,599233,13,599234,13,599235,13,599236,13,599237,13,599238,13,599239,13,599240,12,599241,12,599250,11,599254,11,599256,12,599257,12,599258,11,599262,11,599269,10,599271,10,599272,12,599273,12,599277,10,599279,10,599282,11,599285,10,599286,11,599287,10,599288,12,599289,12,599290,11,599293,10,599294,11,599295,10],BJ=[0,0,1,-1,0,0,0,1,0,-1,0,0,1,0,0,-1,0,0,-1,1,0,0,0,0,1,-1,0,0,0,1,0,-1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,-1,0,0,-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,2,1,1,0,0,1,1,1,-1,0,1,1,1,0,-1,0,2,1,0,1,0,1,1,-1,1,0,1,1,0,1,-1,0,2,0,1,1,0,1,-1,1,1,0,1,0,1,1,-1,0,2,1,0,0,1,1,1,-1,0,1,1,1,0,-1,1,0,2,0,1,0,1,1,-1,1,0,1,1,0,1,-1,1,0,2,0,0,1,1,1,-1,0,1,1,1,0,-1,1,1,1,4,2,1,1,0,4,1,2,1,0,4,1,1,2,0,1,4,2,1,0,1,4,1,2,0,1,4,1,1,0,2,1,4,2,0,1,1,4,1,0,2,1,4,1,0,1,2,1,4,0,2,1,1,4,0,1,2,1,4,0,1,1,2,1,2,1,1,0,0,3,2,1,0,0,3,1,2,0,0,1,2,1,0,1,0,3,2,0,1,0,3,1,0,2,0,1,2,0,1,1,0,3,0,2,1,0,3,0,1,2,0,1,2,1,0,0,1,3,2,0,0,1,3,1,0,0,2,1,2,0,1,0,1,3,0,2,0,1,3,0,1,0,2,1,2,0,0,1,1,3,0,0,2,1,3,0,0,1,2,2,3,1,1,1,0,2,1,1,1,-1,2,2,0,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,2,0,0,0,2,3,1,0,1,1,2,1,-1,1,1,2,2,0,0,0,2,3,1,1,1,0,2,1,1,1,-1,2,0,2,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,0,2,0,0,2,3,0,1,1,1,2,-1,1,1,1,2,0,2,0,0,2,3,1,1,1,0,2,1,1,1,-1,2,0,0,2,0,2,3,1,0,1,1,2,1,-1,1,1,2,0,0,2,0,2,3,0,1,1,1,2,-1,1,1,1,2,0,0,2,0,2,3,1,1,0,1,2,1,1,-1,1,2,0,0,0,2,2,3,1,0,1,1,2,1,-1,1,1,2,0,0,0,2,2,3,0,1,1,1,2,-1,1,1,1,2,0,0,0,2,2,1,1,1,-1,0,1,1,1,0,-1,0,0,0,0,0,2,1,1,-1,1,0,1,1,0,1,-1,0,0,0,0,0,2,1,-1,1,1,0,1,0,1,1,-1,0,0,0,0,0,2,1,1,-1,0,1,1,1,0,-1,1,0,0,0,0,0,2,1,-1,1,0,1,1,0,1,-1,1,0,0,0,0,0,2,1,-1,0,1,1,1,0,-1,1,1,0,0,0,0,0,2,1,1,1,-1,0,1,1,1,0,-1,2,2,0,0,0,2,1,1,-1,1,0,1,1,0,1,-1,2,2,0,0,0,2,1,1,-1,0,1,1,1,0,-1,1,2,2,0,0,0,2,1,1,1,-1,0,1,1,1,0,-1,2,0,2,0,0,2,1,-1,1,1,0,1,0,1,1,-1,2,0,2,0,0,2,1,-1,1,0,1,1,0,1,-1,1,2,0,2,0,0,2,1,1,-1,1,0,1,1,0,1,-1,2,0,0,2,0,2,1,-1,1,1,0,1,0,1,1,-1,2,0,0,2,0,2,1,-1,0,1,1,1,0,-1,1,1,2,0,0,2,0,2,1,1,-1,0,1,1,1,0,-1,1,2,0,0,0,2,2,1,-1,1,0,1,1,0,1,-1,1,2,0,0,0,2,2,1,-1,0,1,1,1,0,-1,1,1,2,0,0,0,2,3,1,1,0,0,0,2,2,0,0,0,2,1,1,1,-1,3,1,0,1,0,0,2,0,2,0,0,2,1,1,1,-1,3,1,0,0,1,0,2,0,0,2,0,2,1,1,1,-1,3,1,1,0,0,0,2,2,0,0,0,2,1,1,-1,1,3,1,0,1,0,0,2,0,2,0,0,2,1,1,-1,1,3,1,0,0,0,1,2,0,0,0,2,2,1,1,-1,1,3,1,1,0,0,0,2,2,0,0,0,2,1,-1,1,1,3,1,0,0,1,0,2,0,0,2,0,2,1,-1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,1,-1,1,1,3,1,0,1,0,0,2,0,2,0,0,2,-1,1,1,1,3,1,0,0,1,0,2,0,0,2,0,2,-1,1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,-1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,4,1,1,1,1,3,3,2,0,1,0,3,1,0,2,0,4,1,1,1,1,3,3,0,2,1,0,3,0,1,2,0,4,1,1,1,1,3,3,2,0,0,1,3,1,0,0,2,4,1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,4,1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,4,1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,1,-1,3,3,2,0,1,0,3,1,0,2,0,2,1,1,1,-1,3,3,0,2,1,0,3,0,1,2,0,2,1,1,1,-1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,-1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,1,-1,1,3,3,0,2,0,1,3,0,1,0,2,2,1,1,-1,1,3,3,2,0,1,0,3,1,0,2,0,2,1,-1,1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,-1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,1,-1,1,1,3,3,0,2,1,0,3,0,1,2,0,2,-1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,2,-1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,-1,1,1,1]});var _26=h((Eu)=>{Object.defineProperty(Eu,"__esModule",{value:!0});Eu.makeNoise4D=Eu.makeNoise3D=Eu.makeNoise2D=void 0;var OV8=I26();Object.defineProperty(Eu,"makeNoise2D",{enumerable:!0,get:function(){return OV8.makeNoise2D}});var MV8=R26();Object.defineProperty(Eu,"makeNoise3D",{enumerable:!0,get:function(){return MV8.makeNoise3D}});var LV8=j26();Object.defineProperty(Eu,"makeNoise4D",{enumerable:!0,get:function(){return LV8.makeNoise4D}})});var bQ6=h((MY5,hQ6)=>{hQ6.exports=I81;function I81(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}I81.prototype.go=function(J){if(this.pending<this.max)fQ6(this,J);else this.waiting.push(J)};I81.prototype.wait=function(J){if(this.pending===0)J(this.error);else this.listeners.push(J)};I81.prototype.hold=function(){return xQ6(this)};function xQ6(J){J.pending+=1;var Q=!1;return Y;function Y(G){if(Q)throw Error("callback called twice");if(Q=!0,J.error=J.error||G,J.pending-=1,J.waiting.length>0&&J.pending<J.max)fQ6(J,J.waiting.shift());else if(J.pending===0){var Z=J.listeners;J.listeners=[],Z.forEach(X)}}function X(G){G(J.error)}}function fQ6(J,Q){Q(xQ6(J))}});var gQ6=h((KF8)=>{var Jg=S1("fs"),P81=S1("util"),z_1=S1("stream"),uQ6=z_1.Readable,F_1=z_1.Writable,GF8=z_1.PassThrough,ZF8=bQ6(),T81=S1("events").EventEmitter;KF8.createFromBuffer=qF8;KF8.createFromFd=VF8;KF8.BufferSlicer=Kz;KF8.FdSlicer=Vz;P81.inherits(Vz,T81);function Vz(J,Q){Q=Q||{},T81.call(this),this.fd=J,this.pend=new ZF8,this.pend.max=1,this.refCount=0,this.autoClose=!!Q.autoClose}Vz.prototype.read=function(J,Q,Y,X,G){var Z=this;Z.pend.go(function(q){Jg.read(Z.fd,J,Q,Y,X,function(V,K,W){q(),G(V,K,W)})})};Vz.prototype.write=function(J,Q,Y,X,G){var Z=this;Z.pend.go(function(q){Jg.write(Z.fd,J,Q,Y,X,function(V,K,W){q(),G(V,K,W)})})};Vz.prototype.createReadStream=function(J){return new R81(this,J)};Vz.prototype.createWriteStream=function(J){return new C81(this,J)};Vz.prototype.ref=function(){this.refCount+=1};Vz.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");if(J.autoClose)Jg.close(J.fd,Q);function Q(Y){if(Y)J.emit("error",Y);else J.emit("close")}};P81.inherits(R81,uQ6);function R81(J,Q){Q=Q||{},uQ6.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end,this.pos=this.start,this.destroyed=!1}R81.prototype._read=function(J){var Q=this;if(Q.destroyed)return;var Y=Math.min(Q._readableState.highWaterMark,J);if(Q.endOffset!=null)Y=Math.min(Y,Q.endOffset-Q.pos);if(Y<=0){Q.destroyed=!0,Q.push(null),Q.context.unref();return}Q.context.pend.go(function(X){if(Q.destroyed)return X();var G=Buffer.allocUnsafe(Y);Jg.read(Q.context.fd,G,0,Y,Q.pos,function(Z,q){if(Z)Q.destroy(Z);else if(q===0)Q.destroyed=!0,Q.push(null),Q.context.unref();else Q.pos+=q,Q.push(G.slice(0,q));X()})})};R81.prototype.destroy=function(J){if(this.destroyed)return;J=J||Error("stream destroyed"),this.destroyed=!0,this.emit("error",J),this.context.unref()};P81.inherits(C81,F_1);function C81(J,Q){Q=Q||{},F_1.call(this,Q),this.context=J,this.context.ref(),this.start=Q.start||0,this.endOffset=Q.end==null?1/0:+Q.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}C81.prototype._write=function(J,Q,Y){var X=this;if(X.destroyed)return;if(X.pos+J.length>X.endOffset){var G=Error("maximum file length exceeded");G.code="ETOOBIG",X.destroy(),Y(G);return}X.context.pend.go(function(Z){if(X.destroyed)return Z();Jg.write(X.context.fd,J,0,J.length,X.pos,function(q,V){if(q)X.destroy(),Z(),Y(q);else X.bytesWritten+=V,X.pos+=V,X.emit("progress"),Z(),Y()})})};C81.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=!0,this.context.unref()};P81.inherits(Kz,T81);function Kz(J,Q){T81.call(this),Q=Q||{},this.refCount=0,this.buffer=J,this.maxChunkSize=Q.maxChunkSize||Number.MAX_SAFE_INTEGER}Kz.prototype.read=function(J,Q,Y,X,G){if(!(0<=Q&&Q<=J.length))throw RangeError("offset outside buffer: 0 <= "+Q+" <= "+J.length);if(X<0)throw RangeError("position is negative: "+X);if(Q+Y>J.length)Y=J.length-Q;if(X+Y>this.buffer.length)Y=this.buffer.length-X;if(Y<=0){setImmediate(function(){G(null,0)});return}this.buffer.copy(J,Q,X,X+Y),setImmediate(function(){G(null,Y)})};Kz.prototype.write=function(J,Q,Y,X,G){J.copy(this.buffer,X,Q,Q+Y),setImmediate(function(){G(null,Y,J)})};Kz.prototype.createReadStream=function(J){J=J||{};var Q=new GF8(J);Q.destroyed=!1,Q.start=J.start||0,Q.endOffset=J.end,Q.pos=Q.endOffset||this.buffer.length;var Y=this.buffer.slice(Q.start,Q.pos),X=0;while(!0){var G=X+this.maxChunkSize;if(G>=Y.length){if(X<Y.length)Q.write(Y.slice(X,Y.length));break}Q.write(Y.slice(X,G)),X=G}return Q.end(),Q.destroy=function(){Q.destroyed=!0},Q};Kz.prototype.createWriteStream=function(J){var Q=this;J=J||{};var Y=new F_1(J);return Y.start=J.start||0,Y.endOffset=J.end==null?this.buffer.length:+J.end,Y.bytesWritten=0,Y.pos=Y.start,Y.destroyed=!1,Y._write=function(X,G,Z){if(Y.destroyed)return;var q=Y.pos+X.length;if(q>Y.endOffset){var V=Error("maximum file length exceeded");V.code="ETOOBIG",Y.destroyed=!0,Z(V);return}X.copy(Q.buffer,Y.pos,0,X.length),Y.bytesWritten+=X.length,Y.pos=q,Y.emit("progress"),Z()},Y.destroy=function(){Y.destroyed=!0},Y};Kz.prototype.ref=function(){this.refCount+=1};Kz.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")};function qF8(J,Q){return new Kz(J,Q)}function VF8(J,Q){return new Vz(J,Q)}});var dQ6=h((AY5,pQ6)=>{var rB=S1("buffer").Buffer,U_1=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array<"u")U_1=new Int32Array(U_1);function mQ6(J){if(rB.isBuffer(J))return J;var Q=typeof rB.alloc==="function"&&typeof rB.from==="function";if(typeof J==="number")return Q?rB.alloc(J):new rB(J);else if(typeof J==="string")return Q?rB.from(J):new rB(J);else throw Error("input must be buffer, number, or string, received "+typeof J)}function UF8(J){var Q=mQ6(4);return Q.writeInt32BE(J,0),Q}function B_1(J,Q){if(J=mQ6(J),rB.isBuffer(Q))Q=Q.readUInt32BE(0);var Y=~~Q^-1;for(var X=0;X<J.length;X++)Y=U_1[(Y^J[X])&255]^Y>>>8;return Y^-1}function N_1(){return UF8(B_1.apply(null,arguments))}N_1.signed=function(){return B_1.apply(null,arguments)};N_1.unsigned=function(){return B_1.apply(null,arguments)>>>0};pQ6.exports=N_1});function __1(J){let Q={},Y={};for(let X in J){if(!Object.hasOwn(J,X))continue;let G=J[X];switch(typeof G){case"number":Q[X]=G;break;case"boolean":Q[X]=G?1:0;break;case"object":{if(G===null||G===void 0){Y[X]=G;break}let{metadata:Z}=__1(G);for(let[q,V]of Object.entries(Z))Q[`${X}.${q}`]=V;Y[X]=G;break}default:Y[X]=G}}return{metadata:Q,sensitiveMetadata:Y}}function k_1(J,Q){let{metadata:Y,sensitiveMetadata:X}=__1(J.metadata||{});return{feature:J.feature,action:J.action,timestamp:Date.now()*1000,source:{client:Q},parameters:{...Object.keys(Y).length>0&&{metadata:Y},...Object.keys(X).length>0&&{sensitiveMetadata:X}}}}var HY6=()=>{};class y_1{configService;constructor(J){this.configService=J}recordEvent(J){let Q=k_1(J,"cli"),Y=JSON.stringify([Q]);To(Y,this.configService).catch((X)=>{x.error("Failed to send telemetry",{error:X,feature:J.feature,action:J.action})})}}var zY6=G1(()=>{H0();dZ();HY6()});var g81={};v8(g81,{recordEvent:()=>OL,recordAdEvent:()=>hs0,initializeCLITelemetry:()=>VU8});function VU8(J){if(FY6)return;let Q=new y_1(J);fs0(Q),FY6=!0}var FY6=!1;var m81=G1(()=>{kI1();zY6()});var LY6=h((JZ5,MY6)=>{function UU8(){if(typeof window<"u"&&typeof window.process==="object"&&window.process.type==="renderer")return!0;if(typeof process<"u"&&typeof process.versions==="object"&&!!process.versions.electron)return!0;if(typeof navigator==="object"&&typeof navigator.userAgent==="string"&&navigator.userAgent.indexOf("Electron")>=0)return!0;return!1}MY6.exports=UU8});var m8=h((QZ5,AY6)=>{AY6.exports={options:{usePureJavaScript:!1}}});var IY6=h((YZ5,wY6)=>{var f_1={};wY6.exports=f_1;var EY6={};f_1.encode=function(J,Q,Y){if(typeof Q!=="string")throw TypeError('"alphabet" must be a string.');if(Y!==void 0&&typeof Y!=="number")throw TypeError('"maxline" must be a number.');var X="";if(!(J instanceof Uint8Array))X=BU8(J,Q);else{var G=0,Z=Q.length,q=Q.charAt(0),V=[0];for(G=0;G<J.length;++G){for(var K=0,W=J[G];K<V.length;++K)W+=V[K]<<8,V[K]=W%Z,W=W/Z|0;while(W>0)V.push(W%Z),W=W/Z|0}for(G=0;J[G]===0&&G<J.length-1;++G)X+=q;for(G=V.length-1;G>=0;--G)X+=Q[V[G]]}if(Y){var H=new RegExp(".{1,"+Y+"}","g");X=X.match(H).join(`\r
|
|
4036
|
+
`)}return X};f_1.decode=function(J,Q){if(typeof J!=="string")throw TypeError('"input" must be a string.');if(typeof Q!=="string")throw TypeError('"alphabet" must be a string.');var Y=EY6[Q];if(!Y){Y=EY6[Q]=[];for(var X=0;X<Q.length;++X)Y[Q.charCodeAt(X)]=X}J=J.replace(/\s/g,"");var G=Q.length,Z=Q.charAt(0),q=[0];for(var X=0;X<J.length;X++){var V=Y[J.charCodeAt(X)];if(V===void 0)return;for(var K=0,W=V;K<q.length;++K)W+=q[K]*G,q[K]=W&255,W>>=8;while(W>0)q.push(W&255),W>>=8}for(var H=0;J[H]===Z&&H<J.length-1;++H)q.push(0);if(typeof Buffer<"u")return Buffer.from(q.reverse());return new Uint8Array(q.reverse())};function BU8(J,Q){var Y=0,X=Q.length,G=Q.charAt(0),Z=[0];for(Y=0;Y<J.length();++Y){for(var q=0,V=J.at(Y);q<Z.length;++q)V+=Z[q]<<8,Z[q]=V%X,V=V/X|0;while(V>0)Z.push(V%X),V=V/X|0}var K="";for(Y=0;J.at(Y)===0&&Y<J.length()-1;++Y)K+=G;for(Y=Z.length-1;Y>=0;--Y)K+=Q[Z[Y]];return K}});var i9=h(($Z5,CY6)=>{var PY6=m8(),TY6=IY6(),G0=CY6.exports=PY6.util=PY6.util||{};(function(){if(typeof process<"u"&&process.nextTick){if(G0.nextTick=process.nextTick,typeof setImmediate==="function")G0.setImmediate=setImmediate;else G0.setImmediate=G0.nextTick;return}if(typeof setImmediate==="function"){G0.setImmediate=function(){return setImmediate.apply(void 0,arguments)},G0.nextTick=function(V){return setImmediate(V)};return}if(G0.setImmediate=function(V){setTimeout(V,0)},typeof window<"u"&&typeof window.postMessage==="function"){let V=function(K){if(K.source===window&&K.data===J){K.stopPropagation();var W=Q.slice();Q.length=0,W.forEach(function(H){H()})}};var q=V,J="forge.setImmediate",Q=[];G0.setImmediate=function(K){if(Q.push(K),Q.length===1)window.postMessage(J,"*")},window.addEventListener("message",V,!0)}if(typeof MutationObserver<"u"){var Y=Date.now(),X=!0,G=document.createElement("div"),Q=[];new MutationObserver(function(){var K=Q.slice();Q.length=0,K.forEach(function(W){W()})}).observe(G,{attributes:!0});var Z=G0.setImmediate;G0.setImmediate=function(K){if(Date.now()-Y>15)Y=Date.now(),Z(K);else if(Q.push(K),Q.length===1)G.setAttribute("a",X=!X)}}G0.nextTick=G0.setImmediate})();G0.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;G0.globalScope=function(){if(G0.isNodejs)return global;return typeof self>"u"?window:self}();G0.isArray=Array.isArray||function(J){return Object.prototype.toString.call(J)==="[object Array]"};G0.isArrayBuffer=function(J){return typeof ArrayBuffer<"u"&&J instanceof ArrayBuffer};G0.isArrayBufferView=function(J){return J&&G0.isArrayBuffer(J.buffer)&&J.byteLength!==void 0};function Gg(J){if(!(J===8||J===16||J===24||J===32))throw Error("Only 8, 16, 24, or 32 bits supported: "+J)}G0.ByteBuffer=h_1;function h_1(J){if(this.data="",this.read=0,typeof J==="string")this.data=J;else if(G0.isArrayBuffer(J)||G0.isArrayBufferView(J))if(typeof Buffer<"u"&&J instanceof Buffer)this.data=J.toString("binary");else{var Q=new Uint8Array(J);try{this.data=String.fromCharCode.apply(null,Q)}catch(X){for(var Y=0;Y<Q.length;++Y)this.putByte(Q[Y])}}else if(J instanceof h_1||typeof J==="object"&&typeof J.data==="string"&&typeof J.read==="number")this.data=J.data,this.read=J.read;this._constructedStringLength=0}G0.ByteStringBuffer=h_1;var NU8=4096;G0.ByteStringBuffer.prototype._optimizeConstructedString=function(J){if(this._constructedStringLength+=J,this._constructedStringLength>NU8)this.data.substr(0,1),this._constructedStringLength=0};G0.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};G0.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};G0.ByteStringBuffer.prototype.putByte=function(J){return this.putBytes(String.fromCharCode(J))};G0.ByteStringBuffer.prototype.fillWithByte=function(J,Q){J=String.fromCharCode(J);var Y=this.data;while(Q>0){if(Q&1)Y+=J;if(Q>>>=1,Q>0)J+=J}return this.data=Y,this._optimizeConstructedString(Q),this};G0.ByteStringBuffer.prototype.putBytes=function(J){return this.data+=J,this._optimizeConstructedString(J.length),this};G0.ByteStringBuffer.prototype.putString=function(J){return this.putBytes(G0.encodeUtf8(J))};G0.ByteStringBuffer.prototype.putInt16=function(J){return this.putBytes(String.fromCharCode(J>>8&255)+String.fromCharCode(J&255))};G0.ByteStringBuffer.prototype.putInt24=function(J){return this.putBytes(String.fromCharCode(J>>16&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J&255))};G0.ByteStringBuffer.prototype.putInt32=function(J){return this.putBytes(String.fromCharCode(J>>24&255)+String.fromCharCode(J>>16&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J&255))};G0.ByteStringBuffer.prototype.putInt16Le=function(J){return this.putBytes(String.fromCharCode(J&255)+String.fromCharCode(J>>8&255))};G0.ByteStringBuffer.prototype.putInt24Le=function(J){return this.putBytes(String.fromCharCode(J&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J>>16&255))};G0.ByteStringBuffer.prototype.putInt32Le=function(J){return this.putBytes(String.fromCharCode(J&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J>>16&255)+String.fromCharCode(J>>24&255))};G0.ByteStringBuffer.prototype.putInt=function(J,Q){Gg(Q);var Y="";do Q-=8,Y+=String.fromCharCode(J>>Q&255);while(Q>0);return this.putBytes(Y)};G0.ByteStringBuffer.prototype.putSignedInt=function(J,Q){if(J<0)J+=2<<Q-1;return this.putInt(J,Q)};G0.ByteStringBuffer.prototype.putBuffer=function(J){return this.putBytes(J.getBytes())};G0.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};G0.ByteStringBuffer.prototype.getInt16=function(){var J=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,J};G0.ByteStringBuffer.prototype.getInt24=function(){var J=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,J};G0.ByteStringBuffer.prototype.getInt32=function(){var J=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,J};G0.ByteStringBuffer.prototype.getInt16Le=function(){var J=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,J};G0.ByteStringBuffer.prototype.getInt24Le=function(){var J=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,J};G0.ByteStringBuffer.prototype.getInt32Le=function(){var J=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,J};G0.ByteStringBuffer.prototype.getInt=function(J){Gg(J);var Q=0;do Q=(Q<<8)+this.data.charCodeAt(this.read++),J-=8;while(J>0);return Q};G0.ByteStringBuffer.prototype.getSignedInt=function(J){var Q=this.getInt(J),Y=2<<J-2;if(Q>=Y)Q-=Y<<1;return Q};G0.ByteStringBuffer.prototype.getBytes=function(J){var Q;if(J)J=Math.min(this.length(),J),Q=this.data.slice(this.read,this.read+J),this.read+=J;else if(J===0)Q="";else Q=this.read===0?this.data:this.data.slice(this.read),this.clear();return Q};G0.ByteStringBuffer.prototype.bytes=function(J){return typeof J>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+J)};G0.ByteStringBuffer.prototype.at=function(J){return this.data.charCodeAt(this.read+J)};G0.ByteStringBuffer.prototype.setAt=function(J,Q){return this.data=this.data.substr(0,this.read+J)+String.fromCharCode(Q)+this.data.substr(this.read+J+1),this};G0.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};G0.ByteStringBuffer.prototype.copy=function(){var J=G0.createBuffer(this.data);return J.read=this.read,J};G0.ByteStringBuffer.prototype.compact=function(){if(this.read>0)this.data=this.data.slice(this.read),this.read=0;return this};G0.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};G0.ByteStringBuffer.prototype.truncate=function(J){var Q=Math.max(0,this.length()-J);return this.data=this.data.substr(this.read,Q),this.read=0,this};G0.ByteStringBuffer.prototype.toHex=function(){var J="";for(var Q=this.read;Q<this.data.length;++Q){var Y=this.data.charCodeAt(Q);if(Y<16)J+="0";J+=Y.toString(16)}return J};G0.ByteStringBuffer.prototype.toString=function(){return G0.decodeUtf8(this.bytes())};function DU8(J,Q){Q=Q||{},this.read=Q.readOffset||0,this.growSize=Q.growSize||1024;var Y=G0.isArrayBuffer(J),X=G0.isArrayBufferView(J);if(Y||X){if(Y)this.data=new DataView(J);else this.data=new DataView(J.buffer,J.byteOffset,J.byteLength);this.write="writeOffset"in Q?Q.writeOffset:this.data.byteLength;return}if(this.data=new DataView(new ArrayBuffer(0)),this.write=0,J!==null&&J!==void 0)this.putBytes(J);if("writeOffset"in Q)this.write=Q.writeOffset}G0.DataBuffer=DU8;G0.DataBuffer.prototype.length=function(){return this.write-this.read};G0.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};G0.DataBuffer.prototype.accommodate=function(J,Q){if(this.length()>=J)return this;Q=Math.max(Q||this.growSize,J);var Y=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),X=new Uint8Array(this.length()+Q);return X.set(Y),this.data=new DataView(X.buffer),this};G0.DataBuffer.prototype.putByte=function(J){return this.accommodate(1),this.data.setUint8(this.write++,J),this};G0.DataBuffer.prototype.fillWithByte=function(J,Q){this.accommodate(Q);for(var Y=0;Y<Q;++Y)this.data.setUint8(J);return this};G0.DataBuffer.prototype.putBytes=function(J,Q){if(G0.isArrayBufferView(J)){var Y=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),X=Y.byteLength-Y.byteOffset;this.accommodate(X);var G=new Uint8Array(this.data.buffer,this.write);return G.set(Y),this.write+=X,this}if(G0.isArrayBuffer(J)){var Y=new Uint8Array(J);this.accommodate(Y.byteLength);var G=new Uint8Array(this.data.buffer);return G.set(Y,this.write),this.write+=Y.byteLength,this}if(J instanceof G0.DataBuffer||typeof J==="object"&&typeof J.read==="number"&&typeof J.write==="number"&&G0.isArrayBufferView(J.data)){var Y=new Uint8Array(J.data.byteLength,J.read,J.length());this.accommodate(Y.byteLength);var G=new Uint8Array(J.data.byteLength,this.write);return G.set(Y),this.write+=Y.byteLength,this}if(J instanceof G0.ByteStringBuffer)J=J.data,Q="binary";if(Q=Q||"binary",typeof J==="string"){var Z;if(Q==="hex")return this.accommodate(Math.ceil(J.length/2)),Z=new Uint8Array(this.data.buffer,this.write),this.write+=G0.binary.hex.decode(J,Z,this.write),this;if(Q==="base64")return this.accommodate(Math.ceil(J.length/4)*3),Z=new Uint8Array(this.data.buffer,this.write),this.write+=G0.binary.base64.decode(J,Z,this.write),this;if(Q==="utf8")J=G0.encodeUtf8(J),Q="binary";if(Q==="binary"||Q==="raw")return this.accommodate(J.length),Z=new Uint8Array(this.data.buffer,this.write),this.write+=G0.binary.raw.decode(Z),this;if(Q==="utf16")return this.accommodate(J.length*2),Z=new Uint16Array(this.data.buffer,this.write),this.write+=G0.text.utf16.encode(Z),this;throw Error("Invalid encoding: "+Q)}throw Error("Invalid parameter: "+J)};G0.DataBuffer.prototype.putBuffer=function(J){return this.putBytes(J),J.clear(),this};G0.DataBuffer.prototype.putString=function(J){return this.putBytes(J,"utf16")};G0.DataBuffer.prototype.putInt16=function(J){return this.accommodate(2),this.data.setInt16(this.write,J),this.write+=2,this};G0.DataBuffer.prototype.putInt24=function(J){return this.accommodate(3),this.data.setInt16(this.write,J>>8&65535),this.data.setInt8(this.write,J>>16&255),this.write+=3,this};G0.DataBuffer.prototype.putInt32=function(J){return this.accommodate(4),this.data.setInt32(this.write,J),this.write+=4,this};G0.DataBuffer.prototype.putInt16Le=function(J){return this.accommodate(2),this.data.setInt16(this.write,J,!0),this.write+=2,this};G0.DataBuffer.prototype.putInt24Le=function(J){return this.accommodate(3),this.data.setInt8(this.write,J>>16&255),this.data.setInt16(this.write,J>>8&65535,!0),this.write+=3,this};G0.DataBuffer.prototype.putInt32Le=function(J){return this.accommodate(4),this.data.setInt32(this.write,J,!0),this.write+=4,this};G0.DataBuffer.prototype.putInt=function(J,Q){Gg(Q),this.accommodate(Q/8);do Q-=8,this.data.setInt8(this.write++,J>>Q&255);while(Q>0);return this};G0.DataBuffer.prototype.putSignedInt=function(J,Q){if(Gg(Q),this.accommodate(Q/8),J<0)J+=2<<Q-1;return this.putInt(J,Q)};G0.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};G0.DataBuffer.prototype.getInt16=function(){var J=this.data.getInt16(this.read);return this.read+=2,J};G0.DataBuffer.prototype.getInt24=function(){var J=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,J};G0.DataBuffer.prototype.getInt32=function(){var J=this.data.getInt32(this.read);return this.read+=4,J};G0.DataBuffer.prototype.getInt16Le=function(){var J=this.data.getInt16(this.read,!0);return this.read+=2,J};G0.DataBuffer.prototype.getInt24Le=function(){var J=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,J};G0.DataBuffer.prototype.getInt32Le=function(){var J=this.data.getInt32(this.read,!0);return this.read+=4,J};G0.DataBuffer.prototype.getInt=function(J){Gg(J);var Q=0;do Q=(Q<<8)+this.data.getInt8(this.read++),J-=8;while(J>0);return Q};G0.DataBuffer.prototype.getSignedInt=function(J){var Q=this.getInt(J),Y=2<<J-2;if(Q>=Y)Q-=Y<<1;return Q};G0.DataBuffer.prototype.getBytes=function(J){var Q;if(J)J=Math.min(this.length(),J),Q=this.data.slice(this.read,this.read+J),this.read+=J;else if(J===0)Q="";else Q=this.read===0?this.data:this.data.slice(this.read),this.clear();return Q};G0.DataBuffer.prototype.bytes=function(J){return typeof J>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+J)};G0.DataBuffer.prototype.at=function(J){return this.data.getUint8(this.read+J)};G0.DataBuffer.prototype.setAt=function(J,Q){return this.data.setUint8(J,Q),this};G0.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};G0.DataBuffer.prototype.copy=function(){return new G0.DataBuffer(this)};G0.DataBuffer.prototype.compact=function(){if(this.read>0){var J=new Uint8Array(this.data.buffer,this.read),Q=new Uint8Array(J.byteLength);Q.set(J),this.data=new DataView(Q),this.write-=this.read,this.read=0}return this};G0.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};G0.DataBuffer.prototype.truncate=function(J){return this.write=Math.max(0,this.length()-J),this.read=Math.min(this.read,this.write),this};G0.DataBuffer.prototype.toHex=function(){var J="";for(var Q=this.read;Q<this.data.byteLength;++Q){var Y=this.data.getUint8(Q);if(Y<16)J+="0";J+=Y.toString(16)}return J};G0.DataBuffer.prototype.toString=function(J){var Q=new Uint8Array(this.data,this.read,this.length());if(J=J||"utf8",J==="binary"||J==="raw")return G0.binary.raw.encode(Q);if(J==="hex")return G0.binary.hex.encode(Q);if(J==="base64")return G0.binary.base64.encode(Q);if(J==="utf8")return G0.text.utf8.decode(Q);if(J==="utf16")return G0.text.utf16.decode(Q);throw Error("Invalid encoding: "+J)};G0.createBuffer=function(J,Q){if(Q=Q||"raw",J!==void 0&&Q==="utf8")J=G0.encodeUtf8(J);return new G0.ByteBuffer(J)};G0.fillString=function(J,Q){var Y="";while(Q>0){if(Q&1)Y+=J;if(Q>>>=1,Q>0)J+=J}return Y};G0.xorBytes=function(J,Q,Y){var X="",G="",Z="",q=0,V=0;for(;Y>0;--Y,++q){if(G=J.charCodeAt(q)^Q.charCodeAt(q),V>=10)X+=Z,Z="",V=0;Z+=String.fromCharCode(G),++V}return X+=Z,X};G0.hexToBytes=function(J){var Q="",Y=0;if(J.length&!0)Y=1,Q+=String.fromCharCode(parseInt(J[0],16));for(;Y<J.length;Y+=2)Q+=String.fromCharCode(parseInt(J.substr(Y,2),16));return Q};G0.bytesToHex=function(J){return G0.createBuffer(J).toHex()};G0.int32ToBytes=function(J){return String.fromCharCode(J>>24&255)+String.fromCharCode(J>>16&255)+String.fromCharCode(J>>8&255)+String.fromCharCode(J&255)};var sB="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",tB=[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],RY6="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";G0.encode64=function(J,Q){var Y="",X="",G,Z,q,V=0;while(V<J.length){if(G=J.charCodeAt(V++),Z=J.charCodeAt(V++),q=J.charCodeAt(V++),Y+=sB.charAt(G>>2),Y+=sB.charAt((G&3)<<4|Z>>4),isNaN(Z))Y+="==";else Y+=sB.charAt((Z&15)<<2|q>>6),Y+=isNaN(q)?"=":sB.charAt(q&63);if(Q&&Y.length>Q)X+=Y.substr(0,Q)+`\r
|
|
4037
4037
|
`,Y=Y.substr(Q)}return X+=Y,X};G0.decode64=function(J){J=J.replace(/[^A-Za-z0-9\+\/\=]/g,"");var Q="",Y,X,G,Z,q=0;while(q<J.length)if(Y=tB[J.charCodeAt(q++)-43],X=tB[J.charCodeAt(q++)-43],G=tB[J.charCodeAt(q++)-43],Z=tB[J.charCodeAt(q++)-43],Q+=String.fromCharCode(Y<<2|X>>4),G!==64){if(Q+=String.fromCharCode((X&15)<<4|G>>2),Z!==64)Q+=String.fromCharCode((G&3)<<6|Z)}return Q};G0.encodeUtf8=function(J){return unescape(encodeURIComponent(J))};G0.decodeUtf8=function(J){return decodeURIComponent(escape(J))};G0.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:TY6.encode,decode:TY6.decode}};G0.binary.raw.encode=function(J){return String.fromCharCode.apply(null,J)};G0.binary.raw.decode=function(J,Q,Y){var X=Q;if(!X)X=new Uint8Array(J.length);Y=Y||0;var G=Y;for(var Z=0;Z<J.length;++Z)X[G++]=J.charCodeAt(Z);return Q?G-Y:X};G0.binary.hex.encode=G0.bytesToHex;G0.binary.hex.decode=function(J,Q,Y){var X=Q;if(!X)X=new Uint8Array(Math.ceil(J.length/2));Y=Y||0;var G=0,Z=Y;if(J.length&1)G=1,X[Z++]=parseInt(J[0],16);for(;G<J.length;G+=2)X[Z++]=parseInt(J.substr(G,2),16);return Q?Z-Y:X};G0.binary.base64.encode=function(J,Q){var Y="",X="",G,Z,q,V=0;while(V<J.byteLength){if(G=J[V++],Z=J[V++],q=J[V++],Y+=sB.charAt(G>>2),Y+=sB.charAt((G&3)<<4|Z>>4),isNaN(Z))Y+="==";else Y+=sB.charAt((Z&15)<<2|q>>6),Y+=isNaN(q)?"=":sB.charAt(q&63);if(Q&&Y.length>Q)X+=Y.substr(0,Q)+`\r
|
|
4038
|
-
`,Y=Y.substr(Q)}return X+=Y,X};G0.binary.base64.decode=function(J,Q,Y){var X=Q;if(!X)X=new Uint8Array(Math.ceil(J.length/4)*3);J=J.replace(/[^A-Za-z0-9\+\/\=]/g,""),Y=Y||0;var G,Z,q,V,K=0,W=Y;while(K<J.length)if(G=tB[J.charCodeAt(K++)-43],Z=tB[J.charCodeAt(K++)-43],q=tB[J.charCodeAt(K++)-43],V=tB[J.charCodeAt(K++)-43],X[W++]=G<<2|Z>>4,q!==64){if(X[W++]=(Z&15)<<4|q>>2,V!==64)X[W++]=(q&3)<<6|V}return Q?W-Y:X.subarray(0,W)};G0.binary.base58.encode=function(J,Q){return G0.binary.baseN.encode(J,RY6,Q)};G0.binary.base58.decode=function(J,Q){return G0.binary.baseN.decode(J,RY6,Q)};G0.text={utf8:{},utf16:{}};G0.text.utf8.encode=function(J,Q,Y){J=G0.encodeUtf8(J);var X=Q;if(!X)X=new Uint8Array(J.length);Y=Y||0;var G=Y;for(var Z=0;Z<J.length;++Z)X[G++]=J.charCodeAt(Z);return Q?G-Y:X};G0.text.utf8.decode=function(J){return G0.decodeUtf8(String.fromCharCode.apply(null,J))};G0.text.utf16.encode=function(J,Q,Y){var X=Q;if(!X)X=new Uint8Array(J.length*2);var G=new Uint16Array(X.buffer);Y=Y||0;var Z=Y,q=Y;for(var V=0;V<J.length;++V)G[q++]=J.charCodeAt(V),Z+=2;return Q?Z-Y:X};G0.text.utf16.decode=function(J){return String.fromCharCode.apply(null,new Uint16Array(J.buffer))};G0.deflate=function(J,Q,Y){if(Q=G0.decode64(J.deflate(G0.encode64(Q)).rval),Y){var X=2,G=Q.charCodeAt(1);if(G&32)X=6;Q=Q.substring(X,Q.length-4)}return Q};G0.inflate=function(J,Q,Y){var X=J.inflate(G0.encode64(Q)).rval;return X===null?null:G0.decode64(X)};var b_1=function(J,Q,Y){if(!J)throw Error("WebStorage not available.");var X;if(Y===null)X=J.removeItem(Q);else Y=G0.encode64(JSON.stringify(Y)),X=J.setItem(Q,Y);if(typeof X<"u"&&X.rval!==!0){var G=Error(X.error.message);throw G.id=X.error.id,G.name=X.error.name,G}},u_1=function(J,Q){if(!J)throw Error("WebStorage not available.");var Y=J.getItem(Q);if(J.init)if(Y.rval===null){if(Y.error){var X=Error(Y.error.message);throw X.id=Y.error.id,X.name=Y.error.name,X}Y=null}else Y=Y.rval;if(Y!==null)Y=JSON.parse(G0.decode64(Y));return Y},OU8=function(J,Q,Y,X){var G=u_1(J,Q);if(G===null)G={};G[Y]=X,b_1(J,Q,G)},MU8=function(J,Q,Y){var X=u_1(J,Q);if(X!==null)X=Y in X?X[Y]:null;return X},LU8=function(J,Q,Y){var X=u_1(J,Q);if(X!==null&&Y in X){delete X[Y];var G=!0;for(var Z in X){G=!1;break}if(G)X=null;b_1(J,Q,X)}},AU8=function(J,Q){b_1(J,Q,null)},p81=function(J,Q,Y){var X=null;if(typeof Y>"u")Y=["web","flash"];var G,Z=!1,q=null;for(var V in Y){G=Y[V];try{if(G==="flash"||G==="both"){if(Q[0]===null)throw Error("Flash local storage not available.");X=J.apply(this,Q),Z=G==="flash"}if(G==="web"||G==="both")Q[0]=localStorage,X=J.apply(this,Q),Z=!0}catch(K){q=K}if(Z)break}if(!Z)throw q;return X};G0.setItem=function(J,Q,Y,X,G){p81(OU8,arguments,G)};G0.getItem=function(J,Q,Y,X){return p81(MU8,arguments,X)};G0.removeItem=function(J,Q,Y,X){p81(LU8,arguments,X)};G0.clearItems=function(J,Q,Y){p81(AU8,arguments,Y)};G0.isEmpty=function(J){for(var Q in J)if(J.hasOwnProperty(Q))return!1;return!0};G0.format=function(J){var Q=/%./g,Y,X,G=0,Z=[],q=0;while(Y=Q.exec(J)){if(X=J.substring(q,Q.lastIndex-2),X.length>0)Z.push(X);q=Q.lastIndex;var V=Y[0][1];switch(V){case"s":case"o":if(G<arguments.length)Z.push(arguments[G+++1]);else Z.push("<?>");break;case"%":Z.push("%");break;default:Z.push("<%"+V+"?>")}}return Z.push(J.substring(q)),Z.join("")};G0.formatNumber=function(J,Q,Y,X){var G=J,Z=isNaN(Q=Math.abs(Q))?2:Q,q=Y===void 0?",":Y,V=X===void 0?".":X,K=G<0?"-":"",W=parseInt(G=Math.abs(+G||0).toFixed(Z),10)+"",H=W.length>3?W.length%3:0;return K+(H?W.substr(0,H)+V:"")+W.substr(H).replace(/(\d{3})(?=\d)/g,"$1"+V)+(Z?q+Math.abs(G-W).toFixed(Z).slice(2):"")};G0.formatSize=function(J){if(J>=1073741824)J=G0.formatNumber(J/1073741824,2,".","")+" GiB";else if(J>=1048576)J=G0.formatNumber(J/1048576,2,".","")+" MiB";else if(J>=1024)J=G0.formatNumber(J/1024,0)+" KiB";else J=G0.formatNumber(J,0)+" bytes";return J};G0.bytesFromIP=function(J){if(J.indexOf(".")!==-1)return G0.bytesFromIPv4(J);if(J.indexOf(":")!==-1)return G0.bytesFromIPv6(J);return null};G0.bytesFromIPv4=function(J){if(J=J.split("."),J.length!==4)return null;var Q=G0.createBuffer();for(var Y=0;Y<J.length;++Y){var X=parseInt(J[Y],10);if(isNaN(X))return null;Q.putByte(X)}return Q.getBytes()};G0.bytesFromIPv6=function(J){var Q=0;J=J.split(":").filter(function(q){if(q.length===0)++Q;return!0});var Y=(8-J.length+Q)*2,X=G0.createBuffer();for(var G=0;G<8;++G){if(!J[G]||J[G].length===0){X.fillWithByte(0,Y),Y=0;continue}var Z=G0.hexToBytes(J[G]);if(Z.length<2)X.putByte(0);X.putBytes(Z)}return X.getBytes()};G0.bytesToIP=function(J){if(J.length===4)return G0.bytesToIPv4(J);if(J.length===16)return G0.bytesToIPv6(J);return null};G0.bytesToIPv4=function(J){if(J.length!==4)return null;var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(J.charCodeAt(Y));return Q.join(".")};G0.bytesToIPv6=function(J){if(J.length!==16)return null;var Q=[],Y=[],X=0;for(var G=0;G<J.length;G+=2){var Z=G0.bytesToHex(J[G]+J[G+1]);while(Z[0]==="0"&&Z!=="0")Z=Z.substr(1);if(Z==="0"){var q=Y[Y.length-1],V=Q.length;if(!q||V!==q.end+1)Y.push({start:V,end:V});else if(q.end=V,q.end-q.start>Y[X].end-Y[X].start)X=Y.length-1}Q.push(Z)}if(Y.length>0){var K=Y[X];if(K.end-K.start>0){if(Q.splice(K.start,K.end-K.start+1,""),K.start===0)Q.unshift("");if(K.end===7)Q.push("")}}return Q.join(":")};G0.estimateCores=function(J,Q){if(typeof J==="function")Q=J,J={};if(J=J||{},"cores"in G0&&!J.update)return Q(null,G0.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return G0.cores=navigator.hardwareConcurrency,Q(null,G0.cores);if(typeof Worker>"u")return G0.cores=1,Q(null,G0.cores);if(typeof Blob>"u")return G0.cores=2,Q(null,G0.cores);var Y=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(q){var V=Date.now(),K=V+4;while(Date.now()<K);self.postMessage({st:V,et:K})})}.toString(),")()"],{type:"application/javascript"}));X([],5,16);function X(q,V,K){if(V===0){var W=Math.floor(q.reduce(function(H,z){return H+z},0)/q.length);return G0.cores=Math.max(1,W),URL.revokeObjectURL(Y),Q(null,G0.cores)}G(K,function(H,z){q.push(Z(K,z)),X(q,V-1,K)})}function G(q,V){var K=[],W=[];for(var H=0;H<q;++H){var z=new Worker(Y);z.addEventListener("message",function(U){if(W.push(U.data),W.length===q){for(var N=0;N<q;++N)K[N].terminate();V(null,W)}}),K.push(z)}for(var H=0;H<q;++H)K[H].postMessage(H)}function Z(q,V){var K=[];for(var W=0;W<q;++W){var H=V[W],z=K[W]=[];for(var U=0;U<q;++U){if(W===U)continue;var N=V[U];if(H.st>N.st&&H.st<N.et||N.st>H.st&&N.st<H.et)z.push(U)}}return K.reduce(function(O,M){return Math.max(O,M.length)},0)}}});var d81=h(($Z5,SY6)=>{var u3=m8();i9();SY6.exports=u3.cipher=u3.cipher||{};u3.cipher.algorithms=u3.cipher.algorithms||{};u3.cipher.createCipher=function(J,Q){var Y=J;if(typeof Y==="string"){if(Y=u3.cipher.getAlgorithm(Y),Y)Y=Y()}if(!Y)throw Error("Unsupported algorithm: "+J);return new u3.cipher.BlockCipher({algorithm:Y,key:Q,decrypt:!1})};u3.cipher.createDecipher=function(J,Q){var Y=J;if(typeof Y==="string"){if(Y=u3.cipher.getAlgorithm(Y),Y)Y=Y()}if(!Y)throw Error("Unsupported algorithm: "+J);return new u3.cipher.BlockCipher({algorithm:Y,key:Q,decrypt:!0})};u3.cipher.registerAlgorithm=function(J,Q){J=J.toUpperCase(),u3.cipher.algorithms[J]=Q};u3.cipher.getAlgorithm=function(J){if(J=J.toUpperCase(),J in u3.cipher.algorithms)return u3.cipher.algorithms[J];return null};var g_1=u3.cipher.BlockCipher=function(J){this.algorithm=J.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=J.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=J.decrypt,this.algorithm.initialize(J)};g_1.prototype.start=function(J){J=J||{};var Q={};for(var Y in J)Q[Y]=J[Y];Q.decrypt=this._decrypt,this._finish=!1,this._input=u3.util.createBuffer(),this.output=J.output||u3.util.createBuffer(),this.mode.start(Q)};g_1.prototype.update=function(J){if(J)this._input.putBuffer(J);while(!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish);this._input.compact()};g_1.prototype.finish=function(J){if(J&&(this.mode.name==="ECB"||this.mode.name==="CBC"))this.mode.pad=function(Y){return J(this.blockSize,Y,!1)},this.mode.unpad=function(Y){return J(this.blockSize,Y,!0)};var Q={};if(Q.decrypt=this._decrypt,Q.overflow=this._input.length()%this.blockSize,!this._decrypt&&this.mode.pad){if(!this.mode.pad(this._input,Q))return!1}if(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad){if(!this.mode.unpad(this.output,Q))return!1}if(this.mode.afterFinish){if(!this.mode.afterFinish(this.output,Q))return!1}return!0}});var p_1=h((XZ5,jY6)=>{var g3=m8();i9();g3.cipher=g3.cipher||{};var O9=jY6.exports=g3.cipher.modes=g3.cipher.modes||{};O9.ecb=function(J){J=J||{},this.name="ECB",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints)};O9.ecb.prototype.start=function(J){};O9.ecb.prototype.encrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=J.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._outBlock[X])};O9.ecb.prototype.decrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=J.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._outBlock[X])};O9.ecb.prototype.pad=function(J,Q){var Y=J.length()===this.blockSize?this.blockSize:this.blockSize-J.length();return J.fillWithByte(Y,Y),!0};O9.ecb.prototype.unpad=function(J,Q){if(Q.overflow>0)return!1;var Y=J.length(),X=J.at(Y-1);if(X>this.blockSize<<2)return!1;return J.truncate(X),!0};O9.cbc=function(J){J=J||{},this.name="CBC",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints)};O9.cbc.prototype.start=function(J){if(J.iv===null){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if(!("iv"in J))throw Error("Invalid IV parameter.");else this._iv=c81(J.iv,this.blockSize),this._prev=this._iv.slice(0)};O9.cbc.prototype.encrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=this._prev[X]^J.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._outBlock[X]);this._prev=this._outBlock};O9.cbc.prototype.decrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=J.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._prev[X]^this._outBlock[X]);this._prev=this._inBlock.slice(0)};O9.cbc.prototype.pad=function(J,Q){var Y=J.length()===this.blockSize?this.blockSize:this.blockSize-J.length();return J.fillWithByte(Y,Y),!0};O9.cbc.prototype.unpad=function(J,Q){if(Q.overflow>0)return!1;var Y=J.length(),X=J.at(Y-1);if(X>this.blockSize<<2)return!1;return J.truncate(X),!0};O9.cfb=function(J){J=J||{},this.name="CFB",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0};O9.cfb.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");this._iv=c81(J.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};O9.cfb.prototype.encrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)this._inBlock[G]=J.getInt32()^this._outBlock[G],Q.putInt32(this._inBlock[G]);return}var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialBlock[G]=J.getInt32()^this._outBlock[G],this._partialOutput.putInt32(this._partialBlock[G]);if(Z>0)J.read-=this.blockSize;else for(var G=0;G<this._ints;++G)this._inBlock[G]=this._partialBlock[G];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0};O9.cfb.prototype.decrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)this._inBlock[G]=J.getInt32(),Q.putInt32(this._inBlock[G]^this._outBlock[G]);return}var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialBlock[G]=J.getInt32(),this._partialOutput.putInt32(this._partialBlock[G]^this._outBlock[G]);if(Z>0)J.read-=this.blockSize;else for(var G=0;G<this._ints;++G)this._inBlock[G]=this._partialBlock[G];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0};O9.ofb=function(J){J=J||{},this.name="OFB",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0};O9.ofb.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");this._iv=c81(J.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};O9.ofb.prototype.encrypt=function(J,Q,Y){var X=J.length();if(J.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)Q.putInt32(J.getInt32()^this._outBlock[G]),this._inBlock[G]=this._outBlock[G];return}var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialOutput.putInt32(J.getInt32()^this._outBlock[G]);if(Z>0)J.read-=this.blockSize;else for(var G=0;G<this._ints;++G)this._inBlock[G]=this._outBlock[G];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0};O9.ofb.prototype.decrypt=O9.ofb.prototype.encrypt;O9.ctr=function(J){J=J||{},this.name="CTR",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0};O9.ctr.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");this._iv=c81(J.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};O9.ctr.prototype.encrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize)for(var G=0;G<this._ints;++G)Q.putInt32(J.getInt32()^this._outBlock[G]);else{var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialOutput.putInt32(J.getInt32()^this._outBlock[G]);if(Z>0)J.read-=this.blockSize;if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0}l81(this._inBlock)};O9.ctr.prototype.decrypt=O9.ctr.prototype.encrypt;O9.gcm=function(J){J=J||{},this.name="GCM",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0,this._R=3774873600};O9.gcm.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");var Q=g3.util.createBuffer(J.iv);this._cipherLength=0;var Y;if("additionalData"in J)Y=g3.util.createBuffer(J.additionalData);else Y=g3.util.createBuffer();if("tagLength"in J)this._tagLength=J.tagLength;else this._tagLength=128;if(this._tag=null,J.decrypt){if(this._tag=g3.util.createBuffer(J.tag).getBytes(),this._tag.length!==this._tagLength/8)throw Error("Authentication tag does not match tag length.")}this._hashBlock=Array(this._ints),this.tag=null,this._hashSubkey=Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var X=Q.length();if(X===12)this._j0=[Q.getInt32(),Q.getInt32(),Q.getInt32(),1];else{this._j0=[0,0,0,0];while(Q.length()>0)this._j0=this.ghash(this._hashSubkey,this._j0,[Q.getInt32(),Q.getInt32(),Q.getInt32(),Q.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(m_1(X*8)))}this._inBlock=this._j0.slice(0),l81(this._inBlock),this._partialBytes=0,Y=g3.util.createBuffer(Y),this._aDataLength=m_1(Y.length()*8);var G=Y.length()%this.blockSize;if(G)Y.fillWithByte(0,this.blockSize-G);this._s=[0,0,0,0];while(Y.length()>0)this._s=this.ghash(this._hashSubkey,this._s,[Y.getInt32(),Y.getInt32(),Y.getInt32(),Y.getInt32()])};O9.gcm.prototype.encrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)Q.putInt32(this._outBlock[G]^=J.getInt32());this._cipherLength+=this.blockSize}else{var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialOutput.putInt32(J.getInt32()^this._outBlock[G]);if(Z<=0||Y){if(Y){var q=X%this.blockSize;this._cipherLength+=q,this._partialOutput.truncate(this.blockSize-q)}else this._cipherLength+=this.blockSize;for(var G=0;G<this._ints;++G)this._outBlock[G]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return J.read-=this.blockSize,Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),l81(this._inBlock)};O9.gcm.prototype.decrypt=function(J,Q,Y){var X=J.length();if(X<this.blockSize&&!(Y&&X>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),l81(this._inBlock),this._hashBlock[0]=J.getInt32(),this._hashBlock[1]=J.getInt32(),this._hashBlock[2]=J.getInt32(),this._hashBlock[3]=J.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var G=0;G<this._ints;++G)Q.putInt32(this._outBlock[G]^this._hashBlock[G]);if(X<this.blockSize)this._cipherLength+=X%this.blockSize;else this._cipherLength+=this.blockSize};O9.gcm.prototype.afterFinish=function(J,Q){var Y=!0;if(Q.decrypt&&Q.overflow)J.truncate(this.blockSize-Q.overflow);this.tag=g3.util.createBuffer();var X=this._aDataLength.concat(m_1(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,X);var G=[];this.cipher.encrypt(this._j0,G);for(var Z=0;Z<this._ints;++Z)this.tag.putInt32(this._s[Z]^G[Z]);if(this.tag.truncate(this.tag.length()%(this._tagLength/8)),Q.decrypt&&this.tag.bytes()!==this._tag)Y=!1;return Y};O9.gcm.prototype.multiply=function(J,Q){var Y=[0,0,0,0],X=Q.slice(0);for(var G=0;G<128;++G){var Z=J[G/32|0]&1<<31-G%32;if(Z)Y[0]^=X[0],Y[1]^=X[1],Y[2]^=X[2],Y[3]^=X[3];this.pow(X,X)}return Y};O9.gcm.prototype.pow=function(J,Q){var Y=J[3]&1;for(var X=3;X>0;--X)Q[X]=J[X]>>>1|(J[X-1]&1)<<31;if(Q[0]=J[0]>>>1,Y)Q[0]^=this._R};O9.gcm.prototype.tableMultiply=function(J){var Q=[0,0,0,0];for(var Y=0;Y<32;++Y){var X=Y/8|0,G=J[X]>>>(7-Y%8)*4&15,Z=this._m[Y][G];Q[0]^=Z[0],Q[1]^=Z[1],Q[2]^=Z[2],Q[3]^=Z[3]}return Q};O9.gcm.prototype.ghash=function(J,Q,Y){return Q[0]^=Y[0],Q[1]^=Y[1],Q[2]^=Y[2],Q[3]^=Y[3],this.tableMultiply(Q)};O9.gcm.prototype.generateHashTable=function(J,Q){var Y=8/Q,X=4*Y,G=16*Y,Z=Array(G);for(var q=0;q<G;++q){var V=[0,0,0,0],K=q/X|0,W=(X-1-q%X)*Q;V[K]=1<<Q-1<<W,Z[q]=this.generateSubHashTable(this.multiply(V,J),Q)}return Z};O9.gcm.prototype.generateSubHashTable=function(J,Q){var Y=1<<Q,X=Y>>>1,G=Array(Y);G[X]=J.slice(0);var Z=X>>>1;while(Z>0)this.pow(G[2*Z],G[Z]=[]),Z>>=1;Z=2;while(Z<X){for(var q=1;q<Z;++q){var V=G[Z],K=G[q];G[Z+q]=[V[0]^K[0],V[1]^K[1],V[2]^K[2],V[3]^K[3]]}Z*=2}G[0]=[0,0,0,0];for(Z=X+1;Z<Y;++Z){var W=G[Z^X];G[Z]=[J[0]^W[0],J[1]^W[1],J[2]^W[2],J[3]^W[3]]}return G};function c81(J,Q){if(typeof J==="string")J=g3.util.createBuffer(J);if(g3.util.isArray(J)&&J.length>4){var Y=J;J=g3.util.createBuffer();for(var X=0;X<Y.length;++X)J.putByte(Y[X])}if(J.length()<Q)throw Error("Invalid IV length; got "+J.length()+" bytes and expected "+Q+" bytes.");if(!g3.util.isArray(J)){var G=[],Z=Q/4;for(var X=0;X<Z;++X)G.push(J.getInt32());J=G}return J}function l81(J){J[J.length-1]=J[J.length-1]+1&4294967295}function m_1(J){return[J/4294967296|0,J&4294967295]}});var eB=h((GZ5,vY6)=>{var e5=m8();d81();p_1();i9();vY6.exports=e5.aes=e5.aes||{};e5.aes.startEncrypting=function(J,Q,Y,X){var G=i81({key:J,output:Y,decrypt:!1,mode:X});return G.start(Q),G};e5.aes.createEncryptionCipher=function(J,Q){return i81({key:J,output:null,decrypt:!1,mode:Q})};e5.aes.startDecrypting=function(J,Q,Y,X){var G=i81({key:J,output:Y,decrypt:!0,mode:X});return G.start(Q),G};e5.aes.createDecryptionCipher=function(J,Q){return i81({key:J,output:null,decrypt:!0,mode:Q})};e5.aes.Algorithm=function(J,Q){if(!l_1)kY6();var Y=this;Y.name=J,Y.mode=new Q({blockSize:16,cipher:{encrypt:function(X,G){return c_1(Y._w,X,G,!1)},decrypt:function(X,G){return c_1(Y._w,X,G,!0)}}}),Y._init=!1};e5.aes.Algorithm.prototype.initialize=function(J){if(this._init)return;var Q=J.key,Y;if(typeof Q==="string"&&(Q.length===16||Q.length===24||Q.length===32))Q=e5.util.createBuffer(Q);else if(e5.util.isArray(Q)&&(Q.length===16||Q.length===24||Q.length===32)){Y=Q,Q=e5.util.createBuffer();for(var X=0;X<Y.length;++X)Q.putByte(Y[X])}if(!e5.util.isArray(Q)){Y=Q,Q=[];var G=Y.length();if(G===16||G===24||G===32){G=G>>>2;for(var X=0;X<G;++X)Q.push(Y.getInt32())}}if(!e5.util.isArray(Q)||!(Q.length===4||Q.length===6||Q.length===8))throw Error("Invalid key parameter.");var Z=this.mode.name,q=["CFB","OFB","CTR","GCM"].indexOf(Z)!==-1;this._w=yY6(Q,J.decrypt&&!q),this._init=!0};e5.aes._expandKey=function(J,Q){if(!l_1)kY6();return yY6(J,Q)};e5.aes._updateBlock=c_1;zC("AES-ECB",e5.cipher.modes.ecb);zC("AES-CBC",e5.cipher.modes.cbc);zC("AES-CFB",e5.cipher.modes.cfb);zC("AES-OFB",e5.cipher.modes.ofb);zC("AES-CTR",e5.cipher.modes.ctr);zC("AES-GCM",e5.cipher.modes.gcm);function zC(J,Q){var Y=function(){return new e5.aes.Algorithm(J,Q)};e5.cipher.registerAlgorithm(J,Y)}var l_1=!1,HC=4,uQ,d_1,_Y6,qA,Oq;function kY6(){l_1=!0,_Y6=[0,1,2,4,8,16,32,64,128,27,54];var J=Array(256);for(var Q=0;Q<128;++Q)J[Q]=Q<<1,J[Q+128]=Q+128<<1^283;uQ=Array(256),d_1=Array(256),qA=[,,,,],Oq=[,,,,];for(var Q=0;Q<4;++Q)qA[Q]=Array(256),Oq[Q]=Array(256);var Y=0,X=0,G,Z,q,V,K,W,H;for(var Q=0;Q<256;++Q){V=X^X<<1^X<<2^X<<3^X<<4,V=V>>8^V&255^99,uQ[Y]=V,d_1[V]=Y,K=J[V],G=J[Y],Z=J[G],q=J[Z],W=K<<24^V<<16^V<<8^(V^K),H=(G^Z^q)<<24^(Y^q)<<16^(Y^Z^q)<<8^(Y^G^q);for(var z=0;z<4;++z)qA[z][Y]=W,Oq[z][V]=H,W=W<<24|W>>>8,H=H<<24|H>>>8;if(Y===0)Y=X=1;else Y=G^J[J[J[G^q]]],X^=J[J[X]]}}function yY6(J,Q){var Y=J.slice(0),X,G=1,Z=Y.length,q=Z+6+1,V=HC*q;for(var K=Z;K<V;++K){if(X=Y[K-1],K%Z===0)X=uQ[X>>>16&255]<<24^uQ[X>>>8&255]<<16^uQ[X&255]<<8^uQ[X>>>24]^_Y6[G]<<24,G++;else if(Z>6&&K%Z===4)X=uQ[X>>>24]<<24^uQ[X>>>16&255]<<16^uQ[X>>>8&255]<<8^uQ[X&255];Y[K]=Y[K-Z]^X}if(Q){var W,H=Oq[0],z=Oq[1],U=Oq[2],N=Oq[3],O=Y.slice(0);V=Y.length;for(var K=0,M=V-HC;K<V;K+=HC,M-=HC)if(K===0||K===V-HC)O[K]=Y[M],O[K+1]=Y[M+3],O[K+2]=Y[M+2],O[K+3]=Y[M+1];else for(var L=0;L<HC;++L)W=Y[M+L],O[K+(3&-L)]=H[uQ[W>>>24]]^z[uQ[W>>>16&255]]^U[uQ[W>>>8&255]]^N[uQ[W&255]];Y=O}return Y}function c_1(J,Q,Y,X){var G=J.length/4-1,Z,q,V,K,W;if(X)Z=Oq[0],q=Oq[1],V=Oq[2],K=Oq[3],W=d_1;else Z=qA[0],q=qA[1],V=qA[2],K=qA[3],W=uQ;var H,z,U,N,O,M,L;H=Q[0]^J[0],z=Q[X?3:1]^J[1],U=Q[2]^J[2],N=Q[X?1:3]^J[3];var w=3;for(var I=1;I<G;++I)O=Z[H>>>24]^q[z>>>16&255]^V[U>>>8&255]^K[N&255]^J[++w],M=Z[z>>>24]^q[U>>>16&255]^V[N>>>8&255]^K[H&255]^J[++w],L=Z[U>>>24]^q[N>>>16&255]^V[H>>>8&255]^K[z&255]^J[++w],N=Z[N>>>24]^q[H>>>16&255]^V[z>>>8&255]^K[U&255]^J[++w],H=O,z=M,U=L;Y[0]=W[H>>>24]<<24^W[z>>>16&255]<<16^W[U>>>8&255]<<8^W[N&255]^J[++w],Y[X?3:1]=W[z>>>24]<<24^W[U>>>16&255]<<16^W[N>>>8&255]<<8^W[H&255]^J[++w],Y[2]=W[U>>>24]<<24^W[N>>>16&255]<<16^W[H>>>8&255]<<8^W[z&255]^J[++w],Y[X?1:3]=W[N>>>24]<<24^W[H>>>16&255]<<16^W[z>>>8&255]<<8^W[U&255]^J[++w]}function i81(J){J=J||{};var Q=(J.mode||"CBC").toUpperCase(),Y="AES-"+Q,X;if(J.decrypt)X=e5.cipher.createDecipher(Y,J.key);else X=e5.cipher.createCipher(Y,J.key);var G=X.start;return X.start=function(Z,q){var V=null;if(q instanceof e5.util.ByteBuffer)V=q,q={};q=q||{},q.output=V,q.iv=Z,G.call(X,q)},X}});var JN=h((ZZ5,xY6)=>{var Zg=m8();Zg.pki=Zg.pki||{};var i_1=xY6.exports=Zg.pki.oids=Zg.oids=Zg.oids||{};function Z6(J,Q){i_1[J]=Q,i_1[Q]=J}function H5(J,Q){i_1[J]=Q}Z6("1.2.840.113549.1.1.1","rsaEncryption");Z6("1.2.840.113549.1.1.4","md5WithRSAEncryption");Z6("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Z6("1.2.840.113549.1.1.7","RSAES-OAEP");Z6("1.2.840.113549.1.1.8","mgf1");Z6("1.2.840.113549.1.1.9","pSpecified");Z6("1.2.840.113549.1.1.10","RSASSA-PSS");Z6("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Z6("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Z6("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Z6("1.3.101.112","EdDSA25519");Z6("1.2.840.10040.4.3","dsa-with-sha1");Z6("1.3.14.3.2.7","desCBC");Z6("1.3.14.3.2.26","sha1");Z6("1.3.14.3.2.29","sha1WithRSASignature");Z6("2.16.840.1.101.3.4.2.1","sha256");Z6("2.16.840.1.101.3.4.2.2","sha384");Z6("2.16.840.1.101.3.4.2.3","sha512");Z6("2.16.840.1.101.3.4.2.4","sha224");Z6("2.16.840.1.101.3.4.2.5","sha512-224");Z6("2.16.840.1.101.3.4.2.6","sha512-256");Z6("1.2.840.113549.2.2","md2");Z6("1.2.840.113549.2.5","md5");Z6("1.2.840.113549.1.7.1","data");Z6("1.2.840.113549.1.7.2","signedData");Z6("1.2.840.113549.1.7.3","envelopedData");Z6("1.2.840.113549.1.7.4","signedAndEnvelopedData");Z6("1.2.840.113549.1.7.5","digestedData");Z6("1.2.840.113549.1.7.6","encryptedData");Z6("1.2.840.113549.1.9.1","emailAddress");Z6("1.2.840.113549.1.9.2","unstructuredName");Z6("1.2.840.113549.1.9.3","contentType");Z6("1.2.840.113549.1.9.4","messageDigest");Z6("1.2.840.113549.1.9.5","signingTime");Z6("1.2.840.113549.1.9.6","counterSignature");Z6("1.2.840.113549.1.9.7","challengePassword");Z6("1.2.840.113549.1.9.8","unstructuredAddress");Z6("1.2.840.113549.1.9.14","extensionRequest");Z6("1.2.840.113549.1.9.20","friendlyName");Z6("1.2.840.113549.1.9.21","localKeyId");Z6("1.2.840.113549.1.9.22.1","x509Certificate");Z6("1.2.840.113549.1.12.10.1.1","keyBag");Z6("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Z6("1.2.840.113549.1.12.10.1.3","certBag");Z6("1.2.840.113549.1.12.10.1.4","crlBag");Z6("1.2.840.113549.1.12.10.1.5","secretBag");Z6("1.2.840.113549.1.12.10.1.6","safeContentsBag");Z6("1.2.840.113549.1.5.13","pkcs5PBES2");Z6("1.2.840.113549.1.5.12","pkcs5PBKDF2");Z6("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Z6("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Z6("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Z6("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Z6("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Z6("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Z6("1.2.840.113549.2.7","hmacWithSHA1");Z6("1.2.840.113549.2.8","hmacWithSHA224");Z6("1.2.840.113549.2.9","hmacWithSHA256");Z6("1.2.840.113549.2.10","hmacWithSHA384");Z6("1.2.840.113549.2.11","hmacWithSHA512");Z6("1.2.840.113549.3.7","des-EDE3-CBC");Z6("2.16.840.1.101.3.4.1.2","aes128-CBC");Z6("2.16.840.1.101.3.4.1.22","aes192-CBC");Z6("2.16.840.1.101.3.4.1.42","aes256-CBC");Z6("2.5.4.3","commonName");Z6("2.5.4.4","surname");Z6("2.5.4.5","serialNumber");Z6("2.5.4.6","countryName");Z6("2.5.4.7","localityName");Z6("2.5.4.8","stateOrProvinceName");Z6("2.5.4.9","streetAddress");Z6("2.5.4.10","organizationName");Z6("2.5.4.11","organizationalUnitName");Z6("2.5.4.12","title");Z6("2.5.4.13","description");Z6("2.5.4.15","businessCategory");Z6("2.5.4.17","postalCode");Z6("2.5.4.42","givenName");Z6("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Z6("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Z6("2.16.840.1.113730.1.1","nsCertType");Z6("2.16.840.1.113730.1.13","nsComment");H5("2.5.29.1","authorityKeyIdentifier");H5("2.5.29.2","keyAttributes");H5("2.5.29.3","certificatePolicies");H5("2.5.29.4","keyUsageRestriction");H5("2.5.29.5","policyMapping");H5("2.5.29.6","subtreesConstraint");H5("2.5.29.7","subjectAltName");H5("2.5.29.8","issuerAltName");H5("2.5.29.9","subjectDirectoryAttributes");H5("2.5.29.10","basicConstraints");H5("2.5.29.11","nameConstraints");H5("2.5.29.12","policyConstraints");H5("2.5.29.13","basicConstraints");Z6("2.5.29.14","subjectKeyIdentifier");Z6("2.5.29.15","keyUsage");H5("2.5.29.16","privateKeyUsagePeriod");Z6("2.5.29.17","subjectAltName");Z6("2.5.29.18","issuerAltName");Z6("2.5.29.19","basicConstraints");H5("2.5.29.20","cRLNumber");H5("2.5.29.21","cRLReason");H5("2.5.29.22","expirationDate");H5("2.5.29.23","instructionCode");H5("2.5.29.24","invalidityDate");H5("2.5.29.25","cRLDistributionPoints");H5("2.5.29.26","issuingDistributionPoint");H5("2.5.29.27","deltaCRLIndicator");H5("2.5.29.28","issuingDistributionPoint");H5("2.5.29.29","certificateIssuer");H5("2.5.29.30","nameConstraints");Z6("2.5.29.31","cRLDistributionPoints");Z6("2.5.29.32","certificatePolicies");H5("2.5.29.33","policyMappings");H5("2.5.29.34","policyConstraints");Z6("2.5.29.35","authorityKeyIdentifier");H5("2.5.29.36","policyConstraints");Z6("2.5.29.37","extKeyUsage");H5("2.5.29.46","freshestCRL");H5("2.5.29.54","inhibitAnyPolicy");Z6("1.3.6.1.4.1.11129.2.4.2","timestampList");Z6("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Z6("1.3.6.1.5.5.7.3.1","serverAuth");Z6("1.3.6.1.5.5.7.3.2","clientAuth");Z6("1.3.6.1.5.5.7.3.3","codeSigning");Z6("1.3.6.1.5.5.7.3.4","emailProtection");Z6("1.3.6.1.5.5.7.3.8","timeStamping")});var Mq=h((qZ5,hY6)=>{var K2=m8();i9();JN();var i6=hY6.exports=K2.asn1=K2.asn1||{};i6.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};i6.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};i6.create=function(J,Q,Y,X,G){if(K2.util.isArray(X)){var Z=[];for(var q=0;q<X.length;++q)if(X[q]!==void 0)Z.push(X[q]);X=Z}var V={tagClass:J,type:Q,constructed:Y,composed:Y||K2.util.isArray(X),value:X};if(G&&"bitStringContents"in G)V.bitStringContents=G.bitStringContents,V.original=i6.copy(V);return V};i6.copy=function(J,Q){var Y;if(K2.util.isArray(J)){Y=[];for(var X=0;X<J.length;++X)Y.push(i6.copy(J[X],Q));return Y}if(typeof J==="string")return J;if(Y={tagClass:J.tagClass,type:J.type,constructed:J.constructed,composed:J.composed,value:i6.copy(J.value,Q)},Q&&!Q.excludeBitStringContents)Y.bitStringContents=J.bitStringContents;return Y};i6.equals=function(J,Q,Y){if(K2.util.isArray(J)){if(!K2.util.isArray(Q))return!1;if(J.length!==Q.length)return!1;for(var X=0;X<J.length;++X)if(!i6.equals(J[X],Q[X]))return!1;return!0}if(typeof J!==typeof Q)return!1;if(typeof J==="string")return J===Q;var G=J.tagClass===Q.tagClass&&J.type===Q.type&&J.constructed===Q.constructed&&J.composed===Q.composed&&i6.equals(J.value,Q.value);if(Y&&Y.includeBitStringContents)G=G&&J.bitStringContents===Q.bitStringContents;return G};i6.getBerValueLength=function(J){var Q=J.getByte();if(Q===128)return;var Y,X=Q&128;if(!X)Y=Q;else Y=J.getInt((Q&127)<<3);return Y};function qg(J,Q,Y){if(Y>Q){var X=Error("Too few bytes to parse DER.");throw X.available=J.length(),X.remaining=Q,X.requested=Y,X}}var EU8=function(J,Q){var Y=J.getByte();if(Q--,Y===128)return;var X,G=Y&128;if(!G)X=Y;else{var Z=Y&127;qg(J,Q,Z),X=J.getInt(Z<<3)}if(X<0)throw Error("Negative length: "+X);return X};i6.fromDer=function(J,Q){if(Q===void 0)Q={strict:!0,parseAllBytes:!0,decodeBitStrings:!0};if(typeof Q==="boolean")Q={strict:Q,parseAllBytes:!0,decodeBitStrings:!0};if(!("strict"in Q))Q.strict=!0;if(!("parseAllBytes"in Q))Q.parseAllBytes=!0;if(!("decodeBitStrings"in Q))Q.decodeBitStrings=!0;if(typeof J==="string")J=K2.util.createBuffer(J);var Y=J.length(),X=n81(J,J.length(),0,Q);if(Q.parseAllBytes&&J.length()!==0){var G=Error("Unparsed DER bytes remain after ASN.1 parsing.");throw G.byteCount=Y,G.remaining=J.length(),G}return X};function n81(J,Q,Y,X){var G;qg(J,Q,2);var Z=J.getByte();Q--;var q=Z&192,V=Z&31;G=J.length();var K=EU8(J,Q);if(Q-=G-J.length(),K!==void 0&&K>Q){if(X.strict){var W=Error("Too few bytes to read ASN.1 value.");throw W.available=J.length(),W.remaining=Q,W.requested=K,W}K=Q}var H,z,U=(Z&32)===32;if(U)if(H=[],K===void 0)for(;;){if(qg(J,Q,2),J.bytes(2)===String.fromCharCode(0,0)){J.getBytes(2),Q-=2;break}G=J.length(),H.push(n81(J,Q,Y+1,X)),Q-=G-J.length()}else while(K>0)G=J.length(),H.push(n81(J,K,Y+1,X)),Q-=G-J.length(),K-=G-J.length();if(H===void 0&&q===i6.Class.UNIVERSAL&&V===i6.Type.BITSTRING)z=J.bytes(K);if(H===void 0&&X.decodeBitStrings&&q===i6.Class.UNIVERSAL&&V===i6.Type.BITSTRING&&K>1){var N=J.read,O=Q,M=0;if(V===i6.Type.BITSTRING)qg(J,Q,1),M=J.getByte(),Q--;if(M===0)try{G=J.length();var L={strict:!0,decodeBitStrings:!0},w=n81(J,Q,Y+1,L),I=G-J.length();if(Q-=I,V==i6.Type.BITSTRING)I++;var P=w.tagClass;if(I===K&&(P===i6.Class.UNIVERSAL||P===i6.Class.CONTEXT_SPECIFIC))H=[w]}catch(j){}if(H===void 0)J.read=N,Q=O}if(H===void 0){if(K===void 0){if(X.strict)throw Error("Non-constructed ASN.1 object of indefinite length.");K=Q}if(V===i6.Type.BMPSTRING){H="";for(;K>0;K-=2)qg(J,Q,2),H+=String.fromCharCode(J.getInt16()),Q-=2}else H=J.getBytes(K),Q-=K}var R=z===void 0?null:{bitStringContents:z};return i6.create(q,V,U,H,R)}i6.toDer=function(J){var Q=K2.util.createBuffer(),Y=J.tagClass|J.type,X=K2.util.createBuffer(),G=!1;if("bitStringContents"in J){if(G=!0,J.original)G=i6.equals(J,J.original)}if(G)X.putBytes(J.bitStringContents);else if(J.composed){if(J.constructed)Y|=32;else X.putByte(0);for(var Z=0;Z<J.value.length;++Z)if(J.value[Z]!==void 0)X.putBuffer(i6.toDer(J.value[Z]))}else if(J.type===i6.Type.BMPSTRING)for(var Z=0;Z<J.value.length;++Z)X.putInt16(J.value.charCodeAt(Z));else if(J.type===i6.Type.INTEGER&&J.value.length>1&&(J.value.charCodeAt(0)===0&&(J.value.charCodeAt(1)&128)===0||J.value.charCodeAt(0)===255&&(J.value.charCodeAt(1)&128)===128))X.putBytes(J.value.substr(1));else X.putBytes(J.value);if(Q.putByte(Y),X.length()<=127)Q.putByte(X.length()&127);else{var q=X.length(),V="";do V+=String.fromCharCode(q&255),q=q>>>8;while(q>0);Q.putByte(V.length|128);for(var Z=V.length-1;Z>=0;--Z)Q.putByte(V.charCodeAt(Z))}return Q.putBuffer(X),Q};i6.oidToDer=function(J){var Q=J.split("."),Y=K2.util.createBuffer();Y.putByte(40*parseInt(Q[0],10)+parseInt(Q[1],10));var X,G,Z,q;for(var V=2;V<Q.length;++V){X=!0,G=[],Z=parseInt(Q[V],10);do{if(q=Z&127,Z=Z>>>7,!X)q|=128;G.push(q),X=!1}while(Z>0);for(var K=G.length-1;K>=0;--K)Y.putByte(G[K])}return Y};i6.derToOid=function(J){var Q;if(typeof J==="string")J=K2.util.createBuffer(J);var Y=J.getByte();Q=Math.floor(Y/40)+"."+Y%40;var X=0;while(J.length()>0)if(Y=J.getByte(),X=X<<7,Y&128)X+=Y&127;else Q+="."+(X+Y),X=0;return Q};i6.utcTimeToDate=function(J){var Q=new Date,Y=parseInt(J.substr(0,2),10);Y=Y>=50?1900+Y:2000+Y;var X=parseInt(J.substr(2,2),10)-1,G=parseInt(J.substr(4,2),10),Z=parseInt(J.substr(6,2),10),q=parseInt(J.substr(8,2),10),V=0;if(J.length>11){var K=J.charAt(10),W=10;if(K!=="+"&&K!=="-")V=parseInt(J.substr(10,2),10),W+=2}if(Q.setUTCFullYear(Y,X,G),Q.setUTCHours(Z,q,V,0),W){if(K=J.charAt(W),K==="+"||K==="-"){var H=parseInt(J.substr(W+1,2),10),z=parseInt(J.substr(W+4,2),10),U=H*60+z;if(U*=60000,K==="+")Q.setTime(+Q-U);else Q.setTime(+Q+U)}}return Q};i6.generalizedTimeToDate=function(J){var Q=new Date,Y=parseInt(J.substr(0,4),10),X=parseInt(J.substr(4,2),10)-1,G=parseInt(J.substr(6,2),10),Z=parseInt(J.substr(8,2),10),q=parseInt(J.substr(10,2),10),V=parseInt(J.substr(12,2),10),K=0,W=0,H=!1;if(J.charAt(J.length-1)==="Z")H=!0;var z=J.length-5,U=J.charAt(z);if(U==="+"||U==="-"){var N=parseInt(J.substr(z+1,2),10),O=parseInt(J.substr(z+4,2),10);if(W=N*60+O,W*=60000,U==="+")W*=-1;H=!0}if(J.charAt(14)===".")K=parseFloat(J.substr(14),10)*1000;if(H)Q.setUTCFullYear(Y,X,G),Q.setUTCHours(Z,q,V,K),Q.setTime(+Q+W);else Q.setFullYear(Y,X,G),Q.setHours(Z,q,V,K);return Q};i6.dateToUtcTime=function(J){if(typeof J==="string")return J;var Q="",Y=[];Y.push((""+J.getUTCFullYear()).substr(2)),Y.push(""+(J.getUTCMonth()+1)),Y.push(""+J.getUTCDate()),Y.push(""+J.getUTCHours()),Y.push(""+J.getUTCMinutes()),Y.push(""+J.getUTCSeconds());for(var X=0;X<Y.length;++X){if(Y[X].length<2)Q+="0";Q+=Y[X]}return Q+="Z",Q};i6.dateToGeneralizedTime=function(J){if(typeof J==="string")return J;var Q="",Y=[];Y.push(""+J.getUTCFullYear()),Y.push(""+(J.getUTCMonth()+1)),Y.push(""+J.getUTCDate()),Y.push(""+J.getUTCHours()),Y.push(""+J.getUTCMinutes()),Y.push(""+J.getUTCSeconds());for(var X=0;X<Y.length;++X){if(Y[X].length<2)Q+="0";Q+=Y[X]}return Q+="Z",Q};i6.integerToDer=function(J){var Q=K2.util.createBuffer();if(J>=-128&&J<128)return Q.putSignedInt(J,8);if(J>=-32768&&J<32768)return Q.putSignedInt(J,16);if(J>=-8388608&&J<8388608)return Q.putSignedInt(J,24);if(J>=-2147483648&&J<2147483648)return Q.putSignedInt(J,32);var Y=Error("Integer too large; max is 32-bits.");throw Y.integer=J,Y};i6.derToInteger=function(J){if(typeof J==="string")J=K2.util.createBuffer(J);var Q=J.length()*8;if(Q>32)throw Error("Integer too large; max is 32-bits.");return J.getSignedInt(Q)};i6.validate=function(J,Q,Y,X){var G=!1;if((J.tagClass===Q.tagClass||typeof Q.tagClass>"u")&&(J.type===Q.type||typeof Q.type>"u")){if(J.constructed===Q.constructed||typeof Q.constructed>"u"){if(G=!0,Q.value&&K2.util.isArray(Q.value)){var Z=0;for(var q=0;G&&q<Q.value.length;++q){if(G=Q.value[q].optional||!1,J.value[Z]){if(G=i6.validate(J.value[Z],Q.value[q],Y,X),G)++Z;else if(Q.value[q].optional)G=!0}if(!G&&X)X.push("["+Q.name+'] Tag class "'+Q.tagClass+'", type "'+Q.type+'" expected value length "'+Q.value.length+'", got "'+J.value.length+'"')}}if(G&&Y){if(Q.capture)Y[Q.capture]=J.value;if(Q.captureAsn1)Y[Q.captureAsn1]=J;if(Q.captureBitStringContents&&"bitStringContents"in J)Y[Q.captureBitStringContents]=J.bitStringContents;if(Q.captureBitStringValue&&"bitStringContents"in J){var V;if(J.bitStringContents.length<2)Y[Q.captureBitStringValue]="";else{var K=J.bitStringContents.charCodeAt(0);if(K!==0)throw Error("captureBitStringValue only supported for zero unused bits");Y[Q.captureBitStringValue]=J.bitStringContents.slice(1)}}}}else if(X)X.push("["+Q.name+'] Expected constructed "'+Q.constructed+'", got "'+J.constructed+'"')}else if(X){if(J.tagClass!==Q.tagClass)X.push("["+Q.name+'] Expected tag class "'+Q.tagClass+'", got "'+J.tagClass+'"');if(J.type!==Q.type)X.push("["+Q.name+'] Expected type "'+Q.type+'", got "'+J.type+'"')}return G};var fY6=/[^\\u0000-\\u00ff]/;i6.prettyPrint=function(J,Q,Y){var X="";if(Q=Q||0,Y=Y||2,Q>0)X+=`
|
|
4038
|
+
`,Y=Y.substr(Q)}return X+=Y,X};G0.binary.base64.decode=function(J,Q,Y){var X=Q;if(!X)X=new Uint8Array(Math.ceil(J.length/4)*3);J=J.replace(/[^A-Za-z0-9\+\/\=]/g,""),Y=Y||0;var G,Z,q,V,K=0,W=Y;while(K<J.length)if(G=tB[J.charCodeAt(K++)-43],Z=tB[J.charCodeAt(K++)-43],q=tB[J.charCodeAt(K++)-43],V=tB[J.charCodeAt(K++)-43],X[W++]=G<<2|Z>>4,q!==64){if(X[W++]=(Z&15)<<4|q>>2,V!==64)X[W++]=(q&3)<<6|V}return Q?W-Y:X.subarray(0,W)};G0.binary.base58.encode=function(J,Q){return G0.binary.baseN.encode(J,RY6,Q)};G0.binary.base58.decode=function(J,Q){return G0.binary.baseN.decode(J,RY6,Q)};G0.text={utf8:{},utf16:{}};G0.text.utf8.encode=function(J,Q,Y){J=G0.encodeUtf8(J);var X=Q;if(!X)X=new Uint8Array(J.length);Y=Y||0;var G=Y;for(var Z=0;Z<J.length;++Z)X[G++]=J.charCodeAt(Z);return Q?G-Y:X};G0.text.utf8.decode=function(J){return G0.decodeUtf8(String.fromCharCode.apply(null,J))};G0.text.utf16.encode=function(J,Q,Y){var X=Q;if(!X)X=new Uint8Array(J.length*2);var G=new Uint16Array(X.buffer);Y=Y||0;var Z=Y,q=Y;for(var V=0;V<J.length;++V)G[q++]=J.charCodeAt(V),Z+=2;return Q?Z-Y:X};G0.text.utf16.decode=function(J){return String.fromCharCode.apply(null,new Uint16Array(J.buffer))};G0.deflate=function(J,Q,Y){if(Q=G0.decode64(J.deflate(G0.encode64(Q)).rval),Y){var X=2,G=Q.charCodeAt(1);if(G&32)X=6;Q=Q.substring(X,Q.length-4)}return Q};G0.inflate=function(J,Q,Y){var X=J.inflate(G0.encode64(Q)).rval;return X===null?null:G0.decode64(X)};var b_1=function(J,Q,Y){if(!J)throw Error("WebStorage not available.");var X;if(Y===null)X=J.removeItem(Q);else Y=G0.encode64(JSON.stringify(Y)),X=J.setItem(Q,Y);if(typeof X<"u"&&X.rval!==!0){var G=Error(X.error.message);throw G.id=X.error.id,G.name=X.error.name,G}},u_1=function(J,Q){if(!J)throw Error("WebStorage not available.");var Y=J.getItem(Q);if(J.init)if(Y.rval===null){if(Y.error){var X=Error(Y.error.message);throw X.id=Y.error.id,X.name=Y.error.name,X}Y=null}else Y=Y.rval;if(Y!==null)Y=JSON.parse(G0.decode64(Y));return Y},OU8=function(J,Q,Y,X){var G=u_1(J,Q);if(G===null)G={};G[Y]=X,b_1(J,Q,G)},MU8=function(J,Q,Y){var X=u_1(J,Q);if(X!==null)X=Y in X?X[Y]:null;return X},LU8=function(J,Q,Y){var X=u_1(J,Q);if(X!==null&&Y in X){delete X[Y];var G=!0;for(var Z in X){G=!1;break}if(G)X=null;b_1(J,Q,X)}},AU8=function(J,Q){b_1(J,Q,null)},p81=function(J,Q,Y){var X=null;if(typeof Y>"u")Y=["web","flash"];var G,Z=!1,q=null;for(var V in Y){G=Y[V];try{if(G==="flash"||G==="both"){if(Q[0]===null)throw Error("Flash local storage not available.");X=J.apply(this,Q),Z=G==="flash"}if(G==="web"||G==="both")Q[0]=localStorage,X=J.apply(this,Q),Z=!0}catch(K){q=K}if(Z)break}if(!Z)throw q;return X};G0.setItem=function(J,Q,Y,X,G){p81(OU8,arguments,G)};G0.getItem=function(J,Q,Y,X){return p81(MU8,arguments,X)};G0.removeItem=function(J,Q,Y,X){p81(LU8,arguments,X)};G0.clearItems=function(J,Q,Y){p81(AU8,arguments,Y)};G0.isEmpty=function(J){for(var Q in J)if(J.hasOwnProperty(Q))return!1;return!0};G0.format=function(J){var Q=/%./g,Y,X,G=0,Z=[],q=0;while(Y=Q.exec(J)){if(X=J.substring(q,Q.lastIndex-2),X.length>0)Z.push(X);q=Q.lastIndex;var V=Y[0][1];switch(V){case"s":case"o":if(G<arguments.length)Z.push(arguments[G+++1]);else Z.push("<?>");break;case"%":Z.push("%");break;default:Z.push("<%"+V+"?>")}}return Z.push(J.substring(q)),Z.join("")};G0.formatNumber=function(J,Q,Y,X){var G=J,Z=isNaN(Q=Math.abs(Q))?2:Q,q=Y===void 0?",":Y,V=X===void 0?".":X,K=G<0?"-":"",W=parseInt(G=Math.abs(+G||0).toFixed(Z),10)+"",H=W.length>3?W.length%3:0;return K+(H?W.substr(0,H)+V:"")+W.substr(H).replace(/(\d{3})(?=\d)/g,"$1"+V)+(Z?q+Math.abs(G-W).toFixed(Z).slice(2):"")};G0.formatSize=function(J){if(J>=1073741824)J=G0.formatNumber(J/1073741824,2,".","")+" GiB";else if(J>=1048576)J=G0.formatNumber(J/1048576,2,".","")+" MiB";else if(J>=1024)J=G0.formatNumber(J/1024,0)+" KiB";else J=G0.formatNumber(J,0)+" bytes";return J};G0.bytesFromIP=function(J){if(J.indexOf(".")!==-1)return G0.bytesFromIPv4(J);if(J.indexOf(":")!==-1)return G0.bytesFromIPv6(J);return null};G0.bytesFromIPv4=function(J){if(J=J.split("."),J.length!==4)return null;var Q=G0.createBuffer();for(var Y=0;Y<J.length;++Y){var X=parseInt(J[Y],10);if(isNaN(X))return null;Q.putByte(X)}return Q.getBytes()};G0.bytesFromIPv6=function(J){var Q=0;J=J.split(":").filter(function(q){if(q.length===0)++Q;return!0});var Y=(8-J.length+Q)*2,X=G0.createBuffer();for(var G=0;G<8;++G){if(!J[G]||J[G].length===0){X.fillWithByte(0,Y),Y=0;continue}var Z=G0.hexToBytes(J[G]);if(Z.length<2)X.putByte(0);X.putBytes(Z)}return X.getBytes()};G0.bytesToIP=function(J){if(J.length===4)return G0.bytesToIPv4(J);if(J.length===16)return G0.bytesToIPv6(J);return null};G0.bytesToIPv4=function(J){if(J.length!==4)return null;var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(J.charCodeAt(Y));return Q.join(".")};G0.bytesToIPv6=function(J){if(J.length!==16)return null;var Q=[],Y=[],X=0;for(var G=0;G<J.length;G+=2){var Z=G0.bytesToHex(J[G]+J[G+1]);while(Z[0]==="0"&&Z!=="0")Z=Z.substr(1);if(Z==="0"){var q=Y[Y.length-1],V=Q.length;if(!q||V!==q.end+1)Y.push({start:V,end:V});else if(q.end=V,q.end-q.start>Y[X].end-Y[X].start)X=Y.length-1}Q.push(Z)}if(Y.length>0){var K=Y[X];if(K.end-K.start>0){if(Q.splice(K.start,K.end-K.start+1,""),K.start===0)Q.unshift("");if(K.end===7)Q.push("")}}return Q.join(":")};G0.estimateCores=function(J,Q){if(typeof J==="function")Q=J,J={};if(J=J||{},"cores"in G0&&!J.update)return Q(null,G0.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return G0.cores=navigator.hardwareConcurrency,Q(null,G0.cores);if(typeof Worker>"u")return G0.cores=1,Q(null,G0.cores);if(typeof Blob>"u")return G0.cores=2,Q(null,G0.cores);var Y=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(q){var V=Date.now(),K=V+4;while(Date.now()<K);self.postMessage({st:V,et:K})})}.toString(),")()"],{type:"application/javascript"}));X([],5,16);function X(q,V,K){if(V===0){var W=Math.floor(q.reduce(function(H,z){return H+z},0)/q.length);return G0.cores=Math.max(1,W),URL.revokeObjectURL(Y),Q(null,G0.cores)}G(K,function(H,z){q.push(Z(K,z)),X(q,V-1,K)})}function G(q,V){var K=[],W=[];for(var H=0;H<q;++H){var z=new Worker(Y);z.addEventListener("message",function(U){if(W.push(U.data),W.length===q){for(var N=0;N<q;++N)K[N].terminate();V(null,W)}}),K.push(z)}for(var H=0;H<q;++H)K[H].postMessage(H)}function Z(q,V){var K=[];for(var W=0;W<q;++W){var H=V[W],z=K[W]=[];for(var U=0;U<q;++U){if(W===U)continue;var N=V[U];if(H.st>N.st&&H.st<N.et||N.st>H.st&&N.st<H.et)z.push(U)}}return K.reduce(function(O,M){return Math.max(O,M.length)},0)}}});var d81=h((XZ5,SY6)=>{var u3=m8();i9();SY6.exports=u3.cipher=u3.cipher||{};u3.cipher.algorithms=u3.cipher.algorithms||{};u3.cipher.createCipher=function(J,Q){var Y=J;if(typeof Y==="string"){if(Y=u3.cipher.getAlgorithm(Y),Y)Y=Y()}if(!Y)throw Error("Unsupported algorithm: "+J);return new u3.cipher.BlockCipher({algorithm:Y,key:Q,decrypt:!1})};u3.cipher.createDecipher=function(J,Q){var Y=J;if(typeof Y==="string"){if(Y=u3.cipher.getAlgorithm(Y),Y)Y=Y()}if(!Y)throw Error("Unsupported algorithm: "+J);return new u3.cipher.BlockCipher({algorithm:Y,key:Q,decrypt:!0})};u3.cipher.registerAlgorithm=function(J,Q){J=J.toUpperCase(),u3.cipher.algorithms[J]=Q};u3.cipher.getAlgorithm=function(J){if(J=J.toUpperCase(),J in u3.cipher.algorithms)return u3.cipher.algorithms[J];return null};var g_1=u3.cipher.BlockCipher=function(J){this.algorithm=J.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=J.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=J.decrypt,this.algorithm.initialize(J)};g_1.prototype.start=function(J){J=J||{};var Q={};for(var Y in J)Q[Y]=J[Y];Q.decrypt=this._decrypt,this._finish=!1,this._input=u3.util.createBuffer(),this.output=J.output||u3.util.createBuffer(),this.mode.start(Q)};g_1.prototype.update=function(J){if(J)this._input.putBuffer(J);while(!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish);this._input.compact()};g_1.prototype.finish=function(J){if(J&&(this.mode.name==="ECB"||this.mode.name==="CBC"))this.mode.pad=function(Y){return J(this.blockSize,Y,!1)},this.mode.unpad=function(Y){return J(this.blockSize,Y,!0)};var Q={};if(Q.decrypt=this._decrypt,Q.overflow=this._input.length()%this.blockSize,!this._decrypt&&this.mode.pad){if(!this.mode.pad(this._input,Q))return!1}if(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad){if(!this.mode.unpad(this.output,Q))return!1}if(this.mode.afterFinish){if(!this.mode.afterFinish(this.output,Q))return!1}return!0}});var p_1=h((GZ5,jY6)=>{var g3=m8();i9();g3.cipher=g3.cipher||{};var O9=jY6.exports=g3.cipher.modes=g3.cipher.modes||{};O9.ecb=function(J){J=J||{},this.name="ECB",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints)};O9.ecb.prototype.start=function(J){};O9.ecb.prototype.encrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=J.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._outBlock[X])};O9.ecb.prototype.decrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=J.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._outBlock[X])};O9.ecb.prototype.pad=function(J,Q){var Y=J.length()===this.blockSize?this.blockSize:this.blockSize-J.length();return J.fillWithByte(Y,Y),!0};O9.ecb.prototype.unpad=function(J,Q){if(Q.overflow>0)return!1;var Y=J.length(),X=J.at(Y-1);if(X>this.blockSize<<2)return!1;return J.truncate(X),!0};O9.cbc=function(J){J=J||{},this.name="CBC",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints)};O9.cbc.prototype.start=function(J){if(J.iv===null){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if(!("iv"in J))throw Error("Invalid IV parameter.");else this._iv=c81(J.iv,this.blockSize),this._prev=this._iv.slice(0)};O9.cbc.prototype.encrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=this._prev[X]^J.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._outBlock[X]);this._prev=this._outBlock};O9.cbc.prototype.decrypt=function(J,Q,Y){if(J.length()<this.blockSize&&!(Y&&J.length()>0))return!0;for(var X=0;X<this._ints;++X)this._inBlock[X]=J.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var X=0;X<this._ints;++X)Q.putInt32(this._prev[X]^this._outBlock[X]);this._prev=this._inBlock.slice(0)};O9.cbc.prototype.pad=function(J,Q){var Y=J.length()===this.blockSize?this.blockSize:this.blockSize-J.length();return J.fillWithByte(Y,Y),!0};O9.cbc.prototype.unpad=function(J,Q){if(Q.overflow>0)return!1;var Y=J.length(),X=J.at(Y-1);if(X>this.blockSize<<2)return!1;return J.truncate(X),!0};O9.cfb=function(J){J=J||{},this.name="CFB",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0};O9.cfb.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");this._iv=c81(J.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};O9.cfb.prototype.encrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)this._inBlock[G]=J.getInt32()^this._outBlock[G],Q.putInt32(this._inBlock[G]);return}var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialBlock[G]=J.getInt32()^this._outBlock[G],this._partialOutput.putInt32(this._partialBlock[G]);if(Z>0)J.read-=this.blockSize;else for(var G=0;G<this._ints;++G)this._inBlock[G]=this._partialBlock[G];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0};O9.cfb.prototype.decrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)this._inBlock[G]=J.getInt32(),Q.putInt32(this._inBlock[G]^this._outBlock[G]);return}var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialBlock[G]=J.getInt32(),this._partialOutput.putInt32(this._partialBlock[G]^this._outBlock[G]);if(Z>0)J.read-=this.blockSize;else for(var G=0;G<this._ints;++G)this._inBlock[G]=this._partialBlock[G];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0};O9.ofb=function(J){J=J||{},this.name="OFB",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0};O9.ofb.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");this._iv=c81(J.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};O9.ofb.prototype.encrypt=function(J,Q,Y){var X=J.length();if(J.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)Q.putInt32(J.getInt32()^this._outBlock[G]),this._inBlock[G]=this._outBlock[G];return}var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialOutput.putInt32(J.getInt32()^this._outBlock[G]);if(Z>0)J.read-=this.blockSize;else for(var G=0;G<this._ints;++G)this._inBlock[G]=this._outBlock[G];if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0};O9.ofb.prototype.decrypt=O9.ofb.prototype.encrypt;O9.ctr=function(J){J=J||{},this.name="CTR",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0};O9.ctr.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");this._iv=c81(J.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};O9.ctr.prototype.encrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize)for(var G=0;G<this._ints;++G)Q.putInt32(J.getInt32()^this._outBlock[G]);else{var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialOutput.putInt32(J.getInt32()^this._outBlock[G]);if(Z>0)J.read-=this.blockSize;if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0}l81(this._inBlock)};O9.ctr.prototype.decrypt=O9.ctr.prototype.encrypt;O9.gcm=function(J){J=J||{},this.name="GCM",this.cipher=J.cipher,this.blockSize=J.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints),this._partialOutput=g3.util.createBuffer(),this._partialBytes=0,this._R=3774873600};O9.gcm.prototype.start=function(J){if(!("iv"in J))throw Error("Invalid IV parameter.");var Q=g3.util.createBuffer(J.iv);this._cipherLength=0;var Y;if("additionalData"in J)Y=g3.util.createBuffer(J.additionalData);else Y=g3.util.createBuffer();if("tagLength"in J)this._tagLength=J.tagLength;else this._tagLength=128;if(this._tag=null,J.decrypt){if(this._tag=g3.util.createBuffer(J.tag).getBytes(),this._tag.length!==this._tagLength/8)throw Error("Authentication tag does not match tag length.")}this._hashBlock=Array(this._ints),this.tag=null,this._hashSubkey=Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var X=Q.length();if(X===12)this._j0=[Q.getInt32(),Q.getInt32(),Q.getInt32(),1];else{this._j0=[0,0,0,0];while(Q.length()>0)this._j0=this.ghash(this._hashSubkey,this._j0,[Q.getInt32(),Q.getInt32(),Q.getInt32(),Q.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(m_1(X*8)))}this._inBlock=this._j0.slice(0),l81(this._inBlock),this._partialBytes=0,Y=g3.util.createBuffer(Y),this._aDataLength=m_1(Y.length()*8);var G=Y.length()%this.blockSize;if(G)Y.fillWithByte(0,this.blockSize-G);this._s=[0,0,0,0];while(Y.length()>0)this._s=this.ghash(this._hashSubkey,this._s,[Y.getInt32(),Y.getInt32(),Y.getInt32(),Y.getInt32()])};O9.gcm.prototype.encrypt=function(J,Q,Y){var X=J.length();if(X===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&X>=this.blockSize){for(var G=0;G<this._ints;++G)Q.putInt32(this._outBlock[G]^=J.getInt32());this._cipherLength+=this.blockSize}else{var Z=(this.blockSize-X)%this.blockSize;if(Z>0)Z=this.blockSize-Z;this._partialOutput.clear();for(var G=0;G<this._ints;++G)this._partialOutput.putInt32(J.getInt32()^this._outBlock[G]);if(Z<=0||Y){if(Y){var q=X%this.blockSize;this._cipherLength+=q,this._partialOutput.truncate(this.blockSize-q)}else this._cipherLength+=this.blockSize;for(var G=0;G<this._ints;++G)this._outBlock[G]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0)this._partialOutput.getBytes(this._partialBytes);if(Z>0&&!Y)return J.read-=this.blockSize,Q.putBytes(this._partialOutput.getBytes(Z-this._partialBytes)),this._partialBytes=Z,!0;Q.putBytes(this._partialOutput.getBytes(X-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),l81(this._inBlock)};O9.gcm.prototype.decrypt=function(J,Q,Y){var X=J.length();if(X<this.blockSize&&!(Y&&X>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),l81(this._inBlock),this._hashBlock[0]=J.getInt32(),this._hashBlock[1]=J.getInt32(),this._hashBlock[2]=J.getInt32(),this._hashBlock[3]=J.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var G=0;G<this._ints;++G)Q.putInt32(this._outBlock[G]^this._hashBlock[G]);if(X<this.blockSize)this._cipherLength+=X%this.blockSize;else this._cipherLength+=this.blockSize};O9.gcm.prototype.afterFinish=function(J,Q){var Y=!0;if(Q.decrypt&&Q.overflow)J.truncate(this.blockSize-Q.overflow);this.tag=g3.util.createBuffer();var X=this._aDataLength.concat(m_1(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,X);var G=[];this.cipher.encrypt(this._j0,G);for(var Z=0;Z<this._ints;++Z)this.tag.putInt32(this._s[Z]^G[Z]);if(this.tag.truncate(this.tag.length()%(this._tagLength/8)),Q.decrypt&&this.tag.bytes()!==this._tag)Y=!1;return Y};O9.gcm.prototype.multiply=function(J,Q){var Y=[0,0,0,0],X=Q.slice(0);for(var G=0;G<128;++G){var Z=J[G/32|0]&1<<31-G%32;if(Z)Y[0]^=X[0],Y[1]^=X[1],Y[2]^=X[2],Y[3]^=X[3];this.pow(X,X)}return Y};O9.gcm.prototype.pow=function(J,Q){var Y=J[3]&1;for(var X=3;X>0;--X)Q[X]=J[X]>>>1|(J[X-1]&1)<<31;if(Q[0]=J[0]>>>1,Y)Q[0]^=this._R};O9.gcm.prototype.tableMultiply=function(J){var Q=[0,0,0,0];for(var Y=0;Y<32;++Y){var X=Y/8|0,G=J[X]>>>(7-Y%8)*4&15,Z=this._m[Y][G];Q[0]^=Z[0],Q[1]^=Z[1],Q[2]^=Z[2],Q[3]^=Z[3]}return Q};O9.gcm.prototype.ghash=function(J,Q,Y){return Q[0]^=Y[0],Q[1]^=Y[1],Q[2]^=Y[2],Q[3]^=Y[3],this.tableMultiply(Q)};O9.gcm.prototype.generateHashTable=function(J,Q){var Y=8/Q,X=4*Y,G=16*Y,Z=Array(G);for(var q=0;q<G;++q){var V=[0,0,0,0],K=q/X|0,W=(X-1-q%X)*Q;V[K]=1<<Q-1<<W,Z[q]=this.generateSubHashTable(this.multiply(V,J),Q)}return Z};O9.gcm.prototype.generateSubHashTable=function(J,Q){var Y=1<<Q,X=Y>>>1,G=Array(Y);G[X]=J.slice(0);var Z=X>>>1;while(Z>0)this.pow(G[2*Z],G[Z]=[]),Z>>=1;Z=2;while(Z<X){for(var q=1;q<Z;++q){var V=G[Z],K=G[q];G[Z+q]=[V[0]^K[0],V[1]^K[1],V[2]^K[2],V[3]^K[3]]}Z*=2}G[0]=[0,0,0,0];for(Z=X+1;Z<Y;++Z){var W=G[Z^X];G[Z]=[J[0]^W[0],J[1]^W[1],J[2]^W[2],J[3]^W[3]]}return G};function c81(J,Q){if(typeof J==="string")J=g3.util.createBuffer(J);if(g3.util.isArray(J)&&J.length>4){var Y=J;J=g3.util.createBuffer();for(var X=0;X<Y.length;++X)J.putByte(Y[X])}if(J.length()<Q)throw Error("Invalid IV length; got "+J.length()+" bytes and expected "+Q+" bytes.");if(!g3.util.isArray(J)){var G=[],Z=Q/4;for(var X=0;X<Z;++X)G.push(J.getInt32());J=G}return J}function l81(J){J[J.length-1]=J[J.length-1]+1&4294967295}function m_1(J){return[J/4294967296|0,J&4294967295]}});var eB=h((ZZ5,vY6)=>{var e5=m8();d81();p_1();i9();vY6.exports=e5.aes=e5.aes||{};e5.aes.startEncrypting=function(J,Q,Y,X){var G=i81({key:J,output:Y,decrypt:!1,mode:X});return G.start(Q),G};e5.aes.createEncryptionCipher=function(J,Q){return i81({key:J,output:null,decrypt:!1,mode:Q})};e5.aes.startDecrypting=function(J,Q,Y,X){var G=i81({key:J,output:Y,decrypt:!0,mode:X});return G.start(Q),G};e5.aes.createDecryptionCipher=function(J,Q){return i81({key:J,output:null,decrypt:!0,mode:Q})};e5.aes.Algorithm=function(J,Q){if(!l_1)kY6();var Y=this;Y.name=J,Y.mode=new Q({blockSize:16,cipher:{encrypt:function(X,G){return c_1(Y._w,X,G,!1)},decrypt:function(X,G){return c_1(Y._w,X,G,!0)}}}),Y._init=!1};e5.aes.Algorithm.prototype.initialize=function(J){if(this._init)return;var Q=J.key,Y;if(typeof Q==="string"&&(Q.length===16||Q.length===24||Q.length===32))Q=e5.util.createBuffer(Q);else if(e5.util.isArray(Q)&&(Q.length===16||Q.length===24||Q.length===32)){Y=Q,Q=e5.util.createBuffer();for(var X=0;X<Y.length;++X)Q.putByte(Y[X])}if(!e5.util.isArray(Q)){Y=Q,Q=[];var G=Y.length();if(G===16||G===24||G===32){G=G>>>2;for(var X=0;X<G;++X)Q.push(Y.getInt32())}}if(!e5.util.isArray(Q)||!(Q.length===4||Q.length===6||Q.length===8))throw Error("Invalid key parameter.");var Z=this.mode.name,q=["CFB","OFB","CTR","GCM"].indexOf(Z)!==-1;this._w=yY6(Q,J.decrypt&&!q),this._init=!0};e5.aes._expandKey=function(J,Q){if(!l_1)kY6();return yY6(J,Q)};e5.aes._updateBlock=c_1;zC("AES-ECB",e5.cipher.modes.ecb);zC("AES-CBC",e5.cipher.modes.cbc);zC("AES-CFB",e5.cipher.modes.cfb);zC("AES-OFB",e5.cipher.modes.ofb);zC("AES-CTR",e5.cipher.modes.ctr);zC("AES-GCM",e5.cipher.modes.gcm);function zC(J,Q){var Y=function(){return new e5.aes.Algorithm(J,Q)};e5.cipher.registerAlgorithm(J,Y)}var l_1=!1,HC=4,uQ,d_1,_Y6,qA,Oq;function kY6(){l_1=!0,_Y6=[0,1,2,4,8,16,32,64,128,27,54];var J=Array(256);for(var Q=0;Q<128;++Q)J[Q]=Q<<1,J[Q+128]=Q+128<<1^283;uQ=Array(256),d_1=Array(256),qA=[,,,,],Oq=[,,,,];for(var Q=0;Q<4;++Q)qA[Q]=Array(256),Oq[Q]=Array(256);var Y=0,X=0,G,Z,q,V,K,W,H;for(var Q=0;Q<256;++Q){V=X^X<<1^X<<2^X<<3^X<<4,V=V>>8^V&255^99,uQ[Y]=V,d_1[V]=Y,K=J[V],G=J[Y],Z=J[G],q=J[Z],W=K<<24^V<<16^V<<8^(V^K),H=(G^Z^q)<<24^(Y^q)<<16^(Y^Z^q)<<8^(Y^G^q);for(var z=0;z<4;++z)qA[z][Y]=W,Oq[z][V]=H,W=W<<24|W>>>8,H=H<<24|H>>>8;if(Y===0)Y=X=1;else Y=G^J[J[J[G^q]]],X^=J[J[X]]}}function yY6(J,Q){var Y=J.slice(0),X,G=1,Z=Y.length,q=Z+6+1,V=HC*q;for(var K=Z;K<V;++K){if(X=Y[K-1],K%Z===0)X=uQ[X>>>16&255]<<24^uQ[X>>>8&255]<<16^uQ[X&255]<<8^uQ[X>>>24]^_Y6[G]<<24,G++;else if(Z>6&&K%Z===4)X=uQ[X>>>24]<<24^uQ[X>>>16&255]<<16^uQ[X>>>8&255]<<8^uQ[X&255];Y[K]=Y[K-Z]^X}if(Q){var W,H=Oq[0],z=Oq[1],U=Oq[2],N=Oq[3],O=Y.slice(0);V=Y.length;for(var K=0,M=V-HC;K<V;K+=HC,M-=HC)if(K===0||K===V-HC)O[K]=Y[M],O[K+1]=Y[M+3],O[K+2]=Y[M+2],O[K+3]=Y[M+1];else for(var L=0;L<HC;++L)W=Y[M+L],O[K+(3&-L)]=H[uQ[W>>>24]]^z[uQ[W>>>16&255]]^U[uQ[W>>>8&255]]^N[uQ[W&255]];Y=O}return Y}function c_1(J,Q,Y,X){var G=J.length/4-1,Z,q,V,K,W;if(X)Z=Oq[0],q=Oq[1],V=Oq[2],K=Oq[3],W=d_1;else Z=qA[0],q=qA[1],V=qA[2],K=qA[3],W=uQ;var H,z,U,N,O,M,L;H=Q[0]^J[0],z=Q[X?3:1]^J[1],U=Q[2]^J[2],N=Q[X?1:3]^J[3];var w=3;for(var I=1;I<G;++I)O=Z[H>>>24]^q[z>>>16&255]^V[U>>>8&255]^K[N&255]^J[++w],M=Z[z>>>24]^q[U>>>16&255]^V[N>>>8&255]^K[H&255]^J[++w],L=Z[U>>>24]^q[N>>>16&255]^V[H>>>8&255]^K[z&255]^J[++w],N=Z[N>>>24]^q[H>>>16&255]^V[z>>>8&255]^K[U&255]^J[++w],H=O,z=M,U=L;Y[0]=W[H>>>24]<<24^W[z>>>16&255]<<16^W[U>>>8&255]<<8^W[N&255]^J[++w],Y[X?3:1]=W[z>>>24]<<24^W[U>>>16&255]<<16^W[N>>>8&255]<<8^W[H&255]^J[++w],Y[2]=W[U>>>24]<<24^W[N>>>16&255]<<16^W[H>>>8&255]<<8^W[z&255]^J[++w],Y[X?1:3]=W[N>>>24]<<24^W[H>>>16&255]<<16^W[z>>>8&255]<<8^W[U&255]^J[++w]}function i81(J){J=J||{};var Q=(J.mode||"CBC").toUpperCase(),Y="AES-"+Q,X;if(J.decrypt)X=e5.cipher.createDecipher(Y,J.key);else X=e5.cipher.createCipher(Y,J.key);var G=X.start;return X.start=function(Z,q){var V=null;if(q instanceof e5.util.ByteBuffer)V=q,q={};q=q||{},q.output=V,q.iv=Z,G.call(X,q)},X}});var JN=h((qZ5,xY6)=>{var Zg=m8();Zg.pki=Zg.pki||{};var i_1=xY6.exports=Zg.pki.oids=Zg.oids=Zg.oids||{};function Z6(J,Q){i_1[J]=Q,i_1[Q]=J}function H5(J,Q){i_1[J]=Q}Z6("1.2.840.113549.1.1.1","rsaEncryption");Z6("1.2.840.113549.1.1.4","md5WithRSAEncryption");Z6("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Z6("1.2.840.113549.1.1.7","RSAES-OAEP");Z6("1.2.840.113549.1.1.8","mgf1");Z6("1.2.840.113549.1.1.9","pSpecified");Z6("1.2.840.113549.1.1.10","RSASSA-PSS");Z6("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Z6("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Z6("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Z6("1.3.101.112","EdDSA25519");Z6("1.2.840.10040.4.3","dsa-with-sha1");Z6("1.3.14.3.2.7","desCBC");Z6("1.3.14.3.2.26","sha1");Z6("1.3.14.3.2.29","sha1WithRSASignature");Z6("2.16.840.1.101.3.4.2.1","sha256");Z6("2.16.840.1.101.3.4.2.2","sha384");Z6("2.16.840.1.101.3.4.2.3","sha512");Z6("2.16.840.1.101.3.4.2.4","sha224");Z6("2.16.840.1.101.3.4.2.5","sha512-224");Z6("2.16.840.1.101.3.4.2.6","sha512-256");Z6("1.2.840.113549.2.2","md2");Z6("1.2.840.113549.2.5","md5");Z6("1.2.840.113549.1.7.1","data");Z6("1.2.840.113549.1.7.2","signedData");Z6("1.2.840.113549.1.7.3","envelopedData");Z6("1.2.840.113549.1.7.4","signedAndEnvelopedData");Z6("1.2.840.113549.1.7.5","digestedData");Z6("1.2.840.113549.1.7.6","encryptedData");Z6("1.2.840.113549.1.9.1","emailAddress");Z6("1.2.840.113549.1.9.2","unstructuredName");Z6("1.2.840.113549.1.9.3","contentType");Z6("1.2.840.113549.1.9.4","messageDigest");Z6("1.2.840.113549.1.9.5","signingTime");Z6("1.2.840.113549.1.9.6","counterSignature");Z6("1.2.840.113549.1.9.7","challengePassword");Z6("1.2.840.113549.1.9.8","unstructuredAddress");Z6("1.2.840.113549.1.9.14","extensionRequest");Z6("1.2.840.113549.1.9.20","friendlyName");Z6("1.2.840.113549.1.9.21","localKeyId");Z6("1.2.840.113549.1.9.22.1","x509Certificate");Z6("1.2.840.113549.1.12.10.1.1","keyBag");Z6("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Z6("1.2.840.113549.1.12.10.1.3","certBag");Z6("1.2.840.113549.1.12.10.1.4","crlBag");Z6("1.2.840.113549.1.12.10.1.5","secretBag");Z6("1.2.840.113549.1.12.10.1.6","safeContentsBag");Z6("1.2.840.113549.1.5.13","pkcs5PBES2");Z6("1.2.840.113549.1.5.12","pkcs5PBKDF2");Z6("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Z6("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Z6("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Z6("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Z6("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Z6("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Z6("1.2.840.113549.2.7","hmacWithSHA1");Z6("1.2.840.113549.2.8","hmacWithSHA224");Z6("1.2.840.113549.2.9","hmacWithSHA256");Z6("1.2.840.113549.2.10","hmacWithSHA384");Z6("1.2.840.113549.2.11","hmacWithSHA512");Z6("1.2.840.113549.3.7","des-EDE3-CBC");Z6("2.16.840.1.101.3.4.1.2","aes128-CBC");Z6("2.16.840.1.101.3.4.1.22","aes192-CBC");Z6("2.16.840.1.101.3.4.1.42","aes256-CBC");Z6("2.5.4.3","commonName");Z6("2.5.4.4","surname");Z6("2.5.4.5","serialNumber");Z6("2.5.4.6","countryName");Z6("2.5.4.7","localityName");Z6("2.5.4.8","stateOrProvinceName");Z6("2.5.4.9","streetAddress");Z6("2.5.4.10","organizationName");Z6("2.5.4.11","organizationalUnitName");Z6("2.5.4.12","title");Z6("2.5.4.13","description");Z6("2.5.4.15","businessCategory");Z6("2.5.4.17","postalCode");Z6("2.5.4.42","givenName");Z6("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Z6("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Z6("2.16.840.1.113730.1.1","nsCertType");Z6("2.16.840.1.113730.1.13","nsComment");H5("2.5.29.1","authorityKeyIdentifier");H5("2.5.29.2","keyAttributes");H5("2.5.29.3","certificatePolicies");H5("2.5.29.4","keyUsageRestriction");H5("2.5.29.5","policyMapping");H5("2.5.29.6","subtreesConstraint");H5("2.5.29.7","subjectAltName");H5("2.5.29.8","issuerAltName");H5("2.5.29.9","subjectDirectoryAttributes");H5("2.5.29.10","basicConstraints");H5("2.5.29.11","nameConstraints");H5("2.5.29.12","policyConstraints");H5("2.5.29.13","basicConstraints");Z6("2.5.29.14","subjectKeyIdentifier");Z6("2.5.29.15","keyUsage");H5("2.5.29.16","privateKeyUsagePeriod");Z6("2.5.29.17","subjectAltName");Z6("2.5.29.18","issuerAltName");Z6("2.5.29.19","basicConstraints");H5("2.5.29.20","cRLNumber");H5("2.5.29.21","cRLReason");H5("2.5.29.22","expirationDate");H5("2.5.29.23","instructionCode");H5("2.5.29.24","invalidityDate");H5("2.5.29.25","cRLDistributionPoints");H5("2.5.29.26","issuingDistributionPoint");H5("2.5.29.27","deltaCRLIndicator");H5("2.5.29.28","issuingDistributionPoint");H5("2.5.29.29","certificateIssuer");H5("2.5.29.30","nameConstraints");Z6("2.5.29.31","cRLDistributionPoints");Z6("2.5.29.32","certificatePolicies");H5("2.5.29.33","policyMappings");H5("2.5.29.34","policyConstraints");Z6("2.5.29.35","authorityKeyIdentifier");H5("2.5.29.36","policyConstraints");Z6("2.5.29.37","extKeyUsage");H5("2.5.29.46","freshestCRL");H5("2.5.29.54","inhibitAnyPolicy");Z6("1.3.6.1.4.1.11129.2.4.2","timestampList");Z6("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Z6("1.3.6.1.5.5.7.3.1","serverAuth");Z6("1.3.6.1.5.5.7.3.2","clientAuth");Z6("1.3.6.1.5.5.7.3.3","codeSigning");Z6("1.3.6.1.5.5.7.3.4","emailProtection");Z6("1.3.6.1.5.5.7.3.8","timeStamping")});var Mq=h((VZ5,hY6)=>{var K2=m8();i9();JN();var i6=hY6.exports=K2.asn1=K2.asn1||{};i6.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};i6.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};i6.create=function(J,Q,Y,X,G){if(K2.util.isArray(X)){var Z=[];for(var q=0;q<X.length;++q)if(X[q]!==void 0)Z.push(X[q]);X=Z}var V={tagClass:J,type:Q,constructed:Y,composed:Y||K2.util.isArray(X),value:X};if(G&&"bitStringContents"in G)V.bitStringContents=G.bitStringContents,V.original=i6.copy(V);return V};i6.copy=function(J,Q){var Y;if(K2.util.isArray(J)){Y=[];for(var X=0;X<J.length;++X)Y.push(i6.copy(J[X],Q));return Y}if(typeof J==="string")return J;if(Y={tagClass:J.tagClass,type:J.type,constructed:J.constructed,composed:J.composed,value:i6.copy(J.value,Q)},Q&&!Q.excludeBitStringContents)Y.bitStringContents=J.bitStringContents;return Y};i6.equals=function(J,Q,Y){if(K2.util.isArray(J)){if(!K2.util.isArray(Q))return!1;if(J.length!==Q.length)return!1;for(var X=0;X<J.length;++X)if(!i6.equals(J[X],Q[X]))return!1;return!0}if(typeof J!==typeof Q)return!1;if(typeof J==="string")return J===Q;var G=J.tagClass===Q.tagClass&&J.type===Q.type&&J.constructed===Q.constructed&&J.composed===Q.composed&&i6.equals(J.value,Q.value);if(Y&&Y.includeBitStringContents)G=G&&J.bitStringContents===Q.bitStringContents;return G};i6.getBerValueLength=function(J){var Q=J.getByte();if(Q===128)return;var Y,X=Q&128;if(!X)Y=Q;else Y=J.getInt((Q&127)<<3);return Y};function qg(J,Q,Y){if(Y>Q){var X=Error("Too few bytes to parse DER.");throw X.available=J.length(),X.remaining=Q,X.requested=Y,X}}var EU8=function(J,Q){var Y=J.getByte();if(Q--,Y===128)return;var X,G=Y&128;if(!G)X=Y;else{var Z=Y&127;qg(J,Q,Z),X=J.getInt(Z<<3)}if(X<0)throw Error("Negative length: "+X);return X};i6.fromDer=function(J,Q){if(Q===void 0)Q={strict:!0,parseAllBytes:!0,decodeBitStrings:!0};if(typeof Q==="boolean")Q={strict:Q,parseAllBytes:!0,decodeBitStrings:!0};if(!("strict"in Q))Q.strict=!0;if(!("parseAllBytes"in Q))Q.parseAllBytes=!0;if(!("decodeBitStrings"in Q))Q.decodeBitStrings=!0;if(typeof J==="string")J=K2.util.createBuffer(J);var Y=J.length(),X=n81(J,J.length(),0,Q);if(Q.parseAllBytes&&J.length()!==0){var G=Error("Unparsed DER bytes remain after ASN.1 parsing.");throw G.byteCount=Y,G.remaining=J.length(),G}return X};function n81(J,Q,Y,X){var G;qg(J,Q,2);var Z=J.getByte();Q--;var q=Z&192,V=Z&31;G=J.length();var K=EU8(J,Q);if(Q-=G-J.length(),K!==void 0&&K>Q){if(X.strict){var W=Error("Too few bytes to read ASN.1 value.");throw W.available=J.length(),W.remaining=Q,W.requested=K,W}K=Q}var H,z,U=(Z&32)===32;if(U)if(H=[],K===void 0)for(;;){if(qg(J,Q,2),J.bytes(2)===String.fromCharCode(0,0)){J.getBytes(2),Q-=2;break}G=J.length(),H.push(n81(J,Q,Y+1,X)),Q-=G-J.length()}else while(K>0)G=J.length(),H.push(n81(J,K,Y+1,X)),Q-=G-J.length(),K-=G-J.length();if(H===void 0&&q===i6.Class.UNIVERSAL&&V===i6.Type.BITSTRING)z=J.bytes(K);if(H===void 0&&X.decodeBitStrings&&q===i6.Class.UNIVERSAL&&V===i6.Type.BITSTRING&&K>1){var N=J.read,O=Q,M=0;if(V===i6.Type.BITSTRING)qg(J,Q,1),M=J.getByte(),Q--;if(M===0)try{G=J.length();var L={strict:!0,decodeBitStrings:!0},w=n81(J,Q,Y+1,L),I=G-J.length();if(Q-=I,V==i6.Type.BITSTRING)I++;var P=w.tagClass;if(I===K&&(P===i6.Class.UNIVERSAL||P===i6.Class.CONTEXT_SPECIFIC))H=[w]}catch(j){}if(H===void 0)J.read=N,Q=O}if(H===void 0){if(K===void 0){if(X.strict)throw Error("Non-constructed ASN.1 object of indefinite length.");K=Q}if(V===i6.Type.BMPSTRING){H="";for(;K>0;K-=2)qg(J,Q,2),H+=String.fromCharCode(J.getInt16()),Q-=2}else H=J.getBytes(K),Q-=K}var R=z===void 0?null:{bitStringContents:z};return i6.create(q,V,U,H,R)}i6.toDer=function(J){var Q=K2.util.createBuffer(),Y=J.tagClass|J.type,X=K2.util.createBuffer(),G=!1;if("bitStringContents"in J){if(G=!0,J.original)G=i6.equals(J,J.original)}if(G)X.putBytes(J.bitStringContents);else if(J.composed){if(J.constructed)Y|=32;else X.putByte(0);for(var Z=0;Z<J.value.length;++Z)if(J.value[Z]!==void 0)X.putBuffer(i6.toDer(J.value[Z]))}else if(J.type===i6.Type.BMPSTRING)for(var Z=0;Z<J.value.length;++Z)X.putInt16(J.value.charCodeAt(Z));else if(J.type===i6.Type.INTEGER&&J.value.length>1&&(J.value.charCodeAt(0)===0&&(J.value.charCodeAt(1)&128)===0||J.value.charCodeAt(0)===255&&(J.value.charCodeAt(1)&128)===128))X.putBytes(J.value.substr(1));else X.putBytes(J.value);if(Q.putByte(Y),X.length()<=127)Q.putByte(X.length()&127);else{var q=X.length(),V="";do V+=String.fromCharCode(q&255),q=q>>>8;while(q>0);Q.putByte(V.length|128);for(var Z=V.length-1;Z>=0;--Z)Q.putByte(V.charCodeAt(Z))}return Q.putBuffer(X),Q};i6.oidToDer=function(J){var Q=J.split("."),Y=K2.util.createBuffer();Y.putByte(40*parseInt(Q[0],10)+parseInt(Q[1],10));var X,G,Z,q;for(var V=2;V<Q.length;++V){X=!0,G=[],Z=parseInt(Q[V],10);do{if(q=Z&127,Z=Z>>>7,!X)q|=128;G.push(q),X=!1}while(Z>0);for(var K=G.length-1;K>=0;--K)Y.putByte(G[K])}return Y};i6.derToOid=function(J){var Q;if(typeof J==="string")J=K2.util.createBuffer(J);var Y=J.getByte();Q=Math.floor(Y/40)+"."+Y%40;var X=0;while(J.length()>0)if(Y=J.getByte(),X=X<<7,Y&128)X+=Y&127;else Q+="."+(X+Y),X=0;return Q};i6.utcTimeToDate=function(J){var Q=new Date,Y=parseInt(J.substr(0,2),10);Y=Y>=50?1900+Y:2000+Y;var X=parseInt(J.substr(2,2),10)-1,G=parseInt(J.substr(4,2),10),Z=parseInt(J.substr(6,2),10),q=parseInt(J.substr(8,2),10),V=0;if(J.length>11){var K=J.charAt(10),W=10;if(K!=="+"&&K!=="-")V=parseInt(J.substr(10,2),10),W+=2}if(Q.setUTCFullYear(Y,X,G),Q.setUTCHours(Z,q,V,0),W){if(K=J.charAt(W),K==="+"||K==="-"){var H=parseInt(J.substr(W+1,2),10),z=parseInt(J.substr(W+4,2),10),U=H*60+z;if(U*=60000,K==="+")Q.setTime(+Q-U);else Q.setTime(+Q+U)}}return Q};i6.generalizedTimeToDate=function(J){var Q=new Date,Y=parseInt(J.substr(0,4),10),X=parseInt(J.substr(4,2),10)-1,G=parseInt(J.substr(6,2),10),Z=parseInt(J.substr(8,2),10),q=parseInt(J.substr(10,2),10),V=parseInt(J.substr(12,2),10),K=0,W=0,H=!1;if(J.charAt(J.length-1)==="Z")H=!0;var z=J.length-5,U=J.charAt(z);if(U==="+"||U==="-"){var N=parseInt(J.substr(z+1,2),10),O=parseInt(J.substr(z+4,2),10);if(W=N*60+O,W*=60000,U==="+")W*=-1;H=!0}if(J.charAt(14)===".")K=parseFloat(J.substr(14),10)*1000;if(H)Q.setUTCFullYear(Y,X,G),Q.setUTCHours(Z,q,V,K),Q.setTime(+Q+W);else Q.setFullYear(Y,X,G),Q.setHours(Z,q,V,K);return Q};i6.dateToUtcTime=function(J){if(typeof J==="string")return J;var Q="",Y=[];Y.push((""+J.getUTCFullYear()).substr(2)),Y.push(""+(J.getUTCMonth()+1)),Y.push(""+J.getUTCDate()),Y.push(""+J.getUTCHours()),Y.push(""+J.getUTCMinutes()),Y.push(""+J.getUTCSeconds());for(var X=0;X<Y.length;++X){if(Y[X].length<2)Q+="0";Q+=Y[X]}return Q+="Z",Q};i6.dateToGeneralizedTime=function(J){if(typeof J==="string")return J;var Q="",Y=[];Y.push(""+J.getUTCFullYear()),Y.push(""+(J.getUTCMonth()+1)),Y.push(""+J.getUTCDate()),Y.push(""+J.getUTCHours()),Y.push(""+J.getUTCMinutes()),Y.push(""+J.getUTCSeconds());for(var X=0;X<Y.length;++X){if(Y[X].length<2)Q+="0";Q+=Y[X]}return Q+="Z",Q};i6.integerToDer=function(J){var Q=K2.util.createBuffer();if(J>=-128&&J<128)return Q.putSignedInt(J,8);if(J>=-32768&&J<32768)return Q.putSignedInt(J,16);if(J>=-8388608&&J<8388608)return Q.putSignedInt(J,24);if(J>=-2147483648&&J<2147483648)return Q.putSignedInt(J,32);var Y=Error("Integer too large; max is 32-bits.");throw Y.integer=J,Y};i6.derToInteger=function(J){if(typeof J==="string")J=K2.util.createBuffer(J);var Q=J.length()*8;if(Q>32)throw Error("Integer too large; max is 32-bits.");return J.getSignedInt(Q)};i6.validate=function(J,Q,Y,X){var G=!1;if((J.tagClass===Q.tagClass||typeof Q.tagClass>"u")&&(J.type===Q.type||typeof Q.type>"u")){if(J.constructed===Q.constructed||typeof Q.constructed>"u"){if(G=!0,Q.value&&K2.util.isArray(Q.value)){var Z=0;for(var q=0;G&&q<Q.value.length;++q){if(G=Q.value[q].optional||!1,J.value[Z]){if(G=i6.validate(J.value[Z],Q.value[q],Y,X),G)++Z;else if(Q.value[q].optional)G=!0}if(!G&&X)X.push("["+Q.name+'] Tag class "'+Q.tagClass+'", type "'+Q.type+'" expected value length "'+Q.value.length+'", got "'+J.value.length+'"')}}if(G&&Y){if(Q.capture)Y[Q.capture]=J.value;if(Q.captureAsn1)Y[Q.captureAsn1]=J;if(Q.captureBitStringContents&&"bitStringContents"in J)Y[Q.captureBitStringContents]=J.bitStringContents;if(Q.captureBitStringValue&&"bitStringContents"in J){var V;if(J.bitStringContents.length<2)Y[Q.captureBitStringValue]="";else{var K=J.bitStringContents.charCodeAt(0);if(K!==0)throw Error("captureBitStringValue only supported for zero unused bits");Y[Q.captureBitStringValue]=J.bitStringContents.slice(1)}}}}else if(X)X.push("["+Q.name+'] Expected constructed "'+Q.constructed+'", got "'+J.constructed+'"')}else if(X){if(J.tagClass!==Q.tagClass)X.push("["+Q.name+'] Expected tag class "'+Q.tagClass+'", got "'+J.tagClass+'"');if(J.type!==Q.type)X.push("["+Q.name+'] Expected type "'+Q.type+'", got "'+J.type+'"')}return G};var fY6=/[^\\u0000-\\u00ff]/;i6.prettyPrint=function(J,Q,Y){var X="";if(Q=Q||0,Y=Y||2,Q>0)X+=`
|
|
4039
4039
|
`;var G="";for(var Z=0;Z<Q*Y;++Z)G+=" ";switch(X+=G+"Tag: ",J.tagClass){case i6.Class.UNIVERSAL:X+="Universal:";break;case i6.Class.APPLICATION:X+="Application:";break;case i6.Class.CONTEXT_SPECIFIC:X+="Context-Specific:";break;case i6.Class.PRIVATE:X+="Private:";break}if(J.tagClass===i6.Class.UNIVERSAL)switch(X+=J.type,J.type){case i6.Type.NONE:X+=" (None)";break;case i6.Type.BOOLEAN:X+=" (Boolean)";break;case i6.Type.INTEGER:X+=" (Integer)";break;case i6.Type.BITSTRING:X+=" (Bit string)";break;case i6.Type.OCTETSTRING:X+=" (Octet string)";break;case i6.Type.NULL:X+=" (Null)";break;case i6.Type.OID:X+=" (Object Identifier)";break;case i6.Type.ODESC:X+=" (Object Descriptor)";break;case i6.Type.EXTERNAL:X+=" (External or Instance of)";break;case i6.Type.REAL:X+=" (Real)";break;case i6.Type.ENUMERATED:X+=" (Enumerated)";break;case i6.Type.EMBEDDED:X+=" (Embedded PDV)";break;case i6.Type.UTF8:X+=" (UTF8)";break;case i6.Type.ROID:X+=" (Relative Object Identifier)";break;case i6.Type.SEQUENCE:X+=" (Sequence)";break;case i6.Type.SET:X+=" (Set)";break;case i6.Type.PRINTABLESTRING:X+=" (Printable String)";break;case i6.Type.IA5String:X+=" (IA5String (ASCII))";break;case i6.Type.UTCTIME:X+=" (UTC time)";break;case i6.Type.GENERALIZEDTIME:X+=" (Generalized time)";break;case i6.Type.BMPSTRING:X+=" (BMP String)";break}else X+=J.type;if(X+=`
|
|
4040
4040
|
`,X+=G+"Constructed: "+J.constructed+`
|
|
4041
|
-
`,J.composed){var q=0,V="";for(var Z=0;Z<J.value.length;++Z)if(J.value[Z]!==void 0){if(q+=1,V+=i6.prettyPrint(J.value[Z],Q+1,Y),Z+1<J.value.length)V+=","}X+=G+"Sub values: "+q+V}else{if(X+=G+"Value: ",J.type===i6.Type.OID){var K=i6.derToOid(J.value);if(X+=K,K2.pki&&K2.pki.oids){if(K in K2.pki.oids)X+=" ("+K2.pki.oids[K]+") "}}if(J.type===i6.Type.INTEGER)try{X+=i6.derToInteger(J.value)}catch(H){X+="0x"+K2.util.bytesToHex(J.value)}else if(J.type===i6.Type.BITSTRING){if(J.value.length>1)X+="0x"+K2.util.bytesToHex(J.value.slice(1));else X+="(none)";if(J.value.length>0){var W=J.value.charCodeAt(0);if(W==1)X+=" (1 unused bit shown)";else if(W>1)X+=" ("+W+" unused bits shown)"}}else if(J.type===i6.Type.OCTETSTRING){if(!fY6.test(J.value))X+="("+J.value+") ";X+="0x"+K2.util.bytesToHex(J.value)}else if(J.type===i6.Type.UTF8)try{X+=K2.util.decodeUtf8(J.value)}catch(H){if(H.message==="URI malformed")X+="0x"+K2.util.bytesToHex(J.value)+" (malformed UTF8)";else throw H}else if(J.type===i6.Type.PRINTABLESTRING||J.type===i6.Type.IA5String)X+=J.value;else if(fY6.test(J.value))X+="0x"+K2.util.bytesToHex(J.value);else if(J.value.length===0)X+="[null]";else X+=J.value}return X}});var yK=h((
|
|
4041
|
+
`,J.composed){var q=0,V="";for(var Z=0;Z<J.value.length;++Z)if(J.value[Z]!==void 0){if(q+=1,V+=i6.prettyPrint(J.value[Z],Q+1,Y),Z+1<J.value.length)V+=","}X+=G+"Sub values: "+q+V}else{if(X+=G+"Value: ",J.type===i6.Type.OID){var K=i6.derToOid(J.value);if(X+=K,K2.pki&&K2.pki.oids){if(K in K2.pki.oids)X+=" ("+K2.pki.oids[K]+") "}}if(J.type===i6.Type.INTEGER)try{X+=i6.derToInteger(J.value)}catch(H){X+="0x"+K2.util.bytesToHex(J.value)}else if(J.type===i6.Type.BITSTRING){if(J.value.length>1)X+="0x"+K2.util.bytesToHex(J.value.slice(1));else X+="(none)";if(J.value.length>0){var W=J.value.charCodeAt(0);if(W==1)X+=" (1 unused bit shown)";else if(W>1)X+=" ("+W+" unused bits shown)"}}else if(J.type===i6.Type.OCTETSTRING){if(!fY6.test(J.value))X+="("+J.value+") ";X+="0x"+K2.util.bytesToHex(J.value)}else if(J.type===i6.Type.UTF8)try{X+=K2.util.decodeUtf8(J.value)}catch(H){if(H.message==="URI malformed")X+="0x"+K2.util.bytesToHex(J.value)+" (malformed UTF8)";else throw H}else if(J.type===i6.Type.PRINTABLESTRING||J.type===i6.Type.IA5String)X+=J.value;else if(fY6.test(J.value))X+="0x"+K2.util.bytesToHex(J.value);else if(J.value.length===0)X+="[null]";else X+=J.value}return X}});var yK=h((KZ5,bY6)=>{var a81=m8();bY6.exports=a81.md=a81.md||{};a81.md.algorithms=a81.md.algorithms||{}});var FC=h((WZ5,uY6)=>{var zz=m8();yK();i9();var wU8=uY6.exports=zz.hmac=zz.hmac||{};wU8.create=function(){var J=null,Q=null,Y=null,X=null,G={};return G.start=function(Z,q){if(Z!==null)if(typeof Z==="string")if(Z=Z.toLowerCase(),Z in zz.md.algorithms)Q=zz.md.algorithms[Z].create();else throw Error('Unknown hash algorithm "'+Z+'"');else Q=Z;if(q===null)q=J;else{if(typeof q==="string")q=zz.util.createBuffer(q);else if(zz.util.isArray(q)){var V=q;q=zz.util.createBuffer();for(var K=0;K<V.length;++K)q.putByte(V[K])}var W=q.length();if(W>Q.blockLength)Q.start(),Q.update(q.bytes()),q=Q.digest();Y=zz.util.createBuffer(),X=zz.util.createBuffer(),W=q.length();for(var K=0;K<W;++K){var V=q.at(K);Y.putByte(54^V),X.putByte(92^V)}if(W<Q.blockLength){var V=Q.blockLength-W;for(var K=0;K<V;++K)Y.putByte(54),X.putByte(92)}J=q,Y=Y.bytes(),X=X.bytes()}Q.start(),Q.update(Y)},G.update=function(Z){Q.update(Z)},G.getMac=function(){var Z=Q.digest().bytes();return Q.start(),Q.update(X),Q.update(Z),Q.digest()},G.digest=G.getMac,G}});var o81=h((HZ5,dY6)=>{var vK=m8();yK();i9();var mY6=dY6.exports=vK.md5=vK.md5||{};vK.md.md5=vK.md.algorithms.md5=mY6;mY6.create=function(){if(!pY6)IU8();var J=null,Q=vK.util.createBuffer(),Y=Array(16),X={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return X.start=function(){X.messageLength=0,X.fullMessageLength=X.messageLength64=[];var G=X.messageLengthSize/4;for(var Z=0;Z<G;++Z)X.fullMessageLength.push(0);return Q=vK.util.createBuffer(),J={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},X},X.start(),X.update=function(G,Z){if(Z==="utf8")G=vK.util.encodeUtf8(G);var q=G.length;X.messageLength+=q,q=[q/4294967296>>>0,q>>>0];for(var V=X.fullMessageLength.length-1;V>=0;--V)X.fullMessageLength[V]+=q[1],q[1]=q[0]+(X.fullMessageLength[V]/4294967296>>>0),X.fullMessageLength[V]=X.fullMessageLength[V]>>>0,q[0]=q[1]/4294967296>>>0;if(Q.putBytes(G),gY6(J,Y,Q),Q.read>2048||Q.length()===0)Q.compact();return X},X.digest=function(){var G=vK.util.createBuffer();G.putBytes(Q.bytes());var Z=X.fullMessageLength[X.fullMessageLength.length-1]+X.messageLengthSize,q=Z&X.blockLength-1;G.putBytes(n_1.substr(0,X.blockLength-q));var V,K=0;for(var W=X.fullMessageLength.length-1;W>=0;--W)V=X.fullMessageLength[W]*8+K,K=V/4294967296>>>0,G.putInt32Le(V>>>0);var H={h0:J.h0,h1:J.h1,h2:J.h2,h3:J.h3};gY6(H,Y,G);var z=vK.util.createBuffer();return z.putInt32Le(H.h0),z.putInt32Le(H.h1),z.putInt32Le(H.h2),z.putInt32Le(H.h3),z},X};var n_1=null,r81=null,Vg=null,UC=null,pY6=!1;function IU8(){n_1=String.fromCharCode(128),n_1+=vK.util.fillString(String.fromCharCode(0),64),r81=[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],Vg=[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],UC=Array(64);for(var J=0;J<64;++J)UC[J]=Math.floor(Math.abs(Math.sin(J+1))*4294967296);pY6=!0}function gY6(J,Q,Y){var X,G,Z,q,V,K,W,H,z=Y.length();while(z>=64){G=J.h0,Z=J.h1,q=J.h2,V=J.h3;for(H=0;H<16;++H)Q[H]=Y.getInt32Le(),K=V^Z&(q^V),X=G+K+UC[H]+Q[H],W=Vg[H],G=V,V=q,q=Z,Z+=X<<W|X>>>32-W;for(;H<32;++H)K=q^V&(Z^q),X=G+K+UC[H]+Q[r81[H]],W=Vg[H],G=V,V=q,q=Z,Z+=X<<W|X>>>32-W;for(;H<48;++H)K=Z^q^V,X=G+K+UC[H]+Q[r81[H]],W=Vg[H],G=V,V=q,q=Z,Z+=X<<W|X>>>32-W;for(;H<64;++H)K=q^(Z|~V),X=G+K+UC[H]+Q[r81[H]],W=Vg[H],G=V,V=q,q=Z,Z+=X<<W|X>>>32-W;J.h0=J.h0+G|0,J.h1=J.h1+Z|0,J.h2=J.h2+q|0,J.h3=J.h3+V|0,z-=64}}});var VA=h((zZ5,lY6)=>{var t81=m8();i9();var cY6=lY6.exports=t81.pem=t81.pem||{};cY6.encode=function(J,Q){Q=Q||{};var Y="-----BEGIN "+J.type+`-----\r
|
|
4042
4042
|
`,X;if(J.procType)X={name:"Proc-Type",values:[String(J.procType.version),J.procType.type]},Y+=s81(X);if(J.contentDomain)X={name:"Content-Domain",values:[J.contentDomain]},Y+=s81(X);if(J.dekInfo){if(X={name:"DEK-Info",values:[J.dekInfo.algorithm]},J.dekInfo.parameters)X.values.push(J.dekInfo.parameters);Y+=s81(X)}if(J.headers)for(var G=0;G<J.headers.length;++G)Y+=s81(J.headers[G]);if(J.procType)Y+=`\r
|
|
4043
4043
|
`;return Y+=t81.util.encode64(J.body,Q.maxline||64)+`\r
|
|
4044
4044
|
`,Y+="-----END "+J.type+`-----\r
|
|
4045
4045
|
`,Y};cY6.decode=function(J){var Q=[],Y=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,X=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,G=/\r?\n/,Z;while(!0){if(Z=Y.exec(J),!Z)break;var q=Z[1];if(q==="NEW CERTIFICATE REQUEST")q="CERTIFICATE REQUEST";var V={type:q,procType:null,contentDomain:null,dekInfo:null,headers:[],body:t81.util.decode64(Z[3])};if(Q.push(V),!Z[2])continue;var K=Z[2].split(G),W=0;while(Z&&W<K.length){var H=K[W].replace(/\s+$/,"");for(var z=W+1;z<K.length;++z){var U=K[z];if(!/\s/.test(U[0]))break;H+=U,W=z}if(Z=H.match(X),Z){var N={name:Z[1],values:[]},O=Z[2].split(",");for(var M=0;M<O.length;++M)N.values.push(PU8(O[M]));if(!V.procType){if(N.name!=="Proc-Type")throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');else if(N.values.length!==2)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');V.procType={version:O[0],type:O[1]}}else if(!V.contentDomain&&N.name==="Content-Domain")V.contentDomain=O[0]||"";else if(!V.dekInfo&&N.name==="DEK-Info"){if(N.values.length===0)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');V.dekInfo={algorithm:O[0],parameters:O[1]||null}}else V.headers.push(N)}++W}if(V.procType==="ENCRYPTED"&&!V.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}if(Q.length===0)throw Error("Invalid PEM formatted message.");return Q};function s81(J){var Q=J.name+": ",Y=[],X=function(K,W){return" "+W};for(var G=0;G<J.values.length;++G)Y.push(J.values[G].replace(/^(\S+\r\n)/,X));Q+=Y.join(",")+`\r
|
|
4046
4046
|
`;var Z=0,q=-1;for(var G=0;G<Q.length;++G,++Z)if(Z>65&&q!==-1){var V=Q[q];if(V===",")++q,Q=Q.substr(0,q)+`\r
|
|
4047
4047
|
`+Q.substr(q);else Q=Q.substr(0,q)+`\r
|
|
4048
|
-
`+V+Q.substr(q+1);Z=G-q-1,q=-1,++G}else if(Q[G]===" "||Q[G]==="\t"||Q[G]===",")q=G;return Q}function PU8(J){return J.replace(/^\s+/,"")}});var Kg=h((zZ5,nY6)=>{var E2=m8();d81();p_1();i9();nY6.exports=E2.des=E2.des||{};E2.des.startEncrypting=function(J,Q,Y,X){var G=e81({key:J,output:Y,decrypt:!1,mode:X||(Q===null?"ECB":"CBC")});return G.start(Q),G};E2.des.createEncryptionCipher=function(J,Q){return e81({key:J,output:null,decrypt:!1,mode:Q})};E2.des.startDecrypting=function(J,Q,Y,X){var G=e81({key:J,output:Y,decrypt:!0,mode:X||(Q===null?"ECB":"CBC")});return G.start(Q),G};E2.des.createDecryptionCipher=function(J,Q){return e81({key:J,output:null,decrypt:!0,mode:Q})};E2.des.Algorithm=function(J,Q){var Y=this;Y.name=J,Y.mode=new Q({blockSize:8,cipher:{encrypt:function(X,G){return iY6(Y._keys,X,G,!1)},decrypt:function(X,G){return iY6(Y._keys,X,G,!0)}}}),Y._init=!1};E2.des.Algorithm.prototype.initialize=function(J){if(this._init)return;var Q=E2.util.createBuffer(J.key);if(this.name.indexOf("3DES")===0){if(Q.length()!==24)throw Error("Invalid Triple-DES key size: "+Q.length()*8)}this._keys=vU8(Q),this._init=!0};xK("DES-ECB",E2.cipher.modes.ecb);xK("DES-CBC",E2.cipher.modes.cbc);xK("DES-CFB",E2.cipher.modes.cfb);xK("DES-OFB",E2.cipher.modes.ofb);xK("DES-CTR",E2.cipher.modes.ctr);xK("3DES-ECB",E2.cipher.modes.ecb);xK("3DES-CBC",E2.cipher.modes.cbc);xK("3DES-CFB",E2.cipher.modes.cfb);xK("3DES-OFB",E2.cipher.modes.ofb);xK("3DES-CTR",E2.cipher.modes.ctr);function xK(J,Q){var Y=function(){return new E2.des.Algorithm(J,Q)};E2.cipher.registerAlgorithm(J,Y)}var TU8=[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],RU8=[-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],CU8=[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],SU8=[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],jU8=[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],_U8=[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],kU8=[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],yU8=[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 vU8(J){var Q=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],Y=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],X=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],G=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],Z=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],q=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],V=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],K=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],W=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],H=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],z=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],U=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],N=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],O=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],M=J.length()>8?3:1,L=[],w=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],I=0,P;for(var R=0;R<M;R++){var j=J.getInt32(),y=J.getInt32();P=(j>>>4^y)&252645135,y^=P,j^=P<<4,P=(y>>>-16^j)&65535,j^=P,y^=P<<-16,P=(j>>>2^y)&858993459,y^=P,j^=P<<2,P=(y>>>-16^j)&65535,j^=P,y^=P<<-16,P=(j>>>1^y)&1431655765,y^=P,j^=P<<1,P=(y>>>8^j)&16711935,j^=P,y^=P<<8,P=(j>>>1^y)&1431655765,y^=P,j^=P<<1,P=j<<8|y>>>20&240,j=y<<24|y<<8&16711680|y>>>8&65280|y>>>24&240,y=P;for(var f=0;f<w.length;++f){if(w[f])j=j<<2|j>>>26,y=y<<2|y>>>26;else j=j<<1|j>>>27,y=y<<1|y>>>27;j&=-15,y&=-15;var g=Q[j>>>28]|Y[j>>>24&15]|X[j>>>20&15]|G[j>>>16&15]|Z[j>>>12&15]|q[j>>>8&15]|V[j>>>4&15],p=K[y>>>28]|W[y>>>24&15]|H[y>>>20&15]|z[y>>>16&15]|U[y>>>12&15]|N[y>>>8&15]|O[y>>>4&15];P=(p>>>16^g)&65535,L[I++]=g^P,L[I++]=p^P<<16}}return L}function iY6(J,Q,Y,X){var G=J.length===32?3:9,Z;if(G===3)Z=X?[30,-2,-2]:[0,32,2];else Z=X?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var q,V=Q[0],K=Q[1];q=(V>>>4^K)&252645135,K^=q,V^=q<<4,q=(V>>>16^K)&65535,K^=q,V^=q<<16,q=(K>>>2^V)&858993459,V^=q,K^=q<<2,q=(K>>>8^V)&16711935,V^=q,K^=q<<8,q=(V>>>1^K)&1431655765,K^=q,V^=q<<1,V=V<<1|V>>>31,K=K<<1|K>>>31;for(var W=0;W<G;W+=3){var H=Z[W+1],z=Z[W+2];for(var U=Z[W];U!=H;U+=z){var N=K^J[U],O=(K>>>4|K<<28)^J[U+1];q=V,V=K,K=q^(RU8[N>>>24&63]|SU8[N>>>16&63]|_U8[N>>>8&63]|yU8[N&63]|TU8[O>>>24&63]|CU8[O>>>16&63]|jU8[O>>>8&63]|kU8[O&63])}q=V,V=K,K=q}V=V>>>1|V<<31,K=K>>>1|K<<31,q=(V>>>1^K)&1431655765,K^=q,V^=q<<1,q=(K>>>8^V)&16711935,V^=q,K^=q<<8,q=(K>>>2^V)&858993459,V^=q,K^=q<<2,q=(V>>>16^K)&65535,K^=q,V^=q<<16,q=(V>>>4^K)&252645135,K^=q,V^=q<<4,Y[0]=V,Y[1]=K}function e81(J){J=J||{};var Q=(J.mode||"CBC").toUpperCase(),Y="DES-"+Q,X;if(J.decrypt)X=E2.cipher.createDecipher(Y,J.key);else X=E2.cipher.createCipher(Y,J.key);var G=X.start;return X.start=function(Z,q){var V=null;if(q instanceof E2.util.ByteBuffer)V=q,q={};q=q||{},q.output=V,q.iv=Z,G.call(X,q)},X}});var J91=h((FZ5,aY6)=>{var gQ=m8();FC();yK();i9();var xU8=gQ.pkcs5=gQ.pkcs5||{},Fz;if(gQ.util.isNodejs&&!gQ.options.usePureJavaScript)Fz=S1("crypto");aY6.exports=gQ.pbkdf2=xU8.pbkdf2=function(J,Q,Y,X,G,Z){if(typeof G==="function")Z=G,G=null;if(gQ.util.isNodejs&&!gQ.options.usePureJavaScript&&Fz.pbkdf2&&(G===null||typeof G!=="object")&&(Fz.pbkdf2Sync.length>4||(!G||G==="sha1"))){if(typeof G!=="string")G="sha1";if(J=Buffer.from(J,"binary"),Q=Buffer.from(Q,"binary"),!Z){if(Fz.pbkdf2Sync.length===4)return Fz.pbkdf2Sync(J,Q,Y,X).toString("binary");return Fz.pbkdf2Sync(J,Q,Y,X,G).toString("binary")}if(Fz.pbkdf2Sync.length===4)return Fz.pbkdf2(J,Q,Y,X,function(P,R){if(P)return Z(P);Z(null,R.toString("binary"))});return Fz.pbkdf2(J,Q,Y,X,G,function(P,R){if(P)return Z(P);Z(null,R.toString("binary"))})}if(typeof G>"u"||G===null)G="sha1";if(typeof G==="string"){if(!(G in gQ.md.algorithms))throw Error("Unknown hash algorithm: "+G);G=gQ.md[G].create()}var q=G.digestLength;if(X>4294967295*q){var V=Error("Derived key is too long.");if(Z)return Z(V);throw V}var K=Math.ceil(X/q),W=X-(K-1)*q,H=gQ.hmac.create();H.start(G,J);var z="",U,N,O;if(!Z){for(var M=1;M<=K;++M){H.start(null,null),H.update(Q),H.update(gQ.util.int32ToBytes(M)),U=O=H.digest().getBytes();for(var L=2;L<=Y;++L)H.start(null,null),H.update(O),N=H.digest().getBytes(),U=gQ.util.xorBytes(U,N,q),O=N;z+=M<K?U:U.substr(0,W)}return z}var M=1,L;function w(){if(M>K)return Z(null,z);H.start(null,null),H.update(Q),H.update(gQ.util.int32ToBytes(M)),U=O=H.digest().getBytes(),L=2,I()}function I(){if(L<=Y)return H.start(null,null),H.update(O),N=H.digest().getBytes(),U=gQ.util.xorBytes(U,N,q),O=N,++L,gQ.util.setImmediate(I);z+=M<K?U:U.substr(0,W),++M,w()}w()}});var r_1=h((UZ5,eY6)=>{var fK=m8();yK();i9();var oY6=eY6.exports=fK.sha256=fK.sha256||{};fK.md.sha256=fK.md.algorithms.sha256=oY6;oY6.create=function(){if(!sY6)fU8();var J=null,Q=fK.util.createBuffer(),Y=Array(64),X={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return X.start=function(){X.messageLength=0,X.fullMessageLength=X.messageLength64=[];var G=X.messageLengthSize/4;for(var Z=0;Z<G;++Z)X.fullMessageLength.push(0);return Q=fK.util.createBuffer(),J={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},X},X.start(),X.update=function(G,Z){if(Z==="utf8")G=fK.util.encodeUtf8(G);var q=G.length;X.messageLength+=q,q=[q/4294967296>>>0,q>>>0];for(var V=X.fullMessageLength.length-1;V>=0;--V)X.fullMessageLength[V]+=q[1],q[1]=q[0]+(X.fullMessageLength[V]/4294967296>>>0),X.fullMessageLength[V]=X.fullMessageLength[V]>>>0,q[0]=q[1]/4294967296>>>0;if(Q.putBytes(G),rY6(J,Y,Q),Q.read>2048||Q.length()===0)Q.compact();return X},X.digest=function(){var G=fK.util.createBuffer();G.putBytes(Q.bytes());var Z=X.fullMessageLength[X.fullMessageLength.length-1]+X.messageLengthSize,q=Z&X.blockLength-1;G.putBytes(a_1.substr(0,X.blockLength-q));var V,K,W=X.fullMessageLength[0]*8;for(var H=0;H<X.fullMessageLength.length-1;++H)V=X.fullMessageLength[H+1]*8,K=V/4294967296>>>0,W+=K,G.putInt32(W>>>0),W=V>>>0;G.putInt32(W);var z={h0:J.h0,h1:J.h1,h2:J.h2,h3:J.h3,h4:J.h4,h5:J.h5,h6:J.h6,h7:J.h7};rY6(z,Y,G);var U=fK.util.createBuffer();return U.putInt32(z.h0),U.putInt32(z.h1),U.putInt32(z.h2),U.putInt32(z.h3),U.putInt32(z.h4),U.putInt32(z.h5),U.putInt32(z.h6),U.putInt32(z.h7),U},X};var a_1=null,sY6=!1,tY6=null;function fU8(){a_1=String.fromCharCode(128),a_1+=fK.util.fillString(String.fromCharCode(0),64),tY6=[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],sY6=!0}function rY6(J,Q,Y){var X,G,Z,q,V,K,W,H,z,U,N,O,M,L,w,I=Y.length();while(I>=64){for(W=0;W<16;++W)Q[W]=Y.getInt32();for(;W<64;++W)X=Q[W-2],X=(X>>>17|X<<15)^(X>>>19|X<<13)^X>>>10,G=Q[W-15],G=(G>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,Q[W]=X+Q[W-7]+G+Q[W-16]|0;H=J.h0,z=J.h1,U=J.h2,N=J.h3,O=J.h4,M=J.h5,L=J.h6,w=J.h7;for(W=0;W<64;++W)q=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),V=L^O&(M^L),Z=(H>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),K=H&z|U&(H^z),X=w+q+V+tY6[W]+Q[W],G=Z+K,w=L,L=M,M=O,O=N+X>>>0,N=U,U=z,z=H,H=X+G>>>0;J.h0=J.h0+H|0,J.h1=J.h1+z|0,J.h2=J.h2+U|0,J.h3=J.h3+N|0,J.h4=J.h4+O|0,J.h5=J.h5+M|0,J.h6=J.h6+L|0,J.h7=J.h7+w|0,I-=64}}});var o_1=h((BZ5,J$6)=>{var hK=m8();i9();var Q91=null;if(hK.util.isNodejs&&!hK.options.usePureJavaScript&&!process.versions["node-webkit"])Q91=S1("crypto");var hU8=J$6.exports=hK.prng=hK.prng||{};hU8.create=function(J){var Q={plugin:J,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},Y=J.md,X=Array(32);for(var G=0;G<32;++G)X[G]=Y.create();Q.pools=X,Q.pool=0,Q.generate=function(W,H){if(!H)return Q.generateSync(W);var z=Q.plugin.cipher,U=Q.plugin.increment,N=Q.plugin.formatKey,O=Q.plugin.formatSeed,M=hK.util.createBuffer();Q.key=null,L();function L(w){if(w)return H(w);if(M.length()>=W)return H(null,M.getBytes(W));if(Q.generated>1048575)Q.key=null;if(Q.key===null)return hK.util.nextTick(function(){Z(L)});var I=z(Q.key,Q.seed);Q.generated+=I.length,M.putBytes(I),Q.key=N(z(Q.key,U(Q.seed))),Q.seed=O(z(Q.key,Q.seed)),hK.util.setImmediate(L)}},Q.generateSync=function(W){var H=Q.plugin.cipher,z=Q.plugin.increment,U=Q.plugin.formatKey,N=Q.plugin.formatSeed;Q.key=null;var O=hK.util.createBuffer();while(O.length()<W){if(Q.generated>1048575)Q.key=null;if(Q.key===null)q();var M=H(Q.key,Q.seed);Q.generated+=M.length,O.putBytes(M),Q.key=U(H(Q.key,z(Q.seed))),Q.seed=N(H(Q.key,Q.seed))}return O.getBytes(W)};function Z(W){if(Q.pools[0].messageLength>=32)return V(),W();var H=32-Q.pools[0].messageLength<<5;Q.seedFile(H,function(z,U){if(z)return W(z);Q.collect(U),V(),W()})}function q(){if(Q.pools[0].messageLength>=32)return V();var W=32-Q.pools[0].messageLength<<5;Q.collect(Q.seedFileSync(W)),V()}function V(){Q.reseeds=Q.reseeds===4294967295?0:Q.reseeds+1;var W=Q.plugin.md.create();W.update(Q.keyBytes);var H=1;for(var z=0;z<32;++z){if(Q.reseeds%H===0)W.update(Q.pools[z].digest().getBytes()),Q.pools[z].start();H=H<<1}Q.keyBytes=W.digest().getBytes(),W.start(),W.update(Q.keyBytes);var U=W.digest().getBytes();Q.key=Q.plugin.formatKey(Q.keyBytes),Q.seed=Q.plugin.formatSeed(U),Q.generated=0}function K(W){var H=null,z=hK.util.globalScope,U=z.crypto||z.msCrypto;if(U&&U.getRandomValues)H=function(j){return U.getRandomValues(j)};var N=hK.util.createBuffer();if(H)while(N.length()<W){var O=Math.max(1,Math.min(W-N.length(),65536)/4),M=new Uint32Array(Math.floor(O));try{H(M);for(var L=0;L<M.length;++L)N.putInt32(M[L])}catch(j){if(!(typeof QuotaExceededError<"u"&&j instanceof QuotaExceededError))throw j}}if(N.length()<W){var w,I,P,R=Math.floor(Math.random()*65536);while(N.length()<W){I=16807*(R&65535),w=16807*(R>>16),I+=(w&32767)<<16,I+=w>>15,I=(I&2147483647)+(I>>31),R=I&4294967295;for(var L=0;L<3;++L)P=R>>>(L<<3),P^=Math.floor(Math.random()*256),N.putByte(P&255)}}return N.getBytes(W)}if(Q91)Q.seedFile=function(W,H){Q91.randomBytes(W,function(z,U){if(z)return H(z);H(null,U.toString())})},Q.seedFileSync=function(W){return Q91.randomBytes(W).toString()};else Q.seedFile=function(W,H){try{H(null,K(W))}catch(z){H(z)}},Q.seedFileSync=K;return Q.collect=function(W){var H=W.length;for(var z=0;z<H;++z)Q.pools[Q.pool].update(W.substr(z,1)),Q.pool=Q.pool===31?0:Q.pool+1},Q.collectInt=function(W,H){var z="";for(var U=0;U<H;U+=8)z+=String.fromCharCode(W>>U&255);Q.collect(z)},Q.registerWorker=function(W){if(W===self)Q.seedFile=function(z,U){function N(O){var M=O.data;if(M.forge&&M.forge.prng)self.removeEventListener("message",N),U(M.forge.prng.err,M.forge.prng.bytes)}self.addEventListener("message",N),self.postMessage({forge:{prng:{needed:z}}})};else{var H=function(z){var U=z.data;if(U.forge&&U.forge.prng)Q.seedFile(U.forge.prng.needed,function(N,O){W.postMessage({forge:{prng:{err:N,bytes:O}}})})};W.addEventListener("message",H)}},Q}});var SG=h((NZ5,s_1)=>{var m3=m8();eB();r_1();o_1();i9();(function(){if(m3.random&&m3.random.getBytes){s_1.exports=m3.random;return}(function(J){var Q={},Y=[,,,,],X=m3.util.createBuffer();Q.formatKey=function(z){var U=m3.util.createBuffer(z);return z=[,,,,],z[0]=U.getInt32(),z[1]=U.getInt32(),z[2]=U.getInt32(),z[3]=U.getInt32(),m3.aes._expandKey(z,!1)},Q.formatSeed=function(z){var U=m3.util.createBuffer(z);return z=[,,,,],z[0]=U.getInt32(),z[1]=U.getInt32(),z[2]=U.getInt32(),z[3]=U.getInt32(),z},Q.cipher=function(z,U){return m3.aes._updateBlock(z,U,Y,!1),X.putInt32(Y[0]),X.putInt32(Y[1]),X.putInt32(Y[2]),X.putInt32(Y[3]),X.getBytes()},Q.increment=function(z){return++z[3],z},Q.md=m3.md.sha256;function G(){var z=m3.prng.create(Q);return z.getBytes=function(U,N){return z.generate(U,N)},z.getBytesSync=function(U){return z.generate(U)},z}var Z=G(),q=null,V=m3.util.globalScope,K=V.crypto||V.msCrypto;if(K&&K.getRandomValues)q=function(z){return K.getRandomValues(z)};if(m3.options.usePureJavaScript||!m3.util.isNodejs&&!q){if(typeof window>"u"||window.document===void 0);if(Z.collectInt(+new Date,32),typeof navigator<"u"){var W="";for(var H in navigator)try{if(typeof navigator[H]=="string")W+=navigator[H]}catch(z){}Z.collect(W),W=null}if(J)J().mousemove(function(z){Z.collectInt(z.clientX,16),Z.collectInt(z.clientY,16)}),J().keypress(function(z){Z.collectInt(z.charCode,8)})}if(!m3.random)m3.random=Z;else for(var H in Z)m3.random[H]=Z[H];m3.random.createInstance=G,s_1.exports=m3.random})(typeof jQuery<"u"?jQuery:null)})()});var e_1=h((DZ5,$$6)=>{var hY=m8();i9();var t_1=[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],Q$6=[1,2,3,5],bU8=function(J,Q){return J<<Q&65535|(J&65535)>>16-Q},uU8=function(J,Q){return(J&65535)>>Q|J<<16-Q&65535};$$6.exports=hY.rc2=hY.rc2||{};hY.rc2.expandKey=function(J,Q){if(typeof J==="string")J=hY.util.createBuffer(J);Q=Q||128;var Y=J,X=J.length(),G=Q,Z=Math.ceil(G/8),q=255>>(G&7),V;for(V=X;V<128;V++)Y.putByte(t_1[Y.at(V-1)+Y.at(V-X)&255]);Y.setAt(128-Z,t_1[Y.at(128-Z)&q]);for(V=127-Z;V>=0;V--)Y.setAt(V,t_1[Y.at(V+1)^Y.at(V+Z)]);return Y};var Y$6=function(J,Q,Y){var X=!1,G=null,Z=null,q=null,V,K,W,H,z=[];J=hY.rc2.expandKey(J,Q);for(W=0;W<64;W++)z.push(J.getInt16Le());if(Y)V=function(O){for(W=0;W<4;W++)O[W]+=z[H]+(O[(W+3)%4]&O[(W+2)%4])+(~O[(W+3)%4]&O[(W+1)%4]),O[W]=bU8(O[W],Q$6[W]),H++},K=function(O){for(W=0;W<4;W++)O[W]+=z[O[(W+3)%4]&63]};else V=function(O){for(W=3;W>=0;W--)O[W]=uU8(O[W],Q$6[W]),O[W]-=z[H]+(O[(W+3)%4]&O[(W+2)%4])+(~O[(W+3)%4]&O[(W+1)%4]),H--},K=function(O){for(W=3;W>=0;W--)O[W]-=z[O[(W+3)%4]&63]};var U=function(O){var M=[];for(W=0;W<4;W++){var L=G.getInt16Le();if(q!==null)if(Y)L^=q.getInt16Le();else q.putInt16Le(L);M.push(L&65535)}H=Y?0:63;for(var w=0;w<O.length;w++)for(var I=0;I<O[w][0];I++)O[w][1](M);for(W=0;W<4;W++){if(q!==null)if(Y)q.putInt16Le(M[W]);else M[W]^=q.getInt16Le();Z.putInt16Le(M[W])}},N=null;return N={start:function(O,M){if(O){if(typeof O==="string")O=hY.util.createBuffer(O)}X=!1,G=hY.util.createBuffer(),Z=M||new hY.util.createBuffer,q=O,N.output=Z},update:function(O){if(!X)G.putBuffer(O);while(G.length()>=8)U([[5,V],[1,K],[6,V],[1,K],[5,V]])},finish:function(O){var M=!0;if(Y)if(O)M=O(8,G,!Y);else{var L=G.length()===8?8:8-G.length();G.fillWithByte(L,L)}if(M)X=!0,N.update();if(!Y){if(M=G.length()===0,M)if(O)M=O(8,Z,!Y);else{var w=Z.length(),I=Z.at(w-1);if(I>w)M=!1;else Z.truncate(I)}}return M}},N};hY.rc2.startEncrypting=function(J,Q,Y){var X=hY.rc2.createEncryptionCipher(J,128);return X.start(Q,Y),X};hY.rc2.createEncryptionCipher=function(J,Q){return Y$6(J,Q,!0)};hY.rc2.startDecrypting=function(J,Q,Y){var X=hY.rc2.createDecryptionCipher(J,128);return X.start(Q,Y),X};hY.rc2.createDecryptionCipher=function(J,Q){return Y$6(J,Q,!1)}});var Hg=h((OZ5,H$6)=>{var Jk1=m8();H$6.exports=Jk1.jsbn=Jk1.jsbn||{};var Uz,gU8=244837814094590,X$6=(gU8&16777215)==15715070;function $6(J,Q,Y){if(this.data=[],J!=null)if(typeof J=="number")this.fromNumber(J,Q,Y);else if(Q==null&&typeof J!="string")this.fromString(J,256);else this.fromString(J,Q)}Jk1.jsbn.BigInteger=$6;function n9(){return new $6(null)}function mU8(J,Q,Y,X,G,Z){while(--Z>=0){var q=Q*this.data[J++]+Y.data[X]+G;G=Math.floor(q/67108864),Y.data[X++]=q&67108863}return G}function pU8(J,Q,Y,X,G,Z){var q=Q&32767,V=Q>>15;while(--Z>=0){var K=this.data[J]&32767,W=this.data[J++]>>15,H=V*K+W*q;K=q*K+((H&32767)<<15)+Y.data[X]+(G&1073741823),G=(K>>>30)+(H>>>15)+V*W+(G>>>30),Y.data[X++]=K&1073741823}return G}function G$6(J,Q,Y,X,G,Z){var q=Q&16383,V=Q>>14;while(--Z>=0){var K=this.data[J]&16383,W=this.data[J++]>>14,H=V*K+W*q;K=q*K+((H&16383)<<14)+Y.data[X]+G,G=(K>>28)+(H>>14)+V*W,Y.data[X++]=K&268435455}return G}if(typeof navigator>"u")$6.prototype.am=G$6,Uz=28;else if(X$6&&navigator.appName=="Microsoft Internet Explorer")$6.prototype.am=pU8,Uz=30;else if(X$6&&navigator.appName!="Netscape")$6.prototype.am=mU8,Uz=26;else $6.prototype.am=G$6,Uz=28;$6.prototype.DB=Uz;$6.prototype.DM=(1<<Uz)-1;$6.prototype.DV=1<<Uz;var Qk1=52;$6.prototype.FV=Math.pow(2,Qk1);$6.prototype.F1=Qk1-Uz;$6.prototype.F2=2*Uz-Qk1;var dU8="0123456789abcdefghijklmnopqrstuvwxyz",Y91=[],BC,jG;BC=48;for(jG=0;jG<=9;++jG)Y91[BC++]=jG;BC=97;for(jG=10;jG<36;++jG)Y91[BC++]=jG;BC=65;for(jG=10;jG<36;++jG)Y91[BC++]=jG;function Z$6(J){return dU8.charAt(J)}function q$6(J,Q){var Y=Y91[J.charCodeAt(Q)];return Y==null?-1:Y}function cU8(J){for(var Q=this.t-1;Q>=0;--Q)J.data[Q]=this.data[Q];J.t=this.t,J.s=this.s}function lU8(J){if(this.t=1,this.s=J<0?-1:0,J>0)this.data[0]=J;else if(J<-1)this.data[0]=J+this.DV;else this.t=0}function QN(J){var Q=n9();return Q.fromInt(J),Q}function iU8(J,Q){var Y;if(Q==16)Y=4;else if(Q==8)Y=3;else if(Q==256)Y=8;else if(Q==2)Y=1;else if(Q==32)Y=5;else if(Q==4)Y=2;else{this.fromRadix(J,Q);return}this.t=0,this.s=0;var X=J.length,G=!1,Z=0;while(--X>=0){var q=Y==8?J[X]&255:q$6(J,X);if(q<0){if(J.charAt(X)=="-")G=!0;continue}if(G=!1,Z==0)this.data[this.t++]=q;else if(Z+Y>this.DB)this.data[this.t-1]|=(q&(1<<this.DB-Z)-1)<<Z,this.data[this.t++]=q>>this.DB-Z;else this.data[this.t-1]|=q<<Z;if(Z+=Y,Z>=this.DB)Z-=this.DB}if(Y==8&&(J[0]&128)!=0){if(this.s=-1,Z>0)this.data[this.t-1]|=(1<<this.DB-Z)-1<<Z}if(this.clamp(),G)$6.ZERO.subTo(this,this)}function nU8(){var J=this.s&this.DM;while(this.t>0&&this.data[this.t-1]==J)--this.t}function aU8(J){if(this.s<0)return"-"+this.negate().toString(J);var Q;if(J==16)Q=4;else if(J==8)Q=3;else if(J==2)Q=1;else if(J==32)Q=5;else if(J==4)Q=2;else return this.toRadix(J);var Y=(1<<Q)-1,X,G=!1,Z="",q=this.t,V=this.DB-q*this.DB%Q;if(q-- >0){if(V<this.DB&&(X=this.data[q]>>V)>0)G=!0,Z=Z$6(X);while(q>=0){if(V<Q)X=(this.data[q]&(1<<V)-1)<<Q-V,X|=this.data[--q]>>(V+=this.DB-Q);else if(X=this.data[q]>>(V-=Q)&Y,V<=0)V+=this.DB,--q;if(X>0)G=!0;if(G)Z+=Z$6(X)}}return G?Z:"0"}function rU8(){var J=n9();return $6.ZERO.subTo(this,J),J}function oU8(){return this.s<0?this.negate():this}function sU8(J){var Q=this.s-J.s;if(Q!=0)return Q;var Y=this.t;if(Q=Y-J.t,Q!=0)return this.s<0?-Q:Q;while(--Y>=0)if((Q=this.data[Y]-J.data[Y])!=0)return Q;return 0}function $91(J){var Q=1,Y;if((Y=J>>>16)!=0)J=Y,Q+=16;if((Y=J>>8)!=0)J=Y,Q+=8;if((Y=J>>4)!=0)J=Y,Q+=4;if((Y=J>>2)!=0)J=Y,Q+=2;if((Y=J>>1)!=0)J=Y,Q+=1;return Q}function tU8(){if(this.t<=0)return 0;return this.DB*(this.t-1)+$91(this.data[this.t-1]^this.s&this.DM)}function eU8(J,Q){var Y;for(Y=this.t-1;Y>=0;--Y)Q.data[Y+J]=this.data[Y];for(Y=J-1;Y>=0;--Y)Q.data[Y]=0;Q.t=this.t+J,Q.s=this.s}function JB8(J,Q){for(var Y=J;Y<this.t;++Y)Q.data[Y-J]=this.data[Y];Q.t=Math.max(this.t-J,0),Q.s=this.s}function QB8(J,Q){var Y=J%this.DB,X=this.DB-Y,G=(1<<X)-1,Z=Math.floor(J/this.DB),q=this.s<<Y&this.DM,V;for(V=this.t-1;V>=0;--V)Q.data[V+Z+1]=this.data[V]>>X|q,q=(this.data[V]&G)<<Y;for(V=Z-1;V>=0;--V)Q.data[V]=0;Q.data[Z]=q,Q.t=this.t+Z+1,Q.s=this.s,Q.clamp()}function YB8(J,Q){Q.s=this.s;var Y=Math.floor(J/this.DB);if(Y>=this.t){Q.t=0;return}var X=J%this.DB,G=this.DB-X,Z=(1<<X)-1;Q.data[0]=this.data[Y]>>X;for(var q=Y+1;q<this.t;++q)Q.data[q-Y-1]|=(this.data[q]&Z)<<G,Q.data[q-Y]=this.data[q]>>X;if(X>0)Q.data[this.t-Y-1]|=(this.s&Z)<<G;Q.t=this.t-Y,Q.clamp()}function $B8(J,Q){var Y=0,X=0,G=Math.min(J.t,this.t);while(Y<G)X+=this.data[Y]-J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;if(J.t<this.t){X-=J.s;while(Y<this.t)X+=this.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X+=this.s}else{X+=this.s;while(Y<J.t)X-=J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X-=J.s}if(Q.s=X<0?-1:0,X<-1)Q.data[Y++]=this.DV+X;else if(X>0)Q.data[Y++]=X;Q.t=Y,Q.clamp()}function XB8(J,Q){var Y=this.abs(),X=J.abs(),G=Y.t;Q.t=G+X.t;while(--G>=0)Q.data[G]=0;for(G=0;G<X.t;++G)Q.data[G+Y.t]=Y.am(0,X.data[G],Q,G,0,Y.t);if(Q.s=0,Q.clamp(),this.s!=J.s)$6.ZERO.subTo(Q,Q)}function GB8(J){var Q=this.abs(),Y=J.t=2*Q.t;while(--Y>=0)J.data[Y]=0;for(Y=0;Y<Q.t-1;++Y){var X=Q.am(Y,Q.data[Y],J,2*Y,0,1);if((J.data[Y+Q.t]+=Q.am(Y+1,2*Q.data[Y],J,2*Y+1,X,Q.t-Y-1))>=Q.DV)J.data[Y+Q.t]-=Q.DV,J.data[Y+Q.t+1]=1}if(J.t>0)J.data[J.t-1]+=Q.am(Y,Q.data[Y],J,2*Y,0,1);J.s=0,J.clamp()}function ZB8(J,Q,Y){var X=J.abs();if(X.t<=0)return;var G=this.abs();if(G.t<X.t){if(Q!=null)Q.fromInt(0);if(Y!=null)this.copyTo(Y);return}if(Y==null)Y=n9();var Z=n9(),q=this.s,V=J.s,K=this.DB-$91(X.data[X.t-1]);if(K>0)X.lShiftTo(K,Z),G.lShiftTo(K,Y);else X.copyTo(Z),G.copyTo(Y);var W=Z.t,H=Z.data[W-1];if(H==0)return;var z=H*(1<<this.F1)+(W>1?Z.data[W-2]>>this.F2:0),U=this.FV/z,N=(1<<this.F1)/z,O=1<<this.F2,M=Y.t,L=M-W,w=Q==null?n9():Q;if(Z.dlShiftTo(L,w),Y.compareTo(w)>=0)Y.data[Y.t++]=1,Y.subTo(w,Y);$6.ONE.dlShiftTo(W,w),w.subTo(Z,Z);while(Z.t<W)Z.data[Z.t++]=0;while(--L>=0){var I=Y.data[--M]==H?this.DM:Math.floor(Y.data[M]*U+(Y.data[M-1]+O)*N);if((Y.data[M]+=Z.am(0,I,Y,L,0,W))<I){Z.dlShiftTo(L,w),Y.subTo(w,Y);while(Y.data[M]<--I)Y.subTo(w,Y)}}if(Q!=null){if(Y.drShiftTo(W,Q),q!=V)$6.ZERO.subTo(Q,Q)}if(Y.t=W,Y.clamp(),K>0)Y.rShiftTo(K,Y);if(q<0)$6.ZERO.subTo(Y,Y)}function qB8(J){var Q=n9();if(this.abs().divRemTo(J,null,Q),this.s<0&&Q.compareTo($6.ZERO)>0)J.subTo(Q,Q);return Q}function KA(J){this.m=J}function VB8(J){if(J.s<0||J.compareTo(this.m)>=0)return J.mod(this.m);else return J}function KB8(J){return J}function WB8(J){J.divRemTo(this.m,null,J)}function HB8(J,Q,Y){J.multiplyTo(Q,Y),this.reduce(Y)}function zB8(J,Q){J.squareTo(Q),this.reduce(Q)}KA.prototype.convert=VB8;KA.prototype.revert=KB8;KA.prototype.reduce=WB8;KA.prototype.mulTo=HB8;KA.prototype.sqrTo=zB8;function FB8(){if(this.t<1)return 0;var J=this.data[0];if((J&1)==0)return 0;var Q=J&3;return Q=Q*(2-(J&15)*Q)&15,Q=Q*(2-(J&255)*Q)&255,Q=Q*(2-((J&65535)*Q&65535))&65535,Q=Q*(2-J*Q%this.DV)%this.DV,Q>0?this.DV-Q:-Q}function WA(J){this.m=J,this.mp=J.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<J.DB-15)-1,this.mt2=2*J.t}function UB8(J){var Q=n9();if(J.abs().dlShiftTo(this.m.t,Q),Q.divRemTo(this.m,null,Q),J.s<0&&Q.compareTo($6.ZERO)>0)this.m.subTo(Q,Q);return Q}function BB8(J){var Q=n9();return J.copyTo(Q),this.reduce(Q),Q}function NB8(J){while(J.t<=this.mt2)J.data[J.t++]=0;for(var Q=0;Q<this.m.t;++Q){var Y=J.data[Q]&32767,X=Y*this.mpl+((Y*this.mph+(J.data[Q]>>15)*this.mpl&this.um)<<15)&J.DM;Y=Q+this.m.t,J.data[Y]+=this.m.am(0,X,J,Q,0,this.m.t);while(J.data[Y]>=J.DV)J.data[Y]-=J.DV,J.data[++Y]++}if(J.clamp(),J.drShiftTo(this.m.t,J),J.compareTo(this.m)>=0)J.subTo(this.m,J)}function DB8(J,Q){J.squareTo(Q),this.reduce(Q)}function OB8(J,Q,Y){J.multiplyTo(Q,Y),this.reduce(Y)}WA.prototype.convert=UB8;WA.prototype.revert=BB8;WA.prototype.reduce=NB8;WA.prototype.mulTo=OB8;WA.prototype.sqrTo=DB8;function MB8(){return(this.t>0?this.data[0]&1:this.s)==0}function LB8(J,Q){if(J>4294967295||J<1)return $6.ONE;var Y=n9(),X=n9(),G=Q.convert(this),Z=$91(J)-1;G.copyTo(Y);while(--Z>=0)if(Q.sqrTo(Y,X),(J&1<<Z)>0)Q.mulTo(X,G,Y);else{var q=Y;Y=X,X=q}return Q.revert(Y)}function AB8(J,Q){var Y;if(J<256||Q.isEven())Y=new KA(Q);else Y=new WA(Q);return this.exp(J,Y)}$6.prototype.copyTo=cU8;$6.prototype.fromInt=lU8;$6.prototype.fromString=iU8;$6.prototype.clamp=nU8;$6.prototype.dlShiftTo=eU8;$6.prototype.drShiftTo=JB8;$6.prototype.lShiftTo=QB8;$6.prototype.rShiftTo=YB8;$6.prototype.subTo=$B8;$6.prototype.multiplyTo=XB8;$6.prototype.squareTo=GB8;$6.prototype.divRemTo=ZB8;$6.prototype.invDigit=FB8;$6.prototype.isEven=MB8;$6.prototype.exp=LB8;$6.prototype.toString=aU8;$6.prototype.negate=rU8;$6.prototype.abs=oU8;$6.prototype.compareTo=sU8;$6.prototype.bitLength=tU8;$6.prototype.mod=qB8;$6.prototype.modPowInt=AB8;$6.ZERO=QN(0);$6.ONE=QN(1);function EB8(){var J=n9();return this.copyTo(J),J}function wB8(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;else if(this.t==0)return-1}else if(this.t==1)return this.data[0];else if(this.t==0)return 0;return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function IB8(){return this.t==0?this.s:this.data[0]<<24>>24}function PB8(){return this.t==0?this.s:this.data[0]<<16>>16}function TB8(J){return Math.floor(Math.LN2*this.DB/Math.log(J))}function RB8(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this.data[0]<=0)return 0;else return 1}function CB8(J){if(J==null)J=10;if(this.signum()==0||J<2||J>36)return"0";var Q=this.chunkSize(J),Y=Math.pow(J,Q),X=QN(Y),G=n9(),Z=n9(),q="";this.divRemTo(X,G,Z);while(G.signum()>0)q=(Y+Z.intValue()).toString(J).substr(1)+q,G.divRemTo(X,G,Z);return Z.intValue().toString(J)+q}function SB8(J,Q){if(this.fromInt(0),Q==null)Q=10;var Y=this.chunkSize(Q),X=Math.pow(Q,Y),G=!1,Z=0,q=0;for(var V=0;V<J.length;++V){var K=q$6(J,V);if(K<0){if(J.charAt(V)=="-"&&this.signum()==0)G=!0;continue}if(q=Q*q+K,++Z>=Y)this.dMultiply(X),this.dAddOffset(q,0),Z=0,q=0}if(Z>0)this.dMultiply(Math.pow(Q,Z)),this.dAddOffset(q,0);if(G)$6.ZERO.subTo(this,this)}function jB8(J,Q,Y){if(typeof Q=="number")if(J<2)this.fromInt(1);else{if(this.fromNumber(J,Y),!this.testBit(J-1))this.bitwiseTo($6.ONE.shiftLeft(J-1),Yk1,this);if(this.isEven())this.dAddOffset(1,0);while(!this.isProbablePrime(Q))if(this.dAddOffset(2,0),this.bitLength()>J)this.subTo($6.ONE.shiftLeft(J-1),this)}else{var X=[],G=J&7;if(X.length=(J>>3)+1,Q.nextBytes(X),G>0)X[0]&=(1<<G)-1;else X[0]=0;this.fromString(X,256)}}function _B8(){var J=this.t,Q=[];Q[0]=this.s;var Y=this.DB-J*this.DB%8,X,G=0;if(J-- >0){if(Y<this.DB&&(X=this.data[J]>>Y)!=(this.s&this.DM)>>Y)Q[G++]=X|this.s<<this.DB-Y;while(J>=0){if(Y<8)X=(this.data[J]&(1<<Y)-1)<<8-Y,X|=this.data[--J]>>(Y+=this.DB-8);else if(X=this.data[J]>>(Y-=8)&255,Y<=0)Y+=this.DB,--J;if((X&128)!=0)X|=-256;if(G==0&&(this.s&128)!=(X&128))++G;if(G>0||X!=this.s)Q[G++]=X}}return Q}function kB8(J){return this.compareTo(J)==0}function yB8(J){return this.compareTo(J)<0?this:J}function vB8(J){return this.compareTo(J)>0?this:J}function xB8(J,Q,Y){var X,G,Z=Math.min(J.t,this.t);for(X=0;X<Z;++X)Y.data[X]=Q(this.data[X],J.data[X]);if(J.t<this.t){G=J.s&this.DM;for(X=Z;X<this.t;++X)Y.data[X]=Q(this.data[X],G);Y.t=this.t}else{G=this.s&this.DM;for(X=Z;X<J.t;++X)Y.data[X]=Q(G,J.data[X]);Y.t=J.t}Y.s=Q(this.s,J.s),Y.clamp()}function fB8(J,Q){return J&Q}function hB8(J){var Q=n9();return this.bitwiseTo(J,fB8,Q),Q}function Yk1(J,Q){return J|Q}function bB8(J){var Q=n9();return this.bitwiseTo(J,Yk1,Q),Q}function V$6(J,Q){return J^Q}function uB8(J){var Q=n9();return this.bitwiseTo(J,V$6,Q),Q}function K$6(J,Q){return J&~Q}function gB8(J){var Q=n9();return this.bitwiseTo(J,K$6,Q),Q}function mB8(){var J=n9();for(var Q=0;Q<this.t;++Q)J.data[Q]=this.DM&~this.data[Q];return J.t=this.t,J.s=~this.s,J}function pB8(J){var Q=n9();if(J<0)this.rShiftTo(-J,Q);else this.lShiftTo(J,Q);return Q}function dB8(J){var Q=n9();if(J<0)this.lShiftTo(-J,Q);else this.rShiftTo(J,Q);return Q}function cB8(J){if(J==0)return-1;var Q=0;if((J&65535)==0)J>>=16,Q+=16;if((J&255)==0)J>>=8,Q+=8;if((J&15)==0)J>>=4,Q+=4;if((J&3)==0)J>>=2,Q+=2;if((J&1)==0)++Q;return Q}function lB8(){for(var J=0;J<this.t;++J)if(this.data[J]!=0)return J*this.DB+cB8(this.data[J]);if(this.s<0)return this.t*this.DB;return-1}function iB8(J){var Q=0;while(J!=0)J&=J-1,++Q;return Q}function nB8(){var J=0,Q=this.s&this.DM;for(var Y=0;Y<this.t;++Y)J+=iB8(this.data[Y]^Q);return J}function aB8(J){var Q=Math.floor(J/this.DB);if(Q>=this.t)return this.s!=0;return(this.data[Q]&1<<J%this.DB)!=0}function rB8(J,Q){var Y=$6.ONE.shiftLeft(J);return this.bitwiseTo(Y,Q,Y),Y}function oB8(J){return this.changeBit(J,Yk1)}function sB8(J){return this.changeBit(J,K$6)}function tB8(J){return this.changeBit(J,V$6)}function eB8(J,Q){var Y=0,X=0,G=Math.min(J.t,this.t);while(Y<G)X+=this.data[Y]+J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;if(J.t<this.t){X+=J.s;while(Y<this.t)X+=this.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X+=this.s}else{X+=this.s;while(Y<J.t)X+=J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X+=J.s}if(Q.s=X<0?-1:0,X>0)Q.data[Y++]=X;else if(X<-1)Q.data[Y++]=this.DV+X;Q.t=Y,Q.clamp()}function JN8(J){var Q=n9();return this.addTo(J,Q),Q}function QN8(J){var Q=n9();return this.subTo(J,Q),Q}function YN8(J){var Q=n9();return this.multiplyTo(J,Q),Q}function $N8(J){var Q=n9();return this.divRemTo(J,Q,null),Q}function XN8(J){var Q=n9();return this.divRemTo(J,null,Q),Q}function GN8(J){var Q=n9(),Y=n9();return this.divRemTo(J,Q,Y),[Q,Y]}function ZN8(J){this.data[this.t]=this.am(0,J-1,this,0,0,this.t),++this.t,this.clamp()}function qN8(J,Q){if(J==0)return;while(this.t<=Q)this.data[this.t++]=0;this.data[Q]+=J;while(this.data[Q]>=this.DV){if(this.data[Q]-=this.DV,++Q>=this.t)this.data[this.t++]=0;++this.data[Q]}}function Wg(){}function W$6(J){return J}function VN8(J,Q,Y){J.multiplyTo(Q,Y)}function KN8(J,Q){J.squareTo(Q)}Wg.prototype.convert=W$6;Wg.prototype.revert=W$6;Wg.prototype.mulTo=VN8;Wg.prototype.sqrTo=KN8;function WN8(J){return this.exp(J,new Wg)}function HN8(J,Q,Y){var X=Math.min(this.t+J.t,Q);Y.s=0,Y.t=X;while(X>0)Y.data[--X]=0;var G;for(G=Y.t-this.t;X<G;++X)Y.data[X+this.t]=this.am(0,J.data[X],Y,X,0,this.t);for(G=Math.min(J.t,Q);X<G;++X)this.am(0,J.data[X],Y,X,0,Q-X);Y.clamp()}function zN8(J,Q,Y){--Q;var X=Y.t=this.t+J.t-Q;Y.s=0;while(--X>=0)Y.data[X]=0;for(X=Math.max(Q-this.t,0);X<J.t;++X)Y.data[this.t+X-Q]=this.am(Q-X,J.data[X],Y,0,0,this.t+X-Q);Y.clamp(),Y.drShiftTo(1,Y)}function NC(J){this.r2=n9(),this.q3=n9(),$6.ONE.dlShiftTo(2*J.t,this.r2),this.mu=this.r2.divide(J),this.m=J}function FN8(J){if(J.s<0||J.t>2*this.m.t)return J.mod(this.m);else if(J.compareTo(this.m)<0)return J;else{var Q=n9();return J.copyTo(Q),this.reduce(Q),Q}}function UN8(J){return J}function BN8(J){if(J.drShiftTo(this.m.t-1,this.r2),J.t>this.m.t+1)J.t=this.m.t+1,J.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(J.compareTo(this.r2)<0)J.dAddOffset(1,this.m.t+1);J.subTo(this.r2,J);while(J.compareTo(this.m)>=0)J.subTo(this.m,J)}function NN8(J,Q){J.squareTo(Q),this.reduce(Q)}function DN8(J,Q,Y){J.multiplyTo(Q,Y),this.reduce(Y)}NC.prototype.convert=FN8;NC.prototype.revert=UN8;NC.prototype.reduce=BN8;NC.prototype.mulTo=DN8;NC.prototype.sqrTo=NN8;function ON8(J,Q){var Y=J.bitLength(),X,G=QN(1),Z;if(Y<=0)return G;else if(Y<18)X=1;else if(Y<48)X=3;else if(Y<144)X=4;else if(Y<768)X=5;else X=6;if(Y<8)Z=new KA(Q);else if(Q.isEven())Z=new NC(Q);else Z=new WA(Q);var q=[],V=3,K=X-1,W=(1<<X)-1;if(q[1]=Z.convert(this),X>1){var H=n9();Z.sqrTo(q[1],H);while(V<=W)q[V]=n9(),Z.mulTo(H,q[V-2],q[V]),V+=2}var z=J.t-1,U,N=!0,O=n9(),M;Y=$91(J.data[z])-1;while(z>=0){if(Y>=K)U=J.data[z]>>Y-K&W;else if(U=(J.data[z]&(1<<Y+1)-1)<<K-Y,z>0)U|=J.data[z-1]>>this.DB+Y-K;V=X;while((U&1)==0)U>>=1,--V;if((Y-=V)<0)Y+=this.DB,--z;if(N)q[U].copyTo(G),N=!1;else{while(V>1)Z.sqrTo(G,O),Z.sqrTo(O,G),V-=2;if(V>0)Z.sqrTo(G,O);else M=G,G=O,O=M;Z.mulTo(O,q[U],G)}while(z>=0&&(J.data[z]&1<<Y)==0)if(Z.sqrTo(G,O),M=G,G=O,O=M,--Y<0)Y=this.DB-1,--z}return Z.revert(G)}function MN8(J){var Q=this.s<0?this.negate():this.clone(),Y=J.s<0?J.negate():J.clone();if(Q.compareTo(Y)<0){var X=Q;Q=Y,Y=X}var G=Q.getLowestSetBit(),Z=Y.getLowestSetBit();if(Z<0)return Q;if(G<Z)Z=G;if(Z>0)Q.rShiftTo(Z,Q),Y.rShiftTo(Z,Y);while(Q.signum()>0){if((G=Q.getLowestSetBit())>0)Q.rShiftTo(G,Q);if((G=Y.getLowestSetBit())>0)Y.rShiftTo(G,Y);if(Q.compareTo(Y)>=0)Q.subTo(Y,Q),Q.rShiftTo(1,Q);else Y.subTo(Q,Y),Y.rShiftTo(1,Y)}if(Z>0)Y.lShiftTo(Z,Y);return Y}function LN8(J){if(J<=0)return 0;var Q=this.DV%J,Y=this.s<0?J-1:0;if(this.t>0)if(Q==0)Y=this.data[0]%J;else for(var X=this.t-1;X>=0;--X)Y=(Q*Y+this.data[X])%J;return Y}function AN8(J){var Q=J.isEven();if(this.isEven()&&Q||J.signum()==0)return $6.ZERO;var Y=J.clone(),X=this.clone(),G=QN(1),Z=QN(0),q=QN(0),V=QN(1);while(Y.signum()!=0){while(Y.isEven()){if(Y.rShiftTo(1,Y),Q){if(!G.isEven()||!Z.isEven())G.addTo(this,G),Z.subTo(J,Z);G.rShiftTo(1,G)}else if(!Z.isEven())Z.subTo(J,Z);Z.rShiftTo(1,Z)}while(X.isEven()){if(X.rShiftTo(1,X),Q){if(!q.isEven()||!V.isEven())q.addTo(this,q),V.subTo(J,V);q.rShiftTo(1,q)}else if(!V.isEven())V.subTo(J,V);V.rShiftTo(1,V)}if(Y.compareTo(X)>=0){if(Y.subTo(X,Y),Q)G.subTo(q,G);Z.subTo(V,Z)}else{if(X.subTo(Y,X),Q)q.subTo(G,q);V.subTo(Z,V)}}if(X.compareTo($6.ONE)!=0)return $6.ZERO;if(V.compareTo(J)>=0)return V.subtract(J);if(V.signum()<0)V.addTo(J,V);else return V;if(V.signum()<0)return V.add(J);else return V}var Lq=[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],EN8=67108864/Lq[Lq.length-1];function wN8(J){var Q,Y=this.abs();if(Y.t==1&&Y.data[0]<=Lq[Lq.length-1]){for(Q=0;Q<Lq.length;++Q)if(Y.data[0]==Lq[Q])return!0;return!1}if(Y.isEven())return!1;Q=1;while(Q<Lq.length){var X=Lq[Q],G=Q+1;while(G<Lq.length&&X<EN8)X*=Lq[G++];X=Y.modInt(X);while(Q<G)if(X%Lq[Q++]==0)return!1}return Y.millerRabin(J)}function IN8(J){var Q=this.subtract($6.ONE),Y=Q.getLowestSetBit();if(Y<=0)return!1;var X=Q.shiftRight(Y),G=PN8(),Z;for(var q=0;q<J;++q){do Z=new $6(this.bitLength(),G);while(Z.compareTo($6.ONE)<=0||Z.compareTo(Q)>=0);var V=Z.modPow(X,this);if(V.compareTo($6.ONE)!=0&&V.compareTo(Q)!=0){var K=1;while(K++<Y&&V.compareTo(Q)!=0)if(V=V.modPowInt(2,this),V.compareTo($6.ONE)==0)return!1;if(V.compareTo(Q)!=0)return!1}}return!0}function PN8(){return{nextBytes:function(J){for(var Q=0;Q<J.length;++Q)J[Q]=Math.floor(Math.random()*256)}}}$6.prototype.chunkSize=TB8;$6.prototype.toRadix=CB8;$6.prototype.fromRadix=SB8;$6.prototype.fromNumber=jB8;$6.prototype.bitwiseTo=xB8;$6.prototype.changeBit=rB8;$6.prototype.addTo=eB8;$6.prototype.dMultiply=ZN8;$6.prototype.dAddOffset=qN8;$6.prototype.multiplyLowerTo=HN8;$6.prototype.multiplyUpperTo=zN8;$6.prototype.modInt=LN8;$6.prototype.millerRabin=IN8;$6.prototype.clone=EB8;$6.prototype.intValue=wB8;$6.prototype.byteValue=IB8;$6.prototype.shortValue=PB8;$6.prototype.signum=RB8;$6.prototype.toByteArray=_B8;$6.prototype.equals=kB8;$6.prototype.min=yB8;$6.prototype.max=vB8;$6.prototype.and=hB8;$6.prototype.or=bB8;$6.prototype.xor=uB8;$6.prototype.andNot=gB8;$6.prototype.not=mB8;$6.prototype.shiftLeft=pB8;$6.prototype.shiftRight=dB8;$6.prototype.getLowestSetBit=lB8;$6.prototype.bitCount=nB8;$6.prototype.testBit=aB8;$6.prototype.setBit=oB8;$6.prototype.clearBit=sB8;$6.prototype.flipBit=tB8;$6.prototype.add=JN8;$6.prototype.subtract=QN8;$6.prototype.multiply=YN8;$6.prototype.divide=$N8;$6.prototype.remainder=XN8;$6.prototype.divideAndRemainder=GN8;$6.prototype.modPow=ON8;$6.prototype.modInverse=AN8;$6.prototype.pow=WN8;$6.prototype.gcd=MN8;$6.prototype.isProbablePrime=wN8});var DC=h((MZ5,B$6)=>{var bK=m8();yK();i9();var F$6=B$6.exports=bK.sha1=bK.sha1||{};bK.md.sha1=bK.md.algorithms.sha1=F$6;F$6.create=function(){if(!U$6)TN8();var J=null,Q=bK.util.createBuffer(),Y=Array(80),X={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return X.start=function(){X.messageLength=0,X.fullMessageLength=X.messageLength64=[];var G=X.messageLengthSize/4;for(var Z=0;Z<G;++Z)X.fullMessageLength.push(0);return Q=bK.util.createBuffer(),J={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},X},X.start(),X.update=function(G,Z){if(Z==="utf8")G=bK.util.encodeUtf8(G);var q=G.length;X.messageLength+=q,q=[q/4294967296>>>0,q>>>0];for(var V=X.fullMessageLength.length-1;V>=0;--V)X.fullMessageLength[V]+=q[1],q[1]=q[0]+(X.fullMessageLength[V]/4294967296>>>0),X.fullMessageLength[V]=X.fullMessageLength[V]>>>0,q[0]=q[1]/4294967296>>>0;if(Q.putBytes(G),z$6(J,Y,Q),Q.read>2048||Q.length()===0)Q.compact();return X},X.digest=function(){var G=bK.util.createBuffer();G.putBytes(Q.bytes());var Z=X.fullMessageLength[X.fullMessageLength.length-1]+X.messageLengthSize,q=Z&X.blockLength-1;G.putBytes($k1.substr(0,X.blockLength-q));var V,K,W=X.fullMessageLength[0]*8;for(var H=0;H<X.fullMessageLength.length-1;++H)V=X.fullMessageLength[H+1]*8,K=V/4294967296>>>0,W+=K,G.putInt32(W>>>0),W=V>>>0;G.putInt32(W);var z={h0:J.h0,h1:J.h1,h2:J.h2,h3:J.h3,h4:J.h4};z$6(z,Y,G);var U=bK.util.createBuffer();return U.putInt32(z.h0),U.putInt32(z.h1),U.putInt32(z.h2),U.putInt32(z.h3),U.putInt32(z.h4),U},X};var $k1=null,U$6=!1;function TN8(){$k1=String.fromCharCode(128),$k1+=bK.util.fillString(String.fromCharCode(0),64),U$6=!0}function z$6(J,Q,Y){var X,G,Z,q,V,K,W,H,z=Y.length();while(z>=64){G=J.h0,Z=J.h1,q=J.h2,V=J.h3,K=J.h4;for(H=0;H<16;++H)X=Y.getInt32(),Q[H]=X,W=V^Z&(q^V),X=(G<<5|G>>>27)+W+K+1518500249+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<20;++H)X=Q[H-3]^Q[H-8]^Q[H-14]^Q[H-16],X=X<<1|X>>>31,Q[H]=X,W=V^Z&(q^V),X=(G<<5|G>>>27)+W+K+1518500249+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<32;++H)X=Q[H-3]^Q[H-8]^Q[H-14]^Q[H-16],X=X<<1|X>>>31,Q[H]=X,W=Z^q^V,X=(G<<5|G>>>27)+W+K+1859775393+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<40;++H)X=Q[H-6]^Q[H-16]^Q[H-28]^Q[H-32],X=X<<2|X>>>30,Q[H]=X,W=Z^q^V,X=(G<<5|G>>>27)+W+K+1859775393+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<60;++H)X=Q[H-6]^Q[H-16]^Q[H-28]^Q[H-32],X=X<<2|X>>>30,Q[H]=X,W=Z&q|V&(Z^q),X=(G<<5|G>>>27)+W+K+2400959708+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<80;++H)X=Q[H-6]^Q[H-16]^Q[H-28]^Q[H-32],X=X<<2|X>>>30,Q[H]=X,W=Z^q^V,X=(G<<5|G>>>27)+W+K+3395469782+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;J.h0=J.h0+G|0,J.h1=J.h1+Z|0,J.h2=J.h2+q|0,J.h3=J.h3+V|0,J.h4=J.h4+K|0,z-=64}}});var Xk1=h((LZ5,D$6)=>{var uK=m8();i9();SG();DC();var N$6=D$6.exports=uK.pkcs1=uK.pkcs1||{};N$6.encode_rsa_oaep=function(J,Q,Y){var X,G,Z,q;if(typeof Y==="string")X=Y,G=arguments[3]||void 0,Z=arguments[4]||void 0;else if(Y){if(X=Y.label||void 0,G=Y.seed||void 0,Z=Y.md||void 0,Y.mgf1&&Y.mgf1.md)q=Y.mgf1.md}if(!Z)Z=uK.md.sha1.create();else Z.start();if(!q)q=Z;var V=Math.ceil(J.n.bitLength()/8),K=V-2*Z.digestLength-2;if(Q.length>K){var W=Error("RSAES-OAEP input message length is too long.");throw W.length=Q.length,W.maxLength=K,W}if(!X)X="";Z.update(X,"raw");var H=Z.digest(),z="",U=K-Q.length;for(var N=0;N<U;N++)z+="\x00";var O=H.getBytes()+z+"\x01"+Q;if(!G)G=uK.random.getBytes(Z.digestLength);else if(G.length!==Z.digestLength){var W=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw W.seedLength=G.length,W.digestLength=Z.digestLength,W}var M=X91(G,V-Z.digestLength-1,q),L=uK.util.xorBytes(O,M,O.length),w=X91(L,Z.digestLength,q),I=uK.util.xorBytes(G,w,G.length);return"\x00"+I+L};N$6.decode_rsa_oaep=function(J,Q,Y){var X,G,Z;if(typeof Y==="string")X=Y,G=arguments[3]||void 0;else if(Y){if(X=Y.label||void 0,G=Y.md||void 0,Y.mgf1&&Y.mgf1.md)Z=Y.mgf1.md}var q=Math.ceil(J.n.bitLength()/8);if(Q.length!==q){var L=Error("RSAES-OAEP encoded message length is invalid.");throw L.length=Q.length,L.expectedLength=q,L}if(G===void 0)G=uK.md.sha1.create();else G.start();if(!Z)Z=G;if(q<2*G.digestLength+2)throw Error("RSAES-OAEP key is too short for the hash function.");if(!X)X="";G.update(X,"raw");var V=G.digest().getBytes(),K=Q.charAt(0),W=Q.substring(1,G.digestLength+1),H=Q.substring(1+G.digestLength),z=X91(H,G.digestLength,Z),U=uK.util.xorBytes(W,z,W.length),N=X91(U,q-G.digestLength-1,Z),O=uK.util.xorBytes(H,N,H.length),M=O.substring(0,G.digestLength),L=K!=="\x00";for(var w=0;w<G.digestLength;++w)L|=V.charAt(w)!==M.charAt(w);var I=1,P=G.digestLength;for(var R=G.digestLength;R<O.length;R++){var j=O.charCodeAt(R),y=j&1^1,f=I?65534:0;L|=j&f,I=I&y,P+=I}if(L||O.charCodeAt(P)!==1)throw Error("Invalid RSAES-OAEP padding.");return O.substring(P+1)};function X91(J,Q,Y){if(!Y)Y=uK.md.sha1.create();var X="",G=Math.ceil(Q/Y.digestLength);for(var Z=0;Z<G;++Z){var q=String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255);Y.start(),Y.update(J+q),X+=Y.digest().getBytes()}return X.substring(0,Q)}});var Zk1=h((AZ5,Gk1)=>{var YN=m8();i9();Hg();SG();(function(){if(YN.prime){Gk1.exports=YN.prime;return}var J=Gk1.exports=YN.prime=YN.prime||{},Q=YN.jsbn.BigInteger,Y=[6,4,2,4,2,4,6,2],X=new Q(null);X.fromInt(30);var G=function(z,U){return z|U};J.generateProbablePrime=function(z,U,N){if(typeof U==="function")N=U,U={};U=U||{};var O=U.algorithm||"PRIMEINC";if(typeof O==="string")O={name:O};O.options=O.options||{};var M=U.prng||YN.random,L={nextBytes:function(w){var I=M.getBytesSync(w.length);for(var P=0;P<w.length;++P)w[P]=I.charCodeAt(P)}};if(O.name==="PRIMEINC")return Z(z,L,O.options,N);throw Error("Invalid prime generation algorithm: "+O.name)};function Z(z,U,N,O){if("workers"in N)return K(z,U,N,O);return q(z,U,N,O)}function q(z,U,N,O){var M=W(z,U),L=0,w=H(M.bitLength());if("millerRabinTests"in N)w=N.millerRabinTests;var I=10;if("maxBlockTime"in N)I=N.maxBlockTime;V(M,z,U,L,w,I,O)}function V(z,U,N,O,M,L,w){var I=+new Date;do{if(z.bitLength()>U)z=W(U,N);if(z.isProbablePrime(M))return w(null,z);z.dAddOffset(Y[O++%8],0)}while(L<0||+new Date-I<L);YN.util.setImmediate(function(){V(z,U,N,O,M,L,w)})}function K(z,U,N,O){if(typeof Worker>"u")return q(z,U,N,O);var M=W(z,U),L=N.workers,w=N.workLoad||100,I=w*30/8,P=N.workerScript||"forge/prime.worker.js";if(L===-1)return YN.util.estimateCores(function(j,y){if(j)y=2;L=y-1,R()});R();function R(){L=Math.max(1,L);var j=[];for(var y=0;y<L;++y)j[y]=new Worker(P);var f=L;for(var y=0;y<L;++y)j[y].addEventListener("message",p);var g=!1;function p(b){if(g)return;--f;var i=b.data;if(i.found){for(var J1=0;J1<j.length;++J1)j[J1].terminate();return g=!0,O(null,new Q(i.prime,16))}if(M.bitLength()>z)M=W(z,U);var n=M.toString(16);b.target.postMessage({hex:n,workLoad:w}),M.dAddOffset(I,0)}}}function W(z,U){var N=new Q(z,U),O=z-1;if(!N.testBit(O))N.bitwiseTo(Q.ONE.shiftLeft(O),G,N);return N.dAddOffset(31-N.mod(X).byteValue(),0),N}function H(z){if(z<=100)return 27;if(z<=150)return 18;if(z<=200)return 15;if(z<=250)return 12;if(z<=300)return 9;if(z<=350)return 8;if(z<=400)return 7;if(z<=500)return 6;if(z<=600)return 5;if(z<=800)return 4;if(z<=1250)return 3;return 2}})()});var zg=h((EZ5,I$6)=>{var _4=m8();Mq();Hg();JN();Xk1();Zk1();SG();i9();if(typeof C9>"u")C9=_4.jsbn.BigInteger;var C9,qk1=_4.util.isNodejs?S1("crypto"):null,L0=_4.asn1,_G=_4.util;_4.pki=_4.pki||{};I$6.exports=_4.pki.rsa=_4.rsa=_4.rsa||{};var A8=_4.pki,RN8=[6,4,2,4,2,4,6,2],CN8={name:"PrivateKeyInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},SN8={name:"RSAPrivateKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},jN8={name:"RSAPublicKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},_N8=_4.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},kN8={name:"DigestInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:L0.Class.UNIVERSAL,type:L0.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},yN8=function(J){var Q;if(J.algorithm in A8.oids)Q=A8.oids[J.algorithm];else{var Y=Error("Unknown message digest algorithm.");throw Y.algorithm=J.algorithm,Y}var X=L0.oidToDer(Q).getBytes(),G=L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[]),Z=L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[]);Z.value.push(L0.create(L0.Class.UNIVERSAL,L0.Type.OID,!1,X)),Z.value.push(L0.create(L0.Class.UNIVERSAL,L0.Type.NULL,!1,""));var q=L0.create(L0.Class.UNIVERSAL,L0.Type.OCTETSTRING,!1,J.digest().getBytes());return G.value.push(Z),G.value.push(q),L0.toDer(G).getBytes()},E$6=function(J,Q,Y){if(Y)return J.modPow(Q.e,Q.n);if(!Q.p||!Q.q)return J.modPow(Q.d,Q.n);if(!Q.dP)Q.dP=Q.d.mod(Q.p.subtract(C9.ONE));if(!Q.dQ)Q.dQ=Q.d.mod(Q.q.subtract(C9.ONE));if(!Q.qInv)Q.qInv=Q.q.modInverse(Q.p);var X;do X=new C9(_4.util.bytesToHex(_4.random.getBytes(Q.n.bitLength()/8)),16);while(X.compareTo(Q.n)>=0||!X.gcd(Q.n).equals(C9.ONE));J=J.multiply(X.modPow(Q.e,Q.n)).mod(Q.n);var G=J.mod(Q.p).modPow(Q.dP,Q.p),Z=J.mod(Q.q).modPow(Q.dQ,Q.q);while(G.compareTo(Z)<0)G=G.add(Q.p);var q=G.subtract(Z).multiply(Q.qInv).mod(Q.p).multiply(Q.q).add(Z);return q=q.multiply(X.modInverse(Q.n)).mod(Q.n),q};A8.rsa.encrypt=function(J,Q,Y){var X=Y,G,Z=Math.ceil(Q.n.bitLength()/8);if(Y!==!1&&Y!==!0)X=Y===2,G=w$6(J,Q,Y);else G=_4.util.createBuffer(),G.putBytes(J);var q=new C9(G.toHex(),16),V=E$6(q,Q,X),K=V.toString(16),W=_4.util.createBuffer(),H=Z-Math.ceil(K.length/2);while(H>0)W.putByte(0),--H;return W.putBytes(_4.util.hexToBytes(K)),W.getBytes()};A8.rsa.decrypt=function(J,Q,Y,X){var G=Math.ceil(Q.n.bitLength()/8);if(J.length!==G){var Z=Error("Encrypted message length is invalid.");throw Z.length=J.length,Z.expected=G,Z}var q=new C9(_4.util.createBuffer(J).toHex(),16);if(q.compareTo(Q.n)>=0)throw Error("Encrypted message is invalid.");var V=E$6(q,Q,Y),K=V.toString(16),W=_4.util.createBuffer(),H=G-Math.ceil(K.length/2);while(H>0)W.putByte(0),--H;if(W.putBytes(_4.util.hexToBytes(K)),X!==!1)return G91(W.getBytes(),Q,Y);return W.getBytes()};A8.rsa.createKeyPairGenerationState=function(J,Q,Y){if(typeof J==="string")J=parseInt(J,10);J=J||2048,Y=Y||{};var X=Y.prng||_4.random,G={nextBytes:function(V){var K=X.getBytesSync(V.length);for(var W=0;W<V.length;++W)V[W]=K.charCodeAt(W)}},Z=Y.algorithm||"PRIMEINC",q;if(Z==="PRIMEINC")q={algorithm:Z,state:0,bits:J,rng:G,eInt:Q||65537,e:new C9(null),p:null,q:null,qBits:J>>1,pBits:J-(J>>1),pqState:0,num:null,keys:null},q.e.fromInt(q.eInt);else throw Error("Invalid key generation algorithm: "+Z);return q};A8.rsa.stepKeyPairGenerationState=function(J,Q){if(!("algorithm"in J))J.algorithm="PRIMEINC";var Y=new C9(null);Y.fromInt(30);var X=0,G=function(z,U){return z|U},Z=+new Date,q,V=0;while(J.keys===null&&(Q<=0||V<Q)){if(J.state===0){var K=J.p===null?J.pBits:J.qBits,W=K-1;if(J.pqState===0){if(J.num=new C9(K,J.rng),!J.num.testBit(W))J.num.bitwiseTo(C9.ONE.shiftLeft(W),G,J.num);J.num.dAddOffset(31-J.num.mod(Y).byteValue(),0),X=0,++J.pqState}else if(J.pqState===1)if(J.num.bitLength()>K)J.pqState=0;else if(J.num.isProbablePrime(xN8(J.num.bitLength())))++J.pqState;else J.num.dAddOffset(RN8[X++%8],0);else if(J.pqState===2)J.pqState=J.num.subtract(C9.ONE).gcd(J.e).compareTo(C9.ONE)===0?3:0;else if(J.pqState===3){if(J.pqState=0,J.p===null)J.p=J.num;else J.q=J.num;if(J.p!==null&&J.q!==null)++J.state;J.num=null}}else if(J.state===1){if(J.p.compareTo(J.q)<0)J.num=J.p,J.p=J.q,J.q=J.num;++J.state}else if(J.state===2)J.p1=J.p.subtract(C9.ONE),J.q1=J.q.subtract(C9.ONE),J.phi=J.p1.multiply(J.q1),++J.state;else if(J.state===3)if(J.phi.gcd(J.e).compareTo(C9.ONE)===0)++J.state;else J.p=null,J.q=null,J.state=0;else if(J.state===4)if(J.n=J.p.multiply(J.q),J.n.bitLength()===J.bits)++J.state;else J.q=null,J.state=0;else if(J.state===5){var H=J.e.modInverse(J.phi);J.keys={privateKey:A8.rsa.setPrivateKey(J.n,J.e,H,J.p,J.q,H.mod(J.p1),H.mod(J.q1),J.q.modInverse(J.p)),publicKey:A8.rsa.setPublicKey(J.n,J.e)}}q=+new Date,V+=q-Z,Z=q}return J.keys!==null};A8.rsa.generateKeyPair=function(J,Q,Y,X){if(arguments.length===1){if(typeof J==="object")Y=J,J=void 0;else if(typeof J==="function")X=J,J=void 0}else if(arguments.length===2)if(typeof J==="number"){if(typeof Q==="function")X=Q,Q=void 0;else if(typeof Q!=="number")Y=Q,Q=void 0}else Y=J,X=Q,J=void 0,Q=void 0;else if(arguments.length===3)if(typeof Q==="number"){if(typeof Y==="function")X=Y,Y=void 0}else X=Y,Y=Q,Q=void 0;if(Y=Y||{},J===void 0)J=Y.bits||2048;if(Q===void 0)Q=Y.e||65537;if(!_4.options.usePureJavaScript&&!Y.prng&&J>=256&&J<=16384&&(Q===65537||Q===3)){if(X){if(O$6("generateKeyPair"))return qk1.generateKeyPair("rsa",{modulusLength:J,publicExponent:Q,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(V,K,W){if(V)return X(V);X(null,{privateKey:A8.privateKeyFromPem(W),publicKey:A8.publicKeyFromPem(K)})});if(M$6("generateKey")&&M$6("exportKey"))return _G.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:J,publicExponent:A$6(Q),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(V){return _G.globalScope.crypto.subtle.exportKey("pkcs8",V.privateKey)}).then(void 0,function(V){X(V)}).then(function(V){if(V){var K=A8.privateKeyFromAsn1(L0.fromDer(_4.util.createBuffer(V)));X(null,{privateKey:K,publicKey:A8.setRsaPublicKey(K.n,K.e)})}});if(L$6("generateKey")&&L$6("exportKey")){var G=_G.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:J,publicExponent:A$6(Q),hash:{name:"SHA-256"}},!0,["sign","verify"]);G.oncomplete=function(V){var K=V.target.result,W=_G.globalScope.msCrypto.subtle.exportKey("pkcs8",K.privateKey);W.oncomplete=function(H){var z=H.target.result,U=A8.privateKeyFromAsn1(L0.fromDer(_4.util.createBuffer(z)));X(null,{privateKey:U,publicKey:A8.setRsaPublicKey(U.n,U.e)})},W.onerror=function(H){X(H)}},G.onerror=function(V){X(V)};return}}else if(O$6("generateKeyPairSync")){var Z=qk1.generateKeyPairSync("rsa",{modulusLength:J,publicExponent:Q,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:A8.privateKeyFromPem(Z.privateKey),publicKey:A8.publicKeyFromPem(Z.publicKey)}}}var q=A8.rsa.createKeyPairGenerationState(J,Q,Y);if(!X)return A8.rsa.stepKeyPairGenerationState(q,0),q.keys;vN8(q,Y,X)};A8.setRsaPublicKey=A8.rsa.setPublicKey=function(J,Q){var Y={n:J,e:Q};return Y.encrypt=function(X,G,Z){if(typeof G==="string")G=G.toUpperCase();else if(G===void 0)G="RSAES-PKCS1-V1_5";if(G==="RSAES-PKCS1-V1_5")G={encode:function(V,K,W){return w$6(V,K,2).getBytes()}};else if(G==="RSA-OAEP"||G==="RSAES-OAEP")G={encode:function(V,K){return _4.pkcs1.encode_rsa_oaep(K,V,Z)}};else if(["RAW","NONE","NULL",null].indexOf(G)!==-1)G={encode:function(V){return V}};else if(typeof G==="string")throw Error('Unsupported encryption scheme: "'+G+'".');var q=G.encode(X,Y,!0);return A8.rsa.encrypt(q,Y,!0)},Y.verify=function(X,G,Z,q){if(typeof Z==="string")Z=Z.toUpperCase();else if(Z===void 0)Z="RSASSA-PKCS1-V1_5";if(q===void 0)q={_parseAllDigestBytes:!0};if(!("_parseAllDigestBytes"in q))q._parseAllDigestBytes=!0;if(Z==="RSASSA-PKCS1-V1_5")Z={verify:function(K,W){W=G91(W,Y,!0);var H=L0.fromDer(W,{parseAllBytes:q._parseAllDigestBytes}),z={},U=[];if(!L0.validate(H,kN8,z,U)){var N=Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw N.errors=U,N}var O=L0.derToOid(z.algorithmIdentifier);if(!(O===_4.oids.md2||O===_4.oids.md5||O===_4.oids.sha1||O===_4.oids.sha224||O===_4.oids.sha256||O===_4.oids.sha384||O===_4.oids.sha512||O===_4.oids["sha512-224"]||O===_4.oids["sha512-256"])){var N=Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw N.oid=O,N}if(O===_4.oids.md2||O===_4.oids.md5){if(!("parameters"in z))throw Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.")}return K===z.digest}};else if(Z==="NONE"||Z==="NULL"||Z===null)Z={verify:function(K,W){return W=G91(W,Y,!0),K===W}};var V=A8.rsa.decrypt(G,Y,!0,!1);return Z.verify(X,V,Y.n.bitLength())},Y};A8.setRsaPrivateKey=A8.rsa.setPrivateKey=function(J,Q,Y,X,G,Z,q,V){var K={n:J,e:Q,d:Y,p:X,q:G,dP:Z,dQ:q,qInv:V};return K.decrypt=function(W,H,z){if(typeof H==="string")H=H.toUpperCase();else if(H===void 0)H="RSAES-PKCS1-V1_5";var U=A8.rsa.decrypt(W,K,!1,!1);if(H==="RSAES-PKCS1-V1_5")H={decode:G91};else if(H==="RSA-OAEP"||H==="RSAES-OAEP")H={decode:function(N,O){return _4.pkcs1.decode_rsa_oaep(O,N,z)}};else if(["RAW","NONE","NULL",null].indexOf(H)!==-1)H={decode:function(N){return N}};else throw Error('Unsupported encryption scheme: "'+H+'".');return H.decode(U,K,!1)},K.sign=function(W,H){var z=!1;if(typeof H==="string")H=H.toUpperCase();if(H===void 0||H==="RSASSA-PKCS1-V1_5")H={encode:yN8},z=1;else if(H==="NONE"||H==="NULL"||H===null)H={encode:function(){return W}},z=1;var U=H.encode(W,K.n.bitLength());return A8.rsa.encrypt(U,K,z)},K};A8.wrapRsaPrivateKey=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,L0.integerToDer(0).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.OID,!1,L0.oidToDer(A8.oids.rsaEncryption).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.NULL,!1,"")]),L0.create(L0.Class.UNIVERSAL,L0.Type.OCTETSTRING,!1,L0.toDer(J).getBytes())])};A8.privateKeyFromAsn1=function(J){var Q={},Y=[];if(L0.validate(J,CN8,Q,Y))J=L0.fromDer(_4.util.createBuffer(Q.privateKey));if(Q={},Y=[],!L0.validate(J,SN8,Q,Y)){var X=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw X.errors=Y,X}var G,Z,q,V,K,W,H,z;return G=_4.util.createBuffer(Q.privateKeyModulus).toHex(),Z=_4.util.createBuffer(Q.privateKeyPublicExponent).toHex(),q=_4.util.createBuffer(Q.privateKeyPrivateExponent).toHex(),V=_4.util.createBuffer(Q.privateKeyPrime1).toHex(),K=_4.util.createBuffer(Q.privateKeyPrime2).toHex(),W=_4.util.createBuffer(Q.privateKeyExponent1).toHex(),H=_4.util.createBuffer(Q.privateKeyExponent2).toHex(),z=_4.util.createBuffer(Q.privateKeyCoefficient).toHex(),A8.setRsaPrivateKey(new C9(G,16),new C9(Z,16),new C9(q,16),new C9(V,16),new C9(K,16),new C9(W,16),new C9(H,16),new C9(z,16))};A8.privateKeyToAsn1=A8.privateKeyToRSAPrivateKey=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,L0.integerToDer(0).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.n)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.e)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.d)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.p)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.q)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.dP)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.dQ)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.qInv))])};A8.publicKeyFromAsn1=function(J){var Q={},Y=[];if(L0.validate(J,_N8,Q,Y)){var X=L0.derToOid(Q.publicKeyOid);if(X!==A8.oids.rsaEncryption){var G=Error("Cannot read public key. Unknown OID.");throw G.oid=X,G}J=Q.rsaPublicKey}if(Y=[],!L0.validate(J,jN8,Q,Y)){var G=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw G.errors=Y,G}var Z=_4.util.createBuffer(Q.publicKeyModulus).toHex(),q=_4.util.createBuffer(Q.publicKeyExponent).toHex();return A8.setRsaPublicKey(new C9(Z,16),new C9(q,16))};A8.publicKeyToAsn1=A8.publicKeyToSubjectPublicKeyInfo=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.OID,!1,L0.oidToDer(A8.oids.rsaEncryption).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.NULL,!1,"")]),L0.create(L0.Class.UNIVERSAL,L0.Type.BITSTRING,!1,[A8.publicKeyToRSAPublicKey(J)])])};A8.publicKeyToRSAPublicKey=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.n)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.e))])};function w$6(J,Q,Y){var X=_4.util.createBuffer(),G=Math.ceil(Q.n.bitLength()/8);if(J.length>G-11){var Z=Error("Message is too long for PKCS#1 v1.5 padding.");throw Z.length=J.length,Z.max=G-11,Z}X.putByte(0),X.putByte(Y);var q=G-3-J.length,V;if(Y===0||Y===1){V=Y===0?0:255;for(var K=0;K<q;++K)X.putByte(V)}else while(q>0){var W=0,H=_4.random.getBytes(q);for(var K=0;K<q;++K)if(V=H.charCodeAt(K),V===0)++W;else X.putByte(V);q=W}return X.putByte(0),X.putBytes(J),X}function G91(J,Q,Y,X){var G=Math.ceil(Q.n.bitLength()/8),Z=_4.util.createBuffer(J),q=Z.getByte(),V=Z.getByte();if(q!==0||Y&&V!==0&&V!==1||!Y&&V!=2||Y&&V===0&&typeof X>"u")throw Error("Encryption block is invalid.");var K=0;if(V===0){K=G-3-X;for(var W=0;W<K;++W)if(Z.getByte()!==0)throw Error("Encryption block is invalid.")}else if(V===1){K=0;while(Z.length()>1){if(Z.getByte()!==255){--Z.read;break}++K}}else if(V===2){K=0;while(Z.length()>1){if(Z.getByte()===0){--Z.read;break}++K}}var H=Z.getByte();if(H!==0||K!==G-3-Z.length())throw Error("Encryption block is invalid.");return Z.getBytes()}function vN8(J,Q,Y){if(typeof Q==="function")Y=Q,Q={};Q=Q||{};var X={algorithm:{name:Q.algorithm||"PRIMEINC",options:{workers:Q.workers||2,workLoad:Q.workLoad||100,workerScript:Q.workerScript}}};if("prng"in Q)X.prng=Q.prng;G();function G(){Z(J.pBits,function(V,K){if(V)return Y(V);if(J.p=K,J.q!==null)return q(V,J.q);Z(J.qBits,q)})}function Z(V,K){_4.prime.generateProbablePrime(V,X,K)}function q(V,K){if(V)return Y(V);if(J.q=K,J.p.compareTo(J.q)<0){var W=J.p;J.p=J.q,J.q=W}if(J.p.subtract(C9.ONE).gcd(J.e).compareTo(C9.ONE)!==0){J.p=null,G();return}if(J.q.subtract(C9.ONE).gcd(J.e).compareTo(C9.ONE)!==0){J.q=null,Z(J.qBits,q);return}if(J.p1=J.p.subtract(C9.ONE),J.q1=J.q.subtract(C9.ONE),J.phi=J.p1.multiply(J.q1),J.phi.gcd(J.e).compareTo(C9.ONE)!==0){J.p=J.q=null,G();return}if(J.n=J.p.multiply(J.q),J.n.bitLength()!==J.bits){J.q=null,Z(J.qBits,q);return}var H=J.e.modInverse(J.phi);J.keys={privateKey:A8.rsa.setPrivateKey(J.n,J.e,H,J.p,J.q,H.mod(J.p1),H.mod(J.q1),J.q.modInverse(J.p)),publicKey:A8.rsa.setPublicKey(J.n,J.e)},Y(null,J.keys)}}function gK(J){var Q=J.toString(16);if(Q[0]>="8")Q="00"+Q;var Y=_4.util.hexToBytes(Q);if(Y.length>1&&(Y.charCodeAt(0)===0&&(Y.charCodeAt(1)&128)===0||Y.charCodeAt(0)===255&&(Y.charCodeAt(1)&128)===128))return Y.substr(1);return Y}function xN8(J){if(J<=100)return 27;if(J<=150)return 18;if(J<=200)return 15;if(J<=250)return 12;if(J<=300)return 9;if(J<=350)return 8;if(J<=400)return 7;if(J<=500)return 6;if(J<=600)return 5;if(J<=800)return 4;if(J<=1250)return 3;return 2}function O$6(J){return _4.util.isNodejs&&typeof qk1[J]==="function"}function M$6(J){return typeof _G.globalScope<"u"&&typeof _G.globalScope.crypto==="object"&&typeof _G.globalScope.crypto.subtle==="object"&&typeof _G.globalScope.crypto.subtle[J]==="function"}function L$6(J){return typeof _G.globalScope<"u"&&typeof _G.globalScope.msCrypto==="object"&&typeof _G.globalScope.msCrypto.subtle==="object"&&typeof _G.globalScope.msCrypto.subtle[J]==="function"}function A$6(J){var Q=_4.util.hexToBytes(J.toString(16)),Y=new Uint8Array(Q.length);for(var X=0;X<Q.length;++X)Y[X]=Q.charCodeAt(X);return Y}});var Kk1=h((wZ5,C$6)=>{var Y4=m8();eB();Mq();Kg();yK();JN();J91();VA();SG();e_1();zg();i9();if(typeof Vk1>"u")Vk1=Y4.jsbn.BigInteger;var Vk1,u0=Y4.asn1,S8=Y4.pki=Y4.pki||{};C$6.exports=S8.pbe=Y4.pbe=Y4.pbe||{};var HA=S8.oids,fN8={name:"EncryptedPrivateKeyInfo",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},hN8={name:"PBES2Algorithms",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:u0.Class.UNIVERSAL,type:u0.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:u0.Class.UNIVERSAL,type:u0.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},bN8={name:"pkcs-12PbeParams",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:u0.Class.UNIVERSAL,type:u0.Type.INTEGER,constructed:!1,capture:"iterations"}]};S8.encryptPrivateKeyInfo=function(J,Q,Y){Y=Y||{},Y.saltSize=Y.saltSize||8,Y.count=Y.count||2048,Y.algorithm=Y.algorithm||"aes128",Y.prfAlgorithm=Y.prfAlgorithm||"sha1";var X=Y4.random.getBytesSync(Y.saltSize),G=Y.count,Z=u0.integerToDer(G),q,V,K;if(Y.algorithm.indexOf("aes")===0||Y.algorithm==="des"){var W,H,z;switch(Y.algorithm){case"aes128":q=16,W=16,H=HA["aes128-CBC"],z=Y4.aes.createEncryptionCipher;break;case"aes192":q=24,W=16,H=HA["aes192-CBC"],z=Y4.aes.createEncryptionCipher;break;case"aes256":q=32,W=16,H=HA["aes256-CBC"],z=Y4.aes.createEncryptionCipher;break;case"des":q=8,W=8,H=HA.desCBC,z=Y4.des.createEncryptionCipher;break;default:var U=Error("Cannot encrypt private key. Unknown encryption algorithm.");throw U.algorithm=Y.algorithm,U}var N="hmacWith"+Y.prfAlgorithm.toUpperCase(),O=R$6(N),M=Y4.pkcs5.pbkdf2(Q,X,G,q,O),L=Y4.random.getBytesSync(W),w=z(M);w.start(L),w.update(u0.toDer(J)),w.finish(),K=w.output.getBytes();var I=uN8(X,Z,q,N);V=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(HA.pkcs5PBES2).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(HA.pkcs5PBKDF2).getBytes()),I]),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(H).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,L)])])])}else if(Y.algorithm==="3des"){q=24;var P=new Y4.util.ByteBuffer(X),M=S8.pbe.generatePkcs12Key(Q,P,1,G,q),L=S8.pbe.generatePkcs12Key(Q,P,2,G,q),w=Y4.des.createEncryptionCipher(M);w.start(L),w.update(u0.toDer(J)),w.finish(),K=w.output.getBytes(),V=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(HA["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,X),u0.create(u0.Class.UNIVERSAL,u0.Type.INTEGER,!1,Z.getBytes())])])}else{var U=Error("Cannot encrypt private key. Unknown encryption algorithm.");throw U.algorithm=Y.algorithm,U}var R=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[V,u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,K)]);return R};S8.decryptPrivateKeyInfo=function(J,Q){var Y=null,X={},G=[];if(!u0.validate(J,fN8,X,G)){var Z=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw Z.errors=G,Z}var q=u0.derToOid(X.encryptionOid),V=S8.pbe.getCipher(q,X.encryptionParams,Q),K=Y4.util.createBuffer(X.encryptedData);if(V.update(K),V.finish())Y=u0.fromDer(V.output);return Y};S8.encryptedPrivateKeyToPem=function(J,Q){var Y={type:"ENCRYPTED PRIVATE KEY",body:u0.toDer(J).getBytes()};return Y4.pem.encode(Y,{maxline:Q})};S8.encryptedPrivateKeyFromPem=function(J){var Q=Y4.pem.decode(J)[0];if(Q.type!=="ENCRYPTED PRIVATE KEY"){var Y=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return u0.fromDer(Q.body)};S8.encryptRsaPrivateKey=function(J,Q,Y){if(Y=Y||{},!Y.legacy){var X=S8.wrapRsaPrivateKey(S8.privateKeyToAsn1(J));return X=S8.encryptPrivateKeyInfo(X,Q,Y),S8.encryptedPrivateKeyToPem(X)}var G,Z,q,V;switch(Y.algorithm){case"aes128":G="AES-128-CBC",q=16,Z=Y4.random.getBytesSync(16),V=Y4.aes.createEncryptionCipher;break;case"aes192":G="AES-192-CBC",q=24,Z=Y4.random.getBytesSync(16),V=Y4.aes.createEncryptionCipher;break;case"aes256":G="AES-256-CBC",q=32,Z=Y4.random.getBytesSync(16),V=Y4.aes.createEncryptionCipher;break;case"3des":G="DES-EDE3-CBC",q=24,Z=Y4.random.getBytesSync(8),V=Y4.des.createEncryptionCipher;break;case"des":G="DES-CBC",q=8,Z=Y4.random.getBytesSync(8),V=Y4.des.createEncryptionCipher;break;default:var K=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+Y.algorithm+'".');throw K.algorithm=Y.algorithm,K}var W=Y4.pbe.opensslDeriveBytes(Q,Z.substr(0,8),q),H=V(W);H.start(Z),H.update(u0.toDer(S8.privateKeyToAsn1(J))),H.finish();var z={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:G,parameters:Y4.util.bytesToHex(Z).toUpperCase()},body:H.output.getBytes()};return Y4.pem.encode(z)};S8.decryptRsaPrivateKey=function(J,Q){var Y=null,X=Y4.pem.decode(J)[0];if(X.type!=="ENCRYPTED PRIVATE KEY"&&X.type!=="PRIVATE KEY"&&X.type!=="RSA PRIVATE KEY"){var G=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw G.headerType=G,G}if(X.procType&&X.procType.type==="ENCRYPTED"){var Z,q;switch(X.dekInfo.algorithm){case"DES-CBC":Z=8,q=Y4.des.createDecryptionCipher;break;case"DES-EDE3-CBC":Z=24,q=Y4.des.createDecryptionCipher;break;case"AES-128-CBC":Z=16,q=Y4.aes.createDecryptionCipher;break;case"AES-192-CBC":Z=24,q=Y4.aes.createDecryptionCipher;break;case"AES-256-CBC":Z=32,q=Y4.aes.createDecryptionCipher;break;case"RC2-40-CBC":Z=5,q=function(z){return Y4.rc2.createDecryptionCipher(z,40)};break;case"RC2-64-CBC":Z=8,q=function(z){return Y4.rc2.createDecryptionCipher(z,64)};break;case"RC2-128-CBC":Z=16,q=function(z){return Y4.rc2.createDecryptionCipher(z,128)};break;default:var G=Error('Could not decrypt private key; unsupported encryption algorithm "'+X.dekInfo.algorithm+'".');throw G.algorithm=X.dekInfo.algorithm,G}var V=Y4.util.hexToBytes(X.dekInfo.parameters),K=Y4.pbe.opensslDeriveBytes(Q,V.substr(0,8),Z),W=q(K);if(W.start(V),W.update(Y4.util.createBuffer(X.body)),W.finish())Y=W.output.getBytes();else return Y}else Y=X.body;if(X.type==="ENCRYPTED PRIVATE KEY")Y=S8.decryptPrivateKeyInfo(u0.fromDer(Y),Q);else Y=u0.fromDer(Y);if(Y!==null)Y=S8.privateKeyFromAsn1(Y);return Y};S8.pbe.generatePkcs12Key=function(J,Q,Y,X,G,Z){var q,V;if(typeof Z>"u"||Z===null){if(!("sha1"in Y4.md))throw Error('"sha1" hash algorithm unavailable.');Z=Y4.md.sha1.create()}var{digestLength:K,blockLength:W}=Z,H=new Y4.util.ByteBuffer,z=new Y4.util.ByteBuffer;if(J!==null&&J!==void 0){for(V=0;V<J.length;V++)z.putInt16(J.charCodeAt(V));z.putInt16(0)}var U=z.length(),N=Q.length(),O=new Y4.util.ByteBuffer;O.fillWithByte(Y,W);var M=W*Math.ceil(N/W),L=new Y4.util.ByteBuffer;for(V=0;V<M;V++)L.putByte(Q.at(V%N));var w=W*Math.ceil(U/W),I=new Y4.util.ByteBuffer;for(V=0;V<w;V++)I.putByte(z.at(V%U));var P=L;P.putBuffer(I);var R=Math.ceil(G/K);for(var j=1;j<=R;j++){var y=new Y4.util.ByteBuffer;y.putBytes(O.bytes()),y.putBytes(P.bytes());for(var f=0;f<X;f++)Z.start(),Z.update(y.getBytes()),y=Z.digest();var g=new Y4.util.ByteBuffer;for(V=0;V<W;V++)g.putByte(y.at(V%K));var p=Math.ceil(N/W)+Math.ceil(U/W),b=new Y4.util.ByteBuffer;for(q=0;q<p;q++){var i=new Y4.util.ByteBuffer(P.getBytes(W)),J1=511;for(V=g.length()-1;V>=0;V--)J1=J1>>8,J1+=g.at(V)+i.at(V),i.setAt(V,J1&255);b.putBuffer(i)}P=b,H.putBuffer(y)}return H.truncate(H.length()-G),H};S8.pbe.getCipher=function(J,Q,Y){switch(J){case S8.oids.pkcs5PBES2:return S8.pbe.getCipherForPBES2(J,Q,Y);case S8.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case S8.oids["pbewithSHAAnd40BitRC2-CBC"]:return S8.pbe.getCipherForPKCS12PBE(J,Q,Y);default:var X=Error("Cannot read encrypted PBE data block. Unsupported OID.");throw X.oid=J,X.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],X}};S8.pbe.getCipherForPBES2=function(J,Q,Y){var X={},G=[];if(!u0.validate(Q,hN8,X,G)){var Z=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw Z.errors=G,Z}if(J=u0.derToOid(X.kdfOid),J!==S8.oids.pkcs5PBKDF2){var Z=Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw Z.oid=J,Z.supportedOids=["pkcs5PBKDF2"],Z}if(J=u0.derToOid(X.encOid),J!==S8.oids["aes128-CBC"]&&J!==S8.oids["aes192-CBC"]&&J!==S8.oids["aes256-CBC"]&&J!==S8.oids["des-EDE3-CBC"]&&J!==S8.oids.desCBC){var Z=Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw Z.oid=J,Z.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],Z}var q=X.kdfSalt,V=Y4.util.createBuffer(X.kdfIterationCount);V=V.getInt(V.length()<<3);var K,W;switch(S8.oids[J]){case"aes128-CBC":K=16,W=Y4.aes.createDecryptionCipher;break;case"aes192-CBC":K=24,W=Y4.aes.createDecryptionCipher;break;case"aes256-CBC":K=32,W=Y4.aes.createDecryptionCipher;break;case"des-EDE3-CBC":K=24,W=Y4.des.createDecryptionCipher;break;case"desCBC":K=8,W=Y4.des.createDecryptionCipher;break}var H=T$6(X.prfOid),z=Y4.pkcs5.pbkdf2(Y,q,V,K,H),U=X.encIv,N=W(z);return N.start(U),N};S8.pbe.getCipherForPKCS12PBE=function(J,Q,Y){var X={},G=[];if(!u0.validate(Q,bN8,X,G)){var Z=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw Z.errors=G,Z}var q=Y4.util.createBuffer(X.salt),V=Y4.util.createBuffer(X.iterations);V=V.getInt(V.length()<<3);var K,W,H;switch(J){case S8.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:K=24,W=8,H=Y4.des.startDecrypting;break;case S8.oids["pbewithSHAAnd40BitRC2-CBC"]:K=5,W=8,H=function(M,L){var w=Y4.rc2.createDecryptionCipher(M,40);return w.start(L,null),w};break;default:var Z=Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw Z.oid=J,Z}var z=T$6(X.prfOid),U=S8.pbe.generatePkcs12Key(Y,q,1,V,K,z);z.start();var N=S8.pbe.generatePkcs12Key(Y,q,2,V,W,z);return H(U,N)};S8.pbe.opensslDeriveBytes=function(J,Q,Y,X){if(typeof X>"u"||X===null){if(!("md5"in Y4.md))throw Error('"md5" hash algorithm unavailable.');X=Y4.md.md5.create()}if(Q===null)Q="";var G=[P$6(X,J+Q)];for(var Z=16,q=1;Z<Y;++q,Z+=16)G.push(P$6(X,G[q-1]+J+Q));return G.join("").substr(0,Y)};function P$6(J,Q){return J.start().update(Q).digest().getBytes()}function T$6(J){var Q;if(!J)Q="hmacWithSHA1";else if(Q=S8.oids[u0.derToOid(J)],!Q){var Y=Error("Unsupported PRF OID.");throw Y.oid=J,Y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],Y}return R$6(Q)}function R$6(J){var Q=Y4.md;switch(J){case"hmacWithSHA224":Q=Y4.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":J=J.substr(8).toLowerCase();break;default:var Y=Error("Unsupported PRF algorithm.");throw Y.algorithm=J,Y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],Y}if(!Q||!(J in Q))throw Error("Unknown hash algorithm: "+J);return Q[J].create()}function uN8(J,Q,Y,X){var G=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,J),u0.create(u0.Class.UNIVERSAL,u0.Type.INTEGER,!1,Q.getBytes())]);if(X!=="hmacWithSHA1")G.value.push(u0.create(u0.Class.UNIVERSAL,u0.Type.INTEGER,!1,Y4.util.hexToBytes(Y.toString(16))),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(S8.oids[X]).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.NULL,!1,"")]));return G}});var Wk1=h((IZ5,_$6)=>{var OC=m8();Mq();i9();var r6=OC.asn1,MC=_$6.exports=OC.pkcs7asn1=OC.pkcs7asn1||{};OC.pkcs7=OC.pkcs7||{};OC.pkcs7.asn1=MC;var S$6={name:"ContentInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};MC.contentInfoValidator=S$6;var j$6={name:"EncryptedContentInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:r6.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};MC.envelopedDataValidator={name:"EnvelopedData",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(j$6)};MC.encryptedDataValidator={name:"EncryptedData",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"}].concat(j$6)};var gN8={name:"SignerInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:r6.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:r6.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};MC.signedDataValidator={name:"SignedData",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},S$6,{name:"SignedData.Certificates",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:r6.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SET,capture:"signerInfos",optional:!0,value:[gN8]}]};MC.recipientInfoValidator={name:"RecipientInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:r6.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var Hk1=h((PZ5,k$6)=>{var zA=m8();i9();zA.mgf=zA.mgf||{};var mN8=k$6.exports=zA.mgf.mgf1=zA.mgf1=zA.mgf1||{};mN8.create=function(J){var Q={generate:function(Y,X){var G=new zA.util.ByteBuffer,Z=Math.ceil(X/J.digestLength);for(var q=0;q<Z;q++){var V=new zA.util.ByteBuffer;V.putInt32(q),J.start(),J.update(Y+V.getBytes()),G.putBuffer(J.digest())}return G.truncate(G.length()-X),G.getBytes()}};return Q}});var v$6=h((TZ5,y$6)=>{var Z91=m8();Hk1();y$6.exports=Z91.mgf=Z91.mgf||{};Z91.mgf.mgf1=Z91.mgf1});var q91=h((RZ5,x$6)=>{var FA=m8();SG();i9();var pN8=x$6.exports=FA.pss=FA.pss||{};pN8.create=function(J){if(arguments.length===3)J={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]};var{md:Q,mgf:Y}=J,X=Q.digestLength,G=J.salt||null;if(typeof G==="string")G=FA.util.createBuffer(G);var Z;if("saltLength"in J)Z=J.saltLength;else if(G!==null)Z=G.length();else throw Error("Salt length not specified or specific salt not given.");if(G!==null&&G.length()!==Z)throw Error("Given salt length does not match length of given salt.");var q=J.prng||FA.random,V={};return V.encode=function(K,W){var H,z=W-1,U=Math.ceil(z/8),N=K.digest().getBytes();if(U<X+Z+2)throw Error("Message is too long to encrypt.");var O;if(G===null)O=q.getBytesSync(Z);else O=G.bytes();var M=new FA.util.ByteBuffer;M.fillWithByte(0,8),M.putBytes(N),M.putBytes(O),Q.start(),Q.update(M.getBytes());var L=Q.digest().getBytes(),w=new FA.util.ByteBuffer;w.fillWithByte(0,U-Z-X-2),w.putByte(1),w.putBytes(O);var I=w.getBytes(),P=U-X-1,R=Y.generate(L,P),j="";for(H=0;H<P;H++)j+=String.fromCharCode(I.charCodeAt(H)^R.charCodeAt(H));var y=65280>>8*U-z&255;return j=String.fromCharCode(j.charCodeAt(0)&~y)+j.substr(1),j+L+String.fromCharCode(188)},V.verify=function(K,W,H){var z,U=H-1,N=Math.ceil(U/8);if(W=W.substr(-N),N<X+Z+2)throw Error("Inconsistent parameters to PSS signature verification.");if(W.charCodeAt(N-1)!==188)throw Error("Encoded message does not end in 0xBC.");var O=N-X-1,M=W.substr(0,O),L=W.substr(O,X),w=65280>>8*N-U&255;if((M.charCodeAt(0)&w)!==0)throw Error("Bits beyond keysize not zero as expected.");var I=Y.generate(L,O),P="";for(z=0;z<O;z++)P+=String.fromCharCode(M.charCodeAt(z)^I.charCodeAt(z));P=String.fromCharCode(P.charCodeAt(0)&~w)+P.substr(1);var R=N-X-Z-2;for(z=0;z<R;z++)if(P.charCodeAt(z)!==0)throw Error("Leftmost octets not zero as expected");if(P.charCodeAt(R)!==1)throw Error("Inconsistent PSS signature, 0x01 marker not found");var j=P.substr(-Z),y=new FA.util.ByteBuffer;y.fillWithByte(0,8),y.putBytes(K),y.putBytes(j),Q.start(),Q.update(y.getBytes());var f=Q.digest().getBytes();return L===f},V}});var W91=h((CZ5,g$6)=>{var k4=m8();eB();Mq();Kg();yK();v$6();JN();VA();q91();zg();i9();var w1=k4.asn1,R6=g$6.exports=k4.pki=k4.pki||{},u9=R6.oids,i2={};i2.CN=u9.commonName;i2.commonName="CN";i2.C=u9.countryName;i2.countryName="C";i2.L=u9.localityName;i2.localityName="L";i2.ST=u9.stateOrProvinceName;i2.stateOrProvinceName="ST";i2.O=u9.organizationName;i2.organizationName="O";i2.OU=u9.organizationalUnitName;i2.organizationalUnitName="OU";i2.E=u9.emailAddress;i2.emailAddress="E";var h$6=k4.pki.rsa.publicKeyValidator,dN8={name:"Certificate",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:w1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:w1.Class.UNIVERSAL,type:w1.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:w1.Class.UNIVERSAL,type:w1.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:w1.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},h$6,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:w1.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:w1.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:w1.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:w1.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},cN8={name:"rsapss",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:w1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:w1.Class.UNIVERSAL,type:w1.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:w1.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:w1.Class.UNIVERSAL,type:w1.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:w1.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:w1.Class.UNIVERSAL,type:w1.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:w1.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:w1.Class.UNIVERSAL,type:w1.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},lN8={name:"CertificationRequestInfo",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:w1.Class.UNIVERSAL,type:w1.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},h$6,{name:"CertificationRequestInfo.attributes",tagClass:w1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SET,constructed:!0}]}]}]},iN8={name:"CertificationRequest",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[lN8,{name:"CertificationRequest.signatureAlgorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:w1.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};R6.RDNAttributesAsArray=function(J,Q){var Y=[],X,G,Z;for(var q=0;q<J.value.length;++q){X=J.value[q];for(var V=0;V<X.value.length;++V){if(Z={},G=X.value[V],Z.type=w1.derToOid(G.value[0].value),Z.value=G.value[1].value,Z.valueTagClass=G.value[1].type,Z.type in u9){if(Z.name=u9[Z.type],Z.name in i2)Z.shortName=i2[Z.name]}if(Q)Q.update(Z.type),Q.update(Z.value);Y.push(Z)}}return Y};R6.CRIAttributesAsArray=function(J){var Q=[];for(var Y=0;Y<J.length;++Y){var X=J[Y],G=w1.derToOid(X.value[0].value),Z=X.value[1].value;for(var q=0;q<Z.length;++q){var V={};if(V.type=G,V.value=Z[q].value,V.valueTagClass=Z[q].type,V.type in u9){if(V.name=u9[V.type],V.name in i2)V.shortName=i2[V.name]}if(V.type===u9.extensionRequest){V.extensions=[];for(var K=0;K<V.value.length;++K)V.extensions.push(R6.certificateExtensionFromAsn1(V.value[K]))}Q.push(V)}}return Q};function $N(J,Q){if(typeof Q==="string")Q={shortName:Q};var Y=null,X;for(var G=0;Y===null&&G<J.attributes.length;++G)if(X=J.attributes[G],Q.type&&Q.type===X.type)Y=X;else if(Q.name&&Q.name===X.name)Y=X;else if(Q.shortName&&Q.shortName===X.shortName)Y=X;return Y}var V91=function(J,Q,Y){var X={};if(J!==u9["RSASSA-PSS"])return X;if(Y)X={hash:{algorithmOid:u9.sha1},mgf:{algorithmOid:u9.mgf1,hash:{algorithmOid:u9.sha1}},saltLength:20};var G={},Z=[];if(!w1.validate(Q,cN8,G,Z)){var q=Error("Cannot read RSASSA-PSS parameter block.");throw q.errors=Z,q}if(G.hashOid!==void 0)X.hash=X.hash||{},X.hash.algorithmOid=w1.derToOid(G.hashOid);if(G.maskGenOid!==void 0)X.mgf=X.mgf||{},X.mgf.algorithmOid=w1.derToOid(G.maskGenOid),X.mgf.hash=X.mgf.hash||{},X.mgf.hash.algorithmOid=w1.derToOid(G.maskGenHashOid);if(G.saltLength!==void 0)X.saltLength=G.saltLength.charCodeAt(0);return X},K91=function(J){switch(u9[J.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return k4.md.sha1.create();case"md5WithRSAEncryption":return k4.md.md5.create();case"sha256WithRSAEncryption":return k4.md.sha256.create();case"sha384WithRSAEncryption":return k4.md.sha384.create();case"sha512WithRSAEncryption":return k4.md.sha512.create();case"RSASSA-PSS":return k4.md.sha256.create();default:var Q=Error("Could not compute "+J.type+" digest. Unknown signature OID.");throw Q.signatureOid=J.signatureOid,Q}},b$6=function(J){var Q=J.certificate,Y;switch(Q.signatureOid){case u9.sha1WithRSAEncryption:case u9.sha1WithRSASignature:break;case u9["RSASSA-PSS"]:var X,G;if(X=u9[Q.signatureParameters.mgf.hash.algorithmOid],X===void 0||k4.md[X]===void 0){var Z=Error("Unsupported MGF hash function.");throw Z.oid=Q.signatureParameters.mgf.hash.algorithmOid,Z.name=X,Z}if(G=u9[Q.signatureParameters.mgf.algorithmOid],G===void 0||k4.mgf[G]===void 0){var Z=Error("Unsupported MGF function.");throw Z.oid=Q.signatureParameters.mgf.algorithmOid,Z.name=G,Z}if(G=k4.mgf[G].create(k4.md[X].create()),X=u9[Q.signatureParameters.hash.algorithmOid],X===void 0||k4.md[X]===void 0){var Z=Error("Unsupported RSASSA-PSS hash function.");throw Z.oid=Q.signatureParameters.hash.algorithmOid,Z.name=X,Z}Y=k4.pss.create(k4.md[X].create(),G,Q.signatureParameters.saltLength);break}return Q.publicKey.verify(J.md.digest().getBytes(),J.signature,Y)};R6.certificateFromPem=function(J,Q,Y){var X=k4.pem.decode(J)[0];if(X.type!=="CERTIFICATE"&&X.type!=="X509 CERTIFICATE"&&X.type!=="TRUSTED CERTIFICATE"){var G=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw G.headerType=X.type,G}if(X.procType&&X.procType.type==="ENCRYPTED")throw Error("Could not convert certificate from PEM; PEM is encrypted.");var Z=w1.fromDer(X.body,Y);return R6.certificateFromAsn1(Z,Q)};R6.certificateToPem=function(J,Q){var Y={type:"CERTIFICATE",body:w1.toDer(R6.certificateToAsn1(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.publicKeyFromPem=function(J){var Q=k4.pem.decode(J)[0];if(Q.type!=="PUBLIC KEY"&&Q.type!=="RSA PUBLIC KEY"){var Y=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert public key from PEM; PEM is encrypted.");var X=w1.fromDer(Q.body);return R6.publicKeyFromAsn1(X)};R6.publicKeyToPem=function(J,Q){var Y={type:"PUBLIC KEY",body:w1.toDer(R6.publicKeyToAsn1(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.publicKeyToRSAPublicKeyPem=function(J,Q){var Y={type:"RSA PUBLIC KEY",body:w1.toDer(R6.publicKeyToRSAPublicKey(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.getPublicKeyFingerprint=function(J,Q){Q=Q||{};var Y=Q.md||k4.md.sha1.create(),X=Q.type||"RSAPublicKey",G;switch(X){case"RSAPublicKey":G=w1.toDer(R6.publicKeyToRSAPublicKey(J)).getBytes();break;case"SubjectPublicKeyInfo":G=w1.toDer(R6.publicKeyToAsn1(J)).getBytes();break;default:throw Error('Unknown fingerprint type "'+Q.type+'".')}Y.start(),Y.update(G);var Z=Y.digest();if(Q.encoding==="hex"){var q=Z.toHex();if(Q.delimiter)return q.match(/.{2}/g).join(Q.delimiter);return q}else if(Q.encoding==="binary")return Z.getBytes();else if(Q.encoding)throw Error('Unknown encoding "'+Q.encoding+'".');return Z};R6.certificationRequestFromPem=function(J,Q,Y){var X=k4.pem.decode(J)[0];if(X.type!=="CERTIFICATE REQUEST"){var G=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw G.headerType=X.type,G}if(X.procType&&X.procType.type==="ENCRYPTED")throw Error("Could not convert certification request from PEM; PEM is encrypted.");var Z=w1.fromDer(X.body,Y);return R6.certificationRequestFromAsn1(Z,Q)};R6.certificationRequestToPem=function(J,Q){var Y={type:"CERTIFICATE REQUEST",body:w1.toDer(R6.certificationRequestToAsn1(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.createCertificate=function(){var J={};return J.version=2,J.serialNumber="00",J.signatureOid=null,J.signature=null,J.siginfo={},J.siginfo.algorithmOid=null,J.validity={},J.validity.notBefore=new Date,J.validity.notAfter=new Date,J.issuer={},J.issuer.getField=function(Q){return $N(J.issuer,Q)},J.issuer.addField=function(Q){kG([Q]),J.issuer.attributes.push(Q)},J.issuer.attributes=[],J.issuer.hash=null,J.subject={},J.subject.getField=function(Q){return $N(J.subject,Q)},J.subject.addField=function(Q){kG([Q]),J.subject.attributes.push(Q)},J.subject.attributes=[],J.subject.hash=null,J.extensions=[],J.publicKey=null,J.md=null,J.setSubject=function(Q,Y){if(kG(Q),J.subject.attributes=Q,delete J.subject.uniqueId,Y)J.subject.uniqueId=Y;J.subject.hash=null},J.setIssuer=function(Q,Y){if(kG(Q),J.issuer.attributes=Q,delete J.issuer.uniqueId,Y)J.issuer.uniqueId=Y;J.issuer.hash=null},J.setExtensions=function(Q){for(var Y=0;Y<Q.length;++Y)u$6(Q[Y],{cert:J});J.extensions=Q},J.getExtension=function(Q){if(typeof Q==="string")Q={name:Q};var Y=null,X;for(var G=0;Y===null&&G<J.extensions.length;++G)if(X=J.extensions[G],Q.id&&X.id===Q.id)Y=X;else if(Q.name&&X.name===Q.name)Y=X;return Y},J.sign=function(Q,Y){J.md=Y||k4.md.sha1.create();var X=u9[J.md.algorithm+"WithRSAEncryption"];if(!X){var G=Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw G.algorithm=J.md.algorithm,G}J.signatureOid=J.siginfo.algorithmOid=X,J.tbsCertificate=R6.getTBSCertificate(J);var Z=w1.toDer(J.tbsCertificate);J.md.update(Z.getBytes()),J.signature=Q.sign(J.md)},J.verify=function(Q){var Y=!1;if(!J.issued(Q)){var X=Q.issuer,G=J.subject,Z=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw Z.expectedIssuer=G.attributes,Z.actualIssuer=X.attributes,Z}var q=Q.md;if(q===null){q=K91({signatureOid:Q.signatureOid,type:"certificate"});var V=Q.tbsCertificate||R6.getTBSCertificate(Q),K=w1.toDer(V);q.update(K.getBytes())}if(q!==null)Y=b$6({certificate:J,md:q,signature:Q.signature});return Y},J.isIssuer=function(Q){var Y=!1,X=J.issuer,G=Q.subject;if(X.hash&&G.hash)Y=X.hash===G.hash;else if(X.attributes.length===G.attributes.length){Y=!0;var Z,q;for(var V=0;Y&&V<X.attributes.length;++V)if(Z=X.attributes[V],q=G.attributes[V],Z.type!==q.type||Z.value!==q.value)Y=!1}return Y},J.issued=function(Q){return Q.isIssuer(J)},J.generateSubjectKeyIdentifier=function(){return R6.getPublicKeyFingerprint(J.publicKey,{type:"RSAPublicKey"})},J.verifySubjectKeyIdentifier=function(){var Q=u9.subjectKeyIdentifier;for(var Y=0;Y<J.extensions.length;++Y){var X=J.extensions[Y];if(X.id===Q){var G=J.generateSubjectKeyIdentifier().getBytes();return k4.util.hexToBytes(X.subjectKeyIdentifier)===G}}return!1},J};R6.certificateFromAsn1=function(J,Q){var Y={},X=[];if(!w1.validate(J,dN8,Y,X)){var G=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw G.errors=X,G}var Z=w1.derToOid(Y.publicKeyOid);if(Z!==R6.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=R6.createCertificate();q.version=Y.certVersion?Y.certVersion.charCodeAt(0):0;var V=k4.util.createBuffer(Y.certSerialNumber);q.serialNumber=V.toHex(),q.signatureOid=k4.asn1.derToOid(Y.certSignatureOid),q.signatureParameters=V91(q.signatureOid,Y.certSignatureParams,!0),q.siginfo.algorithmOid=k4.asn1.derToOid(Y.certinfoSignatureOid),q.siginfo.parameters=V91(q.siginfo.algorithmOid,Y.certinfoSignatureParams,!1),q.signature=Y.certSignature;var K=[];if(Y.certValidity1UTCTime!==void 0)K.push(w1.utcTimeToDate(Y.certValidity1UTCTime));if(Y.certValidity2GeneralizedTime!==void 0)K.push(w1.generalizedTimeToDate(Y.certValidity2GeneralizedTime));if(Y.certValidity3UTCTime!==void 0)K.push(w1.utcTimeToDate(Y.certValidity3UTCTime));if(Y.certValidity4GeneralizedTime!==void 0)K.push(w1.generalizedTimeToDate(Y.certValidity4GeneralizedTime));if(K.length>2)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(K.length<2)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(q.validity.notBefore=K[0],q.validity.notAfter=K[1],q.tbsCertificate=Y.tbsCertificate,Q){q.md=K91({signatureOid:q.signatureOid,type:"certificate"});var W=w1.toDer(q.tbsCertificate);q.md.update(W.getBytes())}var H=k4.md.sha1.create(),z=w1.toDer(Y.certIssuer);if(H.update(z.getBytes()),q.issuer.getField=function(O){return $N(q.issuer,O)},q.issuer.addField=function(O){kG([O]),q.issuer.attributes.push(O)},q.issuer.attributes=R6.RDNAttributesAsArray(Y.certIssuer),Y.certIssuerUniqueId)q.issuer.uniqueId=Y.certIssuerUniqueId;q.issuer.hash=H.digest().toHex();var U=k4.md.sha1.create(),N=w1.toDer(Y.certSubject);if(U.update(N.getBytes()),q.subject.getField=function(O){return $N(q.subject,O)},q.subject.addField=function(O){kG([O]),q.subject.attributes.push(O)},q.subject.attributes=R6.RDNAttributesAsArray(Y.certSubject),Y.certSubjectUniqueId)q.subject.uniqueId=Y.certSubjectUniqueId;if(q.subject.hash=U.digest().toHex(),Y.certExtensions)q.extensions=R6.certificateExtensionsFromAsn1(Y.certExtensions);else q.extensions=[];return q.publicKey=R6.publicKeyFromAsn1(Y.subjectPublicKeyInfo),q};R6.certificateExtensionsFromAsn1=function(J){var Q=[];for(var Y=0;Y<J.value.length;++Y){var X=J.value[Y];for(var G=0;G<X.value.length;++G)Q.push(R6.certificateExtensionFromAsn1(X.value[G]))}return Q};R6.certificateExtensionFromAsn1=function(J){var Q={};if(Q.id=w1.derToOid(J.value[0].value),Q.critical=!1,J.value[1].type===w1.Type.BOOLEAN)Q.critical=J.value[1].value.charCodeAt(0)!==0,Q.value=J.value[2].value;else Q.value=J.value[1].value;if(Q.id in u9){if(Q.name=u9[Q.id],Q.name==="keyUsage"){var Y=w1.fromDer(Q.value),X=0,G=0;if(Y.value.length>1)X=Y.value.charCodeAt(1),G=Y.value.length>2?Y.value.charCodeAt(2):0;Q.digitalSignature=(X&128)===128,Q.nonRepudiation=(X&64)===64,Q.keyEncipherment=(X&32)===32,Q.dataEncipherment=(X&16)===16,Q.keyAgreement=(X&8)===8,Q.keyCertSign=(X&4)===4,Q.cRLSign=(X&2)===2,Q.encipherOnly=(X&1)===1,Q.decipherOnly=(G&128)===128}else if(Q.name==="basicConstraints"){var Y=w1.fromDer(Q.value);if(Y.value.length>0&&Y.value[0].type===w1.Type.BOOLEAN)Q.cA=Y.value[0].value.charCodeAt(0)!==0;else Q.cA=!1;var Z=null;if(Y.value.length>0&&Y.value[0].type===w1.Type.INTEGER)Z=Y.value[0].value;else if(Y.value.length>1)Z=Y.value[1].value;if(Z!==null)Q.pathLenConstraint=w1.derToInteger(Z)}else if(Q.name==="extKeyUsage"){var Y=w1.fromDer(Q.value);for(var q=0;q<Y.value.length;++q){var V=w1.derToOid(Y.value[q].value);if(V in u9)Q[u9[V]]=!0;else Q[V]=!0}}else if(Q.name==="nsCertType"){var Y=w1.fromDer(Q.value),X=0;if(Y.value.length>1)X=Y.value.charCodeAt(1);Q.client=(X&128)===128,Q.server=(X&64)===64,Q.email=(X&32)===32,Q.objsign=(X&16)===16,Q.reserved=(X&8)===8,Q.sslCA=(X&4)===4,Q.emailCA=(X&2)===2,Q.objCA=(X&1)===1}else if(Q.name==="subjectAltName"||Q.name==="issuerAltName"){Q.altNames=[];var K,Y=w1.fromDer(Q.value);for(var W=0;W<Y.value.length;++W){K=Y.value[W];var H={type:K.type,value:K.value};switch(Q.altNames.push(H),K.type){case 1:case 2:case 6:break;case 7:H.ip=k4.util.bytesToIP(K.value);break;case 8:H.oid=w1.derToOid(K.value);break;default:}}}else if(Q.name==="subjectKeyIdentifier"){var Y=w1.fromDer(Q.value);Q.subjectKeyIdentifier=k4.util.bytesToHex(Y.value)}}return Q};R6.certificationRequestFromAsn1=function(J,Q){var Y={},X=[];if(!w1.validate(J,iN8,Y,X)){var G=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw G.errors=X,G}var Z=w1.derToOid(Y.publicKeyOid);if(Z!==R6.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=R6.createCertificationRequest();if(q.version=Y.csrVersion?Y.csrVersion.charCodeAt(0):0,q.signatureOid=k4.asn1.derToOid(Y.csrSignatureOid),q.signatureParameters=V91(q.signatureOid,Y.csrSignatureParams,!0),q.siginfo.algorithmOid=k4.asn1.derToOid(Y.csrSignatureOid),q.siginfo.parameters=V91(q.siginfo.algorithmOid,Y.csrSignatureParams,!1),q.signature=Y.csrSignature,q.certificationRequestInfo=Y.certificationRequestInfo,Q){q.md=K91({signatureOid:q.signatureOid,type:"certification request"});var V=w1.toDer(q.certificationRequestInfo);q.md.update(V.getBytes())}var K=k4.md.sha1.create();return q.subject.getField=function(W){return $N(q.subject,W)},q.subject.addField=function(W){kG([W]),q.subject.attributes.push(W)},q.subject.attributes=R6.RDNAttributesAsArray(Y.certificationRequestInfoSubject,K),q.subject.hash=K.digest().toHex(),q.publicKey=R6.publicKeyFromAsn1(Y.subjectPublicKeyInfo),q.getAttribute=function(W){return $N(q,W)},q.addAttribute=function(W){kG([W]),q.attributes.push(W)},q.attributes=R6.CRIAttributesAsArray(Y.certificationRequestInfoAttributes||[]),q};R6.createCertificationRequest=function(){var J={};return J.version=0,J.signatureOid=null,J.signature=null,J.siginfo={},J.siginfo.algorithmOid=null,J.subject={},J.subject.getField=function(Q){return $N(J.subject,Q)},J.subject.addField=function(Q){kG([Q]),J.subject.attributes.push(Q)},J.subject.attributes=[],J.subject.hash=null,J.publicKey=null,J.attributes=[],J.getAttribute=function(Q){return $N(J,Q)},J.addAttribute=function(Q){kG([Q]),J.attributes.push(Q)},J.md=null,J.setSubject=function(Q){kG(Q),J.subject.attributes=Q,J.subject.hash=null},J.setAttributes=function(Q){kG(Q),J.attributes=Q},J.sign=function(Q,Y){J.md=Y||k4.md.sha1.create();var X=u9[J.md.algorithm+"WithRSAEncryption"];if(!X){var G=Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw G.algorithm=J.md.algorithm,G}J.signatureOid=J.siginfo.algorithmOid=X,J.certificationRequestInfo=R6.getCertificationRequestInfo(J);var Z=w1.toDer(J.certificationRequestInfo);J.md.update(Z.getBytes()),J.signature=Q.sign(J.md)},J.verify=function(){var Q=!1,Y=J.md;if(Y===null){Y=K91({signatureOid:J.signatureOid,type:"certification request"});var X=J.certificationRequestInfo||R6.getCertificationRequestInfo(J),G=w1.toDer(X);Y.update(G.getBytes())}if(Y!==null)Q=b$6({certificate:J,md:Y,signature:J.signature});return Q},J};function LC(J){var Q=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]),Y,X,G=J.attributes;for(var Z=0;Z<G.length;++Z){Y=G[Z];var q=Y.value,V=w1.Type.PRINTABLESTRING;if("valueTagClass"in Y){if(V=Y.valueTagClass,V===w1.Type.UTF8)q=k4.util.encodeUtf8(q)}X=w1.create(w1.Class.UNIVERSAL,w1.Type.SET,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Y.type).getBytes()),w1.create(w1.Class.UNIVERSAL,V,!1,q)])]),Q.value.push(X)}return Q}function kG(J){var Q;for(var Y=0;Y<J.length;++Y){if(Q=J[Y],typeof Q.name>"u"){if(Q.type&&Q.type in R6.oids)Q.name=R6.oids[Q.type];else if(Q.shortName&&Q.shortName in i2)Q.name=R6.oids[i2[Q.shortName]]}if(typeof Q.type>"u")if(Q.name&&Q.name in R6.oids)Q.type=R6.oids[Q.name];else{var X=Error("Attribute type not specified.");throw X.attribute=Q,X}if(typeof Q.shortName>"u"){if(Q.name&&Q.name in i2)Q.shortName=i2[Q.name]}if(Q.type===u9.extensionRequest){if(Q.valueConstructed=!0,Q.valueTagClass=w1.Type.SEQUENCE,!Q.value&&Q.extensions){Q.value=[];for(var G=0;G<Q.extensions.length;++G)Q.value.push(R6.certificateExtensionToAsn1(u$6(Q.extensions[G])))}}if(typeof Q.value>"u"){var X=Error("Attribute value not specified.");throw X.attribute=Q,X}}}function u$6(J,Q){if(Q=Q||{},typeof J.name>"u"){if(J.id&&J.id in R6.oids)J.name=R6.oids[J.id]}if(typeof J.id>"u")if(J.name&&J.name in R6.oids)J.id=R6.oids[J.name];else{var Y=Error("Extension ID not specified.");throw Y.extension=J,Y}if(typeof J.value<"u")return J;if(J.name==="keyUsage"){var X=0,G=0,Z=0;if(J.digitalSignature)G|=128,X=7;if(J.nonRepudiation)G|=64,X=6;if(J.keyEncipherment)G|=32,X=5;if(J.dataEncipherment)G|=16,X=4;if(J.keyAgreement)G|=8,X=3;if(J.keyCertSign)G|=4,X=2;if(J.cRLSign)G|=2,X=1;if(J.encipherOnly)G|=1,X=0;if(J.decipherOnly)Z|=128,X=7;var q=String.fromCharCode(X);if(Z!==0)q+=String.fromCharCode(G)+String.fromCharCode(Z);else if(G!==0)q+=String.fromCharCode(G);J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,q)}else if(J.name==="basicConstraints"){if(J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]),J.cA)J.value.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.BOOLEAN,!1,String.fromCharCode(255)));if("pathLenConstraint"in J)J.value.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(J.pathLenConstraint).getBytes()))}else if(J.name==="extKeyUsage"){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var V=J.value.value;for(var K in J){if(J[K]!==!0)continue;if(K in u9)V.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(u9[K]).getBytes()));else if(K.indexOf(".")!==-1)V.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(K).getBytes()))}}else if(J.name==="nsCertType"){var X=0,G=0;if(J.client)G|=128,X=7;if(J.server)G|=64,X=6;if(J.email)G|=32,X=5;if(J.objsign)G|=16,X=4;if(J.reserved)G|=8,X=3;if(J.sslCA)G|=4,X=2;if(J.emailCA)G|=2,X=1;if(J.objCA)G|=1,X=0;var q=String.fromCharCode(X);if(G!==0)q+=String.fromCharCode(G);J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,q)}else if(J.name==="subjectAltName"||J.name==="issuerAltName"){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var W;for(var H=0;H<J.altNames.length;++H){W=J.altNames[H];var q=W.value;if(W.type===7&&W.ip){if(q=k4.util.bytesFromIP(W.ip),q===null){var Y=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw Y.extension=J,Y}}else if(W.type===8)if(W.oid)q=w1.oidToDer(w1.oidToDer(W.oid));else q=w1.oidToDer(q);J.value.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,W.type,!1,q))}}else if(J.name==="nsComment"&&Q.cert){if(!/^[\x00-\x7F]*$/.test(J.comment)||J.comment.length<1||J.comment.length>128)throw Error('Invalid "nsComment" content.');J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.IA5STRING,!1,J.comment)}else if(J.name==="subjectKeyIdentifier"&&Q.cert){var z=Q.cert.generateSubjectKeyIdentifier();J.subjectKeyIdentifier=z.toHex(),J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.OCTETSTRING,!1,z.getBytes())}else if(J.name==="authorityKeyIdentifier"&&Q.cert){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var V=J.value.value;if(J.keyIdentifier){var U=J.keyIdentifier===!0?Q.cert.generateSubjectKeyIdentifier().getBytes():J.keyIdentifier;V.push(w1.create(w1.Class.CONTEXT_SPECIFIC,0,!1,U))}if(J.authorityCertIssuer){var N=[w1.create(w1.Class.CONTEXT_SPECIFIC,4,!0,[LC(J.authorityCertIssuer===!0?Q.cert.issuer:J.authorityCertIssuer)])];V.push(w1.create(w1.Class.CONTEXT_SPECIFIC,1,!0,N))}if(J.serialNumber){var O=k4.util.hexToBytes(J.serialNumber===!0?Q.cert.serialNumber:J.serialNumber);V.push(w1.create(w1.Class.CONTEXT_SPECIFIC,2,!1,O))}}else if(J.name==="cRLDistributionPoints"){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var V=J.value.value,M=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]),L=w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[]),W;for(var H=0;H<J.altNames.length;++H){W=J.altNames[H];var q=W.value;if(W.type===7&&W.ip){if(q=k4.util.bytesFromIP(W.ip),q===null){var Y=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw Y.extension=J,Y}}else if(W.type===8)if(W.oid)q=w1.oidToDer(w1.oidToDer(W.oid));else q=w1.oidToDer(q);L.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,W.type,!1,q))}M.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[L])),V.push(M)}if(typeof J.value>"u"){var Y=Error("Extension value not specified.");throw Y.extension=J,Y}return J}function zk1(J,Q){switch(J){case u9["RSASSA-PSS"]:var Y=[];if(Q.hash.algorithmOid!==void 0)Y.push(w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Q.hash.algorithmOid).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.NULL,!1,"")])]));if(Q.mgf.algorithmOid!==void 0)Y.push(w1.create(w1.Class.CONTEXT_SPECIFIC,1,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Q.mgf.algorithmOid).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Q.mgf.hash.algorithmOid).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.NULL,!1,"")])])]));if(Q.saltLength!==void 0)Y.push(w1.create(w1.Class.CONTEXT_SPECIFIC,2,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(Q.saltLength).getBytes())]));return w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,Y);default:return w1.create(w1.Class.UNIVERSAL,w1.Type.NULL,!1,"")}}function nN8(J){var Q=w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[]);if(J.attributes.length===0)return Q;var Y=J.attributes;for(var X=0;X<Y.length;++X){var G=Y[X],Z=G.value,q=w1.Type.UTF8;if("valueTagClass"in G)q=G.valueTagClass;if(q===w1.Type.UTF8)Z=k4.util.encodeUtf8(Z);var V=!1;if("valueConstructed"in G)V=G.valueConstructed;var K=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(G.type).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.SET,!0,[w1.create(w1.Class.UNIVERSAL,q,V,Z)])]);Q.value.push(K)}return Q}var aN8=new Date("1950-01-01T00:00:00Z"),rN8=new Date("2050-01-01T00:00:00Z");function f$6(J){if(J>=aN8&&J<rN8)return w1.create(w1.Class.UNIVERSAL,w1.Type.UTCTIME,!1,w1.dateToUtcTime(J));else return w1.create(w1.Class.UNIVERSAL,w1.Type.GENERALIZEDTIME,!1,w1.dateToGeneralizedTime(J))}R6.getTBSCertificate=function(J){var Q=f$6(J.validity.notBefore),Y=f$6(J.validity.notAfter),X=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(J.version).getBytes())]),w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,k4.util.hexToBytes(J.serialNumber)),w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.siginfo.algorithmOid).getBytes()),zk1(J.siginfo.algorithmOid,J.siginfo.parameters)]),LC(J.issuer),w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[Q,Y]),LC(J.subject),R6.publicKeyToAsn1(J.publicKey)]);if(J.issuer.uniqueId)X.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,1,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.issuer.uniqueId)]));if(J.subject.uniqueId)X.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,2,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.subject.uniqueId)]));if(J.extensions.length>0)X.value.push(R6.certificateExtensionsToAsn1(J.extensions));return X};R6.getCertificationRequestInfo=function(J){var Q=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(J.version).getBytes()),LC(J.subject),R6.publicKeyToAsn1(J.publicKey),nN8(J)]);return Q};R6.distinguishedNameToAsn1=function(J){return LC(J)};R6.certificateToAsn1=function(J){var Q=J.tbsCertificate||R6.getTBSCertificate(J);return w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[Q,w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.signatureOid).getBytes()),zk1(J.signatureOid,J.signatureParameters)]),w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.signature)])};R6.certificateExtensionsToAsn1=function(J){var Q=w1.create(w1.Class.CONTEXT_SPECIFIC,3,!0,[]),Y=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);Q.value.push(Y);for(var X=0;X<J.length;++X)Y.value.push(R6.certificateExtensionToAsn1(J[X]));return Q};R6.certificateExtensionToAsn1=function(J){var Q=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);if(Q.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.id).getBytes())),J.critical)Q.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.BOOLEAN,!1,String.fromCharCode(255)));var Y=J.value;if(typeof J.value!=="string")Y=w1.toDer(Y).getBytes();return Q.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OCTETSTRING,!1,Y)),Q};R6.certificationRequestToAsn1=function(J){var Q=J.certificationRequestInfo||R6.getCertificationRequestInfo(J);return w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[Q,w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.signatureOid).getBytes()),zk1(J.signatureOid,J.signatureParameters)]),w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.signature)])};R6.createCaStore=function(J){var Q={certs:{}};Q.getIssuer=function(q){var V=Y(q.issuer);return V},Q.addCertificate=function(q){if(typeof q==="string")q=k4.pki.certificateFromPem(q);if(X(q.subject),!Q.hasCertificate(q))if(q.subject.hash in Q.certs){var V=Q.certs[q.subject.hash];if(!k4.util.isArray(V))V=[V];V.push(q),Q.certs[q.subject.hash]=V}else Q.certs[q.subject.hash]=q},Q.hasCertificate=function(q){if(typeof q==="string")q=k4.pki.certificateFromPem(q);var V=Y(q.subject);if(!V)return!1;if(!k4.util.isArray(V))V=[V];var K=w1.toDer(R6.certificateToAsn1(q)).getBytes();for(var W=0;W<V.length;++W){var H=w1.toDer(R6.certificateToAsn1(V[W])).getBytes();if(K===H)return!0}return!1},Q.listAllCertificates=function(){var q=[];for(var V in Q.certs)if(Q.certs.hasOwnProperty(V)){var K=Q.certs[V];if(!k4.util.isArray(K))q.push(K);else for(var W=0;W<K.length;++W)q.push(K[W])}return q},Q.removeCertificate=function(q){var V;if(typeof q==="string")q=k4.pki.certificateFromPem(q);if(X(q.subject),!Q.hasCertificate(q))return null;var K=Y(q.subject);if(!k4.util.isArray(K))return V=Q.certs[q.subject.hash],delete Q.certs[q.subject.hash],V;var W=w1.toDer(R6.certificateToAsn1(q)).getBytes();for(var H=0;H<K.length;++H){var z=w1.toDer(R6.certificateToAsn1(K[H])).getBytes();if(W===z)V=K[H],K.splice(H,1)}if(K.length===0)delete Q.certs[q.subject.hash];return V};function Y(q){return X(q),Q.certs[q.hash]||null}function X(q){if(!q.hash){var V=k4.md.sha1.create();q.attributes=R6.RDNAttributesAsArray(LC(q),V),q.hash=V.digest().toHex()}}if(J)for(var G=0;G<J.length;++G){var Z=J[G];Q.addCertificate(Z)}return Q};R6.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"};R6.verifyCertificateChain=function(J,Q,Y){if(typeof Y==="function")Y={verify:Y};Y=Y||{},Q=Q.slice(0);var X=Q.slice(0),G=Y.validityCheckDate;if(typeof G>"u")G=new Date;var Z=!0,q=null,V=0;do{var K=Q.shift(),W=null,H=!1;if(G){if(G<K.validity.notBefore||G>K.validity.notAfter)q={message:"Certificate is not valid yet or has expired.",error:R6.certificateError.certificate_expired,notBefore:K.validity.notBefore,notAfter:K.validity.notAfter,now:G}}if(q===null){if(W=Q[0]||J.getIssuer(K),W===null){if(K.isIssuer(K))H=!0,W=K}if(W){var z=W;if(!k4.util.isArray(z))z=[z];var U=!1;while(!U&&z.length>0){W=z.shift();try{U=W.verify(K)}catch(j){}}if(!U)q={message:"Certificate signature is invalid.",error:R6.certificateError.bad_certificate}}if(q===null&&(!W||H)&&!J.hasCertificate(K))q={message:"Certificate is not trusted.",error:R6.certificateError.unknown_ca}}if(q===null&&W&&!K.isIssuer(W))q={message:"Certificate issuer is invalid.",error:R6.certificateError.bad_certificate};if(q===null){var N={keyUsage:!0,basicConstraints:!0};for(var O=0;q===null&&O<K.extensions.length;++O){var M=K.extensions[O];if(M.critical&&!(M.name in N))q={message:"Certificate has an unsupported critical extension.",error:R6.certificateError.unsupported_certificate}}}if(q===null&&(!Z||Q.length===0&&(!W||H))){var L=K.getExtension("basicConstraints"),w=K.getExtension("keyUsage");if(w!==null){if(!w.keyCertSign||L===null)q={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:R6.certificateError.bad_certificate}}if(q===null&&L!==null&&!L.cA)q={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:R6.certificateError.bad_certificate};if(q===null&&w!==null&&"pathLenConstraint"in L){var I=V-1;if(I>L.pathLenConstraint)q={message:"Certificate basicConstraints pathLenConstraint violated.",error:R6.certificateError.bad_certificate}}}var P=q===null?!0:q.error,R=Y.verify?Y.verify(P,V,X):P;if(R===!0)q=null;else{if(P===!0)q={message:"The application rejected the certificate.",error:R6.certificateError.bad_certificate};if(R||R===0){if(typeof R==="object"&&!k4.util.isArray(R)){if(R.message)q.message=R.message;if(R.error)q.error=R.error}else if(typeof R==="string")q.error=R}throw q}Z=!1,++V}while(Q.length>0);return!0}});var Uk1=h((SZ5,p$6)=>{var J2=m8();Mq();FC();JN();Wk1();Kk1();SG();zg();DC();i9();W91();var{asn1:o1,pki:M9}=J2,Ug=p$6.exports=J2.pkcs12=J2.pkcs12||{},m$6={name:"ContentInfo",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:o1.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},oN8={name:"PFX",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:o1.Class.UNIVERSAL,type:o1.Type.INTEGER,constructed:!1,capture:"version"},m$6,{name:"PFX.macData",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:o1.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:o1.Class.UNIVERSAL,type:o1.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},sN8={name:"SafeBag",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:o1.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},tN8={name:"Attribute",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SET,constructed:!0,capture:"values"}]},eN8={name:"CertBag",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:o1.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:o1.Class.UNIVERSAL,type:o1.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Fg(J,Q,Y,X){var G=[];for(var Z=0;Z<J.length;Z++)for(var q=0;q<J[Z].safeBags.length;q++){var V=J[Z].safeBags[q];if(X!==void 0&&V.type!==X)continue;if(Q===null){G.push(V);continue}if(V.attributes[Q]!==void 0&&V.attributes[Q].indexOf(Y)>=0)G.push(V)}return G}Ug.pkcs12FromAsn1=function(J,Q,Y){if(typeof Q==="string")Y=Q,Q=!0;else if(Q===void 0)Q=!0;var X={},G=[];if(!o1.validate(J,oN8,X,G)){var Z=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw Z.errors=Z,Z}var q={version:X.version.charCodeAt(0),safeContents:[],getBags:function(L){var w={},I;if("localKeyId"in L)I=L.localKeyId;else if("localKeyIdHex"in L)I=J2.util.hexToBytes(L.localKeyIdHex);if(I===void 0&&!("friendlyName"in L)&&"bagType"in L)w[L.bagType]=Fg(q.safeContents,null,null,L.bagType);if(I!==void 0)w.localKeyId=Fg(q.safeContents,"localKeyId",I,L.bagType);if("friendlyName"in L)w.friendlyName=Fg(q.safeContents,"friendlyName",L.friendlyName,L.bagType);return w},getBagsByFriendlyName:function(L,w){return Fg(q.safeContents,"friendlyName",L,w)},getBagsByLocalKeyId:function(L,w){return Fg(q.safeContents,"localKeyId",L,w)}};if(X.version.charCodeAt(0)!==3){var Z=Error("PKCS#12 PFX of version other than 3 not supported.");throw Z.version=X.version.charCodeAt(0),Z}if(o1.derToOid(X.contentType)!==M9.oids.data){var Z=Error("Only PKCS#12 PFX in password integrity mode supported.");throw Z.oid=o1.derToOid(X.contentType),Z}var V=X.content.value[0];if(V.tagClass!==o1.Class.UNIVERSAL||V.type!==o1.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(V=Fk1(V),X.mac){var K=null,W=0,H=o1.derToOid(X.macAlgorithm);switch(H){case M9.oids.sha1:K=J2.md.sha1.create(),W=20;break;case M9.oids.sha256:K=J2.md.sha256.create(),W=32;break;case M9.oids.sha384:K=J2.md.sha384.create(),W=48;break;case M9.oids.sha512:K=J2.md.sha512.create(),W=64;break;case M9.oids.md5:K=J2.md.md5.create(),W=16;break}if(K===null)throw Error("PKCS#12 uses unsupported MAC algorithm: "+H);var z=new J2.util.ByteBuffer(X.macSalt),U="macIterations"in X?parseInt(J2.util.bytesToHex(X.macIterations),16):1,N=Ug.generateKey(Y,z,3,U,W,K),O=J2.hmac.create();O.start(K,N),O.update(V.value);var M=O.getMac();if(M.getBytes()!==X.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?")}return JD8(q,V.value,Q,Y),q};function Fk1(J){if(J.composed||J.constructed){var Q=J2.util.createBuffer();for(var Y=0;Y<J.value.length;++Y)Q.putBytes(J.value[Y].value);J.composed=J.constructed=!1,J.value=Q.getBytes()}return J}function JD8(J,Q,Y,X){if(Q=o1.fromDer(Q,Y),Q.tagClass!==o1.Class.UNIVERSAL||Q.type!==o1.Type.SEQUENCE||Q.constructed!==!0)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var G=0;G<Q.value.length;G++){var Z=Q.value[G],q={},V=[];if(!o1.validate(Z,m$6,q,V)){var K=Error("Cannot read ContentInfo.");throw K.errors=V,K}var W={encrypted:!1},H=null,z=q.content.value[0];switch(o1.derToOid(q.contentType)){case M9.oids.data:if(z.tagClass!==o1.Class.UNIVERSAL||z.type!==o1.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");H=Fk1(z).value;break;case M9.oids.encryptedData:H=QD8(z,X),W.encrypted=!0;break;default:var K=Error("Unsupported PKCS#12 contentType.");throw K.contentType=o1.derToOid(q.contentType),K}W.safeBags=YD8(H,Y,X),J.safeContents.push(W)}}function QD8(J,Q){var Y={},X=[];if(!o1.validate(J,J2.pkcs7.asn1.encryptedDataValidator,Y,X)){var G=Error("Cannot read EncryptedContentInfo.");throw G.errors=X,G}var Z=o1.derToOid(Y.contentType);if(Z!==M9.oids.data){var G=Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw G.oid=Z,G}Z=o1.derToOid(Y.encAlgorithm);var q=M9.pbe.getCipher(Z,Y.encParameter,Q),V=Fk1(Y.encryptedContentAsn1),K=J2.util.createBuffer(V.value);if(q.update(K),!q.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");return q.output.getBytes()}function YD8(J,Q,Y){if(!Q&&J.length===0)return[];if(J=o1.fromDer(J,Q),J.tagClass!==o1.Class.UNIVERSAL||J.type!==o1.Type.SEQUENCE||J.constructed!==!0)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");var X=[];for(var G=0;G<J.value.length;G++){var Z=J.value[G],q={},V=[];if(!o1.validate(Z,sN8,q,V)){var K=Error("Cannot read SafeBag.");throw K.errors=V,K}var W={type:o1.derToOid(q.bagId),attributes:$D8(q.bagAttributes)};X.push(W);var H,z,U=q.bagValue.value[0];switch(W.type){case M9.oids.pkcs8ShroudedKeyBag:if(U=M9.decryptPrivateKeyInfo(U,Y),U===null)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case M9.oids.keyBag:try{W.key=M9.privateKeyFromAsn1(U)}catch(O){W.key=null,W.asn1=U}continue;case M9.oids.certBag:H=eN8,z=function(){if(o1.derToOid(q.certId)!==M9.oids.x509Certificate){var O=Error("Unsupported certificate type, only X.509 supported.");throw O.oid=o1.derToOid(q.certId),O}var M=o1.fromDer(q.cert,Q);try{W.cert=M9.certificateFromAsn1(M,!0)}catch(L){W.cert=null,W.asn1=M}};break;default:var K=Error("Unsupported PKCS#12 SafeBag type.");throw K.oid=W.type,K}if(H!==void 0&&!o1.validate(U,H,q,V)){var K=Error("Cannot read PKCS#12 "+H.name);throw K.errors=V,K}z()}return X}function $D8(J){var Q={};if(J!==void 0)for(var Y=0;Y<J.length;++Y){var X={},G=[];if(!o1.validate(J[Y],tN8,X,G)){var Z=Error("Cannot read PKCS#12 BagAttribute.");throw Z.errors=G,Z}var q=o1.derToOid(X.oid);if(M9.oids[q]===void 0)continue;Q[M9.oids[q]]=[];for(var V=0;V<X.values.length;++V)Q[M9.oids[q]].push(X.values[V].value)}return Q}Ug.toPkcs12Asn1=function(J,Q,Y,X){if(X=X||{},X.saltSize=X.saltSize||8,X.count=X.count||2048,X.algorithm=X.algorithm||X.encAlgorithm||"aes128",!("useMac"in X))X.useMac=!0;if(!("localKeyId"in X))X.localKeyId=null;if(!("generateLocalKeyId"in X))X.generateLocalKeyId=!0;var G=X.localKeyId,Z;if(G!==null)G=J2.util.hexToBytes(G);else if(X.generateLocalKeyId)if(Q){var q=J2.util.isArray(Q)?Q[0]:Q;if(typeof q==="string")q=M9.certificateFromPem(q);var V=J2.md.sha1.create();V.update(o1.toDer(M9.certificateToAsn1(q)).getBytes()),G=V.digest().getBytes()}else G=J2.random.getBytes(20);var K=[];if(G!==null)K.push(o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.localKeyId).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.SET,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,G)])]));if("friendlyName"in X)K.push(o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.friendlyName).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.SET,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.BMPSTRING,!1,X.friendlyName)])]));if(K.length>0)Z=o1.create(o1.Class.UNIVERSAL,o1.Type.SET,!0,K);var W=[],H=[];if(Q!==null)if(J2.util.isArray(Q))H=Q;else H=[Q];var z=[];for(var U=0;U<H.length;++U){if(Q=H[U],typeof Q==="string")Q=M9.certificateFromPem(Q);var N=U===0?Z:void 0,O=M9.certificateToAsn1(Q),M=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.certBag).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.x509Certificate).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(O).getBytes())])])]),N]);z.push(M)}if(z.length>0){var L=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,z),w=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.data).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(L).getBytes())])]);W.push(w)}var I=null;if(J!==null){var P=M9.wrapRsaPrivateKey(M9.privateKeyToAsn1(J));if(Y===null)I=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.keyBag).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[P]),Z]);else I=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.pkcs8ShroudedKeyBag).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[M9.encryptPrivateKeyInfo(P,Y,X)]),Z]);var R=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[I]),j=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.data).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(R).getBytes())])]);W.push(j)}var y=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,W),f;if(X.useMac){var V=J2.md.sha1.create(),g=new J2.util.ByteBuffer(J2.random.getBytes(X.saltSize)),p=X.count,J=Ug.generateKey(Y,g,3,p,20),b=J2.hmac.create();b.start(V,J),b.update(o1.toDer(y).getBytes());var i=b.getMac();f=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.sha1).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.NULL,!1,"")]),o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,i.getBytes())]),o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,g.getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.INTEGER,!1,o1.integerToDer(p).getBytes())])}return o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.INTEGER,!1,o1.integerToDer(3).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.data).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(y).getBytes())])]),f])};Ug.generateKey=J2.pbe.generatePkcs12Key});var Nk1=h((jZ5,d$6)=>{var XN=m8();Mq();JN();Kk1();VA();J91();Uk1();q91();zg();i9();W91();var Bk1=XN.asn1,AC=d$6.exports=XN.pki=XN.pki||{};AC.pemToDer=function(J){var Q=XN.pem.decode(J)[0];if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert PEM to DER; PEM is encrypted.");return XN.util.createBuffer(Q.body)};AC.privateKeyFromPem=function(J){var Q=XN.pem.decode(J)[0];if(Q.type!=="PRIVATE KEY"&&Q.type!=="RSA PRIVATE KEY"){var Y=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert private key from PEM; PEM is encrypted.");var X=Bk1.fromDer(Q.body);return AC.privateKeyFromAsn1(X)};AC.privateKeyToPem=function(J,Q){var Y={type:"RSA PRIVATE KEY",body:Bk1.toDer(AC.privateKeyToAsn1(J)).getBytes()};return XN.pem.encode(Y,{maxline:Q})};AC.privateKeyInfoToPem=function(J,Q){var Y={type:"PRIVATE KEY",body:Bk1.toDer(J).getBytes()};return XN.pem.encode(Y,{maxline:Q})}});var Ek1=h((_Z5,s$6)=>{var X6=m8();Mq();FC();o81();VA();Nk1();SG();DC();i9();var F91=function(J,Q,Y,X){var G=X6.util.createBuffer(),Z=J.length>>1,q=Z+(J.length&1),V=J.substr(0,q),K=J.substr(Z,q),W=X6.util.createBuffer(),H=X6.hmac.create();Y=Q+Y;var z=Math.ceil(X/16),U=Math.ceil(X/20);H.start("MD5",V);var N=X6.util.createBuffer();W.putBytes(Y);for(var O=0;O<z;++O)H.start(null,null),H.update(W.getBytes()),W.putBuffer(H.digest()),H.start(null,null),H.update(W.bytes()+Y),N.putBuffer(H.digest());H.start("SHA1",K);var M=X6.util.createBuffer();W.clear(),W.putBytes(Y);for(var O=0;O<U;++O)H.start(null,null),H.update(W.getBytes()),W.putBuffer(H.digest()),H.start(null,null),H.update(W.bytes()+Y),M.putBuffer(H.digest());return G.putBytes(X6.util.xorBytes(N.getBytes(),M.getBytes(),X)),G},XD8=function(J,Q,Y){var X=X6.hmac.create();X.start("SHA1",J);var G=X6.util.createBuffer();return G.putInt32(Q[0]),G.putInt32(Q[1]),G.putByte(Y.type),G.putByte(Y.version.major),G.putByte(Y.version.minor),G.putInt16(Y.length),G.putBytes(Y.fragment.bytes()),X.update(G.getBytes()),X.digest().getBytes()},GD8=function(J,Q,Y){var X=!1;try{var G=J.deflate(Q.fragment.getBytes());Q.fragment=X6.util.createBuffer(G),Q.length=G.length,X=!0}catch(Z){}return X},ZD8=function(J,Q,Y){var X=!1;try{var G=J.inflate(Q.fragment.getBytes());Q.fragment=X6.util.createBuffer(G),Q.length=G.length,X=!0}catch(Z){}return X},t$=function(J,Q){var Y=0;switch(Q){case 1:Y=J.getByte();break;case 2:Y=J.getInt16();break;case 3:Y=J.getInt24();break;case 4:Y=J.getInt32();break}return X6.util.createBuffer(J.getBytes(Y))},yG=function(J,Q,Y){J.putInt(Y.length(),Q<<3),J.putBuffer(Y)},C1={};C1.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};C1.SupportedVersions=[C1.Versions.TLS_1_1,C1.Versions.TLS_1_0];C1.Version=C1.SupportedVersions[0];C1.MaxFragment=15360;C1.ConnectionEnd={server:0,client:1};C1.PRFAlgorithm={tls_prf_sha256:0};C1.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};C1.CipherType={stream:0,block:1,aead:2};C1.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};C1.CompressionMethod={none:0,deflate:1};C1.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};C1.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};C1.Alert={};C1.Alert.Level={warning:1,fatal:2};C1.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};C1.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};C1.CipherSuites={};C1.getCipherSuite=function(J){var Q=null;for(var Y in C1.CipherSuites){var X=C1.CipherSuites[Y];if(X.id[0]===J.charCodeAt(0)&&X.id[1]===J.charCodeAt(1)){Q=X;break}}return Q};C1.handleUnexpected=function(J,Q){var Y=!J.open&&J.entity===C1.ConnectionEnd.client;if(!Y)J.error(J,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unexpected_message}})};C1.handleHelloRequest=function(J,Q,Y){if(!J.handshaking&&J.handshakes>0)C1.queue(J,C1.createAlert(J,{level:C1.Alert.Level.warning,description:C1.Alert.Description.no_renegotiation})),C1.flush(J);J.process()};C1.parseHelloMessage=function(J,Q,Y){var X=null,G=J.entity===C1.ConnectionEnd.client;if(Y<38)J.error(J,{message:G?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});else{var Z=Q.fragment,q=Z.length();if(X={version:{major:Z.getByte(),minor:Z.getByte()},random:X6.util.createBuffer(Z.getBytes(32)),session_id:t$(Z,1),extensions:[]},G)X.cipher_suite=Z.getBytes(2),X.compression_method=Z.getByte();else X.cipher_suites=t$(Z,2),X.compression_methods=t$(Z,1);if(q=Y-(q-Z.length()),q>0){var V=t$(Z,2);while(V.length()>0)X.extensions.push({type:[V.getByte(),V.getByte()],data:t$(V,2)});if(!G)for(var K=0;K<X.extensions.length;++K){var W=X.extensions[K];if(W.type[0]===0&&W.type[1]===0){var H=t$(W.data,2);while(H.length()>0){var z=H.getByte();if(z!==0)break;J.session.extensions.server_name.serverNameList.push(t$(H,2).getBytes())}}}}if(J.session.version){if(X.version.major!==J.session.version.major||X.version.minor!==J.session.version.minor)return J.error(J,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.protocol_version}})}if(G)J.session.cipherSuite=C1.getCipherSuite(X.cipher_suite);else{var U=X6.util.createBuffer(X.cipher_suites.bytes());while(U.length()>0)if(J.session.cipherSuite=C1.getCipherSuite(U.getBytes(2)),J.session.cipherSuite!==null)break}if(J.session.cipherSuite===null)return J.error(J,{message:"No cipher suites in common.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.handshake_failure},cipherSuite:X6.util.bytesToHex(X.cipher_suite)});if(G)J.session.compressionMethod=X.compression_method;else J.session.compressionMethod=C1.CompressionMethod.none}return X};C1.createSecurityParameters=function(J,Q){var Y=J.entity===C1.ConnectionEnd.client,X=Q.random.bytes(),G=Y?J.session.sp.client_random:X,Z=Y?X:C1.createRandom().getBytes();J.session.sp={entity:J.entity,prf_algorithm:C1.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:J.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:G,server_random:Z}};C1.handleServerHello=function(J,Q,Y){var X=C1.parseHelloMessage(J,Q,Y);if(J.fail)return;if(X.version.minor<=J.version.minor)J.version.minor=X.version.minor;else return J.error(J,{message:"Incompatible TLS version.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.protocol_version}});J.session.version=J.version;var G=X.session_id.bytes();if(G.length>0&&G===J.session.id)J.expect=i$6,J.session.resuming=!0,J.session.sp.server_random=X.random.bytes();else J.expect=VD8,J.session.resuming=!1,C1.createSecurityParameters(J,X);J.session.id=G,J.process()};C1.handleClientHello=function(J,Q,Y){var X=C1.parseHelloMessage(J,Q,Y);if(J.fail)return;var G=X.session_id.bytes(),Z=null;if(J.sessionCache){if(Z=J.sessionCache.getSession(G),Z===null)G="";else if(Z.version.major!==X.version.major||Z.version.minor>X.version.minor)Z=null,G=""}if(G.length===0)G=X6.random.getBytes(32);if(J.session.id=G,J.session.clientHelloVersion=X.version,J.session.sp={},Z)J.version=J.session.version=Z.version,J.session.sp=Z.sp;else{var q;for(var V=1;V<C1.SupportedVersions.length;++V)if(q=C1.SupportedVersions[V],q.minor<=X.version.minor)break;J.version={major:q.major,minor:q.minor},J.session.version=J.version}if(Z!==null)J.expect=Lk1,J.session.resuming=!0,J.session.sp.client_random=X.random.bytes();else J.expect=J.verifyClient!==!1?BD8:Mk1,J.session.resuming=!1,C1.createSecurityParameters(J,X);if(J.open=!0,C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createServerHello(J)})),J.session.resuming)C1.queue(J,C1.createRecord(J,{type:C1.ContentType.change_cipher_spec,data:C1.createChangeCipherSpec()})),J.state.pending=C1.createConnectionState(J),J.state.current.write=J.state.pending.write,C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createFinished(J)}));else if(C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createCertificate(J)})),!J.fail){if(C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createServerKeyExchange(J)})),J.verifyClient!==!1)C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createCertificateRequest(J)}));C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createServerHelloDone(J)}))}C1.flush(J),J.process()};C1.handleCertificate=function(J,Q,Y){if(Y<3)return J.error(J,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var X=Q.fragment,G={certificate_list:t$(X,3)},Z,q,V=[];try{while(G.certificate_list.length()>0)Z=t$(G.certificate_list,3),q=X6.asn1.fromDer(Z),Z=X6.pki.certificateFromAsn1(q,!0),V.push(Z)}catch(W){return J.error(J,{message:"Could not parse certificate list.",cause:W,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_certificate}})}var K=J.entity===C1.ConnectionEnd.client;if((K||J.verifyClient===!0)&&V.length===0)J.error(J,{message:K?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});else if(V.length===0)J.expect=K?c$6:Mk1;else{if(K)J.session.serverCertificate=V[0];else J.session.clientCertificate=V[0];if(C1.verifyCertificateChain(J,V))J.expect=K?c$6:Mk1}J.process()};C1.handleServerKeyExchange=function(J,Q,Y){if(Y>0)return J.error(J,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unsupported_certificate}});J.expect=KD8,J.process()};C1.handleClientKeyExchange=function(J,Q,Y){if(Y<48)return J.error(J,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unsupported_certificate}});var X=Q.fragment,G={enc_pre_master_secret:t$(X,2).getBytes()},Z=null;if(J.getPrivateKey)try{Z=J.getPrivateKey(J,J.session.serverCertificate),Z=X6.pki.privateKeyFromPem(Z)}catch(K){J.error(J,{message:"Could not get private key.",cause:K,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}})}if(Z===null)return J.error(J,{message:"No private key set.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});try{var q=J.session.sp;q.pre_master_secret=Z.decrypt(G.enc_pre_master_secret);var V=J.session.clientHelloVersion;if(V.major!==q.pre_master_secret.charCodeAt(0)||V.minor!==q.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.")}catch(K){q.pre_master_secret=X6.random.getBytes(48)}if(J.expect=Lk1,J.session.clientCertificate!==null)J.expect=ND8;J.process()};C1.handleCertificateRequest=function(J,Q,Y){if(Y<3)return J.error(J,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var X=Q.fragment,G={certificate_types:t$(X,1),certificate_authorities:t$(X,2)};J.session.certificateRequest=G,J.expect=WD8,J.process()};C1.handleCertificateVerify=function(J,Q,Y){if(Y<2)return J.error(J,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var X=Q.fragment;X.read-=4;var G=X.bytes();X.read+=4;var Z={signature:t$(X,2).getBytes()},q=X6.util.createBuffer();q.putBuffer(J.session.md5.digest()),q.putBuffer(J.session.sha1.digest()),q=q.getBytes();try{var V=J.session.clientCertificate;if(!V.publicKey.verify(q,Z.signature,"NONE"))throw Error("CertificateVerify signature does not match.");J.session.md5.update(G),J.session.sha1.update(G)}catch(K){return J.error(J,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.handshake_failure}})}J.expect=Lk1,J.process()};C1.handleServerHelloDone=function(J,Q,Y){if(Y>0)return J.error(J,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.record_overflow}});if(J.serverCertificate===null){var X={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.insufficient_security}},G=0,Z=J.verify(J,X.alert.description,G,[]);if(Z!==!0){if(Z||Z===0){if(typeof Z==="object"&&!X6.util.isArray(Z)){if(Z.message)X.message=Z.message;if(Z.alert)X.alert.description=Z.alert}else if(typeof Z==="number")X.alert.description=Z}return J.error(J,X)}}if(J.session.certificateRequest!==null)Q=C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createCertificate(J)}),C1.queue(J,Q);Q=C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createClientKeyExchange(J)}),C1.queue(J,Q),J.expect=FD8;var q=function(V,K){if(V.session.certificateRequest!==null&&V.session.clientCertificate!==null)C1.queue(V,C1.createRecord(V,{type:C1.ContentType.handshake,data:C1.createCertificateVerify(V,K)}));C1.queue(V,C1.createRecord(V,{type:C1.ContentType.change_cipher_spec,data:C1.createChangeCipherSpec()})),V.state.pending=C1.createConnectionState(V),V.state.current.write=V.state.pending.write,C1.queue(V,C1.createRecord(V,{type:C1.ContentType.handshake,data:C1.createFinished(V)})),V.expect=i$6,C1.flush(V),V.process()};if(J.session.certificateRequest===null||J.session.clientCertificate===null)return q(J,null);C1.getClientSignature(J,q)};C1.handleChangeCipherSpec=function(J,Q){if(Q.fragment.getByte()!==1)return J.error(J,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var Y=J.entity===C1.ConnectionEnd.client;if(J.session.resuming&&Y||!J.session.resuming&&!Y)J.state.pending=C1.createConnectionState(J);if(J.state.current.read=J.state.pending.read,!J.session.resuming&&Y||J.session.resuming&&!Y)J.state.pending=null;J.expect=Y?HD8:DD8,J.process()};C1.handleFinished=function(J,Q,Y){var X=Q.fragment;X.read-=4;var G=X.bytes();X.read+=4;var Z=Q.fragment.getBytes();X=X6.util.createBuffer(),X.putBuffer(J.session.md5.digest()),X.putBuffer(J.session.sha1.digest());var q=J.entity===C1.ConnectionEnd.client,V=q?"server finished":"client finished",K=J.session.sp,W=12,H=F91;if(X=H(K.master_secret,V,X.getBytes(),W),X.getBytes()!==Z)return J.error(J,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.decrypt_error}});if(J.session.md5.update(G),J.session.sha1.update(G),J.session.resuming&&q||!J.session.resuming&&!q)C1.queue(J,C1.createRecord(J,{type:C1.ContentType.change_cipher_spec,data:C1.createChangeCipherSpec()})),J.state.current.write=J.state.pending.write,J.state.pending=null,C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createFinished(J)}));J.expect=q?zD8:OD8,J.handshaking=!1,++J.handshakes,J.peerCertificate=q?J.session.serverCertificate:J.session.clientCertificate,C1.flush(J),J.isConnected=!0,J.connected(J),J.process()};C1.handleAlert=function(J,Q){var Y=Q.fragment,X={level:Y.getByte(),description:Y.getByte()},G;switch(X.description){case C1.Alert.Description.close_notify:G="Connection closed.";break;case C1.Alert.Description.unexpected_message:G="Unexpected message.";break;case C1.Alert.Description.bad_record_mac:G="Bad record MAC.";break;case C1.Alert.Description.decryption_failed:G="Decryption failed.";break;case C1.Alert.Description.record_overflow:G="Record overflow.";break;case C1.Alert.Description.decompression_failure:G="Decompression failed.";break;case C1.Alert.Description.handshake_failure:G="Handshake failure.";break;case C1.Alert.Description.bad_certificate:G="Bad certificate.";break;case C1.Alert.Description.unsupported_certificate:G="Unsupported certificate.";break;case C1.Alert.Description.certificate_revoked:G="Certificate revoked.";break;case C1.Alert.Description.certificate_expired:G="Certificate expired.";break;case C1.Alert.Description.certificate_unknown:G="Certificate unknown.";break;case C1.Alert.Description.illegal_parameter:G="Illegal parameter.";break;case C1.Alert.Description.unknown_ca:G="Unknown certificate authority.";break;case C1.Alert.Description.access_denied:G="Access denied.";break;case C1.Alert.Description.decode_error:G="Decode error.";break;case C1.Alert.Description.decrypt_error:G="Decrypt error.";break;case C1.Alert.Description.export_restriction:G="Export restriction.";break;case C1.Alert.Description.protocol_version:G="Unsupported protocol version.";break;case C1.Alert.Description.insufficient_security:G="Insufficient security.";break;case C1.Alert.Description.internal_error:G="Internal error.";break;case C1.Alert.Description.user_canceled:G="User canceled.";break;case C1.Alert.Description.no_renegotiation:G="Renegotiation not supported.";break;default:G="Unknown error.";break}if(X.description===C1.Alert.Description.close_notify)return J.close();J.error(J,{message:G,send:!1,origin:J.entity===C1.ConnectionEnd.client?"server":"client",alert:X}),J.process()};C1.handleHandshake=function(J,Q){var Y=Q.fragment,X=Y.getByte(),G=Y.getInt24();if(G>Y.length())return J.fragmented=Q,Q.fragment=X6.util.createBuffer(),Y.read-=4,J.process();J.fragmented=null,Y.read-=4;var Z=Y.bytes(G+4);if(Y.read+=4,X in z91[J.entity][J.expect]){if(J.entity===C1.ConnectionEnd.server&&!J.open&&!J.fail)J.handshaking=!0,J.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:X6.md.md5.create(),sha1:X6.md.sha1.create()};if(X!==C1.HandshakeType.hello_request&&X!==C1.HandshakeType.certificate_verify&&X!==C1.HandshakeType.finished)J.session.md5.update(Z),J.session.sha1.update(Z);z91[J.entity][J.expect][X](J,Q,G)}else C1.handleUnexpected(J,Q)};C1.handleApplicationData=function(J,Q){J.data.putBuffer(Q.fragment),J.dataReady(J),J.process()};C1.handleHeartbeat=function(J,Q){var Y=Q.fragment,X=Y.getByte(),G=Y.getInt16(),Z=Y.getBytes(G);if(X===C1.HeartbeatMessageType.heartbeat_request){if(J.handshaking||G>Z.length)return J.process();C1.queue(J,C1.createRecord(J,{type:C1.ContentType.heartbeat,data:C1.createHeartbeat(C1.HeartbeatMessageType.heartbeat_response,Z)})),C1.flush(J)}else if(X===C1.HeartbeatMessageType.heartbeat_response){if(Z!==J.expectedHeartbeatPayload)return J.process();if(J.heartbeatReceived)J.heartbeatReceived(J,X6.util.createBuffer(Z))}J.process()};var qD8=0,VD8=1,c$6=2,KD8=3,WD8=4,i$6=5,HD8=6,zD8=7,FD8=8,UD8=0,BD8=1,Mk1=2,ND8=3,Lk1=4,DD8=5,OD8=6,I1=C1.handleUnexpected,n$6=C1.handleChangeCipherSpec,MJ=C1.handleAlert,mQ=C1.handleHandshake,a$6=C1.handleApplicationData,LJ=C1.handleHeartbeat,Ak1=[];Ak1[C1.ConnectionEnd.client]=[[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[n$6,MJ,I1,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,a$6,LJ],[I1,MJ,mQ,I1,LJ]];Ak1[C1.ConnectionEnd.server]=[[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[n$6,MJ,I1,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,a$6,LJ],[I1,MJ,mQ,I1,LJ]];var{handleHelloRequest:GN,handleServerHello:MD8,handleCertificate:r$6,handleServerKeyExchange:l$6,handleCertificateRequest:Dk1,handleServerHelloDone:H91,handleFinished:o$6}=C1,z91=[];z91[C1.ConnectionEnd.client]=[[I1,I1,MD8,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,r$6,l$6,Dk1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,l$6,Dk1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,Dk1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,o$6],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1]];var{handleClientHello:LD8,handleClientKeyExchange:AD8,handleCertificateVerify:ED8}=C1;z91[C1.ConnectionEnd.server]=[[I1,LD8,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,r$6,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,AD8,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,ED8,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,o$6],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1]];C1.generateKeys=function(J,Q){var Y=F91,X=Q.client_random+Q.server_random;if(!J.session.resuming)Q.master_secret=Y(Q.pre_master_secret,"master secret",X,48).bytes(),Q.pre_master_secret=null;X=Q.server_random+Q.client_random;var G=2*Q.mac_key_length+2*Q.enc_key_length,Z=J.version.major===C1.Versions.TLS_1_0.major&&J.version.minor===C1.Versions.TLS_1_0.minor;if(Z)G+=2*Q.fixed_iv_length;var q=Y(Q.master_secret,"key expansion",X,G),V={client_write_MAC_key:q.getBytes(Q.mac_key_length),server_write_MAC_key:q.getBytes(Q.mac_key_length),client_write_key:q.getBytes(Q.enc_key_length),server_write_key:q.getBytes(Q.enc_key_length)};if(Z)V.client_write_IV=q.getBytes(Q.fixed_iv_length),V.server_write_IV=q.getBytes(Q.fixed_iv_length);return V};C1.createConnectionState=function(J){var Q=J.entity===C1.ConnectionEnd.client,Y=function(){var Z={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(q){return!0},compressionState:null,compressFunction:function(q){return!0},updateSequenceNumber:function(){if(Z.sequenceNumber[1]===4294967295)Z.sequenceNumber[1]=0,++Z.sequenceNumber[0];else++Z.sequenceNumber[1]}};return Z},X={read:Y(),write:Y()};if(X.read.update=function(Z,q){if(!X.read.cipherFunction(q,X.read))Z.error(Z,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_record_mac}});else if(!X.read.compressFunction(Z,q,X.read))Z.error(Z,{message:"Could not decompress record.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.decompression_failure}});return!Z.fail},X.write.update=function(Z,q){if(!X.write.compressFunction(Z,q,X.write))Z.error(Z,{message:"Could not compress record.",send:!1,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});else if(!X.write.cipherFunction(q,X.write))Z.error(Z,{message:"Could not encrypt record.",send:!1,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});return!Z.fail},J.session){var G=J.session.sp;switch(J.session.cipherSuite.initSecurityParameters(G),G.keys=C1.generateKeys(J,G),X.read.macKey=Q?G.keys.server_write_MAC_key:G.keys.client_write_MAC_key,X.write.macKey=Q?G.keys.client_write_MAC_key:G.keys.server_write_MAC_key,J.session.cipherSuite.initConnectionState(X,J,G),G.compression_algorithm){case C1.CompressionMethod.none:break;case C1.CompressionMethod.deflate:X.read.compressFunction=ZD8,X.write.compressFunction=GD8;break;default:throw Error("Unsupported compression algorithm.")}}return X};C1.createRandom=function(){var J=new Date,Q=+J+J.getTimezoneOffset()*60000,Y=X6.util.createBuffer();return Y.putInt32(Q),Y.putBytes(X6.random.getBytes(28)),Y};C1.createRecord=function(J,Q){if(!Q.data)return null;var Y={type:Q.type,version:{major:J.version.major,minor:J.version.minor},length:Q.data.length(),fragment:Q.data};return Y};C1.createAlert=function(J,Q){var Y=X6.util.createBuffer();return Y.putByte(Q.level),Y.putByte(Q.description),C1.createRecord(J,{type:C1.ContentType.alert,data:Y})};C1.createClientHello=function(J){J.session.clientHelloVersion={major:J.version.major,minor:J.version.minor};var Q=X6.util.createBuffer();for(var Y=0;Y<J.cipherSuites.length;++Y){var X=J.cipherSuites[Y];Q.putByte(X.id[0]),Q.putByte(X.id[1])}var G=Q.length(),Z=X6.util.createBuffer();Z.putByte(C1.CompressionMethod.none);var q=Z.length(),V=X6.util.createBuffer();if(J.virtualHost){var K=X6.util.createBuffer();K.putByte(0),K.putByte(0);var W=X6.util.createBuffer();W.putByte(0),yG(W,2,X6.util.createBuffer(J.virtualHost));var H=X6.util.createBuffer();yG(H,2,W),yG(K,2,H),V.putBuffer(K)}var z=V.length();if(z>0)z+=2;var U=J.session.id,N=U.length+1+2+4+28+2+G+1+q+z,O=X6.util.createBuffer();if(O.putByte(C1.HandshakeType.client_hello),O.putInt24(N),O.putByte(J.version.major),O.putByte(J.version.minor),O.putBytes(J.session.sp.client_random),yG(O,1,X6.util.createBuffer(U)),yG(O,2,Q),yG(O,1,Z),z>0)yG(O,2,V);return O};C1.createServerHello=function(J){var Q=J.session.id,Y=Q.length+1+2+4+28+2+1,X=X6.util.createBuffer();return X.putByte(C1.HandshakeType.server_hello),X.putInt24(Y),X.putByte(J.version.major),X.putByte(J.version.minor),X.putBytes(J.session.sp.server_random),yG(X,1,X6.util.createBuffer(Q)),X.putByte(J.session.cipherSuite.id[0]),X.putByte(J.session.cipherSuite.id[1]),X.putByte(J.session.compressionMethod),X};C1.createCertificate=function(J){var Q=J.entity===C1.ConnectionEnd.client,Y=null;if(J.getCertificate){var X;if(Q)X=J.session.certificateRequest;else X=J.session.extensions.server_name.serverNameList;Y=J.getCertificate(J,X)}var G=X6.util.createBuffer();if(Y!==null)try{if(!X6.util.isArray(Y))Y=[Y];var Z=null;for(var q=0;q<Y.length;++q){var V=X6.pem.decode(Y[q])[0];if(V.type!=="CERTIFICATE"&&V.type!=="X509 CERTIFICATE"&&V.type!=="TRUSTED CERTIFICATE"){var K=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw K.headerType=V.type,K}if(V.procType&&V.procType.type==="ENCRYPTED")throw Error("Could not convert certificate from PEM; PEM is encrypted.");var W=X6.util.createBuffer(V.body);if(Z===null)Z=X6.asn1.fromDer(W.bytes(),!1);var H=X6.util.createBuffer();yG(H,3,W),G.putBuffer(H)}if(Y=X6.pki.certificateFromAsn1(Z),Q)J.session.clientCertificate=Y;else J.session.serverCertificate=Y}catch(N){return J.error(J,{message:"Could not send certificate list.",cause:N,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_certificate}})}var z=3+G.length(),U=X6.util.createBuffer();return U.putByte(C1.HandshakeType.certificate),U.putInt24(z),yG(U,3,G),U};C1.createClientKeyExchange=function(J){var Q=X6.util.createBuffer();Q.putByte(J.session.clientHelloVersion.major),Q.putByte(J.session.clientHelloVersion.minor),Q.putBytes(X6.random.getBytes(46));var Y=J.session.sp;Y.pre_master_secret=Q.getBytes();var X=J.session.serverCertificate.publicKey;Q=X.encrypt(Y.pre_master_secret);var G=Q.length+2,Z=X6.util.createBuffer();return Z.putByte(C1.HandshakeType.client_key_exchange),Z.putInt24(G),Z.putInt16(Q.length),Z.putBytes(Q),Z};C1.createServerKeyExchange=function(J){var Q=0,Y=X6.util.createBuffer();if(Q>0)Y.putByte(C1.HandshakeType.server_key_exchange),Y.putInt24(Q);return Y};C1.getClientSignature=function(J,Q){var Y=X6.util.createBuffer();Y.putBuffer(J.session.md5.digest()),Y.putBuffer(J.session.sha1.digest()),Y=Y.getBytes(),J.getSignature=J.getSignature||function(X,G,Z){var q=null;if(X.getPrivateKey)try{q=X.getPrivateKey(X,X.session.clientCertificate),q=X6.pki.privateKeyFromPem(q)}catch(V){X.error(X,{message:"Could not get private key.",cause:V,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}})}if(q===null)X.error(X,{message:"No private key set.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});else G=q.sign(G,null);Z(X,G)},J.getSignature(J,Y,Q)};C1.createCertificateVerify=function(J,Q){var Y=Q.length+2,X=X6.util.createBuffer();return X.putByte(C1.HandshakeType.certificate_verify),X.putInt24(Y),X.putInt16(Q.length),X.putBytes(Q),X};C1.createCertificateRequest=function(J){var Q=X6.util.createBuffer();Q.putByte(1);var Y=X6.util.createBuffer();for(var X in J.caStore.certs){var G=J.caStore.certs[X],Z=X6.pki.distinguishedNameToAsn1(G.subject),q=X6.asn1.toDer(Z);Y.putInt16(q.length()),Y.putBuffer(q)}var V=1+Q.length()+2+Y.length(),K=X6.util.createBuffer();return K.putByte(C1.HandshakeType.certificate_request),K.putInt24(V),yG(K,1,Q),yG(K,2,Y),K};C1.createServerHelloDone=function(J){var Q=X6.util.createBuffer();return Q.putByte(C1.HandshakeType.server_hello_done),Q.putInt24(0),Q};C1.createChangeCipherSpec=function(){var J=X6.util.createBuffer();return J.putByte(1),J};C1.createFinished=function(J){var Q=X6.util.createBuffer();Q.putBuffer(J.session.md5.digest()),Q.putBuffer(J.session.sha1.digest());var Y=J.entity===C1.ConnectionEnd.client,X=J.session.sp,G=12,Z=F91,q=Y?"client finished":"server finished";Q=Z(X.master_secret,q,Q.getBytes(),G);var V=X6.util.createBuffer();return V.putByte(C1.HandshakeType.finished),V.putInt24(Q.length()),V.putBuffer(Q),V};C1.createHeartbeat=function(J,Q,Y){if(typeof Y>"u")Y=Q.length;var X=X6.util.createBuffer();X.putByte(J),X.putInt16(Y),X.putBytes(Q);var G=X.length(),Z=Math.max(16,G-Y-3);return X.putBytes(X6.random.getBytes(Z)),X};C1.queue=function(J,Q){if(!Q)return;if(Q.fragment.length()===0){if(Q.type===C1.ContentType.handshake||Q.type===C1.ContentType.alert||Q.type===C1.ContentType.change_cipher_spec)return}if(Q.type===C1.ContentType.handshake){var Y=Q.fragment.bytes();J.session.md5.update(Y),J.session.sha1.update(Y),Y=null}var X;if(Q.fragment.length()<=C1.MaxFragment)X=[Q];else{X=[];var G=Q.fragment.bytes();while(G.length>C1.MaxFragment)X.push(C1.createRecord(J,{type:Q.type,data:X6.util.createBuffer(G.slice(0,C1.MaxFragment))})),G=G.slice(C1.MaxFragment);if(G.length>0)X.push(C1.createRecord(J,{type:Q.type,data:X6.util.createBuffer(G)}))}for(var Z=0;Z<X.length&&!J.fail;++Z){var q=X[Z],V=J.state.current.write;if(V.update(J,q))J.records.push(q)}};C1.flush=function(J){for(var Q=0;Q<J.records.length;++Q){var Y=J.records[Q];J.tlsData.putByte(Y.type),J.tlsData.putByte(Y.version.major),J.tlsData.putByte(Y.version.minor),J.tlsData.putInt16(Y.fragment.length()),J.tlsData.putBuffer(J.records[Q].fragment)}return J.records=[],J.tlsDataReady(J)};var Ok1=function(J){switch(J){case!0:return!0;case X6.pki.certificateError.bad_certificate:return C1.Alert.Description.bad_certificate;case X6.pki.certificateError.unsupported_certificate:return C1.Alert.Description.unsupported_certificate;case X6.pki.certificateError.certificate_revoked:return C1.Alert.Description.certificate_revoked;case X6.pki.certificateError.certificate_expired:return C1.Alert.Description.certificate_expired;case X6.pki.certificateError.certificate_unknown:return C1.Alert.Description.certificate_unknown;case X6.pki.certificateError.unknown_ca:return C1.Alert.Description.unknown_ca;default:return C1.Alert.Description.bad_certificate}},wD8=function(J){switch(J){case!0:return!0;case C1.Alert.Description.bad_certificate:return X6.pki.certificateError.bad_certificate;case C1.Alert.Description.unsupported_certificate:return X6.pki.certificateError.unsupported_certificate;case C1.Alert.Description.certificate_revoked:return X6.pki.certificateError.certificate_revoked;case C1.Alert.Description.certificate_expired:return X6.pki.certificateError.certificate_expired;case C1.Alert.Description.certificate_unknown:return X6.pki.certificateError.certificate_unknown;case C1.Alert.Description.unknown_ca:return X6.pki.certificateError.unknown_ca;default:return X6.pki.certificateError.bad_certificate}};C1.verifyCertificateChain=function(J,Q){try{var Y={};for(var X in J.verifyOptions)Y[X]=J.verifyOptions[X];Y.verify=function(Z,q,V){var K=Ok1(Z),W=J.verify(J,Z,q,V);if(W!==!0){if(typeof W==="object"&&!X6.util.isArray(W)){var H=Error("The application rejected the certificate.");if(H.send=!0,H.alert={level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_certificate},W.message)H.message=W.message;if(W.alert)H.alert.description=W.alert;throw H}if(W!==Z)W=wD8(W)}return W},X6.pki.verifyCertificateChain(J.caStore,Q,Y)}catch(Z){var G=Z;if(typeof G!=="object"||X6.util.isArray(G))G={send:!0,alert:{level:C1.Alert.Level.fatal,description:Ok1(Z)}};if(!("send"in G))G.send=!0;if(!("alert"in G))G.alert={level:C1.Alert.Level.fatal,description:Ok1(G.error)};J.error(J,G)}return!J.fail};C1.createSessionCache=function(J,Q){var Y=null;if(J&&J.getSession&&J.setSession&&J.order)Y=J;else{Y={},Y.cache=J||{},Y.capacity=Math.max(Q||100,1),Y.order=[];for(var X in J)if(Y.order.length<=Q)Y.order.push(X);else delete J[X];Y.getSession=function(G){var Z=null,q=null;if(G)q=X6.util.bytesToHex(G);else if(Y.order.length>0)q=Y.order[0];if(q!==null&&q in Y.cache){Z=Y.cache[q],delete Y.cache[q];for(var V in Y.order)if(Y.order[V]===q){Y.order.splice(V,1);break}}return Z},Y.setSession=function(G,Z){if(Y.order.length===Y.capacity){var q=Y.order.shift();delete Y.cache[q]}var q=X6.util.bytesToHex(G);Y.order.push(q),Y.cache[q]=Z}}return Y};C1.createConnection=function(J){var Q=null;if(J.caStore)if(X6.util.isArray(J.caStore))Q=X6.pki.createCaStore(J.caStore);else Q=J.caStore;else Q=X6.pki.createCaStore();var Y=J.cipherSuites||null;if(Y===null){Y=[];for(var X in C1.CipherSuites)Y.push(C1.CipherSuites[X])}var G=J.server?C1.ConnectionEnd.server:C1.ConnectionEnd.client,Z=J.sessionCache?C1.createSessionCache(J.sessionCache):null,q={version:{major:C1.Version.major,minor:C1.Version.minor},entity:G,sessionId:J.sessionId,caStore:Q,sessionCache:Z,cipherSuites:Y,connected:J.connected,virtualHost:J.virtualHost||null,verifyClient:J.verifyClient||!1,verify:J.verify||function(H,z,U,N){return z},verifyOptions:J.verifyOptions||{},getCertificate:J.getCertificate||null,getPrivateKey:J.getPrivateKey||null,getSignature:J.getSignature||null,input:X6.util.createBuffer(),tlsData:X6.util.createBuffer(),data:X6.util.createBuffer(),tlsDataReady:J.tlsDataReady,dataReady:J.dataReady,heartbeatReceived:J.heartbeatReceived,closed:J.closed,error:function(H,z){if(z.origin=z.origin||(H.entity===C1.ConnectionEnd.client?"client":"server"),z.send)C1.queue(H,C1.createAlert(H,z.alert)),C1.flush(H);var U=z.fatal!==!1;if(U)H.fail=!0;if(J.error(H,z),U)H.close(!1)},deflate:J.deflate||null,inflate:J.inflate||null};q.reset=function(H){q.version={major:C1.Version.major,minor:C1.Version.minor},q.record=null,q.session=null,q.peerCertificate=null,q.state={pending:null,current:null},q.expect=q.entity===C1.ConnectionEnd.client?qD8:UD8,q.fragmented=null,q.records=[],q.open=!1,q.handshakes=0,q.handshaking=!1,q.isConnected=!1,q.fail=!(H||typeof H>"u"),q.input.clear(),q.tlsData.clear(),q.data.clear(),q.state.current=C1.createConnectionState(q)},q.reset();var V=function(H,z){var U=z.type-C1.ContentType.change_cipher_spec,N=Ak1[H.entity][H.expect];if(U in N)N[U](H,z);else C1.handleUnexpected(H,z)},K=function(H){var z=0,U=H.input,N=U.length();if(N<5)z=5-N;else{H.record={type:U.getByte(),version:{major:U.getByte(),minor:U.getByte()},length:U.getInt16(),fragment:X6.util.createBuffer(),ready:!1};var O=H.record.version.major===H.version.major;if(O&&H.session&&H.session.version)O=H.record.version.minor===H.version.minor;if(!O)H.error(H,{message:"Incompatible TLS version.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.protocol_version}})}return z},W=function(H){var z=0,U=H.input,N=U.length();if(N<H.record.length)z=H.record.length-N;else{H.record.fragment.putBytes(U.getBytes(H.record.length)),U.compact();var O=H.state.current.read;if(O.update(H,H.record)){if(H.fragmented!==null)if(H.fragmented.type===H.record.type)H.fragmented.fragment.putBuffer(H.record.fragment),H.record=H.fragmented;else H.error(H,{message:"Invalid fragmented record.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unexpected_message}});H.record.ready=!0}}return z};return q.handshake=function(H){if(q.entity!==C1.ConnectionEnd.client)q.error(q,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(q.handshaking)q.error(q,{message:"Handshake already in progress.",fatal:!1});else{if(q.fail&&!q.open&&q.handshakes===0)q.fail=!1;q.handshaking=!0,H=H||"";var z=null;if(H.length>0){if(q.sessionCache)z=q.sessionCache.getSession(H);if(z===null)H=""}if(H.length===0&&q.sessionCache){if(z=q.sessionCache.getSession(),z!==null)H=z.id}if(q.session={id:H,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:X6.md.md5.create(),sha1:X6.md.sha1.create()},z)q.version=z.version,q.session.sp=z.sp;q.session.sp.client_random=C1.createRandom().getBytes(),q.open=!0,C1.queue(q,C1.createRecord(q,{type:C1.ContentType.handshake,data:C1.createClientHello(q)})),C1.flush(q)}},q.process=function(H){var z=0;if(H)q.input.putBytes(H);if(!q.fail){if(q.record!==null&&q.record.ready&&q.record.fragment.isEmpty())q.record=null;if(q.record===null)z=K(q);if(!q.fail&&q.record!==null&&!q.record.ready)z=W(q);if(!q.fail&&q.record!==null&&q.record.ready)V(q,q.record)}return z},q.prepare=function(H){return C1.queue(q,C1.createRecord(q,{type:C1.ContentType.application_data,data:X6.util.createBuffer(H)})),C1.flush(q)},q.prepareHeartbeatRequest=function(H,z){if(H instanceof X6.util.ByteBuffer)H=H.bytes();if(typeof z>"u")z=H.length;return q.expectedHeartbeatPayload=H,C1.queue(q,C1.createRecord(q,{type:C1.ContentType.heartbeat,data:C1.createHeartbeat(C1.HeartbeatMessageType.heartbeat_request,H,z)})),C1.flush(q)},q.close=function(H){if(!q.fail&&q.sessionCache&&q.session){var z={id:q.session.id,version:q.session.version,sp:q.session.sp};z.sp.keys=null,q.sessionCache.setSession(z.id,z)}if(q.open){if(q.open=!1,q.input.clear(),q.isConnected||q.handshaking)q.isConnected=q.handshaking=!1,C1.queue(q,C1.createAlert(q,{level:C1.Alert.Level.warning,description:C1.Alert.Description.close_notify})),C1.flush(q);q.closed(q)}q.reset(H)},q};s$6.exports=X6.tls=X6.tls||{};for(Bg in C1)if(typeof C1[Bg]!=="function")X6.tls[Bg]=C1[Bg];var Bg;X6.tls.prf_tls1=F91;X6.tls.hmac_sha1=XD8;X6.tls.createSessionCache=C1.createSessionCache;X6.tls.createConnection=C1.createConnection});var JX6=h((kZ5,e$6)=>{var ZN=m8();eB();Ek1();var vG=e$6.exports=ZN.tls;vG.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(J){J.bulk_cipher_algorithm=vG.BulkCipherAlgorithm.aes,J.cipher_type=vG.CipherType.block,J.enc_key_length=16,J.block_length=16,J.fixed_iv_length=16,J.record_iv_length=16,J.mac_algorithm=vG.MACAlgorithm.hmac_sha1,J.mac_length=20,J.mac_key_length=20},initConnectionState:t$6};vG.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(J){J.bulk_cipher_algorithm=vG.BulkCipherAlgorithm.aes,J.cipher_type=vG.CipherType.block,J.enc_key_length=32,J.block_length=16,J.fixed_iv_length=16,J.record_iv_length=16,J.mac_algorithm=vG.MACAlgorithm.hmac_sha1,J.mac_length=20,J.mac_key_length=20},initConnectionState:t$6};function t$6(J,Q,Y){var X=Q.entity===ZN.tls.ConnectionEnd.client;J.read.cipherState={init:!1,cipher:ZN.cipher.createDecipher("AES-CBC",X?Y.keys.server_write_key:Y.keys.client_write_key),iv:X?Y.keys.server_write_IV:Y.keys.client_write_IV},J.write.cipherState={init:!1,cipher:ZN.cipher.createCipher("AES-CBC",X?Y.keys.client_write_key:Y.keys.server_write_key),iv:X?Y.keys.client_write_IV:Y.keys.server_write_IV},J.read.cipherFunction=RD8,J.write.cipherFunction=ID8,J.read.macLength=J.write.macLength=Y.mac_length,J.read.macFunction=J.write.macFunction=vG.hmac_sha1}function ID8(J,Q){var Y=!1,X=Q.macFunction(Q.macKey,Q.sequenceNumber,J);J.fragment.putBytes(X),Q.updateSequenceNumber();var G;if(J.version.minor===vG.Versions.TLS_1_0.minor)G=Q.cipherState.init?null:Q.cipherState.iv;else G=ZN.random.getBytesSync(16);Q.cipherState.init=!0;var Z=Q.cipherState.cipher;if(Z.start({iv:G}),J.version.minor>=vG.Versions.TLS_1_1.minor)Z.output.putBytes(G);if(Z.update(J.fragment),Z.finish(PD8))J.fragment=Z.output,J.length=J.fragment.length(),Y=!0;return Y}function PD8(J,Q,Y){if(!Y){var X=J-Q.length()%J;Q.fillWithByte(X-1,X)}return!0}function TD8(J,Q,Y){var X=!0;if(Y){var G=Q.length(),Z=Q.last();for(var q=G-1-Z;q<G-1;++q)X=X&&Q.at(q)==Z;if(X)Q.truncate(Z+1)}return X}function RD8(J,Q){var Y=!1,X;if(J.version.minor===vG.Versions.TLS_1_0.minor)X=Q.cipherState.init?null:Q.cipherState.iv;else X=J.fragment.getBytes(16);Q.cipherState.init=!0;var G=Q.cipherState.cipher;G.start({iv:X}),G.update(J.fragment),Y=G.finish(TD8);var Z=Q.macLength,q=ZN.random.getBytesSync(Z),V=G.output.length();if(V>=Z)J.fragment=G.output.getBytes(V-Z),q=G.output.getBytes(Z);else J.fragment=G.output.getBytes();J.fragment=ZN.util.createBuffer(J.fragment),J.length=J.fragment.length();var K=Q.macFunction(Q.macKey,Q.sequenceNumber,J);return Q.updateSequenceNumber(),Y=CD8(Q.macKey,q,K)&&Y,Y}function CD8(J,Q,Y){var X=ZN.hmac.create();return X.start("SHA1",J),X.update(Q),Q=X.digest().getBytes(),X.start(null,null),X.update(Y),Y=X.digest().getBytes(),Q===Y}});var Pk1=h((yZ5,XX6)=>{var W2=m8();yK();i9();var Ng=XX6.exports=W2.sha512=W2.sha512||{};W2.md.sha512=W2.md.algorithms.sha512=Ng;var YX6=W2.sha384=W2.sha512.sha384=W2.sha512.sha384||{};YX6.create=function(){return Ng.create("SHA-384")};W2.md.sha384=W2.md.algorithms.sha384=YX6;W2.sha512.sha256=W2.sha512.sha256||{create:function(){return Ng.create("SHA-512/256")}};W2.md["sha512/256"]=W2.md.algorithms["sha512/256"]=W2.sha512.sha256;W2.sha512.sha224=W2.sha512.sha224||{create:function(){return Ng.create("SHA-512/224")}};W2.md["sha512/224"]=W2.md.algorithms["sha512/224"]=W2.sha512.sha224;Ng.create=function(J){if(!$X6)SD8();if(typeof J>"u")J="SHA-512";if(!(J in UA))throw Error("Invalid SHA-512 algorithm: "+J);var Q=UA[J],Y=null,X=W2.util.createBuffer(),G=Array(80);for(var Z=0;Z<80;++Z)G[Z]=[,,];var q=64;switch(J){case"SHA-384":q=48;break;case"SHA-512/256":q=32;break;case"SHA-512/224":q=28;break}var V={algorithm:J.replace("-","").toLowerCase(),blockLength:128,digestLength:q,messageLength:0,fullMessageLength:null,messageLengthSize:16};return V.start=function(){V.messageLength=0,V.fullMessageLength=V.messageLength128=[];var K=V.messageLengthSize/4;for(var W=0;W<K;++W)V.fullMessageLength.push(0);X=W2.util.createBuffer(),Y=Array(Q.length);for(var W=0;W<Q.length;++W)Y[W]=Q[W].slice(0);return V},V.start(),V.update=function(K,W){if(W==="utf8")K=W2.util.encodeUtf8(K);var H=K.length;V.messageLength+=H,H=[H/4294967296>>>0,H>>>0];for(var z=V.fullMessageLength.length-1;z>=0;--z)V.fullMessageLength[z]+=H[1],H[1]=H[0]+(V.fullMessageLength[z]/4294967296>>>0),V.fullMessageLength[z]=V.fullMessageLength[z]>>>0,H[0]=H[1]/4294967296>>>0;if(X.putBytes(K),QX6(Y,G,X),X.read>2048||X.length()===0)X.compact();return V},V.digest=function(){var K=W2.util.createBuffer();K.putBytes(X.bytes());var W=V.fullMessageLength[V.fullMessageLength.length-1]+V.messageLengthSize,H=W&V.blockLength-1;K.putBytes(wk1.substr(0,V.blockLength-H));var z,U,N=V.fullMessageLength[0]*8;for(var O=0;O<V.fullMessageLength.length-1;++O)z=V.fullMessageLength[O+1]*8,U=z/4294967296>>>0,N+=U,K.putInt32(N>>>0),N=z>>>0;K.putInt32(N);var M=Array(Y.length);for(var O=0;O<Y.length;++O)M[O]=Y[O].slice(0);QX6(M,G,K);var L=W2.util.createBuffer(),w;if(J==="SHA-512")w=M.length;else if(J==="SHA-384")w=M.length-2;else w=M.length-4;for(var O=0;O<w;++O)if(L.putInt32(M[O][0]),O!==w-1||J!=="SHA-512/224")L.putInt32(M[O][1]);return L},V};var wk1=null,$X6=!1,Ik1=null,UA=null;function SD8(){wk1=String.fromCharCode(128),wk1+=W2.util.fillString(String.fromCharCode(0),128),Ik1=[[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]],UA={},UA["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],UA["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],UA["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],UA["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],$X6=!0}function QX6(J,Q,Y){var X,G,Z,q,V,K,W,H,z,U,N,O,M,L,w,I,P,R,j,y,f,g,p,b,i,J1,n,m,s,q1,W1,r,o,l,z1,j1=Y.length();while(j1>=128){for(s=0;s<16;++s)Q[s][0]=Y.getInt32()>>>0,Q[s][1]=Y.getInt32()>>>0;for(;s<80;++s)r=Q[s-2],q1=r[0],W1=r[1],X=((q1>>>19|W1<<13)^(W1>>>29|q1<<3)^q1>>>6)>>>0,G=((q1<<13|W1>>>19)^(W1<<3|q1>>>29)^(q1<<26|W1>>>6))>>>0,l=Q[s-15],q1=l[0],W1=l[1],Z=((q1>>>1|W1<<31)^(q1>>>8|W1<<24)^q1>>>7)>>>0,q=((q1<<31|W1>>>1)^(q1<<24|W1>>>8)^(q1<<25|W1>>>7))>>>0,o=Q[s-7],z1=Q[s-16],W1=G+o[1]+q+z1[1],Q[s][0]=X+o[0]+Z+z1[0]+(W1/4294967296>>>0)>>>0,Q[s][1]=W1>>>0;M=J[0][0],L=J[0][1],w=J[1][0],I=J[1][1],P=J[2][0],R=J[2][1],j=J[3][0],y=J[3][1],f=J[4][0],g=J[4][1],p=J[5][0],b=J[5][1],i=J[6][0],J1=J[6][1],n=J[7][0],m=J[7][1];for(s=0;s<80;++s)W=((f>>>14|g<<18)^(f>>>18|g<<14)^(g>>>9|f<<23))>>>0,H=((f<<18|g>>>14)^(f<<14|g>>>18)^(g<<23|f>>>9))>>>0,z=(i^f&(p^i))>>>0,U=(J1^g&(b^J1))>>>0,V=((M>>>28|L<<4)^(L>>>2|M<<30)^(L>>>7|M<<25))>>>0,K=((M<<4|L>>>28)^(L<<30|M>>>2)^(L<<25|M>>>7))>>>0,N=(M&w|P&(M^w))>>>0,O=(L&I|R&(L^I))>>>0,W1=m+H+U+Ik1[s][1]+Q[s][1],X=n+W+z+Ik1[s][0]+Q[s][0]+(W1/4294967296>>>0)>>>0,G=W1>>>0,W1=K+O,Z=V+N+(W1/4294967296>>>0)>>>0,q=W1>>>0,n=i,m=J1,i=p,J1=b,p=f,b=g,W1=y+G,f=j+X+(W1/4294967296>>>0)>>>0,g=W1>>>0,j=P,y=R,P=w,R=I,w=M,I=L,W1=G+q,M=X+Z+(W1/4294967296>>>0)>>>0,L=W1>>>0;W1=J[0][1]+L,J[0][0]=J[0][0]+M+(W1/4294967296>>>0)>>>0,J[0][1]=W1>>>0,W1=J[1][1]+I,J[1][0]=J[1][0]+w+(W1/4294967296>>>0)>>>0,J[1][1]=W1>>>0,W1=J[2][1]+R,J[2][0]=J[2][0]+P+(W1/4294967296>>>0)>>>0,J[2][1]=W1>>>0,W1=J[3][1]+y,J[3][0]=J[3][0]+j+(W1/4294967296>>>0)>>>0,J[3][1]=W1>>>0,W1=J[4][1]+g,J[4][0]=J[4][0]+f+(W1/4294967296>>>0)>>>0,J[4][1]=W1>>>0,W1=J[5][1]+b,J[5][0]=J[5][0]+p+(W1/4294967296>>>0)>>>0,J[5][1]=W1>>>0,W1=J[6][1]+J1,J[6][0]=J[6][0]+i+(W1/4294967296>>>0)>>>0,J[6][1]=W1>>>0,W1=J[7][1]+m,J[7][0]=J[7][0]+n+(W1/4294967296>>>0)>>>0,J[7][1]=W1>>>0,j1-=128}}});var GX6=h((_D8)=>{var jD8=m8();Mq();var p3=jD8.asn1;_D8.privateKeyValidator={name:"PrivateKeyInfo",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:p3.Class.UNIVERSAL,type:p3.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p3.Class.UNIVERSAL,type:p3.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:p3.Class.UNIVERSAL,type:p3.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};_D8.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p3.Class.UNIVERSAL,type:p3.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:p3.Class.UNIVERSAL,type:p3.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var DX6=h((xZ5,NX6)=>{var AJ=m8();Hg();SG();Pk1();i9();var WX6=GX6(),vD8=WX6.publicKeyValidator,xD8=WX6.privateKeyValidator;if(typeof Ck1>"u")Ck1=AJ.jsbn.BigInteger;var Ck1,Sk1=AJ.util.ByteBuffer,bY=typeof Buffer>"u"?Uint8Array:Buffer;AJ.pki=AJ.pki||{};NX6.exports=AJ.pki.ed25519=AJ.ed25519=AJ.ed25519||{};var L9=AJ.ed25519;L9.constants={};L9.constants.PUBLIC_KEY_BYTE_LENGTH=32;L9.constants.PRIVATE_KEY_BYTE_LENGTH=64;L9.constants.SEED_BYTE_LENGTH=32;L9.constants.SIGN_BYTE_LENGTH=64;L9.constants.HASH_BYTE_LENGTH=64;L9.generateKeyPair=function(J){J=J||{};var Q=J.seed;if(Q===void 0)Q=AJ.random.getBytesSync(L9.constants.SEED_BYTE_LENGTH);else if(typeof Q==="string"){if(Q.length!==L9.constants.SEED_BYTE_LENGTH)throw TypeError('"seed" must be '+L9.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(Q instanceof Uint8Array))throw TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');Q=Bz({message:Q,encoding:"binary"});var Y=new bY(L9.constants.PUBLIC_KEY_BYTE_LENGTH),X=new bY(L9.constants.PRIVATE_KEY_BYTE_LENGTH);for(var G=0;G<32;++G)X[G]=Q[G];return uD8(Y,X),{publicKey:Y,privateKey:X}};L9.privateKeyFromAsn1=function(J){var Q={},Y=[],X=AJ.asn1.validate(J,xD8,Q,Y);if(!X){var G=Error("Invalid Key.");throw G.errors=Y,G}var Z=AJ.asn1.derToOid(Q.privateKeyOid),q=AJ.oids.EdDSA25519;if(Z!==q)throw Error('Invalid OID "'+Z+'"; OID must be "'+q+'".');var V=Q.privateKey,K=Bz({message:AJ.asn1.fromDer(V).value,encoding:"binary"});return{privateKeyBytes:K}};L9.publicKeyFromAsn1=function(J){var Q={},Y=[],X=AJ.asn1.validate(J,vD8,Q,Y);if(!X){var G=Error("Invalid Key.");throw G.errors=Y,G}var Z=AJ.asn1.derToOid(Q.publicKeyOid),q=AJ.oids.EdDSA25519;if(Z!==q)throw Error('Invalid OID "'+Z+'"; OID must be "'+q+'".');var V=Q.ed25519PublicKey;if(V.length!==L9.constants.PUBLIC_KEY_BYTE_LENGTH)throw Error("Key length is invalid.");return Bz({message:V,encoding:"binary"})};L9.publicKeyFromPrivateKey=function(J){J=J||{};var Q=Bz({message:J.privateKey,encoding:"binary"});if(Q.length!==L9.constants.PRIVATE_KEY_BYTE_LENGTH)throw TypeError('"options.privateKey" must have a byte length of '+L9.constants.PRIVATE_KEY_BYTE_LENGTH);var Y=new bY(L9.constants.PUBLIC_KEY_BYTE_LENGTH);for(var X=0;X<Y.length;++X)Y[X]=Q[32+X];return Y};L9.sign=function(J){J=J||{};var Q=Bz(J),Y=Bz({message:J.privateKey,encoding:"binary"});if(Y.length===L9.constants.SEED_BYTE_LENGTH){var X=L9.generateKeyPair({seed:Y});Y=X.privateKey}else if(Y.length!==L9.constants.PRIVATE_KEY_BYTE_LENGTH)throw TypeError('"options.privateKey" must have a byte length of '+L9.constants.SEED_BYTE_LENGTH+" or "+L9.constants.PRIVATE_KEY_BYTE_LENGTH);var G=new bY(L9.constants.SIGN_BYTE_LENGTH+Q.length);gD8(G,Q,Q.length,Y);var Z=new bY(L9.constants.SIGN_BYTE_LENGTH);for(var q=0;q<Z.length;++q)Z[q]=G[q];return Z};L9.verify=function(J){J=J||{};var Q=Bz(J);if(J.signature===void 0)throw TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var Y=Bz({message:J.signature,encoding:"binary"});if(Y.length!==L9.constants.SIGN_BYTE_LENGTH)throw TypeError('"options.signature" must have a byte length of '+L9.constants.SIGN_BYTE_LENGTH);var X=Bz({message:J.publicKey,encoding:"binary"});if(X.length!==L9.constants.PUBLIC_KEY_BYTE_LENGTH)throw TypeError('"options.publicKey" must have a byte length of '+L9.constants.PUBLIC_KEY_BYTE_LENGTH);var G=new bY(L9.constants.SIGN_BYTE_LENGTH+Q.length),Z=new bY(L9.constants.SIGN_BYTE_LENGTH+Q.length),q;for(q=0;q<L9.constants.SIGN_BYTE_LENGTH;++q)G[q]=Y[q];for(q=0;q<Q.length;++q)G[q+L9.constants.SIGN_BYTE_LENGTH]=Q[q];return mD8(Z,G,G.length,X)>=0};function Bz(J){var Q=J.message;if(Q instanceof Uint8Array||Q instanceof bY)return Q;var Y=J.encoding;if(Q===void 0)if(J.md)Q=J.md.digest().getBytes(),Y="binary";else throw TypeError('"options.message" or "options.md" not specified.');if(typeof Q==="string"&&!Y)throw TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof Q==="string"){if(typeof Buffer<"u")return Buffer.from(Q,Y);Q=new Sk1(Q,Y)}else if(!(Q instanceof Sk1))throw TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');var X=new bY(Q.length());for(var G=0;G<X.length;++G)X[G]=Q.at(G);return X}var jk1=o4(),U91=o4([1]),fD8=o4([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),hD8=o4([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),ZX6=o4([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),qX6=o4([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Tk1=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]),bD8=o4([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Dg(J,Q){var Y=AJ.md.sha512.create(),X=new Sk1(J);Y.update(X.getBytes(Q),"binary");var G=Y.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(G,"binary");var Z=new bY(L9.constants.HASH_BYTE_LENGTH);for(var q=0;q<64;++q)Z[q]=G.charCodeAt(q);return Z}function uD8(J,Q){var Y=[o4(),o4(),o4(),o4()],X,G=Dg(Q,32);G[0]&=248,G[31]&=127,G[31]|=64,vk1(Y,G),yk1(J,Y);for(X=0;X<32;++X)Q[X+32]=J[X];return 0}function gD8(J,Q,Y,X){var G,Z,q=new Float64Array(64),V=[o4(),o4(),o4(),o4()],K=Dg(X,32);K[0]&=248,K[31]&=127,K[31]|=64;var W=Y+64;for(G=0;G<Y;++G)J[64+G]=Q[G];for(G=0;G<32;++G)J[32+G]=K[32+G];var H=Dg(J.subarray(32),Y+32);_k1(H),vk1(V,H),yk1(J,V);for(G=32;G<64;++G)J[G]=X[G];var z=Dg(J,Y+64);_k1(z);for(G=32;G<64;++G)q[G]=0;for(G=0;G<32;++G)q[G]=H[G];for(G=0;G<32;++G)for(Z=0;Z<32;Z++)q[G+Z]+=z[G]*K[Z];return HX6(J.subarray(32),q),W}function mD8(J,Q,Y,X){var G,Z,q=new bY(32),V=[o4(),o4(),o4(),o4()],K=[o4(),o4(),o4(),o4()];if(Z=-1,Y<64)return-1;if(pD8(K,X))return-1;for(G=0;G<Y;++G)J[G]=Q[G];for(G=0;G<32;++G)J[G+32]=X[G];var W=Dg(J,Y);if(_k1(W),UX6(V,K,W),vk1(K,Q.subarray(32)),kk1(V,K),yk1(q,V),Y-=64,zX6(Q,0,q,0)){for(G=0;G<Y;++G)J[G]=0;return-1}for(G=0;G<Y;++G)J[G]=Q[G+64];return Z=Y,Z}function HX6(J,Q){var Y,X,G,Z;for(X=63;X>=32;--X){Y=0;for(G=X-32,Z=X-12;G<Z;++G)Q[G]+=Y-16*Q[X]*Tk1[G-(X-32)],Y=Q[G]+128>>8,Q[G]-=Y*256;Q[G]+=Y,Q[X]=0}Y=0;for(G=0;G<32;++G)Q[G]+=Y-(Q[31]>>4)*Tk1[G],Y=Q[G]>>8,Q[G]&=255;for(G=0;G<32;++G)Q[G]-=Y*Tk1[G];for(X=0;X<32;++X)Q[X+1]+=Q[X]>>8,J[X]=Q[X]&255}function _k1(J){var Q=new Float64Array(64);for(var Y=0;Y<64;++Y)Q[Y]=J[Y],J[Y]=0;HX6(J,Q)}function kk1(J,Q){var Y=o4(),X=o4(),G=o4(),Z=o4(),q=o4(),V=o4(),K=o4(),W=o4(),H=o4();wC(Y,J[1],J[0]),wC(H,Q[1],Q[0]),p5(Y,Y,H),EC(X,J[0],J[1]),EC(H,Q[0],Q[1]),p5(X,X,H),p5(G,J[3],Q[3]),p5(G,G,hD8),p5(Z,J[2],Q[2]),EC(Z,Z,Z),wC(q,X,Y),wC(V,Z,G),EC(K,Z,G),EC(W,X,Y),p5(J[0],q,V),p5(J[1],W,K),p5(J[2],K,V),p5(J[3],q,W)}function VX6(J,Q,Y){for(var X=0;X<4;++X)BX6(J[X],Q[X],Y)}function yk1(J,Q){var Y=o4(),X=o4(),G=o4();iD8(G,Q[2]),p5(Y,Q[0],G),p5(X,Q[1],G),B91(J,X),J[31]^=FX6(Y)<<7}function B91(J,Q){var Y,X,G,Z=o4(),q=o4();for(Y=0;Y<16;++Y)q[Y]=Q[Y];Rk1(q),Rk1(q),Rk1(q);for(X=0;X<2;++X){Z[0]=q[0]-65517;for(Y=1;Y<15;++Y)Z[Y]=q[Y]-65535-(Z[Y-1]>>16&1),Z[Y-1]&=65535;Z[15]=q[15]-32767-(Z[14]>>16&1),G=Z[15]>>16&1,Z[14]&=65535,BX6(q,Z,1-G)}for(Y=0;Y<16;Y++)J[2*Y]=q[Y]&255,J[2*Y+1]=q[Y]>>8}function pD8(J,Q){var Y=o4(),X=o4(),G=o4(),Z=o4(),q=o4(),V=o4(),K=o4();if(qN(J[2],U91),dD8(J[1],Q),BA(G,J[1]),p5(Z,G,fD8),wC(G,G,J[2]),EC(Z,J[2],Z),BA(q,Z),BA(V,q),p5(K,V,q),p5(Y,K,G),p5(Y,Y,Z),cD8(Y,Y),p5(Y,Y,G),p5(Y,Y,Z),p5(Y,Y,Z),p5(J[0],Y,Z),BA(X,J[0]),p5(X,X,Z),KX6(X,G))p5(J[0],J[0],bD8);if(BA(X,J[0]),p5(X,X,Z),KX6(X,G))return-1;if(FX6(J[0])===Q[31]>>7)wC(J[0],jk1,J[0]);return p5(J[3],J[0],J[1]),0}function dD8(J,Q){var Y;for(Y=0;Y<16;++Y)J[Y]=Q[2*Y]+(Q[2*Y+1]<<8);J[15]&=32767}function cD8(J,Q){var Y=o4(),X;for(X=0;X<16;++X)Y[X]=Q[X];for(X=250;X>=0;--X)if(BA(Y,Y),X!==1)p5(Y,Y,Q);for(X=0;X<16;++X)J[X]=Y[X]}function KX6(J,Q){var Y=new bY(32),X=new bY(32);return B91(Y,J),B91(X,Q),zX6(Y,0,X,0)}function zX6(J,Q,Y,X){return lD8(J,Q,Y,X,32)}function lD8(J,Q,Y,X,G){var Z,q=0;for(Z=0;Z<G;++Z)q|=J[Q+Z]^Y[X+Z];return(1&q-1>>>8)-1}function FX6(J){var Q=new bY(32);return B91(Q,J),Q[0]&1}function UX6(J,Q,Y){var X,G;qN(J[0],jk1),qN(J[1],U91),qN(J[2],U91),qN(J[3],jk1);for(G=255;G>=0;--G)X=Y[G/8|0]>>(G&7)&1,VX6(J,Q,X),kk1(Q,J),kk1(J,J),VX6(J,Q,X)}function vk1(J,Q){var Y=[o4(),o4(),o4(),o4()];qN(Y[0],ZX6),qN(Y[1],qX6),qN(Y[2],U91),p5(Y[3],ZX6,qX6),UX6(J,Y,Q)}function qN(J,Q){var Y;for(Y=0;Y<16;Y++)J[Y]=Q[Y]|0}function iD8(J,Q){var Y=o4(),X;for(X=0;X<16;++X)Y[X]=Q[X];for(X=253;X>=0;--X)if(BA(Y,Y),X!==2&&X!==4)p5(Y,Y,Q);for(X=0;X<16;++X)J[X]=Y[X]}function Rk1(J){var Q,Y,X=1;for(Q=0;Q<16;++Q)Y=J[Q]+X+65535,X=Math.floor(Y/65536),J[Q]=Y-X*65536;J[0]+=X-1+37*(X-1)}function BX6(J,Q,Y){var X,G=~(Y-1);for(var Z=0;Z<16;++Z)X=G&(J[Z]^Q[Z]),J[Z]^=X,Q[Z]^=X}function o4(J){var Q,Y=new Float64Array(16);if(J)for(Q=0;Q<J.length;++Q)Y[Q]=J[Q];return Y}function EC(J,Q,Y){for(var X=0;X<16;++X)J[X]=Q[X]+Y[X]}function wC(J,Q,Y){for(var X=0;X<16;++X)J[X]=Q[X]-Y[X]}function BA(J,Q){p5(J,Q,Q)}function p5(J,Q,Y){var X,G,Z=0,q=0,V=0,K=0,W=0,H=0,z=0,U=0,N=0,O=0,M=0,L=0,w=0,I=0,P=0,R=0,j=0,y=0,f=0,g=0,p=0,b=0,i=0,J1=0,n=0,m=0,s=0,q1=0,W1=0,r=0,o=0,l=Y[0],z1=Y[1],j1=Y[2],t=Y[3],y1=Y[4],R1=Y[5],D0=Y[6],T1=Y[7],a1=Y[8],F1=Y[9],Y1=Y[10],O1=Y[11],L1=Y[12],E1=Y[13],A1=Y[14],u1=Y[15];X=Q[0],Z+=X*l,q+=X*z1,V+=X*j1,K+=X*t,W+=X*y1,H+=X*R1,z+=X*D0,U+=X*T1,N+=X*a1,O+=X*F1,M+=X*Y1,L+=X*O1,w+=X*L1,I+=X*E1,P+=X*A1,R+=X*u1,X=Q[1],q+=X*l,V+=X*z1,K+=X*j1,W+=X*t,H+=X*y1,z+=X*R1,U+=X*D0,N+=X*T1,O+=X*a1,M+=X*F1,L+=X*Y1,w+=X*O1,I+=X*L1,P+=X*E1,R+=X*A1,j+=X*u1,X=Q[2],V+=X*l,K+=X*z1,W+=X*j1,H+=X*t,z+=X*y1,U+=X*R1,N+=X*D0,O+=X*T1,M+=X*a1,L+=X*F1,w+=X*Y1,I+=X*O1,P+=X*L1,R+=X*E1,j+=X*A1,y+=X*u1,X=Q[3],K+=X*l,W+=X*z1,H+=X*j1,z+=X*t,U+=X*y1,N+=X*R1,O+=X*D0,M+=X*T1,L+=X*a1,w+=X*F1,I+=X*Y1,P+=X*O1,R+=X*L1,j+=X*E1,y+=X*A1,f+=X*u1,X=Q[4],W+=X*l,H+=X*z1,z+=X*j1,U+=X*t,N+=X*y1,O+=X*R1,M+=X*D0,L+=X*T1,w+=X*a1,I+=X*F1,P+=X*Y1,R+=X*O1,j+=X*L1,y+=X*E1,f+=X*A1,g+=X*u1,X=Q[5],H+=X*l,z+=X*z1,U+=X*j1,N+=X*t,O+=X*y1,M+=X*R1,L+=X*D0,w+=X*T1,I+=X*a1,P+=X*F1,R+=X*Y1,j+=X*O1,y+=X*L1,f+=X*E1,g+=X*A1,p+=X*u1,X=Q[6],z+=X*l,U+=X*z1,N+=X*j1,O+=X*t,M+=X*y1,L+=X*R1,w+=X*D0,I+=X*T1,P+=X*a1,R+=X*F1,j+=X*Y1,y+=X*O1,f+=X*L1,g+=X*E1,p+=X*A1,b+=X*u1,X=Q[7],U+=X*l,N+=X*z1,O+=X*j1,M+=X*t,L+=X*y1,w+=X*R1,I+=X*D0,P+=X*T1,R+=X*a1,j+=X*F1,y+=X*Y1,f+=X*O1,g+=X*L1,p+=X*E1,b+=X*A1,i+=X*u1,X=Q[8],N+=X*l,O+=X*z1,M+=X*j1,L+=X*t,w+=X*y1,I+=X*R1,P+=X*D0,R+=X*T1,j+=X*a1,y+=X*F1,f+=X*Y1,g+=X*O1,p+=X*L1,b+=X*E1,i+=X*A1,J1+=X*u1,X=Q[9],O+=X*l,M+=X*z1,L+=X*j1,w+=X*t,I+=X*y1,P+=X*R1,R+=X*D0,j+=X*T1,y+=X*a1,f+=X*F1,g+=X*Y1,p+=X*O1,b+=X*L1,i+=X*E1,J1+=X*A1,n+=X*u1,X=Q[10],M+=X*l,L+=X*z1,w+=X*j1,I+=X*t,P+=X*y1,R+=X*R1,j+=X*D0,y+=X*T1,f+=X*a1,g+=X*F1,p+=X*Y1,b+=X*O1,i+=X*L1,J1+=X*E1,n+=X*A1,m+=X*u1,X=Q[11],L+=X*l,w+=X*z1,I+=X*j1,P+=X*t,R+=X*y1,j+=X*R1,y+=X*D0,f+=X*T1,g+=X*a1,p+=X*F1,b+=X*Y1,i+=X*O1,J1+=X*L1,n+=X*E1,m+=X*A1,s+=X*u1,X=Q[12],w+=X*l,I+=X*z1,P+=X*j1,R+=X*t,j+=X*y1,y+=X*R1,f+=X*D0,g+=X*T1,p+=X*a1,b+=X*F1,i+=X*Y1,J1+=X*O1,n+=X*L1,m+=X*E1,s+=X*A1,q1+=X*u1,X=Q[13],I+=X*l,P+=X*z1,R+=X*j1,j+=X*t,y+=X*y1,f+=X*R1,g+=X*D0,p+=X*T1,b+=X*a1,i+=X*F1,J1+=X*Y1,n+=X*O1,m+=X*L1,s+=X*E1,q1+=X*A1,W1+=X*u1,X=Q[14],P+=X*l,R+=X*z1,j+=X*j1,y+=X*t,f+=X*y1,g+=X*R1,p+=X*D0,b+=X*T1,i+=X*a1,J1+=X*F1,n+=X*Y1,m+=X*O1,s+=X*L1,q1+=X*E1,W1+=X*A1,r+=X*u1,X=Q[15],R+=X*l,j+=X*z1,y+=X*j1,f+=X*t,g+=X*y1,p+=X*R1,b+=X*D0,i+=X*T1,J1+=X*a1,n+=X*F1,m+=X*Y1,s+=X*O1,q1+=X*L1,W1+=X*E1,r+=X*A1,o+=X*u1,Z+=38*j,q+=38*y,V+=38*f,K+=38*g,W+=38*p,H+=38*b,z+=38*i,U+=38*J1,N+=38*n,O+=38*m,M+=38*s,L+=38*q1,w+=38*W1,I+=38*r,P+=38*o,G=1,X=Z+G+65535,G=Math.floor(X/65536),Z=X-G*65536,X=q+G+65535,G=Math.floor(X/65536),q=X-G*65536,X=V+G+65535,G=Math.floor(X/65536),V=X-G*65536,X=K+G+65535,G=Math.floor(X/65536),K=X-G*65536,X=W+G+65535,G=Math.floor(X/65536),W=X-G*65536,X=H+G+65535,G=Math.floor(X/65536),H=X-G*65536,X=z+G+65535,G=Math.floor(X/65536),z=X-G*65536,X=U+G+65535,G=Math.floor(X/65536),U=X-G*65536,X=N+G+65535,G=Math.floor(X/65536),N=X-G*65536,X=O+G+65535,G=Math.floor(X/65536),O=X-G*65536,X=M+G+65535,G=Math.floor(X/65536),M=X-G*65536,X=L+G+65535,G=Math.floor(X/65536),L=X-G*65536,X=w+G+65535,G=Math.floor(X/65536),w=X-G*65536,X=I+G+65535,G=Math.floor(X/65536),I=X-G*65536,X=P+G+65535,G=Math.floor(X/65536),P=X-G*65536,X=R+G+65535,G=Math.floor(X/65536),R=X-G*65536,Z+=G-1+37*(G-1),G=1,X=Z+G+65535,G=Math.floor(X/65536),Z=X-G*65536,X=q+G+65535,G=Math.floor(X/65536),q=X-G*65536,X=V+G+65535,G=Math.floor(X/65536),V=X-G*65536,X=K+G+65535,G=Math.floor(X/65536),K=X-G*65536,X=W+G+65535,G=Math.floor(X/65536),W=X-G*65536,X=H+G+65535,G=Math.floor(X/65536),H=X-G*65536,X=z+G+65535,G=Math.floor(X/65536),z=X-G*65536,X=U+G+65535,G=Math.floor(X/65536),U=X-G*65536,X=N+G+65535,G=Math.floor(X/65536),N=X-G*65536,X=O+G+65535,G=Math.floor(X/65536),O=X-G*65536,X=M+G+65535,G=Math.floor(X/65536),M=X-G*65536,X=L+G+65535,G=Math.floor(X/65536),L=X-G*65536,X=w+G+65535,G=Math.floor(X/65536),w=X-G*65536,X=I+G+65535,G=Math.floor(X/65536),I=X-G*65536,X=P+G+65535,G=Math.floor(X/65536),P=X-G*65536,X=R+G+65535,G=Math.floor(X/65536),R=X-G*65536,Z+=G-1+37*(G-1),J[0]=Z,J[1]=q,J[2]=V,J[3]=K,J[4]=W,J[5]=H,J[6]=z,J[7]=U,J[8]=N,J[9]=O,J[10]=M,J[11]=L,J[12]=w,J[13]=I,J[14]=P,J[15]=R}});var AX6=h((fZ5,LX6)=>{var e$=m8();i9();SG();Hg();LX6.exports=e$.kem=e$.kem||{};var OX6=e$.jsbn.BigInteger;e$.kem.rsa={};e$.kem.rsa.create=function(J,Q){Q=Q||{};var Y=Q.prng||e$.random,X={};return X.encrypt=function(G,Z){var q=Math.ceil(G.n.bitLength()/8),V;do V=new OX6(e$.util.bytesToHex(Y.getBytesSync(q)),16).mod(G.n);while(V.compareTo(OX6.ONE)<=0);V=e$.util.hexToBytes(V.toString(16));var K=q-V.length;if(K>0)V=e$.util.fillString(String.fromCharCode(0),K)+V;var W=G.encrypt(V,"NONE"),H=J.generate(V,Z);return{encapsulation:W,key:H}},X.decrypt=function(G,Z,q){var V=G.decrypt(Z,"NONE");return J.generate(V,q)},X};e$.kem.kdf1=function(J,Q){MX6(this,J,0,Q||J.digestLength)};e$.kem.kdf2=function(J,Q){MX6(this,J,1,Q||J.digestLength)};function MX6(J,Q,Y,X){J.generate=function(G,Z){var q=new e$.util.ByteBuffer,V=Math.ceil(Z/X)+Y,K=new e$.util.ByteBuffer;for(var W=Y;W<V;++W){K.putInt32(W),Q.start(),Q.update(G+K.getBytes());var H=Q.digest();q.putBytes(H.getBytes(X))}return q.truncate(q.length()-Z),q.getBytes()}}});var wX6=h((hZ5,EX6)=>{var E9=m8();i9();EX6.exports=E9.log=E9.log||{};E9.log.levels=["none","error","warning","info","debug","verbose","max"];var O91={},xk1=[],Og=null;E9.log.LEVEL_LOCKED=2;E9.log.NO_LEVEL_CHECK=4;E9.log.INTERPOLATE=8;for(xG=0;xG<E9.log.levels.length;++xG)N91=E9.log.levels[xG],O91[N91]={index:xG,name:N91.toUpperCase()};var N91,xG;E9.log.logMessage=function(J){var Q=O91[J.level].index;for(var Y=0;Y<xk1.length;++Y){var X=xk1[Y];if(X.flags&E9.log.NO_LEVEL_CHECK)X.f(J);else{var G=O91[X.level].index;if(Q<=G)X.f(X,J)}}};E9.log.prepareStandard=function(J){if(!("standard"in J))J.standard=O91[J.level].name+" ["+J.category+"] "+J.message};E9.log.prepareFull=function(J){if(!("full"in J)){var Q=[J.message];Q=Q.concat([]),J.full=E9.util.format.apply(this,Q)}};E9.log.prepareStandardFull=function(J){if(!("standardFull"in J))E9.log.prepareStandard(J),J.standardFull=J.standard};D91=["error","warning","info","debug","verbose"];for(xG=0;xG<D91.length;++xG)(function(Q){E9.log[Q]=function(Y,X){var G=Array.prototype.slice.call(arguments).slice(2),Z={timestamp:new Date,level:Q,category:Y,message:X,arguments:G};E9.log.logMessage(Z)}})(D91[xG]);var D91,xG;E9.log.makeLogger=function(J){var Q={flags:0,f:J};return E9.log.setLevel(Q,"none"),Q};E9.log.setLevel=function(J,Q){var Y=!1;if(J&&!(J.flags&E9.log.LEVEL_LOCKED))for(var X=0;X<E9.log.levels.length;++X){var G=E9.log.levels[X];if(Q==G){J.level=Q,Y=!0;break}}return Y};E9.log.lock=function(J,Q){if(typeof Q>"u"||Q)J.flags|=E9.log.LEVEL_LOCKED;else J.flags&=~E9.log.LEVEL_LOCKED};E9.log.addLogger=function(J){xk1.push(J)};if(typeof console<"u"&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)fk1={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},PC=function(J,Q){E9.log.prepareStandard(Q);var Y=fk1[Q.level],X=[Q.standard];X=X.concat(Q.arguments.slice()),Y.apply(console,X)},NA=E9.log.makeLogger(PC);else PC=function(Q,Y){E9.log.prepareStandardFull(Y),console.log(Y.standardFull)},NA=E9.log.makeLogger(PC);E9.log.setLevel(NA,"debug"),E9.log.addLogger(NA),Og=NA}else console={log:function(){}};var NA,fk1,PC;if(Og!==null&&typeof window<"u"&&window.location){if(IC=new URL(window.location.href).searchParams,IC.has("console.level"))E9.log.setLevel(Og,IC.get("console.level").slice(-1)[0]);if(IC.has("console.lock")){if(hk1=IC.get("console.lock").slice(-1)[0],hk1=="true")E9.log.lock(Og)}}var IC,hk1;E9.log.consoleLogger=Og});var PX6=h((bZ5,IX6)=>{IX6.exports=yK();o81();DC();r_1();Pk1()});var CX6=h((uZ5,RX6)=>{var m6=m8();eB();Mq();Kg();JN();VA();Wk1();SG();i9();W91();var Y0=m6.asn1,pQ=RX6.exports=m6.pkcs7=m6.pkcs7||{};pQ.messageFromPem=function(J){var Q=m6.pem.decode(J)[0];if(Q.type!=="PKCS7"){var Y=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var X=Y0.fromDer(Q.body);return pQ.messageFromAsn1(X)};pQ.messageToPem=function(J,Q){var Y={type:"PKCS7",body:Y0.toDer(J.toAsn1()).getBytes()};return m6.pem.encode(Y,{maxline:Q})};pQ.messageFromAsn1=function(J){var Q={},Y=[];if(!Y0.validate(J,pQ.asn1.contentInfoValidator,Q,Y)){var X=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw X.errors=Y,X}var G=Y0.derToOid(Q.contentType),Z;switch(G){case m6.pki.oids.envelopedData:Z=pQ.createEnvelopedData();break;case m6.pki.oids.encryptedData:Z=pQ.createEncryptedData();break;case m6.pki.oids.signedData:Z=pQ.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+G+" is not (yet) supported.")}return Z.fromAsn1(Q.content.value[0]),Z};pQ.createSignedData=function(){var J=null;return J={type:m6.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(X){if(uk1(J,X,pQ.asn1.signedDataValidator),J.certificates=[],J.crls=[],J.digestAlgorithmIdentifiers=[],J.contentInfo=null,J.signerInfos=[],J.rawCapture.certificates){var G=J.rawCapture.certificates.value;for(var Z=0;Z<G.length;++Z)J.certificates.push(m6.pki.certificateFromAsn1(G[Z]))}},toAsn1:function(){if(!J.contentInfo)J.sign();var X=[];for(var G=0;G<J.certificates.length;++G)X.push(m6.pki.certificateToAsn1(J.certificates[G]));var Z=[],q=Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,J.digestAlgorithmIdentifiers),J.contentInfo])]);if(X.length>0)q.value[0].value.push(Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,X));if(Z.length>0)q.value[0].value.push(Y0.create(Y0.Class.CONTEXT_SPECIFIC,1,!0,Z));return q.value[0].value.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,J.signerInfos)),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.type).getBytes()),q])},addSigner:function(X){var{issuer:G,serialNumber:Z}=X;if(X.certificate){var q=X.certificate;if(typeof q==="string")q=m6.pki.certificateFromPem(q);G=q.issuer.attributes,Z=q.serialNumber}var V=X.key;if(!V)throw Error("Could not add PKCS#7 signer; no private key specified.");if(typeof V==="string")V=m6.pki.privateKeyFromPem(V);var K=X.digestAlgorithm||m6.pki.oids.sha1;switch(K){case m6.pki.oids.sha1:case m6.pki.oids.sha256:case m6.pki.oids.sha384:case m6.pki.oids.sha512:case m6.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+K)}var W=X.authenticatedAttributes||[];if(W.length>0){var H=!1,z=!1;for(var U=0;U<W.length;++U){var N=W[U];if(!H&&N.type===m6.pki.oids.contentType){if(H=!0,z)break;continue}if(!z&&N.type===m6.pki.oids.messageDigest){if(z=!0,H)break;continue}}if(!H||!z)throw 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.")}J.signers.push({key:V,version:1,issuer:G,serialNumber:Z,digestAlgorithm:K,signatureAlgorithm:m6.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:W,unauthenticatedAttributes:[]})},sign:function(X){if(X=X||{},typeof J.content!=="object"||J.contentInfo===null){if(J.contentInfo=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(m6.pki.oids.data).getBytes())]),"content"in J){var G;if(J.content instanceof m6.util.ByteBuffer)G=J.content.bytes();else if(typeof J.content==="string")G=m6.util.encodeUtf8(J.content);if(X.detached)J.detachedContent=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,G);else J.contentInfo.value.push(Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,G)]))}}if(J.signers.length===0)return;var Z=Q();Y(Z)},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(X){if(typeof X==="string")X=m6.pki.certificateFromPem(X);J.certificates.push(X)},addCertificateRevokationList:function(X){throw Error("PKCS#7 CRL support not yet implemented.")}},J;function Q(){var X={};for(var G=0;G<J.signers.length;++G){var Z=J.signers[G],q=Z.digestAlgorithm;if(!(q in X))X[q]=m6.md[m6.pki.oids[q]].create();if(Z.authenticatedAttributes.length===0)Z.md=X[q];else Z.md=m6.md[m6.pki.oids[q]].create()}J.digestAlgorithmIdentifiers=[];for(var q in X)J.digestAlgorithmIdentifiers.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(q).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")]));return X}function Y(X){var G;if(J.detachedContent)G=J.detachedContent;else G=J.contentInfo.value[1],G=G.value[0];if(!G)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var Z=Y0.derToOid(J.contentInfo.value[0].value),q=Y0.toDer(G);q.getByte(),Y0.getBerValueLength(q),q=q.getBytes();for(var V in X)X[V].start().update(q);var K=new Date;for(var W=0;W<J.signers.length;++W){var H=J.signers[W];if(H.authenticatedAttributes.length===0){if(Z!==m6.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{H.authenticatedAttributesAsn1=Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[]);var z=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,[]);for(var U=0;U<H.authenticatedAttributes.length;++U){var N=H.authenticatedAttributes[U];if(N.type===m6.pki.oids.messageDigest)N.value=X[H.digestAlgorithm].digest();else if(N.type===m6.pki.oids.signingTime){if(!N.value)N.value=K}z.value.push(bk1(N)),H.authenticatedAttributesAsn1.value.push(bk1(N))}q=Y0.toDer(z).getBytes(),H.md.start().update(q)}H.signature=H.key.sign(H.md,"RSASSA-PKCS1-V1_5")}J.signerInfos=tD8(J.signers)}};pQ.createEncryptedData=function(){var J=null;return J={type:m6.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:m6.pki.oids["aes256-CBC"]},fromAsn1:function(Q){uk1(J,Q,pQ.asn1.encryptedDataValidator)},decrypt:function(Q){if(Q!==void 0)J.encryptedContent.key=Q;TX6(J)}},J};pQ.createEnvelopedData=function(){var J=null;return J={type:m6.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:m6.pki.oids["aes256-CBC"]},fromAsn1:function(Q){var Y=uk1(J,Q,pQ.asn1.envelopedDataValidator);J.recipients=rD8(Y.recipientInfos.value)},toAsn1:function(){return Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.type).getBytes()),Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,oD8(J.recipients)),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,eD8(J.encryptedContent))])])])},findRecipient:function(Q){var Y=Q.issuer.attributes;for(var X=0;X<J.recipients.length;++X){var G=J.recipients[X],Z=G.issuer;if(G.serialNumber!==Q.serialNumber)continue;if(Z.length!==Y.length)continue;var q=!0;for(var V=0;V<Y.length;++V)if(Z[V].type!==Y[V].type||Z[V].value!==Y[V].value){q=!1;break}if(q)return G}return null},decrypt:function(Q,Y){if(J.encryptedContent.key===void 0&&Q!==void 0&&Y!==void 0)switch(Q.encryptedContent.algorithm){case m6.pki.oids.rsaEncryption:case m6.pki.oids.desCBC:var X=Y.decrypt(Q.encryptedContent.content);J.encryptedContent.key=m6.util.createBuffer(X);break;default:throw Error("Unsupported asymmetric cipher, OID "+Q.encryptedContent.algorithm)}TX6(J)},addRecipient:function(Q){J.recipients.push({version:0,issuer:Q.issuer.attributes,serialNumber:Q.serialNumber,encryptedContent:{algorithm:m6.pki.oids.rsaEncryption,key:Q.publicKey}})},encrypt:function(Q,Y){if(J.encryptedContent.content===void 0){Y=Y||J.encryptedContent.algorithm,Q=Q||J.encryptedContent.key;var X,G,Z;switch(Y){case m6.pki.oids["aes128-CBC"]:X=16,G=16,Z=m6.aes.createEncryptionCipher;break;case m6.pki.oids["aes192-CBC"]:X=24,G=16,Z=m6.aes.createEncryptionCipher;break;case m6.pki.oids["aes256-CBC"]:X=32,G=16,Z=m6.aes.createEncryptionCipher;break;case m6.pki.oids["des-EDE3-CBC"]:X=24,G=8,Z=m6.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+Y)}if(Q===void 0)Q=m6.util.createBuffer(m6.random.getBytes(X));else if(Q.length()!=X)throw Error("Symmetric key has wrong length; got "+Q.length()+" bytes, expected "+X+".");J.encryptedContent.algorithm=Y,J.encryptedContent.key=Q,J.encryptedContent.parameter=m6.util.createBuffer(m6.random.getBytes(G));var q=Z(Q);if(q.start(J.encryptedContent.parameter.copy()),q.update(J.content),!q.finish())throw Error("Symmetric encryption failed.");J.encryptedContent.content=q.output}for(var V=0;V<J.recipients.length;++V){var K=J.recipients[V];if(K.encryptedContent.content!==void 0)continue;switch(K.encryptedContent.algorithm){case m6.pki.oids.rsaEncryption:K.encryptedContent.content=K.encryptedContent.key.encrypt(J.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+K.encryptedContent.algorithm)}}}},J};function nD8(J){var Q={},Y=[];if(!Y0.validate(J,pQ.asn1.recipientInfoValidator,Q,Y)){var X=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw X.errors=Y,X}return{version:Q.version.charCodeAt(0),issuer:m6.pki.RDNAttributesAsArray(Q.issuer),serialNumber:m6.util.createBuffer(Q.serial).toHex(),encryptedContent:{algorithm:Y0.derToOid(Q.encAlgorithm),parameter:Q.encParameter?Q.encParameter.value:void 0,content:Q.encKey}}}function aD8(J){return Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[m6.pki.distinguishedNameToAsn1({attributes:J.issuer}),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,m6.util.hexToBytes(J.serialNumber))]),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.encryptedContent.algorithm).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")]),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.encryptedContent.content)])}function rD8(J){var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(nD8(J[Y]));return Q}function oD8(J){var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(aD8(J[Y]));return Q}function sD8(J){var Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[m6.pki.distinguishedNameToAsn1({attributes:J.issuer}),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,m6.util.hexToBytes(J.serialNumber))]),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.digestAlgorithm).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")])]);if(J.authenticatedAttributesAsn1)Q.value.push(J.authenticatedAttributesAsn1);if(Q.value.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.signatureAlgorithm).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")])),Q.value.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.signature)),J.unauthenticatedAttributes.length>0){var Y=Y0.create(Y0.Class.CONTEXT_SPECIFIC,1,!0,[]);for(var X=0;X<J.unauthenticatedAttributes.length;++X){var G=J.unauthenticatedAttributes[X];Y.values.push(bk1(G))}Q.value.push(Y)}return Q}function tD8(J){var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(sD8(J[Y]));return Q}function bk1(J){var Q;if(J.type===m6.pki.oids.contentType)Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.value).getBytes());else if(J.type===m6.pki.oids.messageDigest)Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.value.bytes());else if(J.type===m6.pki.oids.signingTime){var Y=new Date("1950-01-01T00:00:00Z"),X=new Date("2050-01-01T00:00:00Z"),G=J.value;if(typeof G==="string"){var Z=Date.parse(G);if(!isNaN(Z))G=new Date(Z);else if(G.length===13)G=Y0.utcTimeToDate(G);else G=Y0.generalizedTimeToDate(G)}if(G>=Y&&G<X)Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.UTCTIME,!1,Y0.dateToUtcTime(G));else Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.GENERALIZEDTIME,!1,Y0.dateToGeneralizedTime(G))}return Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.type).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,[Q])])}function eD8(J){return[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(m6.pki.oids.data).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.algorithm).getBytes()),!J.parameter?void 0:Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.parameter.getBytes())]),Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.content.getBytes())])]}function uk1(J,Q,Y){var X={},G=[];if(!Y0.validate(Q,Y,X,G)){var Z=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw Z.errors=Z,Z}var q=Y0.derToOid(X.contentType);if(q!==m6.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(X.encryptedContent){var V="";if(m6.util.isArray(X.encryptedContent))for(var K=0;K<X.encryptedContent.length;++K){if(X.encryptedContent[K].type!==Y0.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");V+=X.encryptedContent[K].value}else V=X.encryptedContent;J.encryptedContent={algorithm:Y0.derToOid(X.encAlgorithm),parameter:m6.util.createBuffer(X.encParameter.value),content:m6.util.createBuffer(V)}}if(X.content){var V="";if(m6.util.isArray(X.content))for(var K=0;K<X.content.length;++K){if(X.content[K].type!==Y0.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");V+=X.content[K].value}else V=X.content;J.content=m6.util.createBuffer(V)}return J.version=X.version.charCodeAt(0),J.rawCapture=X,X}function TX6(J){if(J.encryptedContent.key===void 0)throw Error("Symmetric key not available.");if(J.content===void 0){var Q;switch(J.encryptedContent.algorithm){case m6.pki.oids["aes128-CBC"]:case m6.pki.oids["aes192-CBC"]:case m6.pki.oids["aes256-CBC"]:Q=m6.aes.createDecryptionCipher(J.encryptedContent.key);break;case m6.pki.oids.desCBC:case m6.pki.oids["des-EDE3-CBC"]:Q=m6.des.createDecryptionCipher(J.encryptedContent.key);break;default:throw Error("Unsupported symmetric cipher, OID "+J.encryptedContent.algorithm)}if(Q.start(J.encryptedContent.parameter),Q.update(J.encryptedContent.content),!Q.finish())throw Error("Symmetric decryption failed.");J.content=Q.output}}});var jX6=h((gZ5,SX6)=>{var p7=m8();eB();FC();o81();DC();i9();var L91=SX6.exports=p7.ssh=p7.ssh||{};L91.privateKeyToPutty=function(J,Q,Y){Y=Y||"",Q=Q||"";var X="ssh-rsa",G=Q===""?"none":"aes256-cbc",Z="PuTTY-User-Key-File-2: "+X+`\r
|
|
4048
|
+
`+V+Q.substr(q+1);Z=G-q-1,q=-1,++G}else if(Q[G]===" "||Q[G]==="\t"||Q[G]===",")q=G;return Q}function PU8(J){return J.replace(/^\s+/,"")}});var Kg=h((FZ5,nY6)=>{var E2=m8();d81();p_1();i9();nY6.exports=E2.des=E2.des||{};E2.des.startEncrypting=function(J,Q,Y,X){var G=e81({key:J,output:Y,decrypt:!1,mode:X||(Q===null?"ECB":"CBC")});return G.start(Q),G};E2.des.createEncryptionCipher=function(J,Q){return e81({key:J,output:null,decrypt:!1,mode:Q})};E2.des.startDecrypting=function(J,Q,Y,X){var G=e81({key:J,output:Y,decrypt:!0,mode:X||(Q===null?"ECB":"CBC")});return G.start(Q),G};E2.des.createDecryptionCipher=function(J,Q){return e81({key:J,output:null,decrypt:!0,mode:Q})};E2.des.Algorithm=function(J,Q){var Y=this;Y.name=J,Y.mode=new Q({blockSize:8,cipher:{encrypt:function(X,G){return iY6(Y._keys,X,G,!1)},decrypt:function(X,G){return iY6(Y._keys,X,G,!0)}}}),Y._init=!1};E2.des.Algorithm.prototype.initialize=function(J){if(this._init)return;var Q=E2.util.createBuffer(J.key);if(this.name.indexOf("3DES")===0){if(Q.length()!==24)throw Error("Invalid Triple-DES key size: "+Q.length()*8)}this._keys=vU8(Q),this._init=!0};xK("DES-ECB",E2.cipher.modes.ecb);xK("DES-CBC",E2.cipher.modes.cbc);xK("DES-CFB",E2.cipher.modes.cfb);xK("DES-OFB",E2.cipher.modes.ofb);xK("DES-CTR",E2.cipher.modes.ctr);xK("3DES-ECB",E2.cipher.modes.ecb);xK("3DES-CBC",E2.cipher.modes.cbc);xK("3DES-CFB",E2.cipher.modes.cfb);xK("3DES-OFB",E2.cipher.modes.ofb);xK("3DES-CTR",E2.cipher.modes.ctr);function xK(J,Q){var Y=function(){return new E2.des.Algorithm(J,Q)};E2.cipher.registerAlgorithm(J,Y)}var TU8=[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],RU8=[-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],CU8=[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],SU8=[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],jU8=[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],_U8=[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],kU8=[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],yU8=[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 vU8(J){var Q=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],Y=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],X=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],G=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],Z=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],q=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],V=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],K=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],W=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],H=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],z=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],U=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],N=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],O=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],M=J.length()>8?3:1,L=[],w=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],I=0,P;for(var R=0;R<M;R++){var j=J.getInt32(),y=J.getInt32();P=(j>>>4^y)&252645135,y^=P,j^=P<<4,P=(y>>>-16^j)&65535,j^=P,y^=P<<-16,P=(j>>>2^y)&858993459,y^=P,j^=P<<2,P=(y>>>-16^j)&65535,j^=P,y^=P<<-16,P=(j>>>1^y)&1431655765,y^=P,j^=P<<1,P=(y>>>8^j)&16711935,j^=P,y^=P<<8,P=(j>>>1^y)&1431655765,y^=P,j^=P<<1,P=j<<8|y>>>20&240,j=y<<24|y<<8&16711680|y>>>8&65280|y>>>24&240,y=P;for(var f=0;f<w.length;++f){if(w[f])j=j<<2|j>>>26,y=y<<2|y>>>26;else j=j<<1|j>>>27,y=y<<1|y>>>27;j&=-15,y&=-15;var g=Q[j>>>28]|Y[j>>>24&15]|X[j>>>20&15]|G[j>>>16&15]|Z[j>>>12&15]|q[j>>>8&15]|V[j>>>4&15],p=K[y>>>28]|W[y>>>24&15]|H[y>>>20&15]|z[y>>>16&15]|U[y>>>12&15]|N[y>>>8&15]|O[y>>>4&15];P=(p>>>16^g)&65535,L[I++]=g^P,L[I++]=p^P<<16}}return L}function iY6(J,Q,Y,X){var G=J.length===32?3:9,Z;if(G===3)Z=X?[30,-2,-2]:[0,32,2];else Z=X?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var q,V=Q[0],K=Q[1];q=(V>>>4^K)&252645135,K^=q,V^=q<<4,q=(V>>>16^K)&65535,K^=q,V^=q<<16,q=(K>>>2^V)&858993459,V^=q,K^=q<<2,q=(K>>>8^V)&16711935,V^=q,K^=q<<8,q=(V>>>1^K)&1431655765,K^=q,V^=q<<1,V=V<<1|V>>>31,K=K<<1|K>>>31;for(var W=0;W<G;W+=3){var H=Z[W+1],z=Z[W+2];for(var U=Z[W];U!=H;U+=z){var N=K^J[U],O=(K>>>4|K<<28)^J[U+1];q=V,V=K,K=q^(RU8[N>>>24&63]|SU8[N>>>16&63]|_U8[N>>>8&63]|yU8[N&63]|TU8[O>>>24&63]|CU8[O>>>16&63]|jU8[O>>>8&63]|kU8[O&63])}q=V,V=K,K=q}V=V>>>1|V<<31,K=K>>>1|K<<31,q=(V>>>1^K)&1431655765,K^=q,V^=q<<1,q=(K>>>8^V)&16711935,V^=q,K^=q<<8,q=(K>>>2^V)&858993459,V^=q,K^=q<<2,q=(V>>>16^K)&65535,K^=q,V^=q<<16,q=(V>>>4^K)&252645135,K^=q,V^=q<<4,Y[0]=V,Y[1]=K}function e81(J){J=J||{};var Q=(J.mode||"CBC").toUpperCase(),Y="DES-"+Q,X;if(J.decrypt)X=E2.cipher.createDecipher(Y,J.key);else X=E2.cipher.createCipher(Y,J.key);var G=X.start;return X.start=function(Z,q){var V=null;if(q instanceof E2.util.ByteBuffer)V=q,q={};q=q||{},q.output=V,q.iv=Z,G.call(X,q)},X}});var J91=h((UZ5,aY6)=>{var gQ=m8();FC();yK();i9();var xU8=gQ.pkcs5=gQ.pkcs5||{},Fz;if(gQ.util.isNodejs&&!gQ.options.usePureJavaScript)Fz=S1("crypto");aY6.exports=gQ.pbkdf2=xU8.pbkdf2=function(J,Q,Y,X,G,Z){if(typeof G==="function")Z=G,G=null;if(gQ.util.isNodejs&&!gQ.options.usePureJavaScript&&Fz.pbkdf2&&(G===null||typeof G!=="object")&&(Fz.pbkdf2Sync.length>4||(!G||G==="sha1"))){if(typeof G!=="string")G="sha1";if(J=Buffer.from(J,"binary"),Q=Buffer.from(Q,"binary"),!Z){if(Fz.pbkdf2Sync.length===4)return Fz.pbkdf2Sync(J,Q,Y,X).toString("binary");return Fz.pbkdf2Sync(J,Q,Y,X,G).toString("binary")}if(Fz.pbkdf2Sync.length===4)return Fz.pbkdf2(J,Q,Y,X,function(P,R){if(P)return Z(P);Z(null,R.toString("binary"))});return Fz.pbkdf2(J,Q,Y,X,G,function(P,R){if(P)return Z(P);Z(null,R.toString("binary"))})}if(typeof G>"u"||G===null)G="sha1";if(typeof G==="string"){if(!(G in gQ.md.algorithms))throw Error("Unknown hash algorithm: "+G);G=gQ.md[G].create()}var q=G.digestLength;if(X>4294967295*q){var V=Error("Derived key is too long.");if(Z)return Z(V);throw V}var K=Math.ceil(X/q),W=X-(K-1)*q,H=gQ.hmac.create();H.start(G,J);var z="",U,N,O;if(!Z){for(var M=1;M<=K;++M){H.start(null,null),H.update(Q),H.update(gQ.util.int32ToBytes(M)),U=O=H.digest().getBytes();for(var L=2;L<=Y;++L)H.start(null,null),H.update(O),N=H.digest().getBytes(),U=gQ.util.xorBytes(U,N,q),O=N;z+=M<K?U:U.substr(0,W)}return z}var M=1,L;function w(){if(M>K)return Z(null,z);H.start(null,null),H.update(Q),H.update(gQ.util.int32ToBytes(M)),U=O=H.digest().getBytes(),L=2,I()}function I(){if(L<=Y)return H.start(null,null),H.update(O),N=H.digest().getBytes(),U=gQ.util.xorBytes(U,N,q),O=N,++L,gQ.util.setImmediate(I);z+=M<K?U:U.substr(0,W),++M,w()}w()}});var r_1=h((BZ5,eY6)=>{var fK=m8();yK();i9();var oY6=eY6.exports=fK.sha256=fK.sha256||{};fK.md.sha256=fK.md.algorithms.sha256=oY6;oY6.create=function(){if(!sY6)fU8();var J=null,Q=fK.util.createBuffer(),Y=Array(64),X={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return X.start=function(){X.messageLength=0,X.fullMessageLength=X.messageLength64=[];var G=X.messageLengthSize/4;for(var Z=0;Z<G;++Z)X.fullMessageLength.push(0);return Q=fK.util.createBuffer(),J={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},X},X.start(),X.update=function(G,Z){if(Z==="utf8")G=fK.util.encodeUtf8(G);var q=G.length;X.messageLength+=q,q=[q/4294967296>>>0,q>>>0];for(var V=X.fullMessageLength.length-1;V>=0;--V)X.fullMessageLength[V]+=q[1],q[1]=q[0]+(X.fullMessageLength[V]/4294967296>>>0),X.fullMessageLength[V]=X.fullMessageLength[V]>>>0,q[0]=q[1]/4294967296>>>0;if(Q.putBytes(G),rY6(J,Y,Q),Q.read>2048||Q.length()===0)Q.compact();return X},X.digest=function(){var G=fK.util.createBuffer();G.putBytes(Q.bytes());var Z=X.fullMessageLength[X.fullMessageLength.length-1]+X.messageLengthSize,q=Z&X.blockLength-1;G.putBytes(a_1.substr(0,X.blockLength-q));var V,K,W=X.fullMessageLength[0]*8;for(var H=0;H<X.fullMessageLength.length-1;++H)V=X.fullMessageLength[H+1]*8,K=V/4294967296>>>0,W+=K,G.putInt32(W>>>0),W=V>>>0;G.putInt32(W);var z={h0:J.h0,h1:J.h1,h2:J.h2,h3:J.h3,h4:J.h4,h5:J.h5,h6:J.h6,h7:J.h7};rY6(z,Y,G);var U=fK.util.createBuffer();return U.putInt32(z.h0),U.putInt32(z.h1),U.putInt32(z.h2),U.putInt32(z.h3),U.putInt32(z.h4),U.putInt32(z.h5),U.putInt32(z.h6),U.putInt32(z.h7),U},X};var a_1=null,sY6=!1,tY6=null;function fU8(){a_1=String.fromCharCode(128),a_1+=fK.util.fillString(String.fromCharCode(0),64),tY6=[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],sY6=!0}function rY6(J,Q,Y){var X,G,Z,q,V,K,W,H,z,U,N,O,M,L,w,I=Y.length();while(I>=64){for(W=0;W<16;++W)Q[W]=Y.getInt32();for(;W<64;++W)X=Q[W-2],X=(X>>>17|X<<15)^(X>>>19|X<<13)^X>>>10,G=Q[W-15],G=(G>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,Q[W]=X+Q[W-7]+G+Q[W-16]|0;H=J.h0,z=J.h1,U=J.h2,N=J.h3,O=J.h4,M=J.h5,L=J.h6,w=J.h7;for(W=0;W<64;++W)q=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),V=L^O&(M^L),Z=(H>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),K=H&z|U&(H^z),X=w+q+V+tY6[W]+Q[W],G=Z+K,w=L,L=M,M=O,O=N+X>>>0,N=U,U=z,z=H,H=X+G>>>0;J.h0=J.h0+H|0,J.h1=J.h1+z|0,J.h2=J.h2+U|0,J.h3=J.h3+N|0,J.h4=J.h4+O|0,J.h5=J.h5+M|0,J.h6=J.h6+L|0,J.h7=J.h7+w|0,I-=64}}});var o_1=h((NZ5,J$6)=>{var hK=m8();i9();var Q91=null;if(hK.util.isNodejs&&!hK.options.usePureJavaScript&&!process.versions["node-webkit"])Q91=S1("crypto");var hU8=J$6.exports=hK.prng=hK.prng||{};hU8.create=function(J){var Q={plugin:J,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},Y=J.md,X=Array(32);for(var G=0;G<32;++G)X[G]=Y.create();Q.pools=X,Q.pool=0,Q.generate=function(W,H){if(!H)return Q.generateSync(W);var z=Q.plugin.cipher,U=Q.plugin.increment,N=Q.plugin.formatKey,O=Q.plugin.formatSeed,M=hK.util.createBuffer();Q.key=null,L();function L(w){if(w)return H(w);if(M.length()>=W)return H(null,M.getBytes(W));if(Q.generated>1048575)Q.key=null;if(Q.key===null)return hK.util.nextTick(function(){Z(L)});var I=z(Q.key,Q.seed);Q.generated+=I.length,M.putBytes(I),Q.key=N(z(Q.key,U(Q.seed))),Q.seed=O(z(Q.key,Q.seed)),hK.util.setImmediate(L)}},Q.generateSync=function(W){var H=Q.plugin.cipher,z=Q.plugin.increment,U=Q.plugin.formatKey,N=Q.plugin.formatSeed;Q.key=null;var O=hK.util.createBuffer();while(O.length()<W){if(Q.generated>1048575)Q.key=null;if(Q.key===null)q();var M=H(Q.key,Q.seed);Q.generated+=M.length,O.putBytes(M),Q.key=U(H(Q.key,z(Q.seed))),Q.seed=N(H(Q.key,Q.seed))}return O.getBytes(W)};function Z(W){if(Q.pools[0].messageLength>=32)return V(),W();var H=32-Q.pools[0].messageLength<<5;Q.seedFile(H,function(z,U){if(z)return W(z);Q.collect(U),V(),W()})}function q(){if(Q.pools[0].messageLength>=32)return V();var W=32-Q.pools[0].messageLength<<5;Q.collect(Q.seedFileSync(W)),V()}function V(){Q.reseeds=Q.reseeds===4294967295?0:Q.reseeds+1;var W=Q.plugin.md.create();W.update(Q.keyBytes);var H=1;for(var z=0;z<32;++z){if(Q.reseeds%H===0)W.update(Q.pools[z].digest().getBytes()),Q.pools[z].start();H=H<<1}Q.keyBytes=W.digest().getBytes(),W.start(),W.update(Q.keyBytes);var U=W.digest().getBytes();Q.key=Q.plugin.formatKey(Q.keyBytes),Q.seed=Q.plugin.formatSeed(U),Q.generated=0}function K(W){var H=null,z=hK.util.globalScope,U=z.crypto||z.msCrypto;if(U&&U.getRandomValues)H=function(j){return U.getRandomValues(j)};var N=hK.util.createBuffer();if(H)while(N.length()<W){var O=Math.max(1,Math.min(W-N.length(),65536)/4),M=new Uint32Array(Math.floor(O));try{H(M);for(var L=0;L<M.length;++L)N.putInt32(M[L])}catch(j){if(!(typeof QuotaExceededError<"u"&&j instanceof QuotaExceededError))throw j}}if(N.length()<W){var w,I,P,R=Math.floor(Math.random()*65536);while(N.length()<W){I=16807*(R&65535),w=16807*(R>>16),I+=(w&32767)<<16,I+=w>>15,I=(I&2147483647)+(I>>31),R=I&4294967295;for(var L=0;L<3;++L)P=R>>>(L<<3),P^=Math.floor(Math.random()*256),N.putByte(P&255)}}return N.getBytes(W)}if(Q91)Q.seedFile=function(W,H){Q91.randomBytes(W,function(z,U){if(z)return H(z);H(null,U.toString())})},Q.seedFileSync=function(W){return Q91.randomBytes(W).toString()};else Q.seedFile=function(W,H){try{H(null,K(W))}catch(z){H(z)}},Q.seedFileSync=K;return Q.collect=function(W){var H=W.length;for(var z=0;z<H;++z)Q.pools[Q.pool].update(W.substr(z,1)),Q.pool=Q.pool===31?0:Q.pool+1},Q.collectInt=function(W,H){var z="";for(var U=0;U<H;U+=8)z+=String.fromCharCode(W>>U&255);Q.collect(z)},Q.registerWorker=function(W){if(W===self)Q.seedFile=function(z,U){function N(O){var M=O.data;if(M.forge&&M.forge.prng)self.removeEventListener("message",N),U(M.forge.prng.err,M.forge.prng.bytes)}self.addEventListener("message",N),self.postMessage({forge:{prng:{needed:z}}})};else{var H=function(z){var U=z.data;if(U.forge&&U.forge.prng)Q.seedFile(U.forge.prng.needed,function(N,O){W.postMessage({forge:{prng:{err:N,bytes:O}}})})};W.addEventListener("message",H)}},Q}});var SG=h((DZ5,s_1)=>{var m3=m8();eB();r_1();o_1();i9();(function(){if(m3.random&&m3.random.getBytes){s_1.exports=m3.random;return}(function(J){var Q={},Y=[,,,,],X=m3.util.createBuffer();Q.formatKey=function(z){var U=m3.util.createBuffer(z);return z=[,,,,],z[0]=U.getInt32(),z[1]=U.getInt32(),z[2]=U.getInt32(),z[3]=U.getInt32(),m3.aes._expandKey(z,!1)},Q.formatSeed=function(z){var U=m3.util.createBuffer(z);return z=[,,,,],z[0]=U.getInt32(),z[1]=U.getInt32(),z[2]=U.getInt32(),z[3]=U.getInt32(),z},Q.cipher=function(z,U){return m3.aes._updateBlock(z,U,Y,!1),X.putInt32(Y[0]),X.putInt32(Y[1]),X.putInt32(Y[2]),X.putInt32(Y[3]),X.getBytes()},Q.increment=function(z){return++z[3],z},Q.md=m3.md.sha256;function G(){var z=m3.prng.create(Q);return z.getBytes=function(U,N){return z.generate(U,N)},z.getBytesSync=function(U){return z.generate(U)},z}var Z=G(),q=null,V=m3.util.globalScope,K=V.crypto||V.msCrypto;if(K&&K.getRandomValues)q=function(z){return K.getRandomValues(z)};if(m3.options.usePureJavaScript||!m3.util.isNodejs&&!q){if(typeof window>"u"||window.document===void 0);if(Z.collectInt(+new Date,32),typeof navigator<"u"){var W="";for(var H in navigator)try{if(typeof navigator[H]=="string")W+=navigator[H]}catch(z){}Z.collect(W),W=null}if(J)J().mousemove(function(z){Z.collectInt(z.clientX,16),Z.collectInt(z.clientY,16)}),J().keypress(function(z){Z.collectInt(z.charCode,8)})}if(!m3.random)m3.random=Z;else for(var H in Z)m3.random[H]=Z[H];m3.random.createInstance=G,s_1.exports=m3.random})(typeof jQuery<"u"?jQuery:null)})()});var e_1=h((OZ5,$$6)=>{var hY=m8();i9();var t_1=[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],Q$6=[1,2,3,5],bU8=function(J,Q){return J<<Q&65535|(J&65535)>>16-Q},uU8=function(J,Q){return(J&65535)>>Q|J<<16-Q&65535};$$6.exports=hY.rc2=hY.rc2||{};hY.rc2.expandKey=function(J,Q){if(typeof J==="string")J=hY.util.createBuffer(J);Q=Q||128;var Y=J,X=J.length(),G=Q,Z=Math.ceil(G/8),q=255>>(G&7),V;for(V=X;V<128;V++)Y.putByte(t_1[Y.at(V-1)+Y.at(V-X)&255]);Y.setAt(128-Z,t_1[Y.at(128-Z)&q]);for(V=127-Z;V>=0;V--)Y.setAt(V,t_1[Y.at(V+1)^Y.at(V+Z)]);return Y};var Y$6=function(J,Q,Y){var X=!1,G=null,Z=null,q=null,V,K,W,H,z=[];J=hY.rc2.expandKey(J,Q);for(W=0;W<64;W++)z.push(J.getInt16Le());if(Y)V=function(O){for(W=0;W<4;W++)O[W]+=z[H]+(O[(W+3)%4]&O[(W+2)%4])+(~O[(W+3)%4]&O[(W+1)%4]),O[W]=bU8(O[W],Q$6[W]),H++},K=function(O){for(W=0;W<4;W++)O[W]+=z[O[(W+3)%4]&63]};else V=function(O){for(W=3;W>=0;W--)O[W]=uU8(O[W],Q$6[W]),O[W]-=z[H]+(O[(W+3)%4]&O[(W+2)%4])+(~O[(W+3)%4]&O[(W+1)%4]),H--},K=function(O){for(W=3;W>=0;W--)O[W]-=z[O[(W+3)%4]&63]};var U=function(O){var M=[];for(W=0;W<4;W++){var L=G.getInt16Le();if(q!==null)if(Y)L^=q.getInt16Le();else q.putInt16Le(L);M.push(L&65535)}H=Y?0:63;for(var w=0;w<O.length;w++)for(var I=0;I<O[w][0];I++)O[w][1](M);for(W=0;W<4;W++){if(q!==null)if(Y)q.putInt16Le(M[W]);else M[W]^=q.getInt16Le();Z.putInt16Le(M[W])}},N=null;return N={start:function(O,M){if(O){if(typeof O==="string")O=hY.util.createBuffer(O)}X=!1,G=hY.util.createBuffer(),Z=M||new hY.util.createBuffer,q=O,N.output=Z},update:function(O){if(!X)G.putBuffer(O);while(G.length()>=8)U([[5,V],[1,K],[6,V],[1,K],[5,V]])},finish:function(O){var M=!0;if(Y)if(O)M=O(8,G,!Y);else{var L=G.length()===8?8:8-G.length();G.fillWithByte(L,L)}if(M)X=!0,N.update();if(!Y){if(M=G.length()===0,M)if(O)M=O(8,Z,!Y);else{var w=Z.length(),I=Z.at(w-1);if(I>w)M=!1;else Z.truncate(I)}}return M}},N};hY.rc2.startEncrypting=function(J,Q,Y){var X=hY.rc2.createEncryptionCipher(J,128);return X.start(Q,Y),X};hY.rc2.createEncryptionCipher=function(J,Q){return Y$6(J,Q,!0)};hY.rc2.startDecrypting=function(J,Q,Y){var X=hY.rc2.createDecryptionCipher(J,128);return X.start(Q,Y),X};hY.rc2.createDecryptionCipher=function(J,Q){return Y$6(J,Q,!1)}});var Hg=h((MZ5,H$6)=>{var Jk1=m8();H$6.exports=Jk1.jsbn=Jk1.jsbn||{};var Uz,gU8=244837814094590,X$6=(gU8&16777215)==15715070;function $6(J,Q,Y){if(this.data=[],J!=null)if(typeof J=="number")this.fromNumber(J,Q,Y);else if(Q==null&&typeof J!="string")this.fromString(J,256);else this.fromString(J,Q)}Jk1.jsbn.BigInteger=$6;function n9(){return new $6(null)}function mU8(J,Q,Y,X,G,Z){while(--Z>=0){var q=Q*this.data[J++]+Y.data[X]+G;G=Math.floor(q/67108864),Y.data[X++]=q&67108863}return G}function pU8(J,Q,Y,X,G,Z){var q=Q&32767,V=Q>>15;while(--Z>=0){var K=this.data[J]&32767,W=this.data[J++]>>15,H=V*K+W*q;K=q*K+((H&32767)<<15)+Y.data[X]+(G&1073741823),G=(K>>>30)+(H>>>15)+V*W+(G>>>30),Y.data[X++]=K&1073741823}return G}function G$6(J,Q,Y,X,G,Z){var q=Q&16383,V=Q>>14;while(--Z>=0){var K=this.data[J]&16383,W=this.data[J++]>>14,H=V*K+W*q;K=q*K+((H&16383)<<14)+Y.data[X]+G,G=(K>>28)+(H>>14)+V*W,Y.data[X++]=K&268435455}return G}if(typeof navigator>"u")$6.prototype.am=G$6,Uz=28;else if(X$6&&navigator.appName=="Microsoft Internet Explorer")$6.prototype.am=pU8,Uz=30;else if(X$6&&navigator.appName!="Netscape")$6.prototype.am=mU8,Uz=26;else $6.prototype.am=G$6,Uz=28;$6.prototype.DB=Uz;$6.prototype.DM=(1<<Uz)-1;$6.prototype.DV=1<<Uz;var Qk1=52;$6.prototype.FV=Math.pow(2,Qk1);$6.prototype.F1=Qk1-Uz;$6.prototype.F2=2*Uz-Qk1;var dU8="0123456789abcdefghijklmnopqrstuvwxyz",Y91=[],BC,jG;BC=48;for(jG=0;jG<=9;++jG)Y91[BC++]=jG;BC=97;for(jG=10;jG<36;++jG)Y91[BC++]=jG;BC=65;for(jG=10;jG<36;++jG)Y91[BC++]=jG;function Z$6(J){return dU8.charAt(J)}function q$6(J,Q){var Y=Y91[J.charCodeAt(Q)];return Y==null?-1:Y}function cU8(J){for(var Q=this.t-1;Q>=0;--Q)J.data[Q]=this.data[Q];J.t=this.t,J.s=this.s}function lU8(J){if(this.t=1,this.s=J<0?-1:0,J>0)this.data[0]=J;else if(J<-1)this.data[0]=J+this.DV;else this.t=0}function QN(J){var Q=n9();return Q.fromInt(J),Q}function iU8(J,Q){var Y;if(Q==16)Y=4;else if(Q==8)Y=3;else if(Q==256)Y=8;else if(Q==2)Y=1;else if(Q==32)Y=5;else if(Q==4)Y=2;else{this.fromRadix(J,Q);return}this.t=0,this.s=0;var X=J.length,G=!1,Z=0;while(--X>=0){var q=Y==8?J[X]&255:q$6(J,X);if(q<0){if(J.charAt(X)=="-")G=!0;continue}if(G=!1,Z==0)this.data[this.t++]=q;else if(Z+Y>this.DB)this.data[this.t-1]|=(q&(1<<this.DB-Z)-1)<<Z,this.data[this.t++]=q>>this.DB-Z;else this.data[this.t-1]|=q<<Z;if(Z+=Y,Z>=this.DB)Z-=this.DB}if(Y==8&&(J[0]&128)!=0){if(this.s=-1,Z>0)this.data[this.t-1]|=(1<<this.DB-Z)-1<<Z}if(this.clamp(),G)$6.ZERO.subTo(this,this)}function nU8(){var J=this.s&this.DM;while(this.t>0&&this.data[this.t-1]==J)--this.t}function aU8(J){if(this.s<0)return"-"+this.negate().toString(J);var Q;if(J==16)Q=4;else if(J==8)Q=3;else if(J==2)Q=1;else if(J==32)Q=5;else if(J==4)Q=2;else return this.toRadix(J);var Y=(1<<Q)-1,X,G=!1,Z="",q=this.t,V=this.DB-q*this.DB%Q;if(q-- >0){if(V<this.DB&&(X=this.data[q]>>V)>0)G=!0,Z=Z$6(X);while(q>=0){if(V<Q)X=(this.data[q]&(1<<V)-1)<<Q-V,X|=this.data[--q]>>(V+=this.DB-Q);else if(X=this.data[q]>>(V-=Q)&Y,V<=0)V+=this.DB,--q;if(X>0)G=!0;if(G)Z+=Z$6(X)}}return G?Z:"0"}function rU8(){var J=n9();return $6.ZERO.subTo(this,J),J}function oU8(){return this.s<0?this.negate():this}function sU8(J){var Q=this.s-J.s;if(Q!=0)return Q;var Y=this.t;if(Q=Y-J.t,Q!=0)return this.s<0?-Q:Q;while(--Y>=0)if((Q=this.data[Y]-J.data[Y])!=0)return Q;return 0}function $91(J){var Q=1,Y;if((Y=J>>>16)!=0)J=Y,Q+=16;if((Y=J>>8)!=0)J=Y,Q+=8;if((Y=J>>4)!=0)J=Y,Q+=4;if((Y=J>>2)!=0)J=Y,Q+=2;if((Y=J>>1)!=0)J=Y,Q+=1;return Q}function tU8(){if(this.t<=0)return 0;return this.DB*(this.t-1)+$91(this.data[this.t-1]^this.s&this.DM)}function eU8(J,Q){var Y;for(Y=this.t-1;Y>=0;--Y)Q.data[Y+J]=this.data[Y];for(Y=J-1;Y>=0;--Y)Q.data[Y]=0;Q.t=this.t+J,Q.s=this.s}function JB8(J,Q){for(var Y=J;Y<this.t;++Y)Q.data[Y-J]=this.data[Y];Q.t=Math.max(this.t-J,0),Q.s=this.s}function QB8(J,Q){var Y=J%this.DB,X=this.DB-Y,G=(1<<X)-1,Z=Math.floor(J/this.DB),q=this.s<<Y&this.DM,V;for(V=this.t-1;V>=0;--V)Q.data[V+Z+1]=this.data[V]>>X|q,q=(this.data[V]&G)<<Y;for(V=Z-1;V>=0;--V)Q.data[V]=0;Q.data[Z]=q,Q.t=this.t+Z+1,Q.s=this.s,Q.clamp()}function YB8(J,Q){Q.s=this.s;var Y=Math.floor(J/this.DB);if(Y>=this.t){Q.t=0;return}var X=J%this.DB,G=this.DB-X,Z=(1<<X)-1;Q.data[0]=this.data[Y]>>X;for(var q=Y+1;q<this.t;++q)Q.data[q-Y-1]|=(this.data[q]&Z)<<G,Q.data[q-Y]=this.data[q]>>X;if(X>0)Q.data[this.t-Y-1]|=(this.s&Z)<<G;Q.t=this.t-Y,Q.clamp()}function $B8(J,Q){var Y=0,X=0,G=Math.min(J.t,this.t);while(Y<G)X+=this.data[Y]-J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;if(J.t<this.t){X-=J.s;while(Y<this.t)X+=this.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X+=this.s}else{X+=this.s;while(Y<J.t)X-=J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X-=J.s}if(Q.s=X<0?-1:0,X<-1)Q.data[Y++]=this.DV+X;else if(X>0)Q.data[Y++]=X;Q.t=Y,Q.clamp()}function XB8(J,Q){var Y=this.abs(),X=J.abs(),G=Y.t;Q.t=G+X.t;while(--G>=0)Q.data[G]=0;for(G=0;G<X.t;++G)Q.data[G+Y.t]=Y.am(0,X.data[G],Q,G,0,Y.t);if(Q.s=0,Q.clamp(),this.s!=J.s)$6.ZERO.subTo(Q,Q)}function GB8(J){var Q=this.abs(),Y=J.t=2*Q.t;while(--Y>=0)J.data[Y]=0;for(Y=0;Y<Q.t-1;++Y){var X=Q.am(Y,Q.data[Y],J,2*Y,0,1);if((J.data[Y+Q.t]+=Q.am(Y+1,2*Q.data[Y],J,2*Y+1,X,Q.t-Y-1))>=Q.DV)J.data[Y+Q.t]-=Q.DV,J.data[Y+Q.t+1]=1}if(J.t>0)J.data[J.t-1]+=Q.am(Y,Q.data[Y],J,2*Y,0,1);J.s=0,J.clamp()}function ZB8(J,Q,Y){var X=J.abs();if(X.t<=0)return;var G=this.abs();if(G.t<X.t){if(Q!=null)Q.fromInt(0);if(Y!=null)this.copyTo(Y);return}if(Y==null)Y=n9();var Z=n9(),q=this.s,V=J.s,K=this.DB-$91(X.data[X.t-1]);if(K>0)X.lShiftTo(K,Z),G.lShiftTo(K,Y);else X.copyTo(Z),G.copyTo(Y);var W=Z.t,H=Z.data[W-1];if(H==0)return;var z=H*(1<<this.F1)+(W>1?Z.data[W-2]>>this.F2:0),U=this.FV/z,N=(1<<this.F1)/z,O=1<<this.F2,M=Y.t,L=M-W,w=Q==null?n9():Q;if(Z.dlShiftTo(L,w),Y.compareTo(w)>=0)Y.data[Y.t++]=1,Y.subTo(w,Y);$6.ONE.dlShiftTo(W,w),w.subTo(Z,Z);while(Z.t<W)Z.data[Z.t++]=0;while(--L>=0){var I=Y.data[--M]==H?this.DM:Math.floor(Y.data[M]*U+(Y.data[M-1]+O)*N);if((Y.data[M]+=Z.am(0,I,Y,L,0,W))<I){Z.dlShiftTo(L,w),Y.subTo(w,Y);while(Y.data[M]<--I)Y.subTo(w,Y)}}if(Q!=null){if(Y.drShiftTo(W,Q),q!=V)$6.ZERO.subTo(Q,Q)}if(Y.t=W,Y.clamp(),K>0)Y.rShiftTo(K,Y);if(q<0)$6.ZERO.subTo(Y,Y)}function qB8(J){var Q=n9();if(this.abs().divRemTo(J,null,Q),this.s<0&&Q.compareTo($6.ZERO)>0)J.subTo(Q,Q);return Q}function KA(J){this.m=J}function VB8(J){if(J.s<0||J.compareTo(this.m)>=0)return J.mod(this.m);else return J}function KB8(J){return J}function WB8(J){J.divRemTo(this.m,null,J)}function HB8(J,Q,Y){J.multiplyTo(Q,Y),this.reduce(Y)}function zB8(J,Q){J.squareTo(Q),this.reduce(Q)}KA.prototype.convert=VB8;KA.prototype.revert=KB8;KA.prototype.reduce=WB8;KA.prototype.mulTo=HB8;KA.prototype.sqrTo=zB8;function FB8(){if(this.t<1)return 0;var J=this.data[0];if((J&1)==0)return 0;var Q=J&3;return Q=Q*(2-(J&15)*Q)&15,Q=Q*(2-(J&255)*Q)&255,Q=Q*(2-((J&65535)*Q&65535))&65535,Q=Q*(2-J*Q%this.DV)%this.DV,Q>0?this.DV-Q:-Q}function WA(J){this.m=J,this.mp=J.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<J.DB-15)-1,this.mt2=2*J.t}function UB8(J){var Q=n9();if(J.abs().dlShiftTo(this.m.t,Q),Q.divRemTo(this.m,null,Q),J.s<0&&Q.compareTo($6.ZERO)>0)this.m.subTo(Q,Q);return Q}function BB8(J){var Q=n9();return J.copyTo(Q),this.reduce(Q),Q}function NB8(J){while(J.t<=this.mt2)J.data[J.t++]=0;for(var Q=0;Q<this.m.t;++Q){var Y=J.data[Q]&32767,X=Y*this.mpl+((Y*this.mph+(J.data[Q]>>15)*this.mpl&this.um)<<15)&J.DM;Y=Q+this.m.t,J.data[Y]+=this.m.am(0,X,J,Q,0,this.m.t);while(J.data[Y]>=J.DV)J.data[Y]-=J.DV,J.data[++Y]++}if(J.clamp(),J.drShiftTo(this.m.t,J),J.compareTo(this.m)>=0)J.subTo(this.m,J)}function DB8(J,Q){J.squareTo(Q),this.reduce(Q)}function OB8(J,Q,Y){J.multiplyTo(Q,Y),this.reduce(Y)}WA.prototype.convert=UB8;WA.prototype.revert=BB8;WA.prototype.reduce=NB8;WA.prototype.mulTo=OB8;WA.prototype.sqrTo=DB8;function MB8(){return(this.t>0?this.data[0]&1:this.s)==0}function LB8(J,Q){if(J>4294967295||J<1)return $6.ONE;var Y=n9(),X=n9(),G=Q.convert(this),Z=$91(J)-1;G.copyTo(Y);while(--Z>=0)if(Q.sqrTo(Y,X),(J&1<<Z)>0)Q.mulTo(X,G,Y);else{var q=Y;Y=X,X=q}return Q.revert(Y)}function AB8(J,Q){var Y;if(J<256||Q.isEven())Y=new KA(Q);else Y=new WA(Q);return this.exp(J,Y)}$6.prototype.copyTo=cU8;$6.prototype.fromInt=lU8;$6.prototype.fromString=iU8;$6.prototype.clamp=nU8;$6.prototype.dlShiftTo=eU8;$6.prototype.drShiftTo=JB8;$6.prototype.lShiftTo=QB8;$6.prototype.rShiftTo=YB8;$6.prototype.subTo=$B8;$6.prototype.multiplyTo=XB8;$6.prototype.squareTo=GB8;$6.prototype.divRemTo=ZB8;$6.prototype.invDigit=FB8;$6.prototype.isEven=MB8;$6.prototype.exp=LB8;$6.prototype.toString=aU8;$6.prototype.negate=rU8;$6.prototype.abs=oU8;$6.prototype.compareTo=sU8;$6.prototype.bitLength=tU8;$6.prototype.mod=qB8;$6.prototype.modPowInt=AB8;$6.ZERO=QN(0);$6.ONE=QN(1);function EB8(){var J=n9();return this.copyTo(J),J}function wB8(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;else if(this.t==0)return-1}else if(this.t==1)return this.data[0];else if(this.t==0)return 0;return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function IB8(){return this.t==0?this.s:this.data[0]<<24>>24}function PB8(){return this.t==0?this.s:this.data[0]<<16>>16}function TB8(J){return Math.floor(Math.LN2*this.DB/Math.log(J))}function RB8(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this.data[0]<=0)return 0;else return 1}function CB8(J){if(J==null)J=10;if(this.signum()==0||J<2||J>36)return"0";var Q=this.chunkSize(J),Y=Math.pow(J,Q),X=QN(Y),G=n9(),Z=n9(),q="";this.divRemTo(X,G,Z);while(G.signum()>0)q=(Y+Z.intValue()).toString(J).substr(1)+q,G.divRemTo(X,G,Z);return Z.intValue().toString(J)+q}function SB8(J,Q){if(this.fromInt(0),Q==null)Q=10;var Y=this.chunkSize(Q),X=Math.pow(Q,Y),G=!1,Z=0,q=0;for(var V=0;V<J.length;++V){var K=q$6(J,V);if(K<0){if(J.charAt(V)=="-"&&this.signum()==0)G=!0;continue}if(q=Q*q+K,++Z>=Y)this.dMultiply(X),this.dAddOffset(q,0),Z=0,q=0}if(Z>0)this.dMultiply(Math.pow(Q,Z)),this.dAddOffset(q,0);if(G)$6.ZERO.subTo(this,this)}function jB8(J,Q,Y){if(typeof Q=="number")if(J<2)this.fromInt(1);else{if(this.fromNumber(J,Y),!this.testBit(J-1))this.bitwiseTo($6.ONE.shiftLeft(J-1),Yk1,this);if(this.isEven())this.dAddOffset(1,0);while(!this.isProbablePrime(Q))if(this.dAddOffset(2,0),this.bitLength()>J)this.subTo($6.ONE.shiftLeft(J-1),this)}else{var X=[],G=J&7;if(X.length=(J>>3)+1,Q.nextBytes(X),G>0)X[0]&=(1<<G)-1;else X[0]=0;this.fromString(X,256)}}function _B8(){var J=this.t,Q=[];Q[0]=this.s;var Y=this.DB-J*this.DB%8,X,G=0;if(J-- >0){if(Y<this.DB&&(X=this.data[J]>>Y)!=(this.s&this.DM)>>Y)Q[G++]=X|this.s<<this.DB-Y;while(J>=0){if(Y<8)X=(this.data[J]&(1<<Y)-1)<<8-Y,X|=this.data[--J]>>(Y+=this.DB-8);else if(X=this.data[J]>>(Y-=8)&255,Y<=0)Y+=this.DB,--J;if((X&128)!=0)X|=-256;if(G==0&&(this.s&128)!=(X&128))++G;if(G>0||X!=this.s)Q[G++]=X}}return Q}function kB8(J){return this.compareTo(J)==0}function yB8(J){return this.compareTo(J)<0?this:J}function vB8(J){return this.compareTo(J)>0?this:J}function xB8(J,Q,Y){var X,G,Z=Math.min(J.t,this.t);for(X=0;X<Z;++X)Y.data[X]=Q(this.data[X],J.data[X]);if(J.t<this.t){G=J.s&this.DM;for(X=Z;X<this.t;++X)Y.data[X]=Q(this.data[X],G);Y.t=this.t}else{G=this.s&this.DM;for(X=Z;X<J.t;++X)Y.data[X]=Q(G,J.data[X]);Y.t=J.t}Y.s=Q(this.s,J.s),Y.clamp()}function fB8(J,Q){return J&Q}function hB8(J){var Q=n9();return this.bitwiseTo(J,fB8,Q),Q}function Yk1(J,Q){return J|Q}function bB8(J){var Q=n9();return this.bitwiseTo(J,Yk1,Q),Q}function V$6(J,Q){return J^Q}function uB8(J){var Q=n9();return this.bitwiseTo(J,V$6,Q),Q}function K$6(J,Q){return J&~Q}function gB8(J){var Q=n9();return this.bitwiseTo(J,K$6,Q),Q}function mB8(){var J=n9();for(var Q=0;Q<this.t;++Q)J.data[Q]=this.DM&~this.data[Q];return J.t=this.t,J.s=~this.s,J}function pB8(J){var Q=n9();if(J<0)this.rShiftTo(-J,Q);else this.lShiftTo(J,Q);return Q}function dB8(J){var Q=n9();if(J<0)this.lShiftTo(-J,Q);else this.rShiftTo(J,Q);return Q}function cB8(J){if(J==0)return-1;var Q=0;if((J&65535)==0)J>>=16,Q+=16;if((J&255)==0)J>>=8,Q+=8;if((J&15)==0)J>>=4,Q+=4;if((J&3)==0)J>>=2,Q+=2;if((J&1)==0)++Q;return Q}function lB8(){for(var J=0;J<this.t;++J)if(this.data[J]!=0)return J*this.DB+cB8(this.data[J]);if(this.s<0)return this.t*this.DB;return-1}function iB8(J){var Q=0;while(J!=0)J&=J-1,++Q;return Q}function nB8(){var J=0,Q=this.s&this.DM;for(var Y=0;Y<this.t;++Y)J+=iB8(this.data[Y]^Q);return J}function aB8(J){var Q=Math.floor(J/this.DB);if(Q>=this.t)return this.s!=0;return(this.data[Q]&1<<J%this.DB)!=0}function rB8(J,Q){var Y=$6.ONE.shiftLeft(J);return this.bitwiseTo(Y,Q,Y),Y}function oB8(J){return this.changeBit(J,Yk1)}function sB8(J){return this.changeBit(J,K$6)}function tB8(J){return this.changeBit(J,V$6)}function eB8(J,Q){var Y=0,X=0,G=Math.min(J.t,this.t);while(Y<G)X+=this.data[Y]+J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;if(J.t<this.t){X+=J.s;while(Y<this.t)X+=this.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X+=this.s}else{X+=this.s;while(Y<J.t)X+=J.data[Y],Q.data[Y++]=X&this.DM,X>>=this.DB;X+=J.s}if(Q.s=X<0?-1:0,X>0)Q.data[Y++]=X;else if(X<-1)Q.data[Y++]=this.DV+X;Q.t=Y,Q.clamp()}function JN8(J){var Q=n9();return this.addTo(J,Q),Q}function QN8(J){var Q=n9();return this.subTo(J,Q),Q}function YN8(J){var Q=n9();return this.multiplyTo(J,Q),Q}function $N8(J){var Q=n9();return this.divRemTo(J,Q,null),Q}function XN8(J){var Q=n9();return this.divRemTo(J,null,Q),Q}function GN8(J){var Q=n9(),Y=n9();return this.divRemTo(J,Q,Y),[Q,Y]}function ZN8(J){this.data[this.t]=this.am(0,J-1,this,0,0,this.t),++this.t,this.clamp()}function qN8(J,Q){if(J==0)return;while(this.t<=Q)this.data[this.t++]=0;this.data[Q]+=J;while(this.data[Q]>=this.DV){if(this.data[Q]-=this.DV,++Q>=this.t)this.data[this.t++]=0;++this.data[Q]}}function Wg(){}function W$6(J){return J}function VN8(J,Q,Y){J.multiplyTo(Q,Y)}function KN8(J,Q){J.squareTo(Q)}Wg.prototype.convert=W$6;Wg.prototype.revert=W$6;Wg.prototype.mulTo=VN8;Wg.prototype.sqrTo=KN8;function WN8(J){return this.exp(J,new Wg)}function HN8(J,Q,Y){var X=Math.min(this.t+J.t,Q);Y.s=0,Y.t=X;while(X>0)Y.data[--X]=0;var G;for(G=Y.t-this.t;X<G;++X)Y.data[X+this.t]=this.am(0,J.data[X],Y,X,0,this.t);for(G=Math.min(J.t,Q);X<G;++X)this.am(0,J.data[X],Y,X,0,Q-X);Y.clamp()}function zN8(J,Q,Y){--Q;var X=Y.t=this.t+J.t-Q;Y.s=0;while(--X>=0)Y.data[X]=0;for(X=Math.max(Q-this.t,0);X<J.t;++X)Y.data[this.t+X-Q]=this.am(Q-X,J.data[X],Y,0,0,this.t+X-Q);Y.clamp(),Y.drShiftTo(1,Y)}function NC(J){this.r2=n9(),this.q3=n9(),$6.ONE.dlShiftTo(2*J.t,this.r2),this.mu=this.r2.divide(J),this.m=J}function FN8(J){if(J.s<0||J.t>2*this.m.t)return J.mod(this.m);else if(J.compareTo(this.m)<0)return J;else{var Q=n9();return J.copyTo(Q),this.reduce(Q),Q}}function UN8(J){return J}function BN8(J){if(J.drShiftTo(this.m.t-1,this.r2),J.t>this.m.t+1)J.t=this.m.t+1,J.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(J.compareTo(this.r2)<0)J.dAddOffset(1,this.m.t+1);J.subTo(this.r2,J);while(J.compareTo(this.m)>=0)J.subTo(this.m,J)}function NN8(J,Q){J.squareTo(Q),this.reduce(Q)}function DN8(J,Q,Y){J.multiplyTo(Q,Y),this.reduce(Y)}NC.prototype.convert=FN8;NC.prototype.revert=UN8;NC.prototype.reduce=BN8;NC.prototype.mulTo=DN8;NC.prototype.sqrTo=NN8;function ON8(J,Q){var Y=J.bitLength(),X,G=QN(1),Z;if(Y<=0)return G;else if(Y<18)X=1;else if(Y<48)X=3;else if(Y<144)X=4;else if(Y<768)X=5;else X=6;if(Y<8)Z=new KA(Q);else if(Q.isEven())Z=new NC(Q);else Z=new WA(Q);var q=[],V=3,K=X-1,W=(1<<X)-1;if(q[1]=Z.convert(this),X>1){var H=n9();Z.sqrTo(q[1],H);while(V<=W)q[V]=n9(),Z.mulTo(H,q[V-2],q[V]),V+=2}var z=J.t-1,U,N=!0,O=n9(),M;Y=$91(J.data[z])-1;while(z>=0){if(Y>=K)U=J.data[z]>>Y-K&W;else if(U=(J.data[z]&(1<<Y+1)-1)<<K-Y,z>0)U|=J.data[z-1]>>this.DB+Y-K;V=X;while((U&1)==0)U>>=1,--V;if((Y-=V)<0)Y+=this.DB,--z;if(N)q[U].copyTo(G),N=!1;else{while(V>1)Z.sqrTo(G,O),Z.sqrTo(O,G),V-=2;if(V>0)Z.sqrTo(G,O);else M=G,G=O,O=M;Z.mulTo(O,q[U],G)}while(z>=0&&(J.data[z]&1<<Y)==0)if(Z.sqrTo(G,O),M=G,G=O,O=M,--Y<0)Y=this.DB-1,--z}return Z.revert(G)}function MN8(J){var Q=this.s<0?this.negate():this.clone(),Y=J.s<0?J.negate():J.clone();if(Q.compareTo(Y)<0){var X=Q;Q=Y,Y=X}var G=Q.getLowestSetBit(),Z=Y.getLowestSetBit();if(Z<0)return Q;if(G<Z)Z=G;if(Z>0)Q.rShiftTo(Z,Q),Y.rShiftTo(Z,Y);while(Q.signum()>0){if((G=Q.getLowestSetBit())>0)Q.rShiftTo(G,Q);if((G=Y.getLowestSetBit())>0)Y.rShiftTo(G,Y);if(Q.compareTo(Y)>=0)Q.subTo(Y,Q),Q.rShiftTo(1,Q);else Y.subTo(Q,Y),Y.rShiftTo(1,Y)}if(Z>0)Y.lShiftTo(Z,Y);return Y}function LN8(J){if(J<=0)return 0;var Q=this.DV%J,Y=this.s<0?J-1:0;if(this.t>0)if(Q==0)Y=this.data[0]%J;else for(var X=this.t-1;X>=0;--X)Y=(Q*Y+this.data[X])%J;return Y}function AN8(J){var Q=J.isEven();if(this.isEven()&&Q||J.signum()==0)return $6.ZERO;var Y=J.clone(),X=this.clone(),G=QN(1),Z=QN(0),q=QN(0),V=QN(1);while(Y.signum()!=0){while(Y.isEven()){if(Y.rShiftTo(1,Y),Q){if(!G.isEven()||!Z.isEven())G.addTo(this,G),Z.subTo(J,Z);G.rShiftTo(1,G)}else if(!Z.isEven())Z.subTo(J,Z);Z.rShiftTo(1,Z)}while(X.isEven()){if(X.rShiftTo(1,X),Q){if(!q.isEven()||!V.isEven())q.addTo(this,q),V.subTo(J,V);q.rShiftTo(1,q)}else if(!V.isEven())V.subTo(J,V);V.rShiftTo(1,V)}if(Y.compareTo(X)>=0){if(Y.subTo(X,Y),Q)G.subTo(q,G);Z.subTo(V,Z)}else{if(X.subTo(Y,X),Q)q.subTo(G,q);V.subTo(Z,V)}}if(X.compareTo($6.ONE)!=0)return $6.ZERO;if(V.compareTo(J)>=0)return V.subtract(J);if(V.signum()<0)V.addTo(J,V);else return V;if(V.signum()<0)return V.add(J);else return V}var Lq=[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],EN8=67108864/Lq[Lq.length-1];function wN8(J){var Q,Y=this.abs();if(Y.t==1&&Y.data[0]<=Lq[Lq.length-1]){for(Q=0;Q<Lq.length;++Q)if(Y.data[0]==Lq[Q])return!0;return!1}if(Y.isEven())return!1;Q=1;while(Q<Lq.length){var X=Lq[Q],G=Q+1;while(G<Lq.length&&X<EN8)X*=Lq[G++];X=Y.modInt(X);while(Q<G)if(X%Lq[Q++]==0)return!1}return Y.millerRabin(J)}function IN8(J){var Q=this.subtract($6.ONE),Y=Q.getLowestSetBit();if(Y<=0)return!1;var X=Q.shiftRight(Y),G=PN8(),Z;for(var q=0;q<J;++q){do Z=new $6(this.bitLength(),G);while(Z.compareTo($6.ONE)<=0||Z.compareTo(Q)>=0);var V=Z.modPow(X,this);if(V.compareTo($6.ONE)!=0&&V.compareTo(Q)!=0){var K=1;while(K++<Y&&V.compareTo(Q)!=0)if(V=V.modPowInt(2,this),V.compareTo($6.ONE)==0)return!1;if(V.compareTo(Q)!=0)return!1}}return!0}function PN8(){return{nextBytes:function(J){for(var Q=0;Q<J.length;++Q)J[Q]=Math.floor(Math.random()*256)}}}$6.prototype.chunkSize=TB8;$6.prototype.toRadix=CB8;$6.prototype.fromRadix=SB8;$6.prototype.fromNumber=jB8;$6.prototype.bitwiseTo=xB8;$6.prototype.changeBit=rB8;$6.prototype.addTo=eB8;$6.prototype.dMultiply=ZN8;$6.prototype.dAddOffset=qN8;$6.prototype.multiplyLowerTo=HN8;$6.prototype.multiplyUpperTo=zN8;$6.prototype.modInt=LN8;$6.prototype.millerRabin=IN8;$6.prototype.clone=EB8;$6.prototype.intValue=wB8;$6.prototype.byteValue=IB8;$6.prototype.shortValue=PB8;$6.prototype.signum=RB8;$6.prototype.toByteArray=_B8;$6.prototype.equals=kB8;$6.prototype.min=yB8;$6.prototype.max=vB8;$6.prototype.and=hB8;$6.prototype.or=bB8;$6.prototype.xor=uB8;$6.prototype.andNot=gB8;$6.prototype.not=mB8;$6.prototype.shiftLeft=pB8;$6.prototype.shiftRight=dB8;$6.prototype.getLowestSetBit=lB8;$6.prototype.bitCount=nB8;$6.prototype.testBit=aB8;$6.prototype.setBit=oB8;$6.prototype.clearBit=sB8;$6.prototype.flipBit=tB8;$6.prototype.add=JN8;$6.prototype.subtract=QN8;$6.prototype.multiply=YN8;$6.prototype.divide=$N8;$6.prototype.remainder=XN8;$6.prototype.divideAndRemainder=GN8;$6.prototype.modPow=ON8;$6.prototype.modInverse=AN8;$6.prototype.pow=WN8;$6.prototype.gcd=MN8;$6.prototype.isProbablePrime=wN8});var DC=h((LZ5,B$6)=>{var bK=m8();yK();i9();var F$6=B$6.exports=bK.sha1=bK.sha1||{};bK.md.sha1=bK.md.algorithms.sha1=F$6;F$6.create=function(){if(!U$6)TN8();var J=null,Q=bK.util.createBuffer(),Y=Array(80),X={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return X.start=function(){X.messageLength=0,X.fullMessageLength=X.messageLength64=[];var G=X.messageLengthSize/4;for(var Z=0;Z<G;++Z)X.fullMessageLength.push(0);return Q=bK.util.createBuffer(),J={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},X},X.start(),X.update=function(G,Z){if(Z==="utf8")G=bK.util.encodeUtf8(G);var q=G.length;X.messageLength+=q,q=[q/4294967296>>>0,q>>>0];for(var V=X.fullMessageLength.length-1;V>=0;--V)X.fullMessageLength[V]+=q[1],q[1]=q[0]+(X.fullMessageLength[V]/4294967296>>>0),X.fullMessageLength[V]=X.fullMessageLength[V]>>>0,q[0]=q[1]/4294967296>>>0;if(Q.putBytes(G),z$6(J,Y,Q),Q.read>2048||Q.length()===0)Q.compact();return X},X.digest=function(){var G=bK.util.createBuffer();G.putBytes(Q.bytes());var Z=X.fullMessageLength[X.fullMessageLength.length-1]+X.messageLengthSize,q=Z&X.blockLength-1;G.putBytes($k1.substr(0,X.blockLength-q));var V,K,W=X.fullMessageLength[0]*8;for(var H=0;H<X.fullMessageLength.length-1;++H)V=X.fullMessageLength[H+1]*8,K=V/4294967296>>>0,W+=K,G.putInt32(W>>>0),W=V>>>0;G.putInt32(W);var z={h0:J.h0,h1:J.h1,h2:J.h2,h3:J.h3,h4:J.h4};z$6(z,Y,G);var U=bK.util.createBuffer();return U.putInt32(z.h0),U.putInt32(z.h1),U.putInt32(z.h2),U.putInt32(z.h3),U.putInt32(z.h4),U},X};var $k1=null,U$6=!1;function TN8(){$k1=String.fromCharCode(128),$k1+=bK.util.fillString(String.fromCharCode(0),64),U$6=!0}function z$6(J,Q,Y){var X,G,Z,q,V,K,W,H,z=Y.length();while(z>=64){G=J.h0,Z=J.h1,q=J.h2,V=J.h3,K=J.h4;for(H=0;H<16;++H)X=Y.getInt32(),Q[H]=X,W=V^Z&(q^V),X=(G<<5|G>>>27)+W+K+1518500249+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<20;++H)X=Q[H-3]^Q[H-8]^Q[H-14]^Q[H-16],X=X<<1|X>>>31,Q[H]=X,W=V^Z&(q^V),X=(G<<5|G>>>27)+W+K+1518500249+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<32;++H)X=Q[H-3]^Q[H-8]^Q[H-14]^Q[H-16],X=X<<1|X>>>31,Q[H]=X,W=Z^q^V,X=(G<<5|G>>>27)+W+K+1859775393+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<40;++H)X=Q[H-6]^Q[H-16]^Q[H-28]^Q[H-32],X=X<<2|X>>>30,Q[H]=X,W=Z^q^V,X=(G<<5|G>>>27)+W+K+1859775393+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<60;++H)X=Q[H-6]^Q[H-16]^Q[H-28]^Q[H-32],X=X<<2|X>>>30,Q[H]=X,W=Z&q|V&(Z^q),X=(G<<5|G>>>27)+W+K+2400959708+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;for(;H<80;++H)X=Q[H-6]^Q[H-16]^Q[H-28]^Q[H-32],X=X<<2|X>>>30,Q[H]=X,W=Z^q^V,X=(G<<5|G>>>27)+W+K+3395469782+X,K=V,V=q,q=(Z<<30|Z>>>2)>>>0,Z=G,G=X;J.h0=J.h0+G|0,J.h1=J.h1+Z|0,J.h2=J.h2+q|0,J.h3=J.h3+V|0,J.h4=J.h4+K|0,z-=64}}});var Xk1=h((AZ5,D$6)=>{var uK=m8();i9();SG();DC();var N$6=D$6.exports=uK.pkcs1=uK.pkcs1||{};N$6.encode_rsa_oaep=function(J,Q,Y){var X,G,Z,q;if(typeof Y==="string")X=Y,G=arguments[3]||void 0,Z=arguments[4]||void 0;else if(Y){if(X=Y.label||void 0,G=Y.seed||void 0,Z=Y.md||void 0,Y.mgf1&&Y.mgf1.md)q=Y.mgf1.md}if(!Z)Z=uK.md.sha1.create();else Z.start();if(!q)q=Z;var V=Math.ceil(J.n.bitLength()/8),K=V-2*Z.digestLength-2;if(Q.length>K){var W=Error("RSAES-OAEP input message length is too long.");throw W.length=Q.length,W.maxLength=K,W}if(!X)X="";Z.update(X,"raw");var H=Z.digest(),z="",U=K-Q.length;for(var N=0;N<U;N++)z+="\x00";var O=H.getBytes()+z+"\x01"+Q;if(!G)G=uK.random.getBytes(Z.digestLength);else if(G.length!==Z.digestLength){var W=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw W.seedLength=G.length,W.digestLength=Z.digestLength,W}var M=X91(G,V-Z.digestLength-1,q),L=uK.util.xorBytes(O,M,O.length),w=X91(L,Z.digestLength,q),I=uK.util.xorBytes(G,w,G.length);return"\x00"+I+L};N$6.decode_rsa_oaep=function(J,Q,Y){var X,G,Z;if(typeof Y==="string")X=Y,G=arguments[3]||void 0;else if(Y){if(X=Y.label||void 0,G=Y.md||void 0,Y.mgf1&&Y.mgf1.md)Z=Y.mgf1.md}var q=Math.ceil(J.n.bitLength()/8);if(Q.length!==q){var L=Error("RSAES-OAEP encoded message length is invalid.");throw L.length=Q.length,L.expectedLength=q,L}if(G===void 0)G=uK.md.sha1.create();else G.start();if(!Z)Z=G;if(q<2*G.digestLength+2)throw Error("RSAES-OAEP key is too short for the hash function.");if(!X)X="";G.update(X,"raw");var V=G.digest().getBytes(),K=Q.charAt(0),W=Q.substring(1,G.digestLength+1),H=Q.substring(1+G.digestLength),z=X91(H,G.digestLength,Z),U=uK.util.xorBytes(W,z,W.length),N=X91(U,q-G.digestLength-1,Z),O=uK.util.xorBytes(H,N,H.length),M=O.substring(0,G.digestLength),L=K!=="\x00";for(var w=0;w<G.digestLength;++w)L|=V.charAt(w)!==M.charAt(w);var I=1,P=G.digestLength;for(var R=G.digestLength;R<O.length;R++){var j=O.charCodeAt(R),y=j&1^1,f=I?65534:0;L|=j&f,I=I&y,P+=I}if(L||O.charCodeAt(P)!==1)throw Error("Invalid RSAES-OAEP padding.");return O.substring(P+1)};function X91(J,Q,Y){if(!Y)Y=uK.md.sha1.create();var X="",G=Math.ceil(Q/Y.digestLength);for(var Z=0;Z<G;++Z){var q=String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255);Y.start(),Y.update(J+q),X+=Y.digest().getBytes()}return X.substring(0,Q)}});var Zk1=h((EZ5,Gk1)=>{var YN=m8();i9();Hg();SG();(function(){if(YN.prime){Gk1.exports=YN.prime;return}var J=Gk1.exports=YN.prime=YN.prime||{},Q=YN.jsbn.BigInteger,Y=[6,4,2,4,2,4,6,2],X=new Q(null);X.fromInt(30);var G=function(z,U){return z|U};J.generateProbablePrime=function(z,U,N){if(typeof U==="function")N=U,U={};U=U||{};var O=U.algorithm||"PRIMEINC";if(typeof O==="string")O={name:O};O.options=O.options||{};var M=U.prng||YN.random,L={nextBytes:function(w){var I=M.getBytesSync(w.length);for(var P=0;P<w.length;++P)w[P]=I.charCodeAt(P)}};if(O.name==="PRIMEINC")return Z(z,L,O.options,N);throw Error("Invalid prime generation algorithm: "+O.name)};function Z(z,U,N,O){if("workers"in N)return K(z,U,N,O);return q(z,U,N,O)}function q(z,U,N,O){var M=W(z,U),L=0,w=H(M.bitLength());if("millerRabinTests"in N)w=N.millerRabinTests;var I=10;if("maxBlockTime"in N)I=N.maxBlockTime;V(M,z,U,L,w,I,O)}function V(z,U,N,O,M,L,w){var I=+new Date;do{if(z.bitLength()>U)z=W(U,N);if(z.isProbablePrime(M))return w(null,z);z.dAddOffset(Y[O++%8],0)}while(L<0||+new Date-I<L);YN.util.setImmediate(function(){V(z,U,N,O,M,L,w)})}function K(z,U,N,O){if(typeof Worker>"u")return q(z,U,N,O);var M=W(z,U),L=N.workers,w=N.workLoad||100,I=w*30/8,P=N.workerScript||"forge/prime.worker.js";if(L===-1)return YN.util.estimateCores(function(j,y){if(j)y=2;L=y-1,R()});R();function R(){L=Math.max(1,L);var j=[];for(var y=0;y<L;++y)j[y]=new Worker(P);var f=L;for(var y=0;y<L;++y)j[y].addEventListener("message",p);var g=!1;function p(b){if(g)return;--f;var i=b.data;if(i.found){for(var J1=0;J1<j.length;++J1)j[J1].terminate();return g=!0,O(null,new Q(i.prime,16))}if(M.bitLength()>z)M=W(z,U);var n=M.toString(16);b.target.postMessage({hex:n,workLoad:w}),M.dAddOffset(I,0)}}}function W(z,U){var N=new Q(z,U),O=z-1;if(!N.testBit(O))N.bitwiseTo(Q.ONE.shiftLeft(O),G,N);return N.dAddOffset(31-N.mod(X).byteValue(),0),N}function H(z){if(z<=100)return 27;if(z<=150)return 18;if(z<=200)return 15;if(z<=250)return 12;if(z<=300)return 9;if(z<=350)return 8;if(z<=400)return 7;if(z<=500)return 6;if(z<=600)return 5;if(z<=800)return 4;if(z<=1250)return 3;return 2}})()});var zg=h((wZ5,I$6)=>{var _4=m8();Mq();Hg();JN();Xk1();Zk1();SG();i9();if(typeof C9>"u")C9=_4.jsbn.BigInteger;var C9,qk1=_4.util.isNodejs?S1("crypto"):null,L0=_4.asn1,_G=_4.util;_4.pki=_4.pki||{};I$6.exports=_4.pki.rsa=_4.rsa=_4.rsa||{};var A8=_4.pki,RN8=[6,4,2,4,2,4,6,2],CN8={name:"PrivateKeyInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},SN8={name:"RSAPrivateKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},jN8={name:"RSAPublicKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:L0.Class.UNIVERSAL,type:L0.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},_N8=_4.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},kN8={name:"DigestInfo",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:L0.Class.UNIVERSAL,type:L0.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:L0.Class.UNIVERSAL,type:L0.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:L0.Class.UNIVERSAL,type:L0.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},yN8=function(J){var Q;if(J.algorithm in A8.oids)Q=A8.oids[J.algorithm];else{var Y=Error("Unknown message digest algorithm.");throw Y.algorithm=J.algorithm,Y}var X=L0.oidToDer(Q).getBytes(),G=L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[]),Z=L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[]);Z.value.push(L0.create(L0.Class.UNIVERSAL,L0.Type.OID,!1,X)),Z.value.push(L0.create(L0.Class.UNIVERSAL,L0.Type.NULL,!1,""));var q=L0.create(L0.Class.UNIVERSAL,L0.Type.OCTETSTRING,!1,J.digest().getBytes());return G.value.push(Z),G.value.push(q),L0.toDer(G).getBytes()},E$6=function(J,Q,Y){if(Y)return J.modPow(Q.e,Q.n);if(!Q.p||!Q.q)return J.modPow(Q.d,Q.n);if(!Q.dP)Q.dP=Q.d.mod(Q.p.subtract(C9.ONE));if(!Q.dQ)Q.dQ=Q.d.mod(Q.q.subtract(C9.ONE));if(!Q.qInv)Q.qInv=Q.q.modInverse(Q.p);var X;do X=new C9(_4.util.bytesToHex(_4.random.getBytes(Q.n.bitLength()/8)),16);while(X.compareTo(Q.n)>=0||!X.gcd(Q.n).equals(C9.ONE));J=J.multiply(X.modPow(Q.e,Q.n)).mod(Q.n);var G=J.mod(Q.p).modPow(Q.dP,Q.p),Z=J.mod(Q.q).modPow(Q.dQ,Q.q);while(G.compareTo(Z)<0)G=G.add(Q.p);var q=G.subtract(Z).multiply(Q.qInv).mod(Q.p).multiply(Q.q).add(Z);return q=q.multiply(X.modInverse(Q.n)).mod(Q.n),q};A8.rsa.encrypt=function(J,Q,Y){var X=Y,G,Z=Math.ceil(Q.n.bitLength()/8);if(Y!==!1&&Y!==!0)X=Y===2,G=w$6(J,Q,Y);else G=_4.util.createBuffer(),G.putBytes(J);var q=new C9(G.toHex(),16),V=E$6(q,Q,X),K=V.toString(16),W=_4.util.createBuffer(),H=Z-Math.ceil(K.length/2);while(H>0)W.putByte(0),--H;return W.putBytes(_4.util.hexToBytes(K)),W.getBytes()};A8.rsa.decrypt=function(J,Q,Y,X){var G=Math.ceil(Q.n.bitLength()/8);if(J.length!==G){var Z=Error("Encrypted message length is invalid.");throw Z.length=J.length,Z.expected=G,Z}var q=new C9(_4.util.createBuffer(J).toHex(),16);if(q.compareTo(Q.n)>=0)throw Error("Encrypted message is invalid.");var V=E$6(q,Q,Y),K=V.toString(16),W=_4.util.createBuffer(),H=G-Math.ceil(K.length/2);while(H>0)W.putByte(0),--H;if(W.putBytes(_4.util.hexToBytes(K)),X!==!1)return G91(W.getBytes(),Q,Y);return W.getBytes()};A8.rsa.createKeyPairGenerationState=function(J,Q,Y){if(typeof J==="string")J=parseInt(J,10);J=J||2048,Y=Y||{};var X=Y.prng||_4.random,G={nextBytes:function(V){var K=X.getBytesSync(V.length);for(var W=0;W<V.length;++W)V[W]=K.charCodeAt(W)}},Z=Y.algorithm||"PRIMEINC",q;if(Z==="PRIMEINC")q={algorithm:Z,state:0,bits:J,rng:G,eInt:Q||65537,e:new C9(null),p:null,q:null,qBits:J>>1,pBits:J-(J>>1),pqState:0,num:null,keys:null},q.e.fromInt(q.eInt);else throw Error("Invalid key generation algorithm: "+Z);return q};A8.rsa.stepKeyPairGenerationState=function(J,Q){if(!("algorithm"in J))J.algorithm="PRIMEINC";var Y=new C9(null);Y.fromInt(30);var X=0,G=function(z,U){return z|U},Z=+new Date,q,V=0;while(J.keys===null&&(Q<=0||V<Q)){if(J.state===0){var K=J.p===null?J.pBits:J.qBits,W=K-1;if(J.pqState===0){if(J.num=new C9(K,J.rng),!J.num.testBit(W))J.num.bitwiseTo(C9.ONE.shiftLeft(W),G,J.num);J.num.dAddOffset(31-J.num.mod(Y).byteValue(),0),X=0,++J.pqState}else if(J.pqState===1)if(J.num.bitLength()>K)J.pqState=0;else if(J.num.isProbablePrime(xN8(J.num.bitLength())))++J.pqState;else J.num.dAddOffset(RN8[X++%8],0);else if(J.pqState===2)J.pqState=J.num.subtract(C9.ONE).gcd(J.e).compareTo(C9.ONE)===0?3:0;else if(J.pqState===3){if(J.pqState=0,J.p===null)J.p=J.num;else J.q=J.num;if(J.p!==null&&J.q!==null)++J.state;J.num=null}}else if(J.state===1){if(J.p.compareTo(J.q)<0)J.num=J.p,J.p=J.q,J.q=J.num;++J.state}else if(J.state===2)J.p1=J.p.subtract(C9.ONE),J.q1=J.q.subtract(C9.ONE),J.phi=J.p1.multiply(J.q1),++J.state;else if(J.state===3)if(J.phi.gcd(J.e).compareTo(C9.ONE)===0)++J.state;else J.p=null,J.q=null,J.state=0;else if(J.state===4)if(J.n=J.p.multiply(J.q),J.n.bitLength()===J.bits)++J.state;else J.q=null,J.state=0;else if(J.state===5){var H=J.e.modInverse(J.phi);J.keys={privateKey:A8.rsa.setPrivateKey(J.n,J.e,H,J.p,J.q,H.mod(J.p1),H.mod(J.q1),J.q.modInverse(J.p)),publicKey:A8.rsa.setPublicKey(J.n,J.e)}}q=+new Date,V+=q-Z,Z=q}return J.keys!==null};A8.rsa.generateKeyPair=function(J,Q,Y,X){if(arguments.length===1){if(typeof J==="object")Y=J,J=void 0;else if(typeof J==="function")X=J,J=void 0}else if(arguments.length===2)if(typeof J==="number"){if(typeof Q==="function")X=Q,Q=void 0;else if(typeof Q!=="number")Y=Q,Q=void 0}else Y=J,X=Q,J=void 0,Q=void 0;else if(arguments.length===3)if(typeof Q==="number"){if(typeof Y==="function")X=Y,Y=void 0}else X=Y,Y=Q,Q=void 0;if(Y=Y||{},J===void 0)J=Y.bits||2048;if(Q===void 0)Q=Y.e||65537;if(!_4.options.usePureJavaScript&&!Y.prng&&J>=256&&J<=16384&&(Q===65537||Q===3)){if(X){if(O$6("generateKeyPair"))return qk1.generateKeyPair("rsa",{modulusLength:J,publicExponent:Q,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(V,K,W){if(V)return X(V);X(null,{privateKey:A8.privateKeyFromPem(W),publicKey:A8.publicKeyFromPem(K)})});if(M$6("generateKey")&&M$6("exportKey"))return _G.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:J,publicExponent:A$6(Q),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(V){return _G.globalScope.crypto.subtle.exportKey("pkcs8",V.privateKey)}).then(void 0,function(V){X(V)}).then(function(V){if(V){var K=A8.privateKeyFromAsn1(L0.fromDer(_4.util.createBuffer(V)));X(null,{privateKey:K,publicKey:A8.setRsaPublicKey(K.n,K.e)})}});if(L$6("generateKey")&&L$6("exportKey")){var G=_G.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:J,publicExponent:A$6(Q),hash:{name:"SHA-256"}},!0,["sign","verify"]);G.oncomplete=function(V){var K=V.target.result,W=_G.globalScope.msCrypto.subtle.exportKey("pkcs8",K.privateKey);W.oncomplete=function(H){var z=H.target.result,U=A8.privateKeyFromAsn1(L0.fromDer(_4.util.createBuffer(z)));X(null,{privateKey:U,publicKey:A8.setRsaPublicKey(U.n,U.e)})},W.onerror=function(H){X(H)}},G.onerror=function(V){X(V)};return}}else if(O$6("generateKeyPairSync")){var Z=qk1.generateKeyPairSync("rsa",{modulusLength:J,publicExponent:Q,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:A8.privateKeyFromPem(Z.privateKey),publicKey:A8.publicKeyFromPem(Z.publicKey)}}}var q=A8.rsa.createKeyPairGenerationState(J,Q,Y);if(!X)return A8.rsa.stepKeyPairGenerationState(q,0),q.keys;vN8(q,Y,X)};A8.setRsaPublicKey=A8.rsa.setPublicKey=function(J,Q){var Y={n:J,e:Q};return Y.encrypt=function(X,G,Z){if(typeof G==="string")G=G.toUpperCase();else if(G===void 0)G="RSAES-PKCS1-V1_5";if(G==="RSAES-PKCS1-V1_5")G={encode:function(V,K,W){return w$6(V,K,2).getBytes()}};else if(G==="RSA-OAEP"||G==="RSAES-OAEP")G={encode:function(V,K){return _4.pkcs1.encode_rsa_oaep(K,V,Z)}};else if(["RAW","NONE","NULL",null].indexOf(G)!==-1)G={encode:function(V){return V}};else if(typeof G==="string")throw Error('Unsupported encryption scheme: "'+G+'".');var q=G.encode(X,Y,!0);return A8.rsa.encrypt(q,Y,!0)},Y.verify=function(X,G,Z,q){if(typeof Z==="string")Z=Z.toUpperCase();else if(Z===void 0)Z="RSASSA-PKCS1-V1_5";if(q===void 0)q={_parseAllDigestBytes:!0};if(!("_parseAllDigestBytes"in q))q._parseAllDigestBytes=!0;if(Z==="RSASSA-PKCS1-V1_5")Z={verify:function(K,W){W=G91(W,Y,!0);var H=L0.fromDer(W,{parseAllBytes:q._parseAllDigestBytes}),z={},U=[];if(!L0.validate(H,kN8,z,U)){var N=Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw N.errors=U,N}var O=L0.derToOid(z.algorithmIdentifier);if(!(O===_4.oids.md2||O===_4.oids.md5||O===_4.oids.sha1||O===_4.oids.sha224||O===_4.oids.sha256||O===_4.oids.sha384||O===_4.oids.sha512||O===_4.oids["sha512-224"]||O===_4.oids["sha512-256"])){var N=Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw N.oid=O,N}if(O===_4.oids.md2||O===_4.oids.md5){if(!("parameters"in z))throw Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.")}return K===z.digest}};else if(Z==="NONE"||Z==="NULL"||Z===null)Z={verify:function(K,W){return W=G91(W,Y,!0),K===W}};var V=A8.rsa.decrypt(G,Y,!0,!1);return Z.verify(X,V,Y.n.bitLength())},Y};A8.setRsaPrivateKey=A8.rsa.setPrivateKey=function(J,Q,Y,X,G,Z,q,V){var K={n:J,e:Q,d:Y,p:X,q:G,dP:Z,dQ:q,qInv:V};return K.decrypt=function(W,H,z){if(typeof H==="string")H=H.toUpperCase();else if(H===void 0)H="RSAES-PKCS1-V1_5";var U=A8.rsa.decrypt(W,K,!1,!1);if(H==="RSAES-PKCS1-V1_5")H={decode:G91};else if(H==="RSA-OAEP"||H==="RSAES-OAEP")H={decode:function(N,O){return _4.pkcs1.decode_rsa_oaep(O,N,z)}};else if(["RAW","NONE","NULL",null].indexOf(H)!==-1)H={decode:function(N){return N}};else throw Error('Unsupported encryption scheme: "'+H+'".');return H.decode(U,K,!1)},K.sign=function(W,H){var z=!1;if(typeof H==="string")H=H.toUpperCase();if(H===void 0||H==="RSASSA-PKCS1-V1_5")H={encode:yN8},z=1;else if(H==="NONE"||H==="NULL"||H===null)H={encode:function(){return W}},z=1;var U=H.encode(W,K.n.bitLength());return A8.rsa.encrypt(U,K,z)},K};A8.wrapRsaPrivateKey=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,L0.integerToDer(0).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.OID,!1,L0.oidToDer(A8.oids.rsaEncryption).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.NULL,!1,"")]),L0.create(L0.Class.UNIVERSAL,L0.Type.OCTETSTRING,!1,L0.toDer(J).getBytes())])};A8.privateKeyFromAsn1=function(J){var Q={},Y=[];if(L0.validate(J,CN8,Q,Y))J=L0.fromDer(_4.util.createBuffer(Q.privateKey));if(Q={},Y=[],!L0.validate(J,SN8,Q,Y)){var X=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw X.errors=Y,X}var G,Z,q,V,K,W,H,z;return G=_4.util.createBuffer(Q.privateKeyModulus).toHex(),Z=_4.util.createBuffer(Q.privateKeyPublicExponent).toHex(),q=_4.util.createBuffer(Q.privateKeyPrivateExponent).toHex(),V=_4.util.createBuffer(Q.privateKeyPrime1).toHex(),K=_4.util.createBuffer(Q.privateKeyPrime2).toHex(),W=_4.util.createBuffer(Q.privateKeyExponent1).toHex(),H=_4.util.createBuffer(Q.privateKeyExponent2).toHex(),z=_4.util.createBuffer(Q.privateKeyCoefficient).toHex(),A8.setRsaPrivateKey(new C9(G,16),new C9(Z,16),new C9(q,16),new C9(V,16),new C9(K,16),new C9(W,16),new C9(H,16),new C9(z,16))};A8.privateKeyToAsn1=A8.privateKeyToRSAPrivateKey=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,L0.integerToDer(0).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.n)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.e)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.d)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.p)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.q)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.dP)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.dQ)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.qInv))])};A8.publicKeyFromAsn1=function(J){var Q={},Y=[];if(L0.validate(J,_N8,Q,Y)){var X=L0.derToOid(Q.publicKeyOid);if(X!==A8.oids.rsaEncryption){var G=Error("Cannot read public key. Unknown OID.");throw G.oid=X,G}J=Q.rsaPublicKey}if(Y=[],!L0.validate(J,jN8,Q,Y)){var G=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw G.errors=Y,G}var Z=_4.util.createBuffer(Q.publicKeyModulus).toHex(),q=_4.util.createBuffer(Q.publicKeyExponent).toHex();return A8.setRsaPublicKey(new C9(Z,16),new C9(q,16))};A8.publicKeyToAsn1=A8.publicKeyToSubjectPublicKeyInfo=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.OID,!1,L0.oidToDer(A8.oids.rsaEncryption).getBytes()),L0.create(L0.Class.UNIVERSAL,L0.Type.NULL,!1,"")]),L0.create(L0.Class.UNIVERSAL,L0.Type.BITSTRING,!1,[A8.publicKeyToRSAPublicKey(J)])])};A8.publicKeyToRSAPublicKey=function(J){return L0.create(L0.Class.UNIVERSAL,L0.Type.SEQUENCE,!0,[L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.n)),L0.create(L0.Class.UNIVERSAL,L0.Type.INTEGER,!1,gK(J.e))])};function w$6(J,Q,Y){var X=_4.util.createBuffer(),G=Math.ceil(Q.n.bitLength()/8);if(J.length>G-11){var Z=Error("Message is too long for PKCS#1 v1.5 padding.");throw Z.length=J.length,Z.max=G-11,Z}X.putByte(0),X.putByte(Y);var q=G-3-J.length,V;if(Y===0||Y===1){V=Y===0?0:255;for(var K=0;K<q;++K)X.putByte(V)}else while(q>0){var W=0,H=_4.random.getBytes(q);for(var K=0;K<q;++K)if(V=H.charCodeAt(K),V===0)++W;else X.putByte(V);q=W}return X.putByte(0),X.putBytes(J),X}function G91(J,Q,Y,X){var G=Math.ceil(Q.n.bitLength()/8),Z=_4.util.createBuffer(J),q=Z.getByte(),V=Z.getByte();if(q!==0||Y&&V!==0&&V!==1||!Y&&V!=2||Y&&V===0&&typeof X>"u")throw Error("Encryption block is invalid.");var K=0;if(V===0){K=G-3-X;for(var W=0;W<K;++W)if(Z.getByte()!==0)throw Error("Encryption block is invalid.")}else if(V===1){K=0;while(Z.length()>1){if(Z.getByte()!==255){--Z.read;break}++K}}else if(V===2){K=0;while(Z.length()>1){if(Z.getByte()===0){--Z.read;break}++K}}var H=Z.getByte();if(H!==0||K!==G-3-Z.length())throw Error("Encryption block is invalid.");return Z.getBytes()}function vN8(J,Q,Y){if(typeof Q==="function")Y=Q,Q={};Q=Q||{};var X={algorithm:{name:Q.algorithm||"PRIMEINC",options:{workers:Q.workers||2,workLoad:Q.workLoad||100,workerScript:Q.workerScript}}};if("prng"in Q)X.prng=Q.prng;G();function G(){Z(J.pBits,function(V,K){if(V)return Y(V);if(J.p=K,J.q!==null)return q(V,J.q);Z(J.qBits,q)})}function Z(V,K){_4.prime.generateProbablePrime(V,X,K)}function q(V,K){if(V)return Y(V);if(J.q=K,J.p.compareTo(J.q)<0){var W=J.p;J.p=J.q,J.q=W}if(J.p.subtract(C9.ONE).gcd(J.e).compareTo(C9.ONE)!==0){J.p=null,G();return}if(J.q.subtract(C9.ONE).gcd(J.e).compareTo(C9.ONE)!==0){J.q=null,Z(J.qBits,q);return}if(J.p1=J.p.subtract(C9.ONE),J.q1=J.q.subtract(C9.ONE),J.phi=J.p1.multiply(J.q1),J.phi.gcd(J.e).compareTo(C9.ONE)!==0){J.p=J.q=null,G();return}if(J.n=J.p.multiply(J.q),J.n.bitLength()!==J.bits){J.q=null,Z(J.qBits,q);return}var H=J.e.modInverse(J.phi);J.keys={privateKey:A8.rsa.setPrivateKey(J.n,J.e,H,J.p,J.q,H.mod(J.p1),H.mod(J.q1),J.q.modInverse(J.p)),publicKey:A8.rsa.setPublicKey(J.n,J.e)},Y(null,J.keys)}}function gK(J){var Q=J.toString(16);if(Q[0]>="8")Q="00"+Q;var Y=_4.util.hexToBytes(Q);if(Y.length>1&&(Y.charCodeAt(0)===0&&(Y.charCodeAt(1)&128)===0||Y.charCodeAt(0)===255&&(Y.charCodeAt(1)&128)===128))return Y.substr(1);return Y}function xN8(J){if(J<=100)return 27;if(J<=150)return 18;if(J<=200)return 15;if(J<=250)return 12;if(J<=300)return 9;if(J<=350)return 8;if(J<=400)return 7;if(J<=500)return 6;if(J<=600)return 5;if(J<=800)return 4;if(J<=1250)return 3;return 2}function O$6(J){return _4.util.isNodejs&&typeof qk1[J]==="function"}function M$6(J){return typeof _G.globalScope<"u"&&typeof _G.globalScope.crypto==="object"&&typeof _G.globalScope.crypto.subtle==="object"&&typeof _G.globalScope.crypto.subtle[J]==="function"}function L$6(J){return typeof _G.globalScope<"u"&&typeof _G.globalScope.msCrypto==="object"&&typeof _G.globalScope.msCrypto.subtle==="object"&&typeof _G.globalScope.msCrypto.subtle[J]==="function"}function A$6(J){var Q=_4.util.hexToBytes(J.toString(16)),Y=new Uint8Array(Q.length);for(var X=0;X<Q.length;++X)Y[X]=Q.charCodeAt(X);return Y}});var Kk1=h((IZ5,C$6)=>{var Y4=m8();eB();Mq();Kg();yK();JN();J91();VA();SG();e_1();zg();i9();if(typeof Vk1>"u")Vk1=Y4.jsbn.BigInteger;var Vk1,u0=Y4.asn1,S8=Y4.pki=Y4.pki||{};C$6.exports=S8.pbe=Y4.pbe=Y4.pbe||{};var HA=S8.oids,fN8={name:"EncryptedPrivateKeyInfo",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},hN8={name:"PBES2Algorithms",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:u0.Class.UNIVERSAL,type:u0.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:u0.Class.UNIVERSAL,type:u0.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},bN8={name:"pkcs-12PbeParams",tagClass:u0.Class.UNIVERSAL,type:u0.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:u0.Class.UNIVERSAL,type:u0.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:u0.Class.UNIVERSAL,type:u0.Type.INTEGER,constructed:!1,capture:"iterations"}]};S8.encryptPrivateKeyInfo=function(J,Q,Y){Y=Y||{},Y.saltSize=Y.saltSize||8,Y.count=Y.count||2048,Y.algorithm=Y.algorithm||"aes128",Y.prfAlgorithm=Y.prfAlgorithm||"sha1";var X=Y4.random.getBytesSync(Y.saltSize),G=Y.count,Z=u0.integerToDer(G),q,V,K;if(Y.algorithm.indexOf("aes")===0||Y.algorithm==="des"){var W,H,z;switch(Y.algorithm){case"aes128":q=16,W=16,H=HA["aes128-CBC"],z=Y4.aes.createEncryptionCipher;break;case"aes192":q=24,W=16,H=HA["aes192-CBC"],z=Y4.aes.createEncryptionCipher;break;case"aes256":q=32,W=16,H=HA["aes256-CBC"],z=Y4.aes.createEncryptionCipher;break;case"des":q=8,W=8,H=HA.desCBC,z=Y4.des.createEncryptionCipher;break;default:var U=Error("Cannot encrypt private key. Unknown encryption algorithm.");throw U.algorithm=Y.algorithm,U}var N="hmacWith"+Y.prfAlgorithm.toUpperCase(),O=R$6(N),M=Y4.pkcs5.pbkdf2(Q,X,G,q,O),L=Y4.random.getBytesSync(W),w=z(M);w.start(L),w.update(u0.toDer(J)),w.finish(),K=w.output.getBytes();var I=uN8(X,Z,q,N);V=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(HA.pkcs5PBES2).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(HA.pkcs5PBKDF2).getBytes()),I]),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(H).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,L)])])])}else if(Y.algorithm==="3des"){q=24;var P=new Y4.util.ByteBuffer(X),M=S8.pbe.generatePkcs12Key(Q,P,1,G,q),L=S8.pbe.generatePkcs12Key(Q,P,2,G,q),w=Y4.des.createEncryptionCipher(M);w.start(L),w.update(u0.toDer(J)),w.finish(),K=w.output.getBytes(),V=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(HA["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,X),u0.create(u0.Class.UNIVERSAL,u0.Type.INTEGER,!1,Z.getBytes())])])}else{var U=Error("Cannot encrypt private key. Unknown encryption algorithm.");throw U.algorithm=Y.algorithm,U}var R=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[V,u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,K)]);return R};S8.decryptPrivateKeyInfo=function(J,Q){var Y=null,X={},G=[];if(!u0.validate(J,fN8,X,G)){var Z=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw Z.errors=G,Z}var q=u0.derToOid(X.encryptionOid),V=S8.pbe.getCipher(q,X.encryptionParams,Q),K=Y4.util.createBuffer(X.encryptedData);if(V.update(K),V.finish())Y=u0.fromDer(V.output);return Y};S8.encryptedPrivateKeyToPem=function(J,Q){var Y={type:"ENCRYPTED PRIVATE KEY",body:u0.toDer(J).getBytes()};return Y4.pem.encode(Y,{maxline:Q})};S8.encryptedPrivateKeyFromPem=function(J){var Q=Y4.pem.decode(J)[0];if(Q.type!=="ENCRYPTED PRIVATE KEY"){var Y=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return u0.fromDer(Q.body)};S8.encryptRsaPrivateKey=function(J,Q,Y){if(Y=Y||{},!Y.legacy){var X=S8.wrapRsaPrivateKey(S8.privateKeyToAsn1(J));return X=S8.encryptPrivateKeyInfo(X,Q,Y),S8.encryptedPrivateKeyToPem(X)}var G,Z,q,V;switch(Y.algorithm){case"aes128":G="AES-128-CBC",q=16,Z=Y4.random.getBytesSync(16),V=Y4.aes.createEncryptionCipher;break;case"aes192":G="AES-192-CBC",q=24,Z=Y4.random.getBytesSync(16),V=Y4.aes.createEncryptionCipher;break;case"aes256":G="AES-256-CBC",q=32,Z=Y4.random.getBytesSync(16),V=Y4.aes.createEncryptionCipher;break;case"3des":G="DES-EDE3-CBC",q=24,Z=Y4.random.getBytesSync(8),V=Y4.des.createEncryptionCipher;break;case"des":G="DES-CBC",q=8,Z=Y4.random.getBytesSync(8),V=Y4.des.createEncryptionCipher;break;default:var K=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+Y.algorithm+'".');throw K.algorithm=Y.algorithm,K}var W=Y4.pbe.opensslDeriveBytes(Q,Z.substr(0,8),q),H=V(W);H.start(Z),H.update(u0.toDer(S8.privateKeyToAsn1(J))),H.finish();var z={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:G,parameters:Y4.util.bytesToHex(Z).toUpperCase()},body:H.output.getBytes()};return Y4.pem.encode(z)};S8.decryptRsaPrivateKey=function(J,Q){var Y=null,X=Y4.pem.decode(J)[0];if(X.type!=="ENCRYPTED PRIVATE KEY"&&X.type!=="PRIVATE KEY"&&X.type!=="RSA PRIVATE KEY"){var G=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw G.headerType=G,G}if(X.procType&&X.procType.type==="ENCRYPTED"){var Z,q;switch(X.dekInfo.algorithm){case"DES-CBC":Z=8,q=Y4.des.createDecryptionCipher;break;case"DES-EDE3-CBC":Z=24,q=Y4.des.createDecryptionCipher;break;case"AES-128-CBC":Z=16,q=Y4.aes.createDecryptionCipher;break;case"AES-192-CBC":Z=24,q=Y4.aes.createDecryptionCipher;break;case"AES-256-CBC":Z=32,q=Y4.aes.createDecryptionCipher;break;case"RC2-40-CBC":Z=5,q=function(z){return Y4.rc2.createDecryptionCipher(z,40)};break;case"RC2-64-CBC":Z=8,q=function(z){return Y4.rc2.createDecryptionCipher(z,64)};break;case"RC2-128-CBC":Z=16,q=function(z){return Y4.rc2.createDecryptionCipher(z,128)};break;default:var G=Error('Could not decrypt private key; unsupported encryption algorithm "'+X.dekInfo.algorithm+'".');throw G.algorithm=X.dekInfo.algorithm,G}var V=Y4.util.hexToBytes(X.dekInfo.parameters),K=Y4.pbe.opensslDeriveBytes(Q,V.substr(0,8),Z),W=q(K);if(W.start(V),W.update(Y4.util.createBuffer(X.body)),W.finish())Y=W.output.getBytes();else return Y}else Y=X.body;if(X.type==="ENCRYPTED PRIVATE KEY")Y=S8.decryptPrivateKeyInfo(u0.fromDer(Y),Q);else Y=u0.fromDer(Y);if(Y!==null)Y=S8.privateKeyFromAsn1(Y);return Y};S8.pbe.generatePkcs12Key=function(J,Q,Y,X,G,Z){var q,V;if(typeof Z>"u"||Z===null){if(!("sha1"in Y4.md))throw Error('"sha1" hash algorithm unavailable.');Z=Y4.md.sha1.create()}var{digestLength:K,blockLength:W}=Z,H=new Y4.util.ByteBuffer,z=new Y4.util.ByteBuffer;if(J!==null&&J!==void 0){for(V=0;V<J.length;V++)z.putInt16(J.charCodeAt(V));z.putInt16(0)}var U=z.length(),N=Q.length(),O=new Y4.util.ByteBuffer;O.fillWithByte(Y,W);var M=W*Math.ceil(N/W),L=new Y4.util.ByteBuffer;for(V=0;V<M;V++)L.putByte(Q.at(V%N));var w=W*Math.ceil(U/W),I=new Y4.util.ByteBuffer;for(V=0;V<w;V++)I.putByte(z.at(V%U));var P=L;P.putBuffer(I);var R=Math.ceil(G/K);for(var j=1;j<=R;j++){var y=new Y4.util.ByteBuffer;y.putBytes(O.bytes()),y.putBytes(P.bytes());for(var f=0;f<X;f++)Z.start(),Z.update(y.getBytes()),y=Z.digest();var g=new Y4.util.ByteBuffer;for(V=0;V<W;V++)g.putByte(y.at(V%K));var p=Math.ceil(N/W)+Math.ceil(U/W),b=new Y4.util.ByteBuffer;for(q=0;q<p;q++){var i=new Y4.util.ByteBuffer(P.getBytes(W)),J1=511;for(V=g.length()-1;V>=0;V--)J1=J1>>8,J1+=g.at(V)+i.at(V),i.setAt(V,J1&255);b.putBuffer(i)}P=b,H.putBuffer(y)}return H.truncate(H.length()-G),H};S8.pbe.getCipher=function(J,Q,Y){switch(J){case S8.oids.pkcs5PBES2:return S8.pbe.getCipherForPBES2(J,Q,Y);case S8.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case S8.oids["pbewithSHAAnd40BitRC2-CBC"]:return S8.pbe.getCipherForPKCS12PBE(J,Q,Y);default:var X=Error("Cannot read encrypted PBE data block. Unsupported OID.");throw X.oid=J,X.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],X}};S8.pbe.getCipherForPBES2=function(J,Q,Y){var X={},G=[];if(!u0.validate(Q,hN8,X,G)){var Z=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw Z.errors=G,Z}if(J=u0.derToOid(X.kdfOid),J!==S8.oids.pkcs5PBKDF2){var Z=Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw Z.oid=J,Z.supportedOids=["pkcs5PBKDF2"],Z}if(J=u0.derToOid(X.encOid),J!==S8.oids["aes128-CBC"]&&J!==S8.oids["aes192-CBC"]&&J!==S8.oids["aes256-CBC"]&&J!==S8.oids["des-EDE3-CBC"]&&J!==S8.oids.desCBC){var Z=Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw Z.oid=J,Z.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],Z}var q=X.kdfSalt,V=Y4.util.createBuffer(X.kdfIterationCount);V=V.getInt(V.length()<<3);var K,W;switch(S8.oids[J]){case"aes128-CBC":K=16,W=Y4.aes.createDecryptionCipher;break;case"aes192-CBC":K=24,W=Y4.aes.createDecryptionCipher;break;case"aes256-CBC":K=32,W=Y4.aes.createDecryptionCipher;break;case"des-EDE3-CBC":K=24,W=Y4.des.createDecryptionCipher;break;case"desCBC":K=8,W=Y4.des.createDecryptionCipher;break}var H=T$6(X.prfOid),z=Y4.pkcs5.pbkdf2(Y,q,V,K,H),U=X.encIv,N=W(z);return N.start(U),N};S8.pbe.getCipherForPKCS12PBE=function(J,Q,Y){var X={},G=[];if(!u0.validate(Q,bN8,X,G)){var Z=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw Z.errors=G,Z}var q=Y4.util.createBuffer(X.salt),V=Y4.util.createBuffer(X.iterations);V=V.getInt(V.length()<<3);var K,W,H;switch(J){case S8.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:K=24,W=8,H=Y4.des.startDecrypting;break;case S8.oids["pbewithSHAAnd40BitRC2-CBC"]:K=5,W=8,H=function(M,L){var w=Y4.rc2.createDecryptionCipher(M,40);return w.start(L,null),w};break;default:var Z=Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw Z.oid=J,Z}var z=T$6(X.prfOid),U=S8.pbe.generatePkcs12Key(Y,q,1,V,K,z);z.start();var N=S8.pbe.generatePkcs12Key(Y,q,2,V,W,z);return H(U,N)};S8.pbe.opensslDeriveBytes=function(J,Q,Y,X){if(typeof X>"u"||X===null){if(!("md5"in Y4.md))throw Error('"md5" hash algorithm unavailable.');X=Y4.md.md5.create()}if(Q===null)Q="";var G=[P$6(X,J+Q)];for(var Z=16,q=1;Z<Y;++q,Z+=16)G.push(P$6(X,G[q-1]+J+Q));return G.join("").substr(0,Y)};function P$6(J,Q){return J.start().update(Q).digest().getBytes()}function T$6(J){var Q;if(!J)Q="hmacWithSHA1";else if(Q=S8.oids[u0.derToOid(J)],!Q){var Y=Error("Unsupported PRF OID.");throw Y.oid=J,Y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],Y}return R$6(Q)}function R$6(J){var Q=Y4.md;switch(J){case"hmacWithSHA224":Q=Y4.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":J=J.substr(8).toLowerCase();break;default:var Y=Error("Unsupported PRF algorithm.");throw Y.algorithm=J,Y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],Y}if(!Q||!(J in Q))throw Error("Unknown hash algorithm: "+J);return Q[J].create()}function uN8(J,Q,Y,X){var G=u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OCTETSTRING,!1,J),u0.create(u0.Class.UNIVERSAL,u0.Type.INTEGER,!1,Q.getBytes())]);if(X!=="hmacWithSHA1")G.value.push(u0.create(u0.Class.UNIVERSAL,u0.Type.INTEGER,!1,Y4.util.hexToBytes(Y.toString(16))),u0.create(u0.Class.UNIVERSAL,u0.Type.SEQUENCE,!0,[u0.create(u0.Class.UNIVERSAL,u0.Type.OID,!1,u0.oidToDer(S8.oids[X]).getBytes()),u0.create(u0.Class.UNIVERSAL,u0.Type.NULL,!1,"")]));return G}});var Wk1=h((PZ5,_$6)=>{var OC=m8();Mq();i9();var r6=OC.asn1,MC=_$6.exports=OC.pkcs7asn1=OC.pkcs7asn1||{};OC.pkcs7=OC.pkcs7||{};OC.pkcs7.asn1=MC;var S$6={name:"ContentInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};MC.contentInfoValidator=S$6;var j$6={name:"EncryptedContentInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:r6.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};MC.envelopedDataValidator={name:"EnvelopedData",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(j$6)};MC.encryptedDataValidator={name:"EncryptedData",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"}].concat(j$6)};var gN8={name:"SignerInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:r6.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:r6.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};MC.signedDataValidator={name:"SignedData",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},S$6,{name:"SignedData.Certificates",tagClass:r6.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:r6.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SET,capture:"signerInfos",optional:!0,value:[gN8]}]};MC.recipientInfoValidator={name:"RecipientInfo",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:r6.Class.UNIVERSAL,type:r6.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:r6.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:r6.Class.UNIVERSAL,type:r6.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var Hk1=h((TZ5,k$6)=>{var zA=m8();i9();zA.mgf=zA.mgf||{};var mN8=k$6.exports=zA.mgf.mgf1=zA.mgf1=zA.mgf1||{};mN8.create=function(J){var Q={generate:function(Y,X){var G=new zA.util.ByteBuffer,Z=Math.ceil(X/J.digestLength);for(var q=0;q<Z;q++){var V=new zA.util.ByteBuffer;V.putInt32(q),J.start(),J.update(Y+V.getBytes()),G.putBuffer(J.digest())}return G.truncate(G.length()-X),G.getBytes()}};return Q}});var v$6=h((RZ5,y$6)=>{var Z91=m8();Hk1();y$6.exports=Z91.mgf=Z91.mgf||{};Z91.mgf.mgf1=Z91.mgf1});var q91=h((CZ5,x$6)=>{var FA=m8();SG();i9();var pN8=x$6.exports=FA.pss=FA.pss||{};pN8.create=function(J){if(arguments.length===3)J={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]};var{md:Q,mgf:Y}=J,X=Q.digestLength,G=J.salt||null;if(typeof G==="string")G=FA.util.createBuffer(G);var Z;if("saltLength"in J)Z=J.saltLength;else if(G!==null)Z=G.length();else throw Error("Salt length not specified or specific salt not given.");if(G!==null&&G.length()!==Z)throw Error("Given salt length does not match length of given salt.");var q=J.prng||FA.random,V={};return V.encode=function(K,W){var H,z=W-1,U=Math.ceil(z/8),N=K.digest().getBytes();if(U<X+Z+2)throw Error("Message is too long to encrypt.");var O;if(G===null)O=q.getBytesSync(Z);else O=G.bytes();var M=new FA.util.ByteBuffer;M.fillWithByte(0,8),M.putBytes(N),M.putBytes(O),Q.start(),Q.update(M.getBytes());var L=Q.digest().getBytes(),w=new FA.util.ByteBuffer;w.fillWithByte(0,U-Z-X-2),w.putByte(1),w.putBytes(O);var I=w.getBytes(),P=U-X-1,R=Y.generate(L,P),j="";for(H=0;H<P;H++)j+=String.fromCharCode(I.charCodeAt(H)^R.charCodeAt(H));var y=65280>>8*U-z&255;return j=String.fromCharCode(j.charCodeAt(0)&~y)+j.substr(1),j+L+String.fromCharCode(188)},V.verify=function(K,W,H){var z,U=H-1,N=Math.ceil(U/8);if(W=W.substr(-N),N<X+Z+2)throw Error("Inconsistent parameters to PSS signature verification.");if(W.charCodeAt(N-1)!==188)throw Error("Encoded message does not end in 0xBC.");var O=N-X-1,M=W.substr(0,O),L=W.substr(O,X),w=65280>>8*N-U&255;if((M.charCodeAt(0)&w)!==0)throw Error("Bits beyond keysize not zero as expected.");var I=Y.generate(L,O),P="";for(z=0;z<O;z++)P+=String.fromCharCode(M.charCodeAt(z)^I.charCodeAt(z));P=String.fromCharCode(P.charCodeAt(0)&~w)+P.substr(1);var R=N-X-Z-2;for(z=0;z<R;z++)if(P.charCodeAt(z)!==0)throw Error("Leftmost octets not zero as expected");if(P.charCodeAt(R)!==1)throw Error("Inconsistent PSS signature, 0x01 marker not found");var j=P.substr(-Z),y=new FA.util.ByteBuffer;y.fillWithByte(0,8),y.putBytes(K),y.putBytes(j),Q.start(),Q.update(y.getBytes());var f=Q.digest().getBytes();return L===f},V}});var W91=h((SZ5,g$6)=>{var k4=m8();eB();Mq();Kg();yK();v$6();JN();VA();q91();zg();i9();var w1=k4.asn1,R6=g$6.exports=k4.pki=k4.pki||{},u9=R6.oids,i2={};i2.CN=u9.commonName;i2.commonName="CN";i2.C=u9.countryName;i2.countryName="C";i2.L=u9.localityName;i2.localityName="L";i2.ST=u9.stateOrProvinceName;i2.stateOrProvinceName="ST";i2.O=u9.organizationName;i2.organizationName="O";i2.OU=u9.organizationalUnitName;i2.organizationalUnitName="OU";i2.E=u9.emailAddress;i2.emailAddress="E";var h$6=k4.pki.rsa.publicKeyValidator,dN8={name:"Certificate",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:w1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:w1.Class.UNIVERSAL,type:w1.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:w1.Class.UNIVERSAL,type:w1.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:w1.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:w1.Class.UNIVERSAL,type:w1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},h$6,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:w1.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:w1.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:w1.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:w1.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},cN8={name:"rsapss",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:w1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:w1.Class.UNIVERSAL,type:w1.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:w1.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:w1.Class.UNIVERSAL,type:w1.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:w1.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:w1.Class.UNIVERSAL,type:w1.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:w1.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:w1.Class.UNIVERSAL,type:w1.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},lN8={name:"CertificationRequestInfo",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:w1.Class.UNIVERSAL,type:w1.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},h$6,{name:"CertificationRequestInfo.attributes",tagClass:w1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SET,constructed:!0}]}]}]},iN8={name:"CertificationRequest",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[lN8,{name:"CertificationRequest.signatureAlgorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:w1.Class.UNIVERSAL,type:w1.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:w1.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:w1.Class.UNIVERSAL,type:w1.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};R6.RDNAttributesAsArray=function(J,Q){var Y=[],X,G,Z;for(var q=0;q<J.value.length;++q){X=J.value[q];for(var V=0;V<X.value.length;++V){if(Z={},G=X.value[V],Z.type=w1.derToOid(G.value[0].value),Z.value=G.value[1].value,Z.valueTagClass=G.value[1].type,Z.type in u9){if(Z.name=u9[Z.type],Z.name in i2)Z.shortName=i2[Z.name]}if(Q)Q.update(Z.type),Q.update(Z.value);Y.push(Z)}}return Y};R6.CRIAttributesAsArray=function(J){var Q=[];for(var Y=0;Y<J.length;++Y){var X=J[Y],G=w1.derToOid(X.value[0].value),Z=X.value[1].value;for(var q=0;q<Z.length;++q){var V={};if(V.type=G,V.value=Z[q].value,V.valueTagClass=Z[q].type,V.type in u9){if(V.name=u9[V.type],V.name in i2)V.shortName=i2[V.name]}if(V.type===u9.extensionRequest){V.extensions=[];for(var K=0;K<V.value.length;++K)V.extensions.push(R6.certificateExtensionFromAsn1(V.value[K]))}Q.push(V)}}return Q};function $N(J,Q){if(typeof Q==="string")Q={shortName:Q};var Y=null,X;for(var G=0;Y===null&&G<J.attributes.length;++G)if(X=J.attributes[G],Q.type&&Q.type===X.type)Y=X;else if(Q.name&&Q.name===X.name)Y=X;else if(Q.shortName&&Q.shortName===X.shortName)Y=X;return Y}var V91=function(J,Q,Y){var X={};if(J!==u9["RSASSA-PSS"])return X;if(Y)X={hash:{algorithmOid:u9.sha1},mgf:{algorithmOid:u9.mgf1,hash:{algorithmOid:u9.sha1}},saltLength:20};var G={},Z=[];if(!w1.validate(Q,cN8,G,Z)){var q=Error("Cannot read RSASSA-PSS parameter block.");throw q.errors=Z,q}if(G.hashOid!==void 0)X.hash=X.hash||{},X.hash.algorithmOid=w1.derToOid(G.hashOid);if(G.maskGenOid!==void 0)X.mgf=X.mgf||{},X.mgf.algorithmOid=w1.derToOid(G.maskGenOid),X.mgf.hash=X.mgf.hash||{},X.mgf.hash.algorithmOid=w1.derToOid(G.maskGenHashOid);if(G.saltLength!==void 0)X.saltLength=G.saltLength.charCodeAt(0);return X},K91=function(J){switch(u9[J.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return k4.md.sha1.create();case"md5WithRSAEncryption":return k4.md.md5.create();case"sha256WithRSAEncryption":return k4.md.sha256.create();case"sha384WithRSAEncryption":return k4.md.sha384.create();case"sha512WithRSAEncryption":return k4.md.sha512.create();case"RSASSA-PSS":return k4.md.sha256.create();default:var Q=Error("Could not compute "+J.type+" digest. Unknown signature OID.");throw Q.signatureOid=J.signatureOid,Q}},b$6=function(J){var Q=J.certificate,Y;switch(Q.signatureOid){case u9.sha1WithRSAEncryption:case u9.sha1WithRSASignature:break;case u9["RSASSA-PSS"]:var X,G;if(X=u9[Q.signatureParameters.mgf.hash.algorithmOid],X===void 0||k4.md[X]===void 0){var Z=Error("Unsupported MGF hash function.");throw Z.oid=Q.signatureParameters.mgf.hash.algorithmOid,Z.name=X,Z}if(G=u9[Q.signatureParameters.mgf.algorithmOid],G===void 0||k4.mgf[G]===void 0){var Z=Error("Unsupported MGF function.");throw Z.oid=Q.signatureParameters.mgf.algorithmOid,Z.name=G,Z}if(G=k4.mgf[G].create(k4.md[X].create()),X=u9[Q.signatureParameters.hash.algorithmOid],X===void 0||k4.md[X]===void 0){var Z=Error("Unsupported RSASSA-PSS hash function.");throw Z.oid=Q.signatureParameters.hash.algorithmOid,Z.name=X,Z}Y=k4.pss.create(k4.md[X].create(),G,Q.signatureParameters.saltLength);break}return Q.publicKey.verify(J.md.digest().getBytes(),J.signature,Y)};R6.certificateFromPem=function(J,Q,Y){var X=k4.pem.decode(J)[0];if(X.type!=="CERTIFICATE"&&X.type!=="X509 CERTIFICATE"&&X.type!=="TRUSTED CERTIFICATE"){var G=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw G.headerType=X.type,G}if(X.procType&&X.procType.type==="ENCRYPTED")throw Error("Could not convert certificate from PEM; PEM is encrypted.");var Z=w1.fromDer(X.body,Y);return R6.certificateFromAsn1(Z,Q)};R6.certificateToPem=function(J,Q){var Y={type:"CERTIFICATE",body:w1.toDer(R6.certificateToAsn1(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.publicKeyFromPem=function(J){var Q=k4.pem.decode(J)[0];if(Q.type!=="PUBLIC KEY"&&Q.type!=="RSA PUBLIC KEY"){var Y=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert public key from PEM; PEM is encrypted.");var X=w1.fromDer(Q.body);return R6.publicKeyFromAsn1(X)};R6.publicKeyToPem=function(J,Q){var Y={type:"PUBLIC KEY",body:w1.toDer(R6.publicKeyToAsn1(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.publicKeyToRSAPublicKeyPem=function(J,Q){var Y={type:"RSA PUBLIC KEY",body:w1.toDer(R6.publicKeyToRSAPublicKey(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.getPublicKeyFingerprint=function(J,Q){Q=Q||{};var Y=Q.md||k4.md.sha1.create(),X=Q.type||"RSAPublicKey",G;switch(X){case"RSAPublicKey":G=w1.toDer(R6.publicKeyToRSAPublicKey(J)).getBytes();break;case"SubjectPublicKeyInfo":G=w1.toDer(R6.publicKeyToAsn1(J)).getBytes();break;default:throw Error('Unknown fingerprint type "'+Q.type+'".')}Y.start(),Y.update(G);var Z=Y.digest();if(Q.encoding==="hex"){var q=Z.toHex();if(Q.delimiter)return q.match(/.{2}/g).join(Q.delimiter);return q}else if(Q.encoding==="binary")return Z.getBytes();else if(Q.encoding)throw Error('Unknown encoding "'+Q.encoding+'".');return Z};R6.certificationRequestFromPem=function(J,Q,Y){var X=k4.pem.decode(J)[0];if(X.type!=="CERTIFICATE REQUEST"){var G=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw G.headerType=X.type,G}if(X.procType&&X.procType.type==="ENCRYPTED")throw Error("Could not convert certification request from PEM; PEM is encrypted.");var Z=w1.fromDer(X.body,Y);return R6.certificationRequestFromAsn1(Z,Q)};R6.certificationRequestToPem=function(J,Q){var Y={type:"CERTIFICATE REQUEST",body:w1.toDer(R6.certificationRequestToAsn1(J)).getBytes()};return k4.pem.encode(Y,{maxline:Q})};R6.createCertificate=function(){var J={};return J.version=2,J.serialNumber="00",J.signatureOid=null,J.signature=null,J.siginfo={},J.siginfo.algorithmOid=null,J.validity={},J.validity.notBefore=new Date,J.validity.notAfter=new Date,J.issuer={},J.issuer.getField=function(Q){return $N(J.issuer,Q)},J.issuer.addField=function(Q){kG([Q]),J.issuer.attributes.push(Q)},J.issuer.attributes=[],J.issuer.hash=null,J.subject={},J.subject.getField=function(Q){return $N(J.subject,Q)},J.subject.addField=function(Q){kG([Q]),J.subject.attributes.push(Q)},J.subject.attributes=[],J.subject.hash=null,J.extensions=[],J.publicKey=null,J.md=null,J.setSubject=function(Q,Y){if(kG(Q),J.subject.attributes=Q,delete J.subject.uniqueId,Y)J.subject.uniqueId=Y;J.subject.hash=null},J.setIssuer=function(Q,Y){if(kG(Q),J.issuer.attributes=Q,delete J.issuer.uniqueId,Y)J.issuer.uniqueId=Y;J.issuer.hash=null},J.setExtensions=function(Q){for(var Y=0;Y<Q.length;++Y)u$6(Q[Y],{cert:J});J.extensions=Q},J.getExtension=function(Q){if(typeof Q==="string")Q={name:Q};var Y=null,X;for(var G=0;Y===null&&G<J.extensions.length;++G)if(X=J.extensions[G],Q.id&&X.id===Q.id)Y=X;else if(Q.name&&X.name===Q.name)Y=X;return Y},J.sign=function(Q,Y){J.md=Y||k4.md.sha1.create();var X=u9[J.md.algorithm+"WithRSAEncryption"];if(!X){var G=Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw G.algorithm=J.md.algorithm,G}J.signatureOid=J.siginfo.algorithmOid=X,J.tbsCertificate=R6.getTBSCertificate(J);var Z=w1.toDer(J.tbsCertificate);J.md.update(Z.getBytes()),J.signature=Q.sign(J.md)},J.verify=function(Q){var Y=!1;if(!J.issued(Q)){var X=Q.issuer,G=J.subject,Z=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw Z.expectedIssuer=G.attributes,Z.actualIssuer=X.attributes,Z}var q=Q.md;if(q===null){q=K91({signatureOid:Q.signatureOid,type:"certificate"});var V=Q.tbsCertificate||R6.getTBSCertificate(Q),K=w1.toDer(V);q.update(K.getBytes())}if(q!==null)Y=b$6({certificate:J,md:q,signature:Q.signature});return Y},J.isIssuer=function(Q){var Y=!1,X=J.issuer,G=Q.subject;if(X.hash&&G.hash)Y=X.hash===G.hash;else if(X.attributes.length===G.attributes.length){Y=!0;var Z,q;for(var V=0;Y&&V<X.attributes.length;++V)if(Z=X.attributes[V],q=G.attributes[V],Z.type!==q.type||Z.value!==q.value)Y=!1}return Y},J.issued=function(Q){return Q.isIssuer(J)},J.generateSubjectKeyIdentifier=function(){return R6.getPublicKeyFingerprint(J.publicKey,{type:"RSAPublicKey"})},J.verifySubjectKeyIdentifier=function(){var Q=u9.subjectKeyIdentifier;for(var Y=0;Y<J.extensions.length;++Y){var X=J.extensions[Y];if(X.id===Q){var G=J.generateSubjectKeyIdentifier().getBytes();return k4.util.hexToBytes(X.subjectKeyIdentifier)===G}}return!1},J};R6.certificateFromAsn1=function(J,Q){var Y={},X=[];if(!w1.validate(J,dN8,Y,X)){var G=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw G.errors=X,G}var Z=w1.derToOid(Y.publicKeyOid);if(Z!==R6.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=R6.createCertificate();q.version=Y.certVersion?Y.certVersion.charCodeAt(0):0;var V=k4.util.createBuffer(Y.certSerialNumber);q.serialNumber=V.toHex(),q.signatureOid=k4.asn1.derToOid(Y.certSignatureOid),q.signatureParameters=V91(q.signatureOid,Y.certSignatureParams,!0),q.siginfo.algorithmOid=k4.asn1.derToOid(Y.certinfoSignatureOid),q.siginfo.parameters=V91(q.siginfo.algorithmOid,Y.certinfoSignatureParams,!1),q.signature=Y.certSignature;var K=[];if(Y.certValidity1UTCTime!==void 0)K.push(w1.utcTimeToDate(Y.certValidity1UTCTime));if(Y.certValidity2GeneralizedTime!==void 0)K.push(w1.generalizedTimeToDate(Y.certValidity2GeneralizedTime));if(Y.certValidity3UTCTime!==void 0)K.push(w1.utcTimeToDate(Y.certValidity3UTCTime));if(Y.certValidity4GeneralizedTime!==void 0)K.push(w1.generalizedTimeToDate(Y.certValidity4GeneralizedTime));if(K.length>2)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(K.length<2)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(q.validity.notBefore=K[0],q.validity.notAfter=K[1],q.tbsCertificate=Y.tbsCertificate,Q){q.md=K91({signatureOid:q.signatureOid,type:"certificate"});var W=w1.toDer(q.tbsCertificate);q.md.update(W.getBytes())}var H=k4.md.sha1.create(),z=w1.toDer(Y.certIssuer);if(H.update(z.getBytes()),q.issuer.getField=function(O){return $N(q.issuer,O)},q.issuer.addField=function(O){kG([O]),q.issuer.attributes.push(O)},q.issuer.attributes=R6.RDNAttributesAsArray(Y.certIssuer),Y.certIssuerUniqueId)q.issuer.uniqueId=Y.certIssuerUniqueId;q.issuer.hash=H.digest().toHex();var U=k4.md.sha1.create(),N=w1.toDer(Y.certSubject);if(U.update(N.getBytes()),q.subject.getField=function(O){return $N(q.subject,O)},q.subject.addField=function(O){kG([O]),q.subject.attributes.push(O)},q.subject.attributes=R6.RDNAttributesAsArray(Y.certSubject),Y.certSubjectUniqueId)q.subject.uniqueId=Y.certSubjectUniqueId;if(q.subject.hash=U.digest().toHex(),Y.certExtensions)q.extensions=R6.certificateExtensionsFromAsn1(Y.certExtensions);else q.extensions=[];return q.publicKey=R6.publicKeyFromAsn1(Y.subjectPublicKeyInfo),q};R6.certificateExtensionsFromAsn1=function(J){var Q=[];for(var Y=0;Y<J.value.length;++Y){var X=J.value[Y];for(var G=0;G<X.value.length;++G)Q.push(R6.certificateExtensionFromAsn1(X.value[G]))}return Q};R6.certificateExtensionFromAsn1=function(J){var Q={};if(Q.id=w1.derToOid(J.value[0].value),Q.critical=!1,J.value[1].type===w1.Type.BOOLEAN)Q.critical=J.value[1].value.charCodeAt(0)!==0,Q.value=J.value[2].value;else Q.value=J.value[1].value;if(Q.id in u9){if(Q.name=u9[Q.id],Q.name==="keyUsage"){var Y=w1.fromDer(Q.value),X=0,G=0;if(Y.value.length>1)X=Y.value.charCodeAt(1),G=Y.value.length>2?Y.value.charCodeAt(2):0;Q.digitalSignature=(X&128)===128,Q.nonRepudiation=(X&64)===64,Q.keyEncipherment=(X&32)===32,Q.dataEncipherment=(X&16)===16,Q.keyAgreement=(X&8)===8,Q.keyCertSign=(X&4)===4,Q.cRLSign=(X&2)===2,Q.encipherOnly=(X&1)===1,Q.decipherOnly=(G&128)===128}else if(Q.name==="basicConstraints"){var Y=w1.fromDer(Q.value);if(Y.value.length>0&&Y.value[0].type===w1.Type.BOOLEAN)Q.cA=Y.value[0].value.charCodeAt(0)!==0;else Q.cA=!1;var Z=null;if(Y.value.length>0&&Y.value[0].type===w1.Type.INTEGER)Z=Y.value[0].value;else if(Y.value.length>1)Z=Y.value[1].value;if(Z!==null)Q.pathLenConstraint=w1.derToInteger(Z)}else if(Q.name==="extKeyUsage"){var Y=w1.fromDer(Q.value);for(var q=0;q<Y.value.length;++q){var V=w1.derToOid(Y.value[q].value);if(V in u9)Q[u9[V]]=!0;else Q[V]=!0}}else if(Q.name==="nsCertType"){var Y=w1.fromDer(Q.value),X=0;if(Y.value.length>1)X=Y.value.charCodeAt(1);Q.client=(X&128)===128,Q.server=(X&64)===64,Q.email=(X&32)===32,Q.objsign=(X&16)===16,Q.reserved=(X&8)===8,Q.sslCA=(X&4)===4,Q.emailCA=(X&2)===2,Q.objCA=(X&1)===1}else if(Q.name==="subjectAltName"||Q.name==="issuerAltName"){Q.altNames=[];var K,Y=w1.fromDer(Q.value);for(var W=0;W<Y.value.length;++W){K=Y.value[W];var H={type:K.type,value:K.value};switch(Q.altNames.push(H),K.type){case 1:case 2:case 6:break;case 7:H.ip=k4.util.bytesToIP(K.value);break;case 8:H.oid=w1.derToOid(K.value);break;default:}}}else if(Q.name==="subjectKeyIdentifier"){var Y=w1.fromDer(Q.value);Q.subjectKeyIdentifier=k4.util.bytesToHex(Y.value)}}return Q};R6.certificationRequestFromAsn1=function(J,Q){var Y={},X=[];if(!w1.validate(J,iN8,Y,X)){var G=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw G.errors=X,G}var Z=w1.derToOid(Y.publicKeyOid);if(Z!==R6.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=R6.createCertificationRequest();if(q.version=Y.csrVersion?Y.csrVersion.charCodeAt(0):0,q.signatureOid=k4.asn1.derToOid(Y.csrSignatureOid),q.signatureParameters=V91(q.signatureOid,Y.csrSignatureParams,!0),q.siginfo.algorithmOid=k4.asn1.derToOid(Y.csrSignatureOid),q.siginfo.parameters=V91(q.siginfo.algorithmOid,Y.csrSignatureParams,!1),q.signature=Y.csrSignature,q.certificationRequestInfo=Y.certificationRequestInfo,Q){q.md=K91({signatureOid:q.signatureOid,type:"certification request"});var V=w1.toDer(q.certificationRequestInfo);q.md.update(V.getBytes())}var K=k4.md.sha1.create();return q.subject.getField=function(W){return $N(q.subject,W)},q.subject.addField=function(W){kG([W]),q.subject.attributes.push(W)},q.subject.attributes=R6.RDNAttributesAsArray(Y.certificationRequestInfoSubject,K),q.subject.hash=K.digest().toHex(),q.publicKey=R6.publicKeyFromAsn1(Y.subjectPublicKeyInfo),q.getAttribute=function(W){return $N(q,W)},q.addAttribute=function(W){kG([W]),q.attributes.push(W)},q.attributes=R6.CRIAttributesAsArray(Y.certificationRequestInfoAttributes||[]),q};R6.createCertificationRequest=function(){var J={};return J.version=0,J.signatureOid=null,J.signature=null,J.siginfo={},J.siginfo.algorithmOid=null,J.subject={},J.subject.getField=function(Q){return $N(J.subject,Q)},J.subject.addField=function(Q){kG([Q]),J.subject.attributes.push(Q)},J.subject.attributes=[],J.subject.hash=null,J.publicKey=null,J.attributes=[],J.getAttribute=function(Q){return $N(J,Q)},J.addAttribute=function(Q){kG([Q]),J.attributes.push(Q)},J.md=null,J.setSubject=function(Q){kG(Q),J.subject.attributes=Q,J.subject.hash=null},J.setAttributes=function(Q){kG(Q),J.attributes=Q},J.sign=function(Q,Y){J.md=Y||k4.md.sha1.create();var X=u9[J.md.algorithm+"WithRSAEncryption"];if(!X){var G=Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw G.algorithm=J.md.algorithm,G}J.signatureOid=J.siginfo.algorithmOid=X,J.certificationRequestInfo=R6.getCertificationRequestInfo(J);var Z=w1.toDer(J.certificationRequestInfo);J.md.update(Z.getBytes()),J.signature=Q.sign(J.md)},J.verify=function(){var Q=!1,Y=J.md;if(Y===null){Y=K91({signatureOid:J.signatureOid,type:"certification request"});var X=J.certificationRequestInfo||R6.getCertificationRequestInfo(J),G=w1.toDer(X);Y.update(G.getBytes())}if(Y!==null)Q=b$6({certificate:J,md:Y,signature:J.signature});return Q},J};function LC(J){var Q=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]),Y,X,G=J.attributes;for(var Z=0;Z<G.length;++Z){Y=G[Z];var q=Y.value,V=w1.Type.PRINTABLESTRING;if("valueTagClass"in Y){if(V=Y.valueTagClass,V===w1.Type.UTF8)q=k4.util.encodeUtf8(q)}X=w1.create(w1.Class.UNIVERSAL,w1.Type.SET,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Y.type).getBytes()),w1.create(w1.Class.UNIVERSAL,V,!1,q)])]),Q.value.push(X)}return Q}function kG(J){var Q;for(var Y=0;Y<J.length;++Y){if(Q=J[Y],typeof Q.name>"u"){if(Q.type&&Q.type in R6.oids)Q.name=R6.oids[Q.type];else if(Q.shortName&&Q.shortName in i2)Q.name=R6.oids[i2[Q.shortName]]}if(typeof Q.type>"u")if(Q.name&&Q.name in R6.oids)Q.type=R6.oids[Q.name];else{var X=Error("Attribute type not specified.");throw X.attribute=Q,X}if(typeof Q.shortName>"u"){if(Q.name&&Q.name in i2)Q.shortName=i2[Q.name]}if(Q.type===u9.extensionRequest){if(Q.valueConstructed=!0,Q.valueTagClass=w1.Type.SEQUENCE,!Q.value&&Q.extensions){Q.value=[];for(var G=0;G<Q.extensions.length;++G)Q.value.push(R6.certificateExtensionToAsn1(u$6(Q.extensions[G])))}}if(typeof Q.value>"u"){var X=Error("Attribute value not specified.");throw X.attribute=Q,X}}}function u$6(J,Q){if(Q=Q||{},typeof J.name>"u"){if(J.id&&J.id in R6.oids)J.name=R6.oids[J.id]}if(typeof J.id>"u")if(J.name&&J.name in R6.oids)J.id=R6.oids[J.name];else{var Y=Error("Extension ID not specified.");throw Y.extension=J,Y}if(typeof J.value<"u")return J;if(J.name==="keyUsage"){var X=0,G=0,Z=0;if(J.digitalSignature)G|=128,X=7;if(J.nonRepudiation)G|=64,X=6;if(J.keyEncipherment)G|=32,X=5;if(J.dataEncipherment)G|=16,X=4;if(J.keyAgreement)G|=8,X=3;if(J.keyCertSign)G|=4,X=2;if(J.cRLSign)G|=2,X=1;if(J.encipherOnly)G|=1,X=0;if(J.decipherOnly)Z|=128,X=7;var q=String.fromCharCode(X);if(Z!==0)q+=String.fromCharCode(G)+String.fromCharCode(Z);else if(G!==0)q+=String.fromCharCode(G);J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,q)}else if(J.name==="basicConstraints"){if(J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]),J.cA)J.value.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.BOOLEAN,!1,String.fromCharCode(255)));if("pathLenConstraint"in J)J.value.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(J.pathLenConstraint).getBytes()))}else if(J.name==="extKeyUsage"){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var V=J.value.value;for(var K in J){if(J[K]!==!0)continue;if(K in u9)V.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(u9[K]).getBytes()));else if(K.indexOf(".")!==-1)V.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(K).getBytes()))}}else if(J.name==="nsCertType"){var X=0,G=0;if(J.client)G|=128,X=7;if(J.server)G|=64,X=6;if(J.email)G|=32,X=5;if(J.objsign)G|=16,X=4;if(J.reserved)G|=8,X=3;if(J.sslCA)G|=4,X=2;if(J.emailCA)G|=2,X=1;if(J.objCA)G|=1,X=0;var q=String.fromCharCode(X);if(G!==0)q+=String.fromCharCode(G);J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,q)}else if(J.name==="subjectAltName"||J.name==="issuerAltName"){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var W;for(var H=0;H<J.altNames.length;++H){W=J.altNames[H];var q=W.value;if(W.type===7&&W.ip){if(q=k4.util.bytesFromIP(W.ip),q===null){var Y=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw Y.extension=J,Y}}else if(W.type===8)if(W.oid)q=w1.oidToDer(w1.oidToDer(W.oid));else q=w1.oidToDer(q);J.value.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,W.type,!1,q))}}else if(J.name==="nsComment"&&Q.cert){if(!/^[\x00-\x7F]*$/.test(J.comment)||J.comment.length<1||J.comment.length>128)throw Error('Invalid "nsComment" content.');J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.IA5STRING,!1,J.comment)}else if(J.name==="subjectKeyIdentifier"&&Q.cert){var z=Q.cert.generateSubjectKeyIdentifier();J.subjectKeyIdentifier=z.toHex(),J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.OCTETSTRING,!1,z.getBytes())}else if(J.name==="authorityKeyIdentifier"&&Q.cert){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var V=J.value.value;if(J.keyIdentifier){var U=J.keyIdentifier===!0?Q.cert.generateSubjectKeyIdentifier().getBytes():J.keyIdentifier;V.push(w1.create(w1.Class.CONTEXT_SPECIFIC,0,!1,U))}if(J.authorityCertIssuer){var N=[w1.create(w1.Class.CONTEXT_SPECIFIC,4,!0,[LC(J.authorityCertIssuer===!0?Q.cert.issuer:J.authorityCertIssuer)])];V.push(w1.create(w1.Class.CONTEXT_SPECIFIC,1,!0,N))}if(J.serialNumber){var O=k4.util.hexToBytes(J.serialNumber===!0?Q.cert.serialNumber:J.serialNumber);V.push(w1.create(w1.Class.CONTEXT_SPECIFIC,2,!1,O))}}else if(J.name==="cRLDistributionPoints"){J.value=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);var V=J.value.value,M=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]),L=w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[]),W;for(var H=0;H<J.altNames.length;++H){W=J.altNames[H];var q=W.value;if(W.type===7&&W.ip){if(q=k4.util.bytesFromIP(W.ip),q===null){var Y=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw Y.extension=J,Y}}else if(W.type===8)if(W.oid)q=w1.oidToDer(w1.oidToDer(W.oid));else q=w1.oidToDer(q);L.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,W.type,!1,q))}M.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[L])),V.push(M)}if(typeof J.value>"u"){var Y=Error("Extension value not specified.");throw Y.extension=J,Y}return J}function zk1(J,Q){switch(J){case u9["RSASSA-PSS"]:var Y=[];if(Q.hash.algorithmOid!==void 0)Y.push(w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Q.hash.algorithmOid).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.NULL,!1,"")])]));if(Q.mgf.algorithmOid!==void 0)Y.push(w1.create(w1.Class.CONTEXT_SPECIFIC,1,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Q.mgf.algorithmOid).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(Q.mgf.hash.algorithmOid).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.NULL,!1,"")])])]));if(Q.saltLength!==void 0)Y.push(w1.create(w1.Class.CONTEXT_SPECIFIC,2,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(Q.saltLength).getBytes())]));return w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,Y);default:return w1.create(w1.Class.UNIVERSAL,w1.Type.NULL,!1,"")}}function nN8(J){var Q=w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[]);if(J.attributes.length===0)return Q;var Y=J.attributes;for(var X=0;X<Y.length;++X){var G=Y[X],Z=G.value,q=w1.Type.UTF8;if("valueTagClass"in G)q=G.valueTagClass;if(q===w1.Type.UTF8)Z=k4.util.encodeUtf8(Z);var V=!1;if("valueConstructed"in G)V=G.valueConstructed;var K=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(G.type).getBytes()),w1.create(w1.Class.UNIVERSAL,w1.Type.SET,!0,[w1.create(w1.Class.UNIVERSAL,q,V,Z)])]);Q.value.push(K)}return Q}var aN8=new Date("1950-01-01T00:00:00Z"),rN8=new Date("2050-01-01T00:00:00Z");function f$6(J){if(J>=aN8&&J<rN8)return w1.create(w1.Class.UNIVERSAL,w1.Type.UTCTIME,!1,w1.dateToUtcTime(J));else return w1.create(w1.Class.UNIVERSAL,w1.Type.GENERALIZEDTIME,!1,w1.dateToGeneralizedTime(J))}R6.getTBSCertificate=function(J){var Q=f$6(J.validity.notBefore),Y=f$6(J.validity.notAfter),X=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.CONTEXT_SPECIFIC,0,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(J.version).getBytes())]),w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,k4.util.hexToBytes(J.serialNumber)),w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.siginfo.algorithmOid).getBytes()),zk1(J.siginfo.algorithmOid,J.siginfo.parameters)]),LC(J.issuer),w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[Q,Y]),LC(J.subject),R6.publicKeyToAsn1(J.publicKey)]);if(J.issuer.uniqueId)X.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,1,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.issuer.uniqueId)]));if(J.subject.uniqueId)X.value.push(w1.create(w1.Class.CONTEXT_SPECIFIC,2,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.subject.uniqueId)]));if(J.extensions.length>0)X.value.push(R6.certificateExtensionsToAsn1(J.extensions));return X};R6.getCertificationRequestInfo=function(J){var Q=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.INTEGER,!1,w1.integerToDer(J.version).getBytes()),LC(J.subject),R6.publicKeyToAsn1(J.publicKey),nN8(J)]);return Q};R6.distinguishedNameToAsn1=function(J){return LC(J)};R6.certificateToAsn1=function(J){var Q=J.tbsCertificate||R6.getTBSCertificate(J);return w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[Q,w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.signatureOid).getBytes()),zk1(J.signatureOid,J.signatureParameters)]),w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.signature)])};R6.certificateExtensionsToAsn1=function(J){var Q=w1.create(w1.Class.CONTEXT_SPECIFIC,3,!0,[]),Y=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);Q.value.push(Y);for(var X=0;X<J.length;++X)Y.value.push(R6.certificateExtensionToAsn1(J[X]));return Q};R6.certificateExtensionToAsn1=function(J){var Q=w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[]);if(Q.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.id).getBytes())),J.critical)Q.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.BOOLEAN,!1,String.fromCharCode(255)));var Y=J.value;if(typeof J.value!=="string")Y=w1.toDer(Y).getBytes();return Q.value.push(w1.create(w1.Class.UNIVERSAL,w1.Type.OCTETSTRING,!1,Y)),Q};R6.certificationRequestToAsn1=function(J){var Q=J.certificationRequestInfo||R6.getCertificationRequestInfo(J);return w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[Q,w1.create(w1.Class.UNIVERSAL,w1.Type.SEQUENCE,!0,[w1.create(w1.Class.UNIVERSAL,w1.Type.OID,!1,w1.oidToDer(J.signatureOid).getBytes()),zk1(J.signatureOid,J.signatureParameters)]),w1.create(w1.Class.UNIVERSAL,w1.Type.BITSTRING,!1,String.fromCharCode(0)+J.signature)])};R6.createCaStore=function(J){var Q={certs:{}};Q.getIssuer=function(q){var V=Y(q.issuer);return V},Q.addCertificate=function(q){if(typeof q==="string")q=k4.pki.certificateFromPem(q);if(X(q.subject),!Q.hasCertificate(q))if(q.subject.hash in Q.certs){var V=Q.certs[q.subject.hash];if(!k4.util.isArray(V))V=[V];V.push(q),Q.certs[q.subject.hash]=V}else Q.certs[q.subject.hash]=q},Q.hasCertificate=function(q){if(typeof q==="string")q=k4.pki.certificateFromPem(q);var V=Y(q.subject);if(!V)return!1;if(!k4.util.isArray(V))V=[V];var K=w1.toDer(R6.certificateToAsn1(q)).getBytes();for(var W=0;W<V.length;++W){var H=w1.toDer(R6.certificateToAsn1(V[W])).getBytes();if(K===H)return!0}return!1},Q.listAllCertificates=function(){var q=[];for(var V in Q.certs)if(Q.certs.hasOwnProperty(V)){var K=Q.certs[V];if(!k4.util.isArray(K))q.push(K);else for(var W=0;W<K.length;++W)q.push(K[W])}return q},Q.removeCertificate=function(q){var V;if(typeof q==="string")q=k4.pki.certificateFromPem(q);if(X(q.subject),!Q.hasCertificate(q))return null;var K=Y(q.subject);if(!k4.util.isArray(K))return V=Q.certs[q.subject.hash],delete Q.certs[q.subject.hash],V;var W=w1.toDer(R6.certificateToAsn1(q)).getBytes();for(var H=0;H<K.length;++H){var z=w1.toDer(R6.certificateToAsn1(K[H])).getBytes();if(W===z)V=K[H],K.splice(H,1)}if(K.length===0)delete Q.certs[q.subject.hash];return V};function Y(q){return X(q),Q.certs[q.hash]||null}function X(q){if(!q.hash){var V=k4.md.sha1.create();q.attributes=R6.RDNAttributesAsArray(LC(q),V),q.hash=V.digest().toHex()}}if(J)for(var G=0;G<J.length;++G){var Z=J[G];Q.addCertificate(Z)}return Q};R6.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"};R6.verifyCertificateChain=function(J,Q,Y){if(typeof Y==="function")Y={verify:Y};Y=Y||{},Q=Q.slice(0);var X=Q.slice(0),G=Y.validityCheckDate;if(typeof G>"u")G=new Date;var Z=!0,q=null,V=0;do{var K=Q.shift(),W=null,H=!1;if(G){if(G<K.validity.notBefore||G>K.validity.notAfter)q={message:"Certificate is not valid yet or has expired.",error:R6.certificateError.certificate_expired,notBefore:K.validity.notBefore,notAfter:K.validity.notAfter,now:G}}if(q===null){if(W=Q[0]||J.getIssuer(K),W===null){if(K.isIssuer(K))H=!0,W=K}if(W){var z=W;if(!k4.util.isArray(z))z=[z];var U=!1;while(!U&&z.length>0){W=z.shift();try{U=W.verify(K)}catch(j){}}if(!U)q={message:"Certificate signature is invalid.",error:R6.certificateError.bad_certificate}}if(q===null&&(!W||H)&&!J.hasCertificate(K))q={message:"Certificate is not trusted.",error:R6.certificateError.unknown_ca}}if(q===null&&W&&!K.isIssuer(W))q={message:"Certificate issuer is invalid.",error:R6.certificateError.bad_certificate};if(q===null){var N={keyUsage:!0,basicConstraints:!0};for(var O=0;q===null&&O<K.extensions.length;++O){var M=K.extensions[O];if(M.critical&&!(M.name in N))q={message:"Certificate has an unsupported critical extension.",error:R6.certificateError.unsupported_certificate}}}if(q===null&&(!Z||Q.length===0&&(!W||H))){var L=K.getExtension("basicConstraints"),w=K.getExtension("keyUsage");if(w!==null){if(!w.keyCertSign||L===null)q={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:R6.certificateError.bad_certificate}}if(q===null&&L!==null&&!L.cA)q={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:R6.certificateError.bad_certificate};if(q===null&&w!==null&&"pathLenConstraint"in L){var I=V-1;if(I>L.pathLenConstraint)q={message:"Certificate basicConstraints pathLenConstraint violated.",error:R6.certificateError.bad_certificate}}}var P=q===null?!0:q.error,R=Y.verify?Y.verify(P,V,X):P;if(R===!0)q=null;else{if(P===!0)q={message:"The application rejected the certificate.",error:R6.certificateError.bad_certificate};if(R||R===0){if(typeof R==="object"&&!k4.util.isArray(R)){if(R.message)q.message=R.message;if(R.error)q.error=R.error}else if(typeof R==="string")q.error=R}throw q}Z=!1,++V}while(Q.length>0);return!0}});var Uk1=h((jZ5,p$6)=>{var J2=m8();Mq();FC();JN();Wk1();Kk1();SG();zg();DC();i9();W91();var{asn1:o1,pki:M9}=J2,Ug=p$6.exports=J2.pkcs12=J2.pkcs12||{},m$6={name:"ContentInfo",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:o1.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},oN8={name:"PFX",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:o1.Class.UNIVERSAL,type:o1.Type.INTEGER,constructed:!1,capture:"version"},m$6,{name:"PFX.macData",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:o1.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:o1.Class.UNIVERSAL,type:o1.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},sN8={name:"SafeBag",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:o1.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},tN8={name:"Attribute",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SET,constructed:!0,capture:"values"}]},eN8={name:"CertBag",tagClass:o1.Class.UNIVERSAL,type:o1.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:o1.Class.UNIVERSAL,type:o1.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:o1.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:o1.Class.UNIVERSAL,type:o1.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Fg(J,Q,Y,X){var G=[];for(var Z=0;Z<J.length;Z++)for(var q=0;q<J[Z].safeBags.length;q++){var V=J[Z].safeBags[q];if(X!==void 0&&V.type!==X)continue;if(Q===null){G.push(V);continue}if(V.attributes[Q]!==void 0&&V.attributes[Q].indexOf(Y)>=0)G.push(V)}return G}Ug.pkcs12FromAsn1=function(J,Q,Y){if(typeof Q==="string")Y=Q,Q=!0;else if(Q===void 0)Q=!0;var X={},G=[];if(!o1.validate(J,oN8,X,G)){var Z=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw Z.errors=Z,Z}var q={version:X.version.charCodeAt(0),safeContents:[],getBags:function(L){var w={},I;if("localKeyId"in L)I=L.localKeyId;else if("localKeyIdHex"in L)I=J2.util.hexToBytes(L.localKeyIdHex);if(I===void 0&&!("friendlyName"in L)&&"bagType"in L)w[L.bagType]=Fg(q.safeContents,null,null,L.bagType);if(I!==void 0)w.localKeyId=Fg(q.safeContents,"localKeyId",I,L.bagType);if("friendlyName"in L)w.friendlyName=Fg(q.safeContents,"friendlyName",L.friendlyName,L.bagType);return w},getBagsByFriendlyName:function(L,w){return Fg(q.safeContents,"friendlyName",L,w)},getBagsByLocalKeyId:function(L,w){return Fg(q.safeContents,"localKeyId",L,w)}};if(X.version.charCodeAt(0)!==3){var Z=Error("PKCS#12 PFX of version other than 3 not supported.");throw Z.version=X.version.charCodeAt(0),Z}if(o1.derToOid(X.contentType)!==M9.oids.data){var Z=Error("Only PKCS#12 PFX in password integrity mode supported.");throw Z.oid=o1.derToOid(X.contentType),Z}var V=X.content.value[0];if(V.tagClass!==o1.Class.UNIVERSAL||V.type!==o1.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(V=Fk1(V),X.mac){var K=null,W=0,H=o1.derToOid(X.macAlgorithm);switch(H){case M9.oids.sha1:K=J2.md.sha1.create(),W=20;break;case M9.oids.sha256:K=J2.md.sha256.create(),W=32;break;case M9.oids.sha384:K=J2.md.sha384.create(),W=48;break;case M9.oids.sha512:K=J2.md.sha512.create(),W=64;break;case M9.oids.md5:K=J2.md.md5.create(),W=16;break}if(K===null)throw Error("PKCS#12 uses unsupported MAC algorithm: "+H);var z=new J2.util.ByteBuffer(X.macSalt),U="macIterations"in X?parseInt(J2.util.bytesToHex(X.macIterations),16):1,N=Ug.generateKey(Y,z,3,U,W,K),O=J2.hmac.create();O.start(K,N),O.update(V.value);var M=O.getMac();if(M.getBytes()!==X.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?")}return JD8(q,V.value,Q,Y),q};function Fk1(J){if(J.composed||J.constructed){var Q=J2.util.createBuffer();for(var Y=0;Y<J.value.length;++Y)Q.putBytes(J.value[Y].value);J.composed=J.constructed=!1,J.value=Q.getBytes()}return J}function JD8(J,Q,Y,X){if(Q=o1.fromDer(Q,Y),Q.tagClass!==o1.Class.UNIVERSAL||Q.type!==o1.Type.SEQUENCE||Q.constructed!==!0)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var G=0;G<Q.value.length;G++){var Z=Q.value[G],q={},V=[];if(!o1.validate(Z,m$6,q,V)){var K=Error("Cannot read ContentInfo.");throw K.errors=V,K}var W={encrypted:!1},H=null,z=q.content.value[0];switch(o1.derToOid(q.contentType)){case M9.oids.data:if(z.tagClass!==o1.Class.UNIVERSAL||z.type!==o1.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");H=Fk1(z).value;break;case M9.oids.encryptedData:H=QD8(z,X),W.encrypted=!0;break;default:var K=Error("Unsupported PKCS#12 contentType.");throw K.contentType=o1.derToOid(q.contentType),K}W.safeBags=YD8(H,Y,X),J.safeContents.push(W)}}function QD8(J,Q){var Y={},X=[];if(!o1.validate(J,J2.pkcs7.asn1.encryptedDataValidator,Y,X)){var G=Error("Cannot read EncryptedContentInfo.");throw G.errors=X,G}var Z=o1.derToOid(Y.contentType);if(Z!==M9.oids.data){var G=Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw G.oid=Z,G}Z=o1.derToOid(Y.encAlgorithm);var q=M9.pbe.getCipher(Z,Y.encParameter,Q),V=Fk1(Y.encryptedContentAsn1),K=J2.util.createBuffer(V.value);if(q.update(K),!q.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");return q.output.getBytes()}function YD8(J,Q,Y){if(!Q&&J.length===0)return[];if(J=o1.fromDer(J,Q),J.tagClass!==o1.Class.UNIVERSAL||J.type!==o1.Type.SEQUENCE||J.constructed!==!0)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");var X=[];for(var G=0;G<J.value.length;G++){var Z=J.value[G],q={},V=[];if(!o1.validate(Z,sN8,q,V)){var K=Error("Cannot read SafeBag.");throw K.errors=V,K}var W={type:o1.derToOid(q.bagId),attributes:$D8(q.bagAttributes)};X.push(W);var H,z,U=q.bagValue.value[0];switch(W.type){case M9.oids.pkcs8ShroudedKeyBag:if(U=M9.decryptPrivateKeyInfo(U,Y),U===null)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case M9.oids.keyBag:try{W.key=M9.privateKeyFromAsn1(U)}catch(O){W.key=null,W.asn1=U}continue;case M9.oids.certBag:H=eN8,z=function(){if(o1.derToOid(q.certId)!==M9.oids.x509Certificate){var O=Error("Unsupported certificate type, only X.509 supported.");throw O.oid=o1.derToOid(q.certId),O}var M=o1.fromDer(q.cert,Q);try{W.cert=M9.certificateFromAsn1(M,!0)}catch(L){W.cert=null,W.asn1=M}};break;default:var K=Error("Unsupported PKCS#12 SafeBag type.");throw K.oid=W.type,K}if(H!==void 0&&!o1.validate(U,H,q,V)){var K=Error("Cannot read PKCS#12 "+H.name);throw K.errors=V,K}z()}return X}function $D8(J){var Q={};if(J!==void 0)for(var Y=0;Y<J.length;++Y){var X={},G=[];if(!o1.validate(J[Y],tN8,X,G)){var Z=Error("Cannot read PKCS#12 BagAttribute.");throw Z.errors=G,Z}var q=o1.derToOid(X.oid);if(M9.oids[q]===void 0)continue;Q[M9.oids[q]]=[];for(var V=0;V<X.values.length;++V)Q[M9.oids[q]].push(X.values[V].value)}return Q}Ug.toPkcs12Asn1=function(J,Q,Y,X){if(X=X||{},X.saltSize=X.saltSize||8,X.count=X.count||2048,X.algorithm=X.algorithm||X.encAlgorithm||"aes128",!("useMac"in X))X.useMac=!0;if(!("localKeyId"in X))X.localKeyId=null;if(!("generateLocalKeyId"in X))X.generateLocalKeyId=!0;var G=X.localKeyId,Z;if(G!==null)G=J2.util.hexToBytes(G);else if(X.generateLocalKeyId)if(Q){var q=J2.util.isArray(Q)?Q[0]:Q;if(typeof q==="string")q=M9.certificateFromPem(q);var V=J2.md.sha1.create();V.update(o1.toDer(M9.certificateToAsn1(q)).getBytes()),G=V.digest().getBytes()}else G=J2.random.getBytes(20);var K=[];if(G!==null)K.push(o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.localKeyId).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.SET,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,G)])]));if("friendlyName"in X)K.push(o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.friendlyName).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.SET,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.BMPSTRING,!1,X.friendlyName)])]));if(K.length>0)Z=o1.create(o1.Class.UNIVERSAL,o1.Type.SET,!0,K);var W=[],H=[];if(Q!==null)if(J2.util.isArray(Q))H=Q;else H=[Q];var z=[];for(var U=0;U<H.length;++U){if(Q=H[U],typeof Q==="string")Q=M9.certificateFromPem(Q);var N=U===0?Z:void 0,O=M9.certificateToAsn1(Q),M=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.certBag).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.x509Certificate).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(O).getBytes())])])]),N]);z.push(M)}if(z.length>0){var L=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,z),w=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.data).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(L).getBytes())])]);W.push(w)}var I=null;if(J!==null){var P=M9.wrapRsaPrivateKey(M9.privateKeyToAsn1(J));if(Y===null)I=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.keyBag).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[P]),Z]);else I=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.pkcs8ShroudedKeyBag).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[M9.encryptPrivateKeyInfo(P,Y,X)]),Z]);var R=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[I]),j=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.data).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(R).getBytes())])]);W.push(j)}var y=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,W),f;if(X.useMac){var V=J2.md.sha1.create(),g=new J2.util.ByteBuffer(J2.random.getBytes(X.saltSize)),p=X.count,J=Ug.generateKey(Y,g,3,p,20),b=J2.hmac.create();b.start(V,J),b.update(o1.toDer(y).getBytes());var i=b.getMac();f=o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.sha1).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.NULL,!1,"")]),o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,i.getBytes())]),o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,g.getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.INTEGER,!1,o1.integerToDer(p).getBytes())])}return o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.INTEGER,!1,o1.integerToDer(3).getBytes()),o1.create(o1.Class.UNIVERSAL,o1.Type.SEQUENCE,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OID,!1,o1.oidToDer(M9.oids.data).getBytes()),o1.create(o1.Class.CONTEXT_SPECIFIC,0,!0,[o1.create(o1.Class.UNIVERSAL,o1.Type.OCTETSTRING,!1,o1.toDer(y).getBytes())])]),f])};Ug.generateKey=J2.pbe.generatePkcs12Key});var Nk1=h((_Z5,d$6)=>{var XN=m8();Mq();JN();Kk1();VA();J91();Uk1();q91();zg();i9();W91();var Bk1=XN.asn1,AC=d$6.exports=XN.pki=XN.pki||{};AC.pemToDer=function(J){var Q=XN.pem.decode(J)[0];if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert PEM to DER; PEM is encrypted.");return XN.util.createBuffer(Q.body)};AC.privateKeyFromPem=function(J){var Q=XN.pem.decode(J)[0];if(Q.type!=="PRIVATE KEY"&&Q.type!=="RSA PRIVATE KEY"){var Y=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert private key from PEM; PEM is encrypted.");var X=Bk1.fromDer(Q.body);return AC.privateKeyFromAsn1(X)};AC.privateKeyToPem=function(J,Q){var Y={type:"RSA PRIVATE KEY",body:Bk1.toDer(AC.privateKeyToAsn1(J)).getBytes()};return XN.pem.encode(Y,{maxline:Q})};AC.privateKeyInfoToPem=function(J,Q){var Y={type:"PRIVATE KEY",body:Bk1.toDer(J).getBytes()};return XN.pem.encode(Y,{maxline:Q})}});var Ek1=h((kZ5,s$6)=>{var X6=m8();Mq();FC();o81();VA();Nk1();SG();DC();i9();var F91=function(J,Q,Y,X){var G=X6.util.createBuffer(),Z=J.length>>1,q=Z+(J.length&1),V=J.substr(0,q),K=J.substr(Z,q),W=X6.util.createBuffer(),H=X6.hmac.create();Y=Q+Y;var z=Math.ceil(X/16),U=Math.ceil(X/20);H.start("MD5",V);var N=X6.util.createBuffer();W.putBytes(Y);for(var O=0;O<z;++O)H.start(null,null),H.update(W.getBytes()),W.putBuffer(H.digest()),H.start(null,null),H.update(W.bytes()+Y),N.putBuffer(H.digest());H.start("SHA1",K);var M=X6.util.createBuffer();W.clear(),W.putBytes(Y);for(var O=0;O<U;++O)H.start(null,null),H.update(W.getBytes()),W.putBuffer(H.digest()),H.start(null,null),H.update(W.bytes()+Y),M.putBuffer(H.digest());return G.putBytes(X6.util.xorBytes(N.getBytes(),M.getBytes(),X)),G},XD8=function(J,Q,Y){var X=X6.hmac.create();X.start("SHA1",J);var G=X6.util.createBuffer();return G.putInt32(Q[0]),G.putInt32(Q[1]),G.putByte(Y.type),G.putByte(Y.version.major),G.putByte(Y.version.minor),G.putInt16(Y.length),G.putBytes(Y.fragment.bytes()),X.update(G.getBytes()),X.digest().getBytes()},GD8=function(J,Q,Y){var X=!1;try{var G=J.deflate(Q.fragment.getBytes());Q.fragment=X6.util.createBuffer(G),Q.length=G.length,X=!0}catch(Z){}return X},ZD8=function(J,Q,Y){var X=!1;try{var G=J.inflate(Q.fragment.getBytes());Q.fragment=X6.util.createBuffer(G),Q.length=G.length,X=!0}catch(Z){}return X},t$=function(J,Q){var Y=0;switch(Q){case 1:Y=J.getByte();break;case 2:Y=J.getInt16();break;case 3:Y=J.getInt24();break;case 4:Y=J.getInt32();break}return X6.util.createBuffer(J.getBytes(Y))},yG=function(J,Q,Y){J.putInt(Y.length(),Q<<3),J.putBuffer(Y)},C1={};C1.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};C1.SupportedVersions=[C1.Versions.TLS_1_1,C1.Versions.TLS_1_0];C1.Version=C1.SupportedVersions[0];C1.MaxFragment=15360;C1.ConnectionEnd={server:0,client:1};C1.PRFAlgorithm={tls_prf_sha256:0};C1.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};C1.CipherType={stream:0,block:1,aead:2};C1.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};C1.CompressionMethod={none:0,deflate:1};C1.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};C1.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};C1.Alert={};C1.Alert.Level={warning:1,fatal:2};C1.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};C1.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};C1.CipherSuites={};C1.getCipherSuite=function(J){var Q=null;for(var Y in C1.CipherSuites){var X=C1.CipherSuites[Y];if(X.id[0]===J.charCodeAt(0)&&X.id[1]===J.charCodeAt(1)){Q=X;break}}return Q};C1.handleUnexpected=function(J,Q){var Y=!J.open&&J.entity===C1.ConnectionEnd.client;if(!Y)J.error(J,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unexpected_message}})};C1.handleHelloRequest=function(J,Q,Y){if(!J.handshaking&&J.handshakes>0)C1.queue(J,C1.createAlert(J,{level:C1.Alert.Level.warning,description:C1.Alert.Description.no_renegotiation})),C1.flush(J);J.process()};C1.parseHelloMessage=function(J,Q,Y){var X=null,G=J.entity===C1.ConnectionEnd.client;if(Y<38)J.error(J,{message:G?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});else{var Z=Q.fragment,q=Z.length();if(X={version:{major:Z.getByte(),minor:Z.getByte()},random:X6.util.createBuffer(Z.getBytes(32)),session_id:t$(Z,1),extensions:[]},G)X.cipher_suite=Z.getBytes(2),X.compression_method=Z.getByte();else X.cipher_suites=t$(Z,2),X.compression_methods=t$(Z,1);if(q=Y-(q-Z.length()),q>0){var V=t$(Z,2);while(V.length()>0)X.extensions.push({type:[V.getByte(),V.getByte()],data:t$(V,2)});if(!G)for(var K=0;K<X.extensions.length;++K){var W=X.extensions[K];if(W.type[0]===0&&W.type[1]===0){var H=t$(W.data,2);while(H.length()>0){var z=H.getByte();if(z!==0)break;J.session.extensions.server_name.serverNameList.push(t$(H,2).getBytes())}}}}if(J.session.version){if(X.version.major!==J.session.version.major||X.version.minor!==J.session.version.minor)return J.error(J,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.protocol_version}})}if(G)J.session.cipherSuite=C1.getCipherSuite(X.cipher_suite);else{var U=X6.util.createBuffer(X.cipher_suites.bytes());while(U.length()>0)if(J.session.cipherSuite=C1.getCipherSuite(U.getBytes(2)),J.session.cipherSuite!==null)break}if(J.session.cipherSuite===null)return J.error(J,{message:"No cipher suites in common.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.handshake_failure},cipherSuite:X6.util.bytesToHex(X.cipher_suite)});if(G)J.session.compressionMethod=X.compression_method;else J.session.compressionMethod=C1.CompressionMethod.none}return X};C1.createSecurityParameters=function(J,Q){var Y=J.entity===C1.ConnectionEnd.client,X=Q.random.bytes(),G=Y?J.session.sp.client_random:X,Z=Y?X:C1.createRandom().getBytes();J.session.sp={entity:J.entity,prf_algorithm:C1.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:J.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:G,server_random:Z}};C1.handleServerHello=function(J,Q,Y){var X=C1.parseHelloMessage(J,Q,Y);if(J.fail)return;if(X.version.minor<=J.version.minor)J.version.minor=X.version.minor;else return J.error(J,{message:"Incompatible TLS version.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.protocol_version}});J.session.version=J.version;var G=X.session_id.bytes();if(G.length>0&&G===J.session.id)J.expect=i$6,J.session.resuming=!0,J.session.sp.server_random=X.random.bytes();else J.expect=VD8,J.session.resuming=!1,C1.createSecurityParameters(J,X);J.session.id=G,J.process()};C1.handleClientHello=function(J,Q,Y){var X=C1.parseHelloMessage(J,Q,Y);if(J.fail)return;var G=X.session_id.bytes(),Z=null;if(J.sessionCache){if(Z=J.sessionCache.getSession(G),Z===null)G="";else if(Z.version.major!==X.version.major||Z.version.minor>X.version.minor)Z=null,G=""}if(G.length===0)G=X6.random.getBytes(32);if(J.session.id=G,J.session.clientHelloVersion=X.version,J.session.sp={},Z)J.version=J.session.version=Z.version,J.session.sp=Z.sp;else{var q;for(var V=1;V<C1.SupportedVersions.length;++V)if(q=C1.SupportedVersions[V],q.minor<=X.version.minor)break;J.version={major:q.major,minor:q.minor},J.session.version=J.version}if(Z!==null)J.expect=Lk1,J.session.resuming=!0,J.session.sp.client_random=X.random.bytes();else J.expect=J.verifyClient!==!1?BD8:Mk1,J.session.resuming=!1,C1.createSecurityParameters(J,X);if(J.open=!0,C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createServerHello(J)})),J.session.resuming)C1.queue(J,C1.createRecord(J,{type:C1.ContentType.change_cipher_spec,data:C1.createChangeCipherSpec()})),J.state.pending=C1.createConnectionState(J),J.state.current.write=J.state.pending.write,C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createFinished(J)}));else if(C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createCertificate(J)})),!J.fail){if(C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createServerKeyExchange(J)})),J.verifyClient!==!1)C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createCertificateRequest(J)}));C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createServerHelloDone(J)}))}C1.flush(J),J.process()};C1.handleCertificate=function(J,Q,Y){if(Y<3)return J.error(J,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var X=Q.fragment,G={certificate_list:t$(X,3)},Z,q,V=[];try{while(G.certificate_list.length()>0)Z=t$(G.certificate_list,3),q=X6.asn1.fromDer(Z),Z=X6.pki.certificateFromAsn1(q,!0),V.push(Z)}catch(W){return J.error(J,{message:"Could not parse certificate list.",cause:W,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_certificate}})}var K=J.entity===C1.ConnectionEnd.client;if((K||J.verifyClient===!0)&&V.length===0)J.error(J,{message:K?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});else if(V.length===0)J.expect=K?c$6:Mk1;else{if(K)J.session.serverCertificate=V[0];else J.session.clientCertificate=V[0];if(C1.verifyCertificateChain(J,V))J.expect=K?c$6:Mk1}J.process()};C1.handleServerKeyExchange=function(J,Q,Y){if(Y>0)return J.error(J,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unsupported_certificate}});J.expect=KD8,J.process()};C1.handleClientKeyExchange=function(J,Q,Y){if(Y<48)return J.error(J,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unsupported_certificate}});var X=Q.fragment,G={enc_pre_master_secret:t$(X,2).getBytes()},Z=null;if(J.getPrivateKey)try{Z=J.getPrivateKey(J,J.session.serverCertificate),Z=X6.pki.privateKeyFromPem(Z)}catch(K){J.error(J,{message:"Could not get private key.",cause:K,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}})}if(Z===null)return J.error(J,{message:"No private key set.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});try{var q=J.session.sp;q.pre_master_secret=Z.decrypt(G.enc_pre_master_secret);var V=J.session.clientHelloVersion;if(V.major!==q.pre_master_secret.charCodeAt(0)||V.minor!==q.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.")}catch(K){q.pre_master_secret=X6.random.getBytes(48)}if(J.expect=Lk1,J.session.clientCertificate!==null)J.expect=ND8;J.process()};C1.handleCertificateRequest=function(J,Q,Y){if(Y<3)return J.error(J,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var X=Q.fragment,G={certificate_types:t$(X,1),certificate_authorities:t$(X,2)};J.session.certificateRequest=G,J.expect=WD8,J.process()};C1.handleCertificateVerify=function(J,Q,Y){if(Y<2)return J.error(J,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var X=Q.fragment;X.read-=4;var G=X.bytes();X.read+=4;var Z={signature:t$(X,2).getBytes()},q=X6.util.createBuffer();q.putBuffer(J.session.md5.digest()),q.putBuffer(J.session.sha1.digest()),q=q.getBytes();try{var V=J.session.clientCertificate;if(!V.publicKey.verify(q,Z.signature,"NONE"))throw Error("CertificateVerify signature does not match.");J.session.md5.update(G),J.session.sha1.update(G)}catch(K){return J.error(J,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.handshake_failure}})}J.expect=Lk1,J.process()};C1.handleServerHelloDone=function(J,Q,Y){if(Y>0)return J.error(J,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.record_overflow}});if(J.serverCertificate===null){var X={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.insufficient_security}},G=0,Z=J.verify(J,X.alert.description,G,[]);if(Z!==!0){if(Z||Z===0){if(typeof Z==="object"&&!X6.util.isArray(Z)){if(Z.message)X.message=Z.message;if(Z.alert)X.alert.description=Z.alert}else if(typeof Z==="number")X.alert.description=Z}return J.error(J,X)}}if(J.session.certificateRequest!==null)Q=C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createCertificate(J)}),C1.queue(J,Q);Q=C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createClientKeyExchange(J)}),C1.queue(J,Q),J.expect=FD8;var q=function(V,K){if(V.session.certificateRequest!==null&&V.session.clientCertificate!==null)C1.queue(V,C1.createRecord(V,{type:C1.ContentType.handshake,data:C1.createCertificateVerify(V,K)}));C1.queue(V,C1.createRecord(V,{type:C1.ContentType.change_cipher_spec,data:C1.createChangeCipherSpec()})),V.state.pending=C1.createConnectionState(V),V.state.current.write=V.state.pending.write,C1.queue(V,C1.createRecord(V,{type:C1.ContentType.handshake,data:C1.createFinished(V)})),V.expect=i$6,C1.flush(V),V.process()};if(J.session.certificateRequest===null||J.session.clientCertificate===null)return q(J,null);C1.getClientSignature(J,q)};C1.handleChangeCipherSpec=function(J,Q){if(Q.fragment.getByte()!==1)return J.error(J,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.illegal_parameter}});var Y=J.entity===C1.ConnectionEnd.client;if(J.session.resuming&&Y||!J.session.resuming&&!Y)J.state.pending=C1.createConnectionState(J);if(J.state.current.read=J.state.pending.read,!J.session.resuming&&Y||J.session.resuming&&!Y)J.state.pending=null;J.expect=Y?HD8:DD8,J.process()};C1.handleFinished=function(J,Q,Y){var X=Q.fragment;X.read-=4;var G=X.bytes();X.read+=4;var Z=Q.fragment.getBytes();X=X6.util.createBuffer(),X.putBuffer(J.session.md5.digest()),X.putBuffer(J.session.sha1.digest());var q=J.entity===C1.ConnectionEnd.client,V=q?"server finished":"client finished",K=J.session.sp,W=12,H=F91;if(X=H(K.master_secret,V,X.getBytes(),W),X.getBytes()!==Z)return J.error(J,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.decrypt_error}});if(J.session.md5.update(G),J.session.sha1.update(G),J.session.resuming&&q||!J.session.resuming&&!q)C1.queue(J,C1.createRecord(J,{type:C1.ContentType.change_cipher_spec,data:C1.createChangeCipherSpec()})),J.state.current.write=J.state.pending.write,J.state.pending=null,C1.queue(J,C1.createRecord(J,{type:C1.ContentType.handshake,data:C1.createFinished(J)}));J.expect=q?zD8:OD8,J.handshaking=!1,++J.handshakes,J.peerCertificate=q?J.session.serverCertificate:J.session.clientCertificate,C1.flush(J),J.isConnected=!0,J.connected(J),J.process()};C1.handleAlert=function(J,Q){var Y=Q.fragment,X={level:Y.getByte(),description:Y.getByte()},G;switch(X.description){case C1.Alert.Description.close_notify:G="Connection closed.";break;case C1.Alert.Description.unexpected_message:G="Unexpected message.";break;case C1.Alert.Description.bad_record_mac:G="Bad record MAC.";break;case C1.Alert.Description.decryption_failed:G="Decryption failed.";break;case C1.Alert.Description.record_overflow:G="Record overflow.";break;case C1.Alert.Description.decompression_failure:G="Decompression failed.";break;case C1.Alert.Description.handshake_failure:G="Handshake failure.";break;case C1.Alert.Description.bad_certificate:G="Bad certificate.";break;case C1.Alert.Description.unsupported_certificate:G="Unsupported certificate.";break;case C1.Alert.Description.certificate_revoked:G="Certificate revoked.";break;case C1.Alert.Description.certificate_expired:G="Certificate expired.";break;case C1.Alert.Description.certificate_unknown:G="Certificate unknown.";break;case C1.Alert.Description.illegal_parameter:G="Illegal parameter.";break;case C1.Alert.Description.unknown_ca:G="Unknown certificate authority.";break;case C1.Alert.Description.access_denied:G="Access denied.";break;case C1.Alert.Description.decode_error:G="Decode error.";break;case C1.Alert.Description.decrypt_error:G="Decrypt error.";break;case C1.Alert.Description.export_restriction:G="Export restriction.";break;case C1.Alert.Description.protocol_version:G="Unsupported protocol version.";break;case C1.Alert.Description.insufficient_security:G="Insufficient security.";break;case C1.Alert.Description.internal_error:G="Internal error.";break;case C1.Alert.Description.user_canceled:G="User canceled.";break;case C1.Alert.Description.no_renegotiation:G="Renegotiation not supported.";break;default:G="Unknown error.";break}if(X.description===C1.Alert.Description.close_notify)return J.close();J.error(J,{message:G,send:!1,origin:J.entity===C1.ConnectionEnd.client?"server":"client",alert:X}),J.process()};C1.handleHandshake=function(J,Q){var Y=Q.fragment,X=Y.getByte(),G=Y.getInt24();if(G>Y.length())return J.fragmented=Q,Q.fragment=X6.util.createBuffer(),Y.read-=4,J.process();J.fragmented=null,Y.read-=4;var Z=Y.bytes(G+4);if(Y.read+=4,X in z91[J.entity][J.expect]){if(J.entity===C1.ConnectionEnd.server&&!J.open&&!J.fail)J.handshaking=!0,J.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:X6.md.md5.create(),sha1:X6.md.sha1.create()};if(X!==C1.HandshakeType.hello_request&&X!==C1.HandshakeType.certificate_verify&&X!==C1.HandshakeType.finished)J.session.md5.update(Z),J.session.sha1.update(Z);z91[J.entity][J.expect][X](J,Q,G)}else C1.handleUnexpected(J,Q)};C1.handleApplicationData=function(J,Q){J.data.putBuffer(Q.fragment),J.dataReady(J),J.process()};C1.handleHeartbeat=function(J,Q){var Y=Q.fragment,X=Y.getByte(),G=Y.getInt16(),Z=Y.getBytes(G);if(X===C1.HeartbeatMessageType.heartbeat_request){if(J.handshaking||G>Z.length)return J.process();C1.queue(J,C1.createRecord(J,{type:C1.ContentType.heartbeat,data:C1.createHeartbeat(C1.HeartbeatMessageType.heartbeat_response,Z)})),C1.flush(J)}else if(X===C1.HeartbeatMessageType.heartbeat_response){if(Z!==J.expectedHeartbeatPayload)return J.process();if(J.heartbeatReceived)J.heartbeatReceived(J,X6.util.createBuffer(Z))}J.process()};var qD8=0,VD8=1,c$6=2,KD8=3,WD8=4,i$6=5,HD8=6,zD8=7,FD8=8,UD8=0,BD8=1,Mk1=2,ND8=3,Lk1=4,DD8=5,OD8=6,I1=C1.handleUnexpected,n$6=C1.handleChangeCipherSpec,MJ=C1.handleAlert,mQ=C1.handleHandshake,a$6=C1.handleApplicationData,LJ=C1.handleHeartbeat,Ak1=[];Ak1[C1.ConnectionEnd.client]=[[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[n$6,MJ,I1,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,a$6,LJ],[I1,MJ,mQ,I1,LJ]];Ak1[C1.ConnectionEnd.server]=[[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,I1,LJ],[n$6,MJ,I1,I1,LJ],[I1,MJ,mQ,I1,LJ],[I1,MJ,mQ,a$6,LJ],[I1,MJ,mQ,I1,LJ]];var{handleHelloRequest:GN,handleServerHello:MD8,handleCertificate:r$6,handleServerKeyExchange:l$6,handleCertificateRequest:Dk1,handleServerHelloDone:H91,handleFinished:o$6}=C1,z91=[];z91[C1.ConnectionEnd.client]=[[I1,I1,MD8,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,r$6,l$6,Dk1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,l$6,Dk1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,Dk1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,H91,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,o$6],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[GN,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1]];var{handleClientHello:LD8,handleClientKeyExchange:AD8,handleCertificateVerify:ED8}=C1;z91[C1.ConnectionEnd.server]=[[I1,LD8,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,r$6,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,AD8,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,ED8,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,o$6],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1],[I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1,I1]];C1.generateKeys=function(J,Q){var Y=F91,X=Q.client_random+Q.server_random;if(!J.session.resuming)Q.master_secret=Y(Q.pre_master_secret,"master secret",X,48).bytes(),Q.pre_master_secret=null;X=Q.server_random+Q.client_random;var G=2*Q.mac_key_length+2*Q.enc_key_length,Z=J.version.major===C1.Versions.TLS_1_0.major&&J.version.minor===C1.Versions.TLS_1_0.minor;if(Z)G+=2*Q.fixed_iv_length;var q=Y(Q.master_secret,"key expansion",X,G),V={client_write_MAC_key:q.getBytes(Q.mac_key_length),server_write_MAC_key:q.getBytes(Q.mac_key_length),client_write_key:q.getBytes(Q.enc_key_length),server_write_key:q.getBytes(Q.enc_key_length)};if(Z)V.client_write_IV=q.getBytes(Q.fixed_iv_length),V.server_write_IV=q.getBytes(Q.fixed_iv_length);return V};C1.createConnectionState=function(J){var Q=J.entity===C1.ConnectionEnd.client,Y=function(){var Z={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(q){return!0},compressionState:null,compressFunction:function(q){return!0},updateSequenceNumber:function(){if(Z.sequenceNumber[1]===4294967295)Z.sequenceNumber[1]=0,++Z.sequenceNumber[0];else++Z.sequenceNumber[1]}};return Z},X={read:Y(),write:Y()};if(X.read.update=function(Z,q){if(!X.read.cipherFunction(q,X.read))Z.error(Z,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_record_mac}});else if(!X.read.compressFunction(Z,q,X.read))Z.error(Z,{message:"Could not decompress record.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.decompression_failure}});return!Z.fail},X.write.update=function(Z,q){if(!X.write.compressFunction(Z,q,X.write))Z.error(Z,{message:"Could not compress record.",send:!1,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});else if(!X.write.cipherFunction(q,X.write))Z.error(Z,{message:"Could not encrypt record.",send:!1,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});return!Z.fail},J.session){var G=J.session.sp;switch(J.session.cipherSuite.initSecurityParameters(G),G.keys=C1.generateKeys(J,G),X.read.macKey=Q?G.keys.server_write_MAC_key:G.keys.client_write_MAC_key,X.write.macKey=Q?G.keys.client_write_MAC_key:G.keys.server_write_MAC_key,J.session.cipherSuite.initConnectionState(X,J,G),G.compression_algorithm){case C1.CompressionMethod.none:break;case C1.CompressionMethod.deflate:X.read.compressFunction=ZD8,X.write.compressFunction=GD8;break;default:throw Error("Unsupported compression algorithm.")}}return X};C1.createRandom=function(){var J=new Date,Q=+J+J.getTimezoneOffset()*60000,Y=X6.util.createBuffer();return Y.putInt32(Q),Y.putBytes(X6.random.getBytes(28)),Y};C1.createRecord=function(J,Q){if(!Q.data)return null;var Y={type:Q.type,version:{major:J.version.major,minor:J.version.minor},length:Q.data.length(),fragment:Q.data};return Y};C1.createAlert=function(J,Q){var Y=X6.util.createBuffer();return Y.putByte(Q.level),Y.putByte(Q.description),C1.createRecord(J,{type:C1.ContentType.alert,data:Y})};C1.createClientHello=function(J){J.session.clientHelloVersion={major:J.version.major,minor:J.version.minor};var Q=X6.util.createBuffer();for(var Y=0;Y<J.cipherSuites.length;++Y){var X=J.cipherSuites[Y];Q.putByte(X.id[0]),Q.putByte(X.id[1])}var G=Q.length(),Z=X6.util.createBuffer();Z.putByte(C1.CompressionMethod.none);var q=Z.length(),V=X6.util.createBuffer();if(J.virtualHost){var K=X6.util.createBuffer();K.putByte(0),K.putByte(0);var W=X6.util.createBuffer();W.putByte(0),yG(W,2,X6.util.createBuffer(J.virtualHost));var H=X6.util.createBuffer();yG(H,2,W),yG(K,2,H),V.putBuffer(K)}var z=V.length();if(z>0)z+=2;var U=J.session.id,N=U.length+1+2+4+28+2+G+1+q+z,O=X6.util.createBuffer();if(O.putByte(C1.HandshakeType.client_hello),O.putInt24(N),O.putByte(J.version.major),O.putByte(J.version.minor),O.putBytes(J.session.sp.client_random),yG(O,1,X6.util.createBuffer(U)),yG(O,2,Q),yG(O,1,Z),z>0)yG(O,2,V);return O};C1.createServerHello=function(J){var Q=J.session.id,Y=Q.length+1+2+4+28+2+1,X=X6.util.createBuffer();return X.putByte(C1.HandshakeType.server_hello),X.putInt24(Y),X.putByte(J.version.major),X.putByte(J.version.minor),X.putBytes(J.session.sp.server_random),yG(X,1,X6.util.createBuffer(Q)),X.putByte(J.session.cipherSuite.id[0]),X.putByte(J.session.cipherSuite.id[1]),X.putByte(J.session.compressionMethod),X};C1.createCertificate=function(J){var Q=J.entity===C1.ConnectionEnd.client,Y=null;if(J.getCertificate){var X;if(Q)X=J.session.certificateRequest;else X=J.session.extensions.server_name.serverNameList;Y=J.getCertificate(J,X)}var G=X6.util.createBuffer();if(Y!==null)try{if(!X6.util.isArray(Y))Y=[Y];var Z=null;for(var q=0;q<Y.length;++q){var V=X6.pem.decode(Y[q])[0];if(V.type!=="CERTIFICATE"&&V.type!=="X509 CERTIFICATE"&&V.type!=="TRUSTED CERTIFICATE"){var K=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw K.headerType=V.type,K}if(V.procType&&V.procType.type==="ENCRYPTED")throw Error("Could not convert certificate from PEM; PEM is encrypted.");var W=X6.util.createBuffer(V.body);if(Z===null)Z=X6.asn1.fromDer(W.bytes(),!1);var H=X6.util.createBuffer();yG(H,3,W),G.putBuffer(H)}if(Y=X6.pki.certificateFromAsn1(Z),Q)J.session.clientCertificate=Y;else J.session.serverCertificate=Y}catch(N){return J.error(J,{message:"Could not send certificate list.",cause:N,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_certificate}})}var z=3+G.length(),U=X6.util.createBuffer();return U.putByte(C1.HandshakeType.certificate),U.putInt24(z),yG(U,3,G),U};C1.createClientKeyExchange=function(J){var Q=X6.util.createBuffer();Q.putByte(J.session.clientHelloVersion.major),Q.putByte(J.session.clientHelloVersion.minor),Q.putBytes(X6.random.getBytes(46));var Y=J.session.sp;Y.pre_master_secret=Q.getBytes();var X=J.session.serverCertificate.publicKey;Q=X.encrypt(Y.pre_master_secret);var G=Q.length+2,Z=X6.util.createBuffer();return Z.putByte(C1.HandshakeType.client_key_exchange),Z.putInt24(G),Z.putInt16(Q.length),Z.putBytes(Q),Z};C1.createServerKeyExchange=function(J){var Q=0,Y=X6.util.createBuffer();if(Q>0)Y.putByte(C1.HandshakeType.server_key_exchange),Y.putInt24(Q);return Y};C1.getClientSignature=function(J,Q){var Y=X6.util.createBuffer();Y.putBuffer(J.session.md5.digest()),Y.putBuffer(J.session.sha1.digest()),Y=Y.getBytes(),J.getSignature=J.getSignature||function(X,G,Z){var q=null;if(X.getPrivateKey)try{q=X.getPrivateKey(X,X.session.clientCertificate),q=X6.pki.privateKeyFromPem(q)}catch(V){X.error(X,{message:"Could not get private key.",cause:V,send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}})}if(q===null)X.error(X,{message:"No private key set.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.internal_error}});else G=q.sign(G,null);Z(X,G)},J.getSignature(J,Y,Q)};C1.createCertificateVerify=function(J,Q){var Y=Q.length+2,X=X6.util.createBuffer();return X.putByte(C1.HandshakeType.certificate_verify),X.putInt24(Y),X.putInt16(Q.length),X.putBytes(Q),X};C1.createCertificateRequest=function(J){var Q=X6.util.createBuffer();Q.putByte(1);var Y=X6.util.createBuffer();for(var X in J.caStore.certs){var G=J.caStore.certs[X],Z=X6.pki.distinguishedNameToAsn1(G.subject),q=X6.asn1.toDer(Z);Y.putInt16(q.length()),Y.putBuffer(q)}var V=1+Q.length()+2+Y.length(),K=X6.util.createBuffer();return K.putByte(C1.HandshakeType.certificate_request),K.putInt24(V),yG(K,1,Q),yG(K,2,Y),K};C1.createServerHelloDone=function(J){var Q=X6.util.createBuffer();return Q.putByte(C1.HandshakeType.server_hello_done),Q.putInt24(0),Q};C1.createChangeCipherSpec=function(){var J=X6.util.createBuffer();return J.putByte(1),J};C1.createFinished=function(J){var Q=X6.util.createBuffer();Q.putBuffer(J.session.md5.digest()),Q.putBuffer(J.session.sha1.digest());var Y=J.entity===C1.ConnectionEnd.client,X=J.session.sp,G=12,Z=F91,q=Y?"client finished":"server finished";Q=Z(X.master_secret,q,Q.getBytes(),G);var V=X6.util.createBuffer();return V.putByte(C1.HandshakeType.finished),V.putInt24(Q.length()),V.putBuffer(Q),V};C1.createHeartbeat=function(J,Q,Y){if(typeof Y>"u")Y=Q.length;var X=X6.util.createBuffer();X.putByte(J),X.putInt16(Y),X.putBytes(Q);var G=X.length(),Z=Math.max(16,G-Y-3);return X.putBytes(X6.random.getBytes(Z)),X};C1.queue=function(J,Q){if(!Q)return;if(Q.fragment.length()===0){if(Q.type===C1.ContentType.handshake||Q.type===C1.ContentType.alert||Q.type===C1.ContentType.change_cipher_spec)return}if(Q.type===C1.ContentType.handshake){var Y=Q.fragment.bytes();J.session.md5.update(Y),J.session.sha1.update(Y),Y=null}var X;if(Q.fragment.length()<=C1.MaxFragment)X=[Q];else{X=[];var G=Q.fragment.bytes();while(G.length>C1.MaxFragment)X.push(C1.createRecord(J,{type:Q.type,data:X6.util.createBuffer(G.slice(0,C1.MaxFragment))})),G=G.slice(C1.MaxFragment);if(G.length>0)X.push(C1.createRecord(J,{type:Q.type,data:X6.util.createBuffer(G)}))}for(var Z=0;Z<X.length&&!J.fail;++Z){var q=X[Z],V=J.state.current.write;if(V.update(J,q))J.records.push(q)}};C1.flush=function(J){for(var Q=0;Q<J.records.length;++Q){var Y=J.records[Q];J.tlsData.putByte(Y.type),J.tlsData.putByte(Y.version.major),J.tlsData.putByte(Y.version.minor),J.tlsData.putInt16(Y.fragment.length()),J.tlsData.putBuffer(J.records[Q].fragment)}return J.records=[],J.tlsDataReady(J)};var Ok1=function(J){switch(J){case!0:return!0;case X6.pki.certificateError.bad_certificate:return C1.Alert.Description.bad_certificate;case X6.pki.certificateError.unsupported_certificate:return C1.Alert.Description.unsupported_certificate;case X6.pki.certificateError.certificate_revoked:return C1.Alert.Description.certificate_revoked;case X6.pki.certificateError.certificate_expired:return C1.Alert.Description.certificate_expired;case X6.pki.certificateError.certificate_unknown:return C1.Alert.Description.certificate_unknown;case X6.pki.certificateError.unknown_ca:return C1.Alert.Description.unknown_ca;default:return C1.Alert.Description.bad_certificate}},wD8=function(J){switch(J){case!0:return!0;case C1.Alert.Description.bad_certificate:return X6.pki.certificateError.bad_certificate;case C1.Alert.Description.unsupported_certificate:return X6.pki.certificateError.unsupported_certificate;case C1.Alert.Description.certificate_revoked:return X6.pki.certificateError.certificate_revoked;case C1.Alert.Description.certificate_expired:return X6.pki.certificateError.certificate_expired;case C1.Alert.Description.certificate_unknown:return X6.pki.certificateError.certificate_unknown;case C1.Alert.Description.unknown_ca:return X6.pki.certificateError.unknown_ca;default:return X6.pki.certificateError.bad_certificate}};C1.verifyCertificateChain=function(J,Q){try{var Y={};for(var X in J.verifyOptions)Y[X]=J.verifyOptions[X];Y.verify=function(Z,q,V){var K=Ok1(Z),W=J.verify(J,Z,q,V);if(W!==!0){if(typeof W==="object"&&!X6.util.isArray(W)){var H=Error("The application rejected the certificate.");if(H.send=!0,H.alert={level:C1.Alert.Level.fatal,description:C1.Alert.Description.bad_certificate},W.message)H.message=W.message;if(W.alert)H.alert.description=W.alert;throw H}if(W!==Z)W=wD8(W)}return W},X6.pki.verifyCertificateChain(J.caStore,Q,Y)}catch(Z){var G=Z;if(typeof G!=="object"||X6.util.isArray(G))G={send:!0,alert:{level:C1.Alert.Level.fatal,description:Ok1(Z)}};if(!("send"in G))G.send=!0;if(!("alert"in G))G.alert={level:C1.Alert.Level.fatal,description:Ok1(G.error)};J.error(J,G)}return!J.fail};C1.createSessionCache=function(J,Q){var Y=null;if(J&&J.getSession&&J.setSession&&J.order)Y=J;else{Y={},Y.cache=J||{},Y.capacity=Math.max(Q||100,1),Y.order=[];for(var X in J)if(Y.order.length<=Q)Y.order.push(X);else delete J[X];Y.getSession=function(G){var Z=null,q=null;if(G)q=X6.util.bytesToHex(G);else if(Y.order.length>0)q=Y.order[0];if(q!==null&&q in Y.cache){Z=Y.cache[q],delete Y.cache[q];for(var V in Y.order)if(Y.order[V]===q){Y.order.splice(V,1);break}}return Z},Y.setSession=function(G,Z){if(Y.order.length===Y.capacity){var q=Y.order.shift();delete Y.cache[q]}var q=X6.util.bytesToHex(G);Y.order.push(q),Y.cache[q]=Z}}return Y};C1.createConnection=function(J){var Q=null;if(J.caStore)if(X6.util.isArray(J.caStore))Q=X6.pki.createCaStore(J.caStore);else Q=J.caStore;else Q=X6.pki.createCaStore();var Y=J.cipherSuites||null;if(Y===null){Y=[];for(var X in C1.CipherSuites)Y.push(C1.CipherSuites[X])}var G=J.server?C1.ConnectionEnd.server:C1.ConnectionEnd.client,Z=J.sessionCache?C1.createSessionCache(J.sessionCache):null,q={version:{major:C1.Version.major,minor:C1.Version.minor},entity:G,sessionId:J.sessionId,caStore:Q,sessionCache:Z,cipherSuites:Y,connected:J.connected,virtualHost:J.virtualHost||null,verifyClient:J.verifyClient||!1,verify:J.verify||function(H,z,U,N){return z},verifyOptions:J.verifyOptions||{},getCertificate:J.getCertificate||null,getPrivateKey:J.getPrivateKey||null,getSignature:J.getSignature||null,input:X6.util.createBuffer(),tlsData:X6.util.createBuffer(),data:X6.util.createBuffer(),tlsDataReady:J.tlsDataReady,dataReady:J.dataReady,heartbeatReceived:J.heartbeatReceived,closed:J.closed,error:function(H,z){if(z.origin=z.origin||(H.entity===C1.ConnectionEnd.client?"client":"server"),z.send)C1.queue(H,C1.createAlert(H,z.alert)),C1.flush(H);var U=z.fatal!==!1;if(U)H.fail=!0;if(J.error(H,z),U)H.close(!1)},deflate:J.deflate||null,inflate:J.inflate||null};q.reset=function(H){q.version={major:C1.Version.major,minor:C1.Version.minor},q.record=null,q.session=null,q.peerCertificate=null,q.state={pending:null,current:null},q.expect=q.entity===C1.ConnectionEnd.client?qD8:UD8,q.fragmented=null,q.records=[],q.open=!1,q.handshakes=0,q.handshaking=!1,q.isConnected=!1,q.fail=!(H||typeof H>"u"),q.input.clear(),q.tlsData.clear(),q.data.clear(),q.state.current=C1.createConnectionState(q)},q.reset();var V=function(H,z){var U=z.type-C1.ContentType.change_cipher_spec,N=Ak1[H.entity][H.expect];if(U in N)N[U](H,z);else C1.handleUnexpected(H,z)},K=function(H){var z=0,U=H.input,N=U.length();if(N<5)z=5-N;else{H.record={type:U.getByte(),version:{major:U.getByte(),minor:U.getByte()},length:U.getInt16(),fragment:X6.util.createBuffer(),ready:!1};var O=H.record.version.major===H.version.major;if(O&&H.session&&H.session.version)O=H.record.version.minor===H.version.minor;if(!O)H.error(H,{message:"Incompatible TLS version.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.protocol_version}})}return z},W=function(H){var z=0,U=H.input,N=U.length();if(N<H.record.length)z=H.record.length-N;else{H.record.fragment.putBytes(U.getBytes(H.record.length)),U.compact();var O=H.state.current.read;if(O.update(H,H.record)){if(H.fragmented!==null)if(H.fragmented.type===H.record.type)H.fragmented.fragment.putBuffer(H.record.fragment),H.record=H.fragmented;else H.error(H,{message:"Invalid fragmented record.",send:!0,alert:{level:C1.Alert.Level.fatal,description:C1.Alert.Description.unexpected_message}});H.record.ready=!0}}return z};return q.handshake=function(H){if(q.entity!==C1.ConnectionEnd.client)q.error(q,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(q.handshaking)q.error(q,{message:"Handshake already in progress.",fatal:!1});else{if(q.fail&&!q.open&&q.handshakes===0)q.fail=!1;q.handshaking=!0,H=H||"";var z=null;if(H.length>0){if(q.sessionCache)z=q.sessionCache.getSession(H);if(z===null)H=""}if(H.length===0&&q.sessionCache){if(z=q.sessionCache.getSession(),z!==null)H=z.id}if(q.session={id:H,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:X6.md.md5.create(),sha1:X6.md.sha1.create()},z)q.version=z.version,q.session.sp=z.sp;q.session.sp.client_random=C1.createRandom().getBytes(),q.open=!0,C1.queue(q,C1.createRecord(q,{type:C1.ContentType.handshake,data:C1.createClientHello(q)})),C1.flush(q)}},q.process=function(H){var z=0;if(H)q.input.putBytes(H);if(!q.fail){if(q.record!==null&&q.record.ready&&q.record.fragment.isEmpty())q.record=null;if(q.record===null)z=K(q);if(!q.fail&&q.record!==null&&!q.record.ready)z=W(q);if(!q.fail&&q.record!==null&&q.record.ready)V(q,q.record)}return z},q.prepare=function(H){return C1.queue(q,C1.createRecord(q,{type:C1.ContentType.application_data,data:X6.util.createBuffer(H)})),C1.flush(q)},q.prepareHeartbeatRequest=function(H,z){if(H instanceof X6.util.ByteBuffer)H=H.bytes();if(typeof z>"u")z=H.length;return q.expectedHeartbeatPayload=H,C1.queue(q,C1.createRecord(q,{type:C1.ContentType.heartbeat,data:C1.createHeartbeat(C1.HeartbeatMessageType.heartbeat_request,H,z)})),C1.flush(q)},q.close=function(H){if(!q.fail&&q.sessionCache&&q.session){var z={id:q.session.id,version:q.session.version,sp:q.session.sp};z.sp.keys=null,q.sessionCache.setSession(z.id,z)}if(q.open){if(q.open=!1,q.input.clear(),q.isConnected||q.handshaking)q.isConnected=q.handshaking=!1,C1.queue(q,C1.createAlert(q,{level:C1.Alert.Level.warning,description:C1.Alert.Description.close_notify})),C1.flush(q);q.closed(q)}q.reset(H)},q};s$6.exports=X6.tls=X6.tls||{};for(Bg in C1)if(typeof C1[Bg]!=="function")X6.tls[Bg]=C1[Bg];var Bg;X6.tls.prf_tls1=F91;X6.tls.hmac_sha1=XD8;X6.tls.createSessionCache=C1.createSessionCache;X6.tls.createConnection=C1.createConnection});var JX6=h((yZ5,e$6)=>{var ZN=m8();eB();Ek1();var vG=e$6.exports=ZN.tls;vG.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(J){J.bulk_cipher_algorithm=vG.BulkCipherAlgorithm.aes,J.cipher_type=vG.CipherType.block,J.enc_key_length=16,J.block_length=16,J.fixed_iv_length=16,J.record_iv_length=16,J.mac_algorithm=vG.MACAlgorithm.hmac_sha1,J.mac_length=20,J.mac_key_length=20},initConnectionState:t$6};vG.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(J){J.bulk_cipher_algorithm=vG.BulkCipherAlgorithm.aes,J.cipher_type=vG.CipherType.block,J.enc_key_length=32,J.block_length=16,J.fixed_iv_length=16,J.record_iv_length=16,J.mac_algorithm=vG.MACAlgorithm.hmac_sha1,J.mac_length=20,J.mac_key_length=20},initConnectionState:t$6};function t$6(J,Q,Y){var X=Q.entity===ZN.tls.ConnectionEnd.client;J.read.cipherState={init:!1,cipher:ZN.cipher.createDecipher("AES-CBC",X?Y.keys.server_write_key:Y.keys.client_write_key),iv:X?Y.keys.server_write_IV:Y.keys.client_write_IV},J.write.cipherState={init:!1,cipher:ZN.cipher.createCipher("AES-CBC",X?Y.keys.client_write_key:Y.keys.server_write_key),iv:X?Y.keys.client_write_IV:Y.keys.server_write_IV},J.read.cipherFunction=RD8,J.write.cipherFunction=ID8,J.read.macLength=J.write.macLength=Y.mac_length,J.read.macFunction=J.write.macFunction=vG.hmac_sha1}function ID8(J,Q){var Y=!1,X=Q.macFunction(Q.macKey,Q.sequenceNumber,J);J.fragment.putBytes(X),Q.updateSequenceNumber();var G;if(J.version.minor===vG.Versions.TLS_1_0.minor)G=Q.cipherState.init?null:Q.cipherState.iv;else G=ZN.random.getBytesSync(16);Q.cipherState.init=!0;var Z=Q.cipherState.cipher;if(Z.start({iv:G}),J.version.minor>=vG.Versions.TLS_1_1.minor)Z.output.putBytes(G);if(Z.update(J.fragment),Z.finish(PD8))J.fragment=Z.output,J.length=J.fragment.length(),Y=!0;return Y}function PD8(J,Q,Y){if(!Y){var X=J-Q.length()%J;Q.fillWithByte(X-1,X)}return!0}function TD8(J,Q,Y){var X=!0;if(Y){var G=Q.length(),Z=Q.last();for(var q=G-1-Z;q<G-1;++q)X=X&&Q.at(q)==Z;if(X)Q.truncate(Z+1)}return X}function RD8(J,Q){var Y=!1,X;if(J.version.minor===vG.Versions.TLS_1_0.minor)X=Q.cipherState.init?null:Q.cipherState.iv;else X=J.fragment.getBytes(16);Q.cipherState.init=!0;var G=Q.cipherState.cipher;G.start({iv:X}),G.update(J.fragment),Y=G.finish(TD8);var Z=Q.macLength,q=ZN.random.getBytesSync(Z),V=G.output.length();if(V>=Z)J.fragment=G.output.getBytes(V-Z),q=G.output.getBytes(Z);else J.fragment=G.output.getBytes();J.fragment=ZN.util.createBuffer(J.fragment),J.length=J.fragment.length();var K=Q.macFunction(Q.macKey,Q.sequenceNumber,J);return Q.updateSequenceNumber(),Y=CD8(Q.macKey,q,K)&&Y,Y}function CD8(J,Q,Y){var X=ZN.hmac.create();return X.start("SHA1",J),X.update(Q),Q=X.digest().getBytes(),X.start(null,null),X.update(Y),Y=X.digest().getBytes(),Q===Y}});var Pk1=h((vZ5,XX6)=>{var W2=m8();yK();i9();var Ng=XX6.exports=W2.sha512=W2.sha512||{};W2.md.sha512=W2.md.algorithms.sha512=Ng;var YX6=W2.sha384=W2.sha512.sha384=W2.sha512.sha384||{};YX6.create=function(){return Ng.create("SHA-384")};W2.md.sha384=W2.md.algorithms.sha384=YX6;W2.sha512.sha256=W2.sha512.sha256||{create:function(){return Ng.create("SHA-512/256")}};W2.md["sha512/256"]=W2.md.algorithms["sha512/256"]=W2.sha512.sha256;W2.sha512.sha224=W2.sha512.sha224||{create:function(){return Ng.create("SHA-512/224")}};W2.md["sha512/224"]=W2.md.algorithms["sha512/224"]=W2.sha512.sha224;Ng.create=function(J){if(!$X6)SD8();if(typeof J>"u")J="SHA-512";if(!(J in UA))throw Error("Invalid SHA-512 algorithm: "+J);var Q=UA[J],Y=null,X=W2.util.createBuffer(),G=Array(80);for(var Z=0;Z<80;++Z)G[Z]=[,,];var q=64;switch(J){case"SHA-384":q=48;break;case"SHA-512/256":q=32;break;case"SHA-512/224":q=28;break}var V={algorithm:J.replace("-","").toLowerCase(),blockLength:128,digestLength:q,messageLength:0,fullMessageLength:null,messageLengthSize:16};return V.start=function(){V.messageLength=0,V.fullMessageLength=V.messageLength128=[];var K=V.messageLengthSize/4;for(var W=0;W<K;++W)V.fullMessageLength.push(0);X=W2.util.createBuffer(),Y=Array(Q.length);for(var W=0;W<Q.length;++W)Y[W]=Q[W].slice(0);return V},V.start(),V.update=function(K,W){if(W==="utf8")K=W2.util.encodeUtf8(K);var H=K.length;V.messageLength+=H,H=[H/4294967296>>>0,H>>>0];for(var z=V.fullMessageLength.length-1;z>=0;--z)V.fullMessageLength[z]+=H[1],H[1]=H[0]+(V.fullMessageLength[z]/4294967296>>>0),V.fullMessageLength[z]=V.fullMessageLength[z]>>>0,H[0]=H[1]/4294967296>>>0;if(X.putBytes(K),QX6(Y,G,X),X.read>2048||X.length()===0)X.compact();return V},V.digest=function(){var K=W2.util.createBuffer();K.putBytes(X.bytes());var W=V.fullMessageLength[V.fullMessageLength.length-1]+V.messageLengthSize,H=W&V.blockLength-1;K.putBytes(wk1.substr(0,V.blockLength-H));var z,U,N=V.fullMessageLength[0]*8;for(var O=0;O<V.fullMessageLength.length-1;++O)z=V.fullMessageLength[O+1]*8,U=z/4294967296>>>0,N+=U,K.putInt32(N>>>0),N=z>>>0;K.putInt32(N);var M=Array(Y.length);for(var O=0;O<Y.length;++O)M[O]=Y[O].slice(0);QX6(M,G,K);var L=W2.util.createBuffer(),w;if(J==="SHA-512")w=M.length;else if(J==="SHA-384")w=M.length-2;else w=M.length-4;for(var O=0;O<w;++O)if(L.putInt32(M[O][0]),O!==w-1||J!=="SHA-512/224")L.putInt32(M[O][1]);return L},V};var wk1=null,$X6=!1,Ik1=null,UA=null;function SD8(){wk1=String.fromCharCode(128),wk1+=W2.util.fillString(String.fromCharCode(0),128),Ik1=[[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]],UA={},UA["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],UA["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],UA["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],UA["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],$X6=!0}function QX6(J,Q,Y){var X,G,Z,q,V,K,W,H,z,U,N,O,M,L,w,I,P,R,j,y,f,g,p,b,i,J1,n,m,s,q1,W1,r,o,l,z1,j1=Y.length();while(j1>=128){for(s=0;s<16;++s)Q[s][0]=Y.getInt32()>>>0,Q[s][1]=Y.getInt32()>>>0;for(;s<80;++s)r=Q[s-2],q1=r[0],W1=r[1],X=((q1>>>19|W1<<13)^(W1>>>29|q1<<3)^q1>>>6)>>>0,G=((q1<<13|W1>>>19)^(W1<<3|q1>>>29)^(q1<<26|W1>>>6))>>>0,l=Q[s-15],q1=l[0],W1=l[1],Z=((q1>>>1|W1<<31)^(q1>>>8|W1<<24)^q1>>>7)>>>0,q=((q1<<31|W1>>>1)^(q1<<24|W1>>>8)^(q1<<25|W1>>>7))>>>0,o=Q[s-7],z1=Q[s-16],W1=G+o[1]+q+z1[1],Q[s][0]=X+o[0]+Z+z1[0]+(W1/4294967296>>>0)>>>0,Q[s][1]=W1>>>0;M=J[0][0],L=J[0][1],w=J[1][0],I=J[1][1],P=J[2][0],R=J[2][1],j=J[3][0],y=J[3][1],f=J[4][0],g=J[4][1],p=J[5][0],b=J[5][1],i=J[6][0],J1=J[6][1],n=J[7][0],m=J[7][1];for(s=0;s<80;++s)W=((f>>>14|g<<18)^(f>>>18|g<<14)^(g>>>9|f<<23))>>>0,H=((f<<18|g>>>14)^(f<<14|g>>>18)^(g<<23|f>>>9))>>>0,z=(i^f&(p^i))>>>0,U=(J1^g&(b^J1))>>>0,V=((M>>>28|L<<4)^(L>>>2|M<<30)^(L>>>7|M<<25))>>>0,K=((M<<4|L>>>28)^(L<<30|M>>>2)^(L<<25|M>>>7))>>>0,N=(M&w|P&(M^w))>>>0,O=(L&I|R&(L^I))>>>0,W1=m+H+U+Ik1[s][1]+Q[s][1],X=n+W+z+Ik1[s][0]+Q[s][0]+(W1/4294967296>>>0)>>>0,G=W1>>>0,W1=K+O,Z=V+N+(W1/4294967296>>>0)>>>0,q=W1>>>0,n=i,m=J1,i=p,J1=b,p=f,b=g,W1=y+G,f=j+X+(W1/4294967296>>>0)>>>0,g=W1>>>0,j=P,y=R,P=w,R=I,w=M,I=L,W1=G+q,M=X+Z+(W1/4294967296>>>0)>>>0,L=W1>>>0;W1=J[0][1]+L,J[0][0]=J[0][0]+M+(W1/4294967296>>>0)>>>0,J[0][1]=W1>>>0,W1=J[1][1]+I,J[1][0]=J[1][0]+w+(W1/4294967296>>>0)>>>0,J[1][1]=W1>>>0,W1=J[2][1]+R,J[2][0]=J[2][0]+P+(W1/4294967296>>>0)>>>0,J[2][1]=W1>>>0,W1=J[3][1]+y,J[3][0]=J[3][0]+j+(W1/4294967296>>>0)>>>0,J[3][1]=W1>>>0,W1=J[4][1]+g,J[4][0]=J[4][0]+f+(W1/4294967296>>>0)>>>0,J[4][1]=W1>>>0,W1=J[5][1]+b,J[5][0]=J[5][0]+p+(W1/4294967296>>>0)>>>0,J[5][1]=W1>>>0,W1=J[6][1]+J1,J[6][0]=J[6][0]+i+(W1/4294967296>>>0)>>>0,J[6][1]=W1>>>0,W1=J[7][1]+m,J[7][0]=J[7][0]+n+(W1/4294967296>>>0)>>>0,J[7][1]=W1>>>0,j1-=128}}});var GX6=h((_D8)=>{var jD8=m8();Mq();var p3=jD8.asn1;_D8.privateKeyValidator={name:"PrivateKeyInfo",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:p3.Class.UNIVERSAL,type:p3.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p3.Class.UNIVERSAL,type:p3.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:p3.Class.UNIVERSAL,type:p3.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};_D8.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:p3.Class.UNIVERSAL,type:p3.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p3.Class.UNIVERSAL,type:p3.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:p3.Class.UNIVERSAL,type:p3.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var DX6=h((fZ5,NX6)=>{var AJ=m8();Hg();SG();Pk1();i9();var WX6=GX6(),vD8=WX6.publicKeyValidator,xD8=WX6.privateKeyValidator;if(typeof Ck1>"u")Ck1=AJ.jsbn.BigInteger;var Ck1,Sk1=AJ.util.ByteBuffer,bY=typeof Buffer>"u"?Uint8Array:Buffer;AJ.pki=AJ.pki||{};NX6.exports=AJ.pki.ed25519=AJ.ed25519=AJ.ed25519||{};var L9=AJ.ed25519;L9.constants={};L9.constants.PUBLIC_KEY_BYTE_LENGTH=32;L9.constants.PRIVATE_KEY_BYTE_LENGTH=64;L9.constants.SEED_BYTE_LENGTH=32;L9.constants.SIGN_BYTE_LENGTH=64;L9.constants.HASH_BYTE_LENGTH=64;L9.generateKeyPair=function(J){J=J||{};var Q=J.seed;if(Q===void 0)Q=AJ.random.getBytesSync(L9.constants.SEED_BYTE_LENGTH);else if(typeof Q==="string"){if(Q.length!==L9.constants.SEED_BYTE_LENGTH)throw TypeError('"seed" must be '+L9.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(Q instanceof Uint8Array))throw TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');Q=Bz({message:Q,encoding:"binary"});var Y=new bY(L9.constants.PUBLIC_KEY_BYTE_LENGTH),X=new bY(L9.constants.PRIVATE_KEY_BYTE_LENGTH);for(var G=0;G<32;++G)X[G]=Q[G];return uD8(Y,X),{publicKey:Y,privateKey:X}};L9.privateKeyFromAsn1=function(J){var Q={},Y=[],X=AJ.asn1.validate(J,xD8,Q,Y);if(!X){var G=Error("Invalid Key.");throw G.errors=Y,G}var Z=AJ.asn1.derToOid(Q.privateKeyOid),q=AJ.oids.EdDSA25519;if(Z!==q)throw Error('Invalid OID "'+Z+'"; OID must be "'+q+'".');var V=Q.privateKey,K=Bz({message:AJ.asn1.fromDer(V).value,encoding:"binary"});return{privateKeyBytes:K}};L9.publicKeyFromAsn1=function(J){var Q={},Y=[],X=AJ.asn1.validate(J,vD8,Q,Y);if(!X){var G=Error("Invalid Key.");throw G.errors=Y,G}var Z=AJ.asn1.derToOid(Q.publicKeyOid),q=AJ.oids.EdDSA25519;if(Z!==q)throw Error('Invalid OID "'+Z+'"; OID must be "'+q+'".');var V=Q.ed25519PublicKey;if(V.length!==L9.constants.PUBLIC_KEY_BYTE_LENGTH)throw Error("Key length is invalid.");return Bz({message:V,encoding:"binary"})};L9.publicKeyFromPrivateKey=function(J){J=J||{};var Q=Bz({message:J.privateKey,encoding:"binary"});if(Q.length!==L9.constants.PRIVATE_KEY_BYTE_LENGTH)throw TypeError('"options.privateKey" must have a byte length of '+L9.constants.PRIVATE_KEY_BYTE_LENGTH);var Y=new bY(L9.constants.PUBLIC_KEY_BYTE_LENGTH);for(var X=0;X<Y.length;++X)Y[X]=Q[32+X];return Y};L9.sign=function(J){J=J||{};var Q=Bz(J),Y=Bz({message:J.privateKey,encoding:"binary"});if(Y.length===L9.constants.SEED_BYTE_LENGTH){var X=L9.generateKeyPair({seed:Y});Y=X.privateKey}else if(Y.length!==L9.constants.PRIVATE_KEY_BYTE_LENGTH)throw TypeError('"options.privateKey" must have a byte length of '+L9.constants.SEED_BYTE_LENGTH+" or "+L9.constants.PRIVATE_KEY_BYTE_LENGTH);var G=new bY(L9.constants.SIGN_BYTE_LENGTH+Q.length);gD8(G,Q,Q.length,Y);var Z=new bY(L9.constants.SIGN_BYTE_LENGTH);for(var q=0;q<Z.length;++q)Z[q]=G[q];return Z};L9.verify=function(J){J=J||{};var Q=Bz(J);if(J.signature===void 0)throw TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var Y=Bz({message:J.signature,encoding:"binary"});if(Y.length!==L9.constants.SIGN_BYTE_LENGTH)throw TypeError('"options.signature" must have a byte length of '+L9.constants.SIGN_BYTE_LENGTH);var X=Bz({message:J.publicKey,encoding:"binary"});if(X.length!==L9.constants.PUBLIC_KEY_BYTE_LENGTH)throw TypeError('"options.publicKey" must have a byte length of '+L9.constants.PUBLIC_KEY_BYTE_LENGTH);var G=new bY(L9.constants.SIGN_BYTE_LENGTH+Q.length),Z=new bY(L9.constants.SIGN_BYTE_LENGTH+Q.length),q;for(q=0;q<L9.constants.SIGN_BYTE_LENGTH;++q)G[q]=Y[q];for(q=0;q<Q.length;++q)G[q+L9.constants.SIGN_BYTE_LENGTH]=Q[q];return mD8(Z,G,G.length,X)>=0};function Bz(J){var Q=J.message;if(Q instanceof Uint8Array||Q instanceof bY)return Q;var Y=J.encoding;if(Q===void 0)if(J.md)Q=J.md.digest().getBytes(),Y="binary";else throw TypeError('"options.message" or "options.md" not specified.');if(typeof Q==="string"&&!Y)throw TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof Q==="string"){if(typeof Buffer<"u")return Buffer.from(Q,Y);Q=new Sk1(Q,Y)}else if(!(Q instanceof Sk1))throw TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');var X=new bY(Q.length());for(var G=0;G<X.length;++G)X[G]=Q.at(G);return X}var jk1=o4(),U91=o4([1]),fD8=o4([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),hD8=o4([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),ZX6=o4([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),qX6=o4([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Tk1=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]),bD8=o4([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Dg(J,Q){var Y=AJ.md.sha512.create(),X=new Sk1(J);Y.update(X.getBytes(Q),"binary");var G=Y.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(G,"binary");var Z=new bY(L9.constants.HASH_BYTE_LENGTH);for(var q=0;q<64;++q)Z[q]=G.charCodeAt(q);return Z}function uD8(J,Q){var Y=[o4(),o4(),o4(),o4()],X,G=Dg(Q,32);G[0]&=248,G[31]&=127,G[31]|=64,vk1(Y,G),yk1(J,Y);for(X=0;X<32;++X)Q[X+32]=J[X];return 0}function gD8(J,Q,Y,X){var G,Z,q=new Float64Array(64),V=[o4(),o4(),o4(),o4()],K=Dg(X,32);K[0]&=248,K[31]&=127,K[31]|=64;var W=Y+64;for(G=0;G<Y;++G)J[64+G]=Q[G];for(G=0;G<32;++G)J[32+G]=K[32+G];var H=Dg(J.subarray(32),Y+32);_k1(H),vk1(V,H),yk1(J,V);for(G=32;G<64;++G)J[G]=X[G];var z=Dg(J,Y+64);_k1(z);for(G=32;G<64;++G)q[G]=0;for(G=0;G<32;++G)q[G]=H[G];for(G=0;G<32;++G)for(Z=0;Z<32;Z++)q[G+Z]+=z[G]*K[Z];return HX6(J.subarray(32),q),W}function mD8(J,Q,Y,X){var G,Z,q=new bY(32),V=[o4(),o4(),o4(),o4()],K=[o4(),o4(),o4(),o4()];if(Z=-1,Y<64)return-1;if(pD8(K,X))return-1;for(G=0;G<Y;++G)J[G]=Q[G];for(G=0;G<32;++G)J[G+32]=X[G];var W=Dg(J,Y);if(_k1(W),UX6(V,K,W),vk1(K,Q.subarray(32)),kk1(V,K),yk1(q,V),Y-=64,zX6(Q,0,q,0)){for(G=0;G<Y;++G)J[G]=0;return-1}for(G=0;G<Y;++G)J[G]=Q[G+64];return Z=Y,Z}function HX6(J,Q){var Y,X,G,Z;for(X=63;X>=32;--X){Y=0;for(G=X-32,Z=X-12;G<Z;++G)Q[G]+=Y-16*Q[X]*Tk1[G-(X-32)],Y=Q[G]+128>>8,Q[G]-=Y*256;Q[G]+=Y,Q[X]=0}Y=0;for(G=0;G<32;++G)Q[G]+=Y-(Q[31]>>4)*Tk1[G],Y=Q[G]>>8,Q[G]&=255;for(G=0;G<32;++G)Q[G]-=Y*Tk1[G];for(X=0;X<32;++X)Q[X+1]+=Q[X]>>8,J[X]=Q[X]&255}function _k1(J){var Q=new Float64Array(64);for(var Y=0;Y<64;++Y)Q[Y]=J[Y],J[Y]=0;HX6(J,Q)}function kk1(J,Q){var Y=o4(),X=o4(),G=o4(),Z=o4(),q=o4(),V=o4(),K=o4(),W=o4(),H=o4();wC(Y,J[1],J[0]),wC(H,Q[1],Q[0]),p5(Y,Y,H),EC(X,J[0],J[1]),EC(H,Q[0],Q[1]),p5(X,X,H),p5(G,J[3],Q[3]),p5(G,G,hD8),p5(Z,J[2],Q[2]),EC(Z,Z,Z),wC(q,X,Y),wC(V,Z,G),EC(K,Z,G),EC(W,X,Y),p5(J[0],q,V),p5(J[1],W,K),p5(J[2],K,V),p5(J[3],q,W)}function VX6(J,Q,Y){for(var X=0;X<4;++X)BX6(J[X],Q[X],Y)}function yk1(J,Q){var Y=o4(),X=o4(),G=o4();iD8(G,Q[2]),p5(Y,Q[0],G),p5(X,Q[1],G),B91(J,X),J[31]^=FX6(Y)<<7}function B91(J,Q){var Y,X,G,Z=o4(),q=o4();for(Y=0;Y<16;++Y)q[Y]=Q[Y];Rk1(q),Rk1(q),Rk1(q);for(X=0;X<2;++X){Z[0]=q[0]-65517;for(Y=1;Y<15;++Y)Z[Y]=q[Y]-65535-(Z[Y-1]>>16&1),Z[Y-1]&=65535;Z[15]=q[15]-32767-(Z[14]>>16&1),G=Z[15]>>16&1,Z[14]&=65535,BX6(q,Z,1-G)}for(Y=0;Y<16;Y++)J[2*Y]=q[Y]&255,J[2*Y+1]=q[Y]>>8}function pD8(J,Q){var Y=o4(),X=o4(),G=o4(),Z=o4(),q=o4(),V=o4(),K=o4();if(qN(J[2],U91),dD8(J[1],Q),BA(G,J[1]),p5(Z,G,fD8),wC(G,G,J[2]),EC(Z,J[2],Z),BA(q,Z),BA(V,q),p5(K,V,q),p5(Y,K,G),p5(Y,Y,Z),cD8(Y,Y),p5(Y,Y,G),p5(Y,Y,Z),p5(Y,Y,Z),p5(J[0],Y,Z),BA(X,J[0]),p5(X,X,Z),KX6(X,G))p5(J[0],J[0],bD8);if(BA(X,J[0]),p5(X,X,Z),KX6(X,G))return-1;if(FX6(J[0])===Q[31]>>7)wC(J[0],jk1,J[0]);return p5(J[3],J[0],J[1]),0}function dD8(J,Q){var Y;for(Y=0;Y<16;++Y)J[Y]=Q[2*Y]+(Q[2*Y+1]<<8);J[15]&=32767}function cD8(J,Q){var Y=o4(),X;for(X=0;X<16;++X)Y[X]=Q[X];for(X=250;X>=0;--X)if(BA(Y,Y),X!==1)p5(Y,Y,Q);for(X=0;X<16;++X)J[X]=Y[X]}function KX6(J,Q){var Y=new bY(32),X=new bY(32);return B91(Y,J),B91(X,Q),zX6(Y,0,X,0)}function zX6(J,Q,Y,X){return lD8(J,Q,Y,X,32)}function lD8(J,Q,Y,X,G){var Z,q=0;for(Z=0;Z<G;++Z)q|=J[Q+Z]^Y[X+Z];return(1&q-1>>>8)-1}function FX6(J){var Q=new bY(32);return B91(Q,J),Q[0]&1}function UX6(J,Q,Y){var X,G;qN(J[0],jk1),qN(J[1],U91),qN(J[2],U91),qN(J[3],jk1);for(G=255;G>=0;--G)X=Y[G/8|0]>>(G&7)&1,VX6(J,Q,X),kk1(Q,J),kk1(J,J),VX6(J,Q,X)}function vk1(J,Q){var Y=[o4(),o4(),o4(),o4()];qN(Y[0],ZX6),qN(Y[1],qX6),qN(Y[2],U91),p5(Y[3],ZX6,qX6),UX6(J,Y,Q)}function qN(J,Q){var Y;for(Y=0;Y<16;Y++)J[Y]=Q[Y]|0}function iD8(J,Q){var Y=o4(),X;for(X=0;X<16;++X)Y[X]=Q[X];for(X=253;X>=0;--X)if(BA(Y,Y),X!==2&&X!==4)p5(Y,Y,Q);for(X=0;X<16;++X)J[X]=Y[X]}function Rk1(J){var Q,Y,X=1;for(Q=0;Q<16;++Q)Y=J[Q]+X+65535,X=Math.floor(Y/65536),J[Q]=Y-X*65536;J[0]+=X-1+37*(X-1)}function BX6(J,Q,Y){var X,G=~(Y-1);for(var Z=0;Z<16;++Z)X=G&(J[Z]^Q[Z]),J[Z]^=X,Q[Z]^=X}function o4(J){var Q,Y=new Float64Array(16);if(J)for(Q=0;Q<J.length;++Q)Y[Q]=J[Q];return Y}function EC(J,Q,Y){for(var X=0;X<16;++X)J[X]=Q[X]+Y[X]}function wC(J,Q,Y){for(var X=0;X<16;++X)J[X]=Q[X]-Y[X]}function BA(J,Q){p5(J,Q,Q)}function p5(J,Q,Y){var X,G,Z=0,q=0,V=0,K=0,W=0,H=0,z=0,U=0,N=0,O=0,M=0,L=0,w=0,I=0,P=0,R=0,j=0,y=0,f=0,g=0,p=0,b=0,i=0,J1=0,n=0,m=0,s=0,q1=0,W1=0,r=0,o=0,l=Y[0],z1=Y[1],j1=Y[2],t=Y[3],y1=Y[4],R1=Y[5],D0=Y[6],T1=Y[7],a1=Y[8],F1=Y[9],Y1=Y[10],O1=Y[11],L1=Y[12],E1=Y[13],A1=Y[14],u1=Y[15];X=Q[0],Z+=X*l,q+=X*z1,V+=X*j1,K+=X*t,W+=X*y1,H+=X*R1,z+=X*D0,U+=X*T1,N+=X*a1,O+=X*F1,M+=X*Y1,L+=X*O1,w+=X*L1,I+=X*E1,P+=X*A1,R+=X*u1,X=Q[1],q+=X*l,V+=X*z1,K+=X*j1,W+=X*t,H+=X*y1,z+=X*R1,U+=X*D0,N+=X*T1,O+=X*a1,M+=X*F1,L+=X*Y1,w+=X*O1,I+=X*L1,P+=X*E1,R+=X*A1,j+=X*u1,X=Q[2],V+=X*l,K+=X*z1,W+=X*j1,H+=X*t,z+=X*y1,U+=X*R1,N+=X*D0,O+=X*T1,M+=X*a1,L+=X*F1,w+=X*Y1,I+=X*O1,P+=X*L1,R+=X*E1,j+=X*A1,y+=X*u1,X=Q[3],K+=X*l,W+=X*z1,H+=X*j1,z+=X*t,U+=X*y1,N+=X*R1,O+=X*D0,M+=X*T1,L+=X*a1,w+=X*F1,I+=X*Y1,P+=X*O1,R+=X*L1,j+=X*E1,y+=X*A1,f+=X*u1,X=Q[4],W+=X*l,H+=X*z1,z+=X*j1,U+=X*t,N+=X*y1,O+=X*R1,M+=X*D0,L+=X*T1,w+=X*a1,I+=X*F1,P+=X*Y1,R+=X*O1,j+=X*L1,y+=X*E1,f+=X*A1,g+=X*u1,X=Q[5],H+=X*l,z+=X*z1,U+=X*j1,N+=X*t,O+=X*y1,M+=X*R1,L+=X*D0,w+=X*T1,I+=X*a1,P+=X*F1,R+=X*Y1,j+=X*O1,y+=X*L1,f+=X*E1,g+=X*A1,p+=X*u1,X=Q[6],z+=X*l,U+=X*z1,N+=X*j1,O+=X*t,M+=X*y1,L+=X*R1,w+=X*D0,I+=X*T1,P+=X*a1,R+=X*F1,j+=X*Y1,y+=X*O1,f+=X*L1,g+=X*E1,p+=X*A1,b+=X*u1,X=Q[7],U+=X*l,N+=X*z1,O+=X*j1,M+=X*t,L+=X*y1,w+=X*R1,I+=X*D0,P+=X*T1,R+=X*a1,j+=X*F1,y+=X*Y1,f+=X*O1,g+=X*L1,p+=X*E1,b+=X*A1,i+=X*u1,X=Q[8],N+=X*l,O+=X*z1,M+=X*j1,L+=X*t,w+=X*y1,I+=X*R1,P+=X*D0,R+=X*T1,j+=X*a1,y+=X*F1,f+=X*Y1,g+=X*O1,p+=X*L1,b+=X*E1,i+=X*A1,J1+=X*u1,X=Q[9],O+=X*l,M+=X*z1,L+=X*j1,w+=X*t,I+=X*y1,P+=X*R1,R+=X*D0,j+=X*T1,y+=X*a1,f+=X*F1,g+=X*Y1,p+=X*O1,b+=X*L1,i+=X*E1,J1+=X*A1,n+=X*u1,X=Q[10],M+=X*l,L+=X*z1,w+=X*j1,I+=X*t,P+=X*y1,R+=X*R1,j+=X*D0,y+=X*T1,f+=X*a1,g+=X*F1,p+=X*Y1,b+=X*O1,i+=X*L1,J1+=X*E1,n+=X*A1,m+=X*u1,X=Q[11],L+=X*l,w+=X*z1,I+=X*j1,P+=X*t,R+=X*y1,j+=X*R1,y+=X*D0,f+=X*T1,g+=X*a1,p+=X*F1,b+=X*Y1,i+=X*O1,J1+=X*L1,n+=X*E1,m+=X*A1,s+=X*u1,X=Q[12],w+=X*l,I+=X*z1,P+=X*j1,R+=X*t,j+=X*y1,y+=X*R1,f+=X*D0,g+=X*T1,p+=X*a1,b+=X*F1,i+=X*Y1,J1+=X*O1,n+=X*L1,m+=X*E1,s+=X*A1,q1+=X*u1,X=Q[13],I+=X*l,P+=X*z1,R+=X*j1,j+=X*t,y+=X*y1,f+=X*R1,g+=X*D0,p+=X*T1,b+=X*a1,i+=X*F1,J1+=X*Y1,n+=X*O1,m+=X*L1,s+=X*E1,q1+=X*A1,W1+=X*u1,X=Q[14],P+=X*l,R+=X*z1,j+=X*j1,y+=X*t,f+=X*y1,g+=X*R1,p+=X*D0,b+=X*T1,i+=X*a1,J1+=X*F1,n+=X*Y1,m+=X*O1,s+=X*L1,q1+=X*E1,W1+=X*A1,r+=X*u1,X=Q[15],R+=X*l,j+=X*z1,y+=X*j1,f+=X*t,g+=X*y1,p+=X*R1,b+=X*D0,i+=X*T1,J1+=X*a1,n+=X*F1,m+=X*Y1,s+=X*O1,q1+=X*L1,W1+=X*E1,r+=X*A1,o+=X*u1,Z+=38*j,q+=38*y,V+=38*f,K+=38*g,W+=38*p,H+=38*b,z+=38*i,U+=38*J1,N+=38*n,O+=38*m,M+=38*s,L+=38*q1,w+=38*W1,I+=38*r,P+=38*o,G=1,X=Z+G+65535,G=Math.floor(X/65536),Z=X-G*65536,X=q+G+65535,G=Math.floor(X/65536),q=X-G*65536,X=V+G+65535,G=Math.floor(X/65536),V=X-G*65536,X=K+G+65535,G=Math.floor(X/65536),K=X-G*65536,X=W+G+65535,G=Math.floor(X/65536),W=X-G*65536,X=H+G+65535,G=Math.floor(X/65536),H=X-G*65536,X=z+G+65535,G=Math.floor(X/65536),z=X-G*65536,X=U+G+65535,G=Math.floor(X/65536),U=X-G*65536,X=N+G+65535,G=Math.floor(X/65536),N=X-G*65536,X=O+G+65535,G=Math.floor(X/65536),O=X-G*65536,X=M+G+65535,G=Math.floor(X/65536),M=X-G*65536,X=L+G+65535,G=Math.floor(X/65536),L=X-G*65536,X=w+G+65535,G=Math.floor(X/65536),w=X-G*65536,X=I+G+65535,G=Math.floor(X/65536),I=X-G*65536,X=P+G+65535,G=Math.floor(X/65536),P=X-G*65536,X=R+G+65535,G=Math.floor(X/65536),R=X-G*65536,Z+=G-1+37*(G-1),G=1,X=Z+G+65535,G=Math.floor(X/65536),Z=X-G*65536,X=q+G+65535,G=Math.floor(X/65536),q=X-G*65536,X=V+G+65535,G=Math.floor(X/65536),V=X-G*65536,X=K+G+65535,G=Math.floor(X/65536),K=X-G*65536,X=W+G+65535,G=Math.floor(X/65536),W=X-G*65536,X=H+G+65535,G=Math.floor(X/65536),H=X-G*65536,X=z+G+65535,G=Math.floor(X/65536),z=X-G*65536,X=U+G+65535,G=Math.floor(X/65536),U=X-G*65536,X=N+G+65535,G=Math.floor(X/65536),N=X-G*65536,X=O+G+65535,G=Math.floor(X/65536),O=X-G*65536,X=M+G+65535,G=Math.floor(X/65536),M=X-G*65536,X=L+G+65535,G=Math.floor(X/65536),L=X-G*65536,X=w+G+65535,G=Math.floor(X/65536),w=X-G*65536,X=I+G+65535,G=Math.floor(X/65536),I=X-G*65536,X=P+G+65535,G=Math.floor(X/65536),P=X-G*65536,X=R+G+65535,G=Math.floor(X/65536),R=X-G*65536,Z+=G-1+37*(G-1),J[0]=Z,J[1]=q,J[2]=V,J[3]=K,J[4]=W,J[5]=H,J[6]=z,J[7]=U,J[8]=N,J[9]=O,J[10]=M,J[11]=L,J[12]=w,J[13]=I,J[14]=P,J[15]=R}});var AX6=h((hZ5,LX6)=>{var e$=m8();i9();SG();Hg();LX6.exports=e$.kem=e$.kem||{};var OX6=e$.jsbn.BigInteger;e$.kem.rsa={};e$.kem.rsa.create=function(J,Q){Q=Q||{};var Y=Q.prng||e$.random,X={};return X.encrypt=function(G,Z){var q=Math.ceil(G.n.bitLength()/8),V;do V=new OX6(e$.util.bytesToHex(Y.getBytesSync(q)),16).mod(G.n);while(V.compareTo(OX6.ONE)<=0);V=e$.util.hexToBytes(V.toString(16));var K=q-V.length;if(K>0)V=e$.util.fillString(String.fromCharCode(0),K)+V;var W=G.encrypt(V,"NONE"),H=J.generate(V,Z);return{encapsulation:W,key:H}},X.decrypt=function(G,Z,q){var V=G.decrypt(Z,"NONE");return J.generate(V,q)},X};e$.kem.kdf1=function(J,Q){MX6(this,J,0,Q||J.digestLength)};e$.kem.kdf2=function(J,Q){MX6(this,J,1,Q||J.digestLength)};function MX6(J,Q,Y,X){J.generate=function(G,Z){var q=new e$.util.ByteBuffer,V=Math.ceil(Z/X)+Y,K=new e$.util.ByteBuffer;for(var W=Y;W<V;++W){K.putInt32(W),Q.start(),Q.update(G+K.getBytes());var H=Q.digest();q.putBytes(H.getBytes(X))}return q.truncate(q.length()-Z),q.getBytes()}}});var wX6=h((bZ5,EX6)=>{var E9=m8();i9();EX6.exports=E9.log=E9.log||{};E9.log.levels=["none","error","warning","info","debug","verbose","max"];var O91={},xk1=[],Og=null;E9.log.LEVEL_LOCKED=2;E9.log.NO_LEVEL_CHECK=4;E9.log.INTERPOLATE=8;for(xG=0;xG<E9.log.levels.length;++xG)N91=E9.log.levels[xG],O91[N91]={index:xG,name:N91.toUpperCase()};var N91,xG;E9.log.logMessage=function(J){var Q=O91[J.level].index;for(var Y=0;Y<xk1.length;++Y){var X=xk1[Y];if(X.flags&E9.log.NO_LEVEL_CHECK)X.f(J);else{var G=O91[X.level].index;if(Q<=G)X.f(X,J)}}};E9.log.prepareStandard=function(J){if(!("standard"in J))J.standard=O91[J.level].name+" ["+J.category+"] "+J.message};E9.log.prepareFull=function(J){if(!("full"in J)){var Q=[J.message];Q=Q.concat([]),J.full=E9.util.format.apply(this,Q)}};E9.log.prepareStandardFull=function(J){if(!("standardFull"in J))E9.log.prepareStandard(J),J.standardFull=J.standard};D91=["error","warning","info","debug","verbose"];for(xG=0;xG<D91.length;++xG)(function(Q){E9.log[Q]=function(Y,X){var G=Array.prototype.slice.call(arguments).slice(2),Z={timestamp:new Date,level:Q,category:Y,message:X,arguments:G};E9.log.logMessage(Z)}})(D91[xG]);var D91,xG;E9.log.makeLogger=function(J){var Q={flags:0,f:J};return E9.log.setLevel(Q,"none"),Q};E9.log.setLevel=function(J,Q){var Y=!1;if(J&&!(J.flags&E9.log.LEVEL_LOCKED))for(var X=0;X<E9.log.levels.length;++X){var G=E9.log.levels[X];if(Q==G){J.level=Q,Y=!0;break}}return Y};E9.log.lock=function(J,Q){if(typeof Q>"u"||Q)J.flags|=E9.log.LEVEL_LOCKED;else J.flags&=~E9.log.LEVEL_LOCKED};E9.log.addLogger=function(J){xk1.push(J)};if(typeof console<"u"&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)fk1={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},PC=function(J,Q){E9.log.prepareStandard(Q);var Y=fk1[Q.level],X=[Q.standard];X=X.concat(Q.arguments.slice()),Y.apply(console,X)},NA=E9.log.makeLogger(PC);else PC=function(Q,Y){E9.log.prepareStandardFull(Y),console.log(Y.standardFull)},NA=E9.log.makeLogger(PC);E9.log.setLevel(NA,"debug"),E9.log.addLogger(NA),Og=NA}else console={log:function(){}};var NA,fk1,PC;if(Og!==null&&typeof window<"u"&&window.location){if(IC=new URL(window.location.href).searchParams,IC.has("console.level"))E9.log.setLevel(Og,IC.get("console.level").slice(-1)[0]);if(IC.has("console.lock")){if(hk1=IC.get("console.lock").slice(-1)[0],hk1=="true")E9.log.lock(Og)}}var IC,hk1;E9.log.consoleLogger=Og});var PX6=h((uZ5,IX6)=>{IX6.exports=yK();o81();DC();r_1();Pk1()});var CX6=h((gZ5,RX6)=>{var m6=m8();eB();Mq();Kg();JN();VA();Wk1();SG();i9();W91();var Y0=m6.asn1,pQ=RX6.exports=m6.pkcs7=m6.pkcs7||{};pQ.messageFromPem=function(J){var Q=m6.pem.decode(J)[0];if(Q.type!=="PKCS7"){var Y=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw Y.headerType=Q.type,Y}if(Q.procType&&Q.procType.type==="ENCRYPTED")throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var X=Y0.fromDer(Q.body);return pQ.messageFromAsn1(X)};pQ.messageToPem=function(J,Q){var Y={type:"PKCS7",body:Y0.toDer(J.toAsn1()).getBytes()};return m6.pem.encode(Y,{maxline:Q})};pQ.messageFromAsn1=function(J){var Q={},Y=[];if(!Y0.validate(J,pQ.asn1.contentInfoValidator,Q,Y)){var X=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw X.errors=Y,X}var G=Y0.derToOid(Q.contentType),Z;switch(G){case m6.pki.oids.envelopedData:Z=pQ.createEnvelopedData();break;case m6.pki.oids.encryptedData:Z=pQ.createEncryptedData();break;case m6.pki.oids.signedData:Z=pQ.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+G+" is not (yet) supported.")}return Z.fromAsn1(Q.content.value[0]),Z};pQ.createSignedData=function(){var J=null;return J={type:m6.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(X){if(uk1(J,X,pQ.asn1.signedDataValidator),J.certificates=[],J.crls=[],J.digestAlgorithmIdentifiers=[],J.contentInfo=null,J.signerInfos=[],J.rawCapture.certificates){var G=J.rawCapture.certificates.value;for(var Z=0;Z<G.length;++Z)J.certificates.push(m6.pki.certificateFromAsn1(G[Z]))}},toAsn1:function(){if(!J.contentInfo)J.sign();var X=[];for(var G=0;G<J.certificates.length;++G)X.push(m6.pki.certificateToAsn1(J.certificates[G]));var Z=[],q=Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,J.digestAlgorithmIdentifiers),J.contentInfo])]);if(X.length>0)q.value[0].value.push(Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,X));if(Z.length>0)q.value[0].value.push(Y0.create(Y0.Class.CONTEXT_SPECIFIC,1,!0,Z));return q.value[0].value.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,J.signerInfos)),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.type).getBytes()),q])},addSigner:function(X){var{issuer:G,serialNumber:Z}=X;if(X.certificate){var q=X.certificate;if(typeof q==="string")q=m6.pki.certificateFromPem(q);G=q.issuer.attributes,Z=q.serialNumber}var V=X.key;if(!V)throw Error("Could not add PKCS#7 signer; no private key specified.");if(typeof V==="string")V=m6.pki.privateKeyFromPem(V);var K=X.digestAlgorithm||m6.pki.oids.sha1;switch(K){case m6.pki.oids.sha1:case m6.pki.oids.sha256:case m6.pki.oids.sha384:case m6.pki.oids.sha512:case m6.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+K)}var W=X.authenticatedAttributes||[];if(W.length>0){var H=!1,z=!1;for(var U=0;U<W.length;++U){var N=W[U];if(!H&&N.type===m6.pki.oids.contentType){if(H=!0,z)break;continue}if(!z&&N.type===m6.pki.oids.messageDigest){if(z=!0,H)break;continue}}if(!H||!z)throw 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.")}J.signers.push({key:V,version:1,issuer:G,serialNumber:Z,digestAlgorithm:K,signatureAlgorithm:m6.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:W,unauthenticatedAttributes:[]})},sign:function(X){if(X=X||{},typeof J.content!=="object"||J.contentInfo===null){if(J.contentInfo=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(m6.pki.oids.data).getBytes())]),"content"in J){var G;if(J.content instanceof m6.util.ByteBuffer)G=J.content.bytes();else if(typeof J.content==="string")G=m6.util.encodeUtf8(J.content);if(X.detached)J.detachedContent=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,G);else J.contentInfo.value.push(Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,G)]))}}if(J.signers.length===0)return;var Z=Q();Y(Z)},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(X){if(typeof X==="string")X=m6.pki.certificateFromPem(X);J.certificates.push(X)},addCertificateRevokationList:function(X){throw Error("PKCS#7 CRL support not yet implemented.")}},J;function Q(){var X={};for(var G=0;G<J.signers.length;++G){var Z=J.signers[G],q=Z.digestAlgorithm;if(!(q in X))X[q]=m6.md[m6.pki.oids[q]].create();if(Z.authenticatedAttributes.length===0)Z.md=X[q];else Z.md=m6.md[m6.pki.oids[q]].create()}J.digestAlgorithmIdentifiers=[];for(var q in X)J.digestAlgorithmIdentifiers.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(q).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")]));return X}function Y(X){var G;if(J.detachedContent)G=J.detachedContent;else G=J.contentInfo.value[1],G=G.value[0];if(!G)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var Z=Y0.derToOid(J.contentInfo.value[0].value),q=Y0.toDer(G);q.getByte(),Y0.getBerValueLength(q),q=q.getBytes();for(var V in X)X[V].start().update(q);var K=new Date;for(var W=0;W<J.signers.length;++W){var H=J.signers[W];if(H.authenticatedAttributes.length===0){if(Z!==m6.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{H.authenticatedAttributesAsn1=Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[]);var z=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,[]);for(var U=0;U<H.authenticatedAttributes.length;++U){var N=H.authenticatedAttributes[U];if(N.type===m6.pki.oids.messageDigest)N.value=X[H.digestAlgorithm].digest();else if(N.type===m6.pki.oids.signingTime){if(!N.value)N.value=K}z.value.push(bk1(N)),H.authenticatedAttributesAsn1.value.push(bk1(N))}q=Y0.toDer(z).getBytes(),H.md.start().update(q)}H.signature=H.key.sign(H.md,"RSASSA-PKCS1-V1_5")}J.signerInfos=tD8(J.signers)}};pQ.createEncryptedData=function(){var J=null;return J={type:m6.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:m6.pki.oids["aes256-CBC"]},fromAsn1:function(Q){uk1(J,Q,pQ.asn1.encryptedDataValidator)},decrypt:function(Q){if(Q!==void 0)J.encryptedContent.key=Q;TX6(J)}},J};pQ.createEnvelopedData=function(){var J=null;return J={type:m6.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:m6.pki.oids["aes256-CBC"]},fromAsn1:function(Q){var Y=uk1(J,Q,pQ.asn1.envelopedDataValidator);J.recipients=rD8(Y.recipientInfos.value)},toAsn1:function(){return Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.type).getBytes()),Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,oD8(J.recipients)),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,eD8(J.encryptedContent))])])])},findRecipient:function(Q){var Y=Q.issuer.attributes;for(var X=0;X<J.recipients.length;++X){var G=J.recipients[X],Z=G.issuer;if(G.serialNumber!==Q.serialNumber)continue;if(Z.length!==Y.length)continue;var q=!0;for(var V=0;V<Y.length;++V)if(Z[V].type!==Y[V].type||Z[V].value!==Y[V].value){q=!1;break}if(q)return G}return null},decrypt:function(Q,Y){if(J.encryptedContent.key===void 0&&Q!==void 0&&Y!==void 0)switch(Q.encryptedContent.algorithm){case m6.pki.oids.rsaEncryption:case m6.pki.oids.desCBC:var X=Y.decrypt(Q.encryptedContent.content);J.encryptedContent.key=m6.util.createBuffer(X);break;default:throw Error("Unsupported asymmetric cipher, OID "+Q.encryptedContent.algorithm)}TX6(J)},addRecipient:function(Q){J.recipients.push({version:0,issuer:Q.issuer.attributes,serialNumber:Q.serialNumber,encryptedContent:{algorithm:m6.pki.oids.rsaEncryption,key:Q.publicKey}})},encrypt:function(Q,Y){if(J.encryptedContent.content===void 0){Y=Y||J.encryptedContent.algorithm,Q=Q||J.encryptedContent.key;var X,G,Z;switch(Y){case m6.pki.oids["aes128-CBC"]:X=16,G=16,Z=m6.aes.createEncryptionCipher;break;case m6.pki.oids["aes192-CBC"]:X=24,G=16,Z=m6.aes.createEncryptionCipher;break;case m6.pki.oids["aes256-CBC"]:X=32,G=16,Z=m6.aes.createEncryptionCipher;break;case m6.pki.oids["des-EDE3-CBC"]:X=24,G=8,Z=m6.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+Y)}if(Q===void 0)Q=m6.util.createBuffer(m6.random.getBytes(X));else if(Q.length()!=X)throw Error("Symmetric key has wrong length; got "+Q.length()+" bytes, expected "+X+".");J.encryptedContent.algorithm=Y,J.encryptedContent.key=Q,J.encryptedContent.parameter=m6.util.createBuffer(m6.random.getBytes(G));var q=Z(Q);if(q.start(J.encryptedContent.parameter.copy()),q.update(J.content),!q.finish())throw Error("Symmetric encryption failed.");J.encryptedContent.content=q.output}for(var V=0;V<J.recipients.length;++V){var K=J.recipients[V];if(K.encryptedContent.content!==void 0)continue;switch(K.encryptedContent.algorithm){case m6.pki.oids.rsaEncryption:K.encryptedContent.content=K.encryptedContent.key.encrypt(J.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+K.encryptedContent.algorithm)}}}},J};function nD8(J){var Q={},Y=[];if(!Y0.validate(J,pQ.asn1.recipientInfoValidator,Q,Y)){var X=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw X.errors=Y,X}return{version:Q.version.charCodeAt(0),issuer:m6.pki.RDNAttributesAsArray(Q.issuer),serialNumber:m6.util.createBuffer(Q.serial).toHex(),encryptedContent:{algorithm:Y0.derToOid(Q.encAlgorithm),parameter:Q.encParameter?Q.encParameter.value:void 0,content:Q.encKey}}}function aD8(J){return Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[m6.pki.distinguishedNameToAsn1({attributes:J.issuer}),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,m6.util.hexToBytes(J.serialNumber))]),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.encryptedContent.algorithm).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")]),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.encryptedContent.content)])}function rD8(J){var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(nD8(J[Y]));return Q}function oD8(J){var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(aD8(J[Y]));return Q}function sD8(J){var Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,Y0.integerToDer(J.version).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[m6.pki.distinguishedNameToAsn1({attributes:J.issuer}),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.INTEGER,!1,m6.util.hexToBytes(J.serialNumber))]),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.digestAlgorithm).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")])]);if(J.authenticatedAttributesAsn1)Q.value.push(J.authenticatedAttributesAsn1);if(Q.value.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.signatureAlgorithm).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.NULL,!1,"")])),Q.value.push(Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.signature)),J.unauthenticatedAttributes.length>0){var Y=Y0.create(Y0.Class.CONTEXT_SPECIFIC,1,!0,[]);for(var X=0;X<J.unauthenticatedAttributes.length;++X){var G=J.unauthenticatedAttributes[X];Y.values.push(bk1(G))}Q.value.push(Y)}return Q}function tD8(J){var Q=[];for(var Y=0;Y<J.length;++Y)Q.push(sD8(J[Y]));return Q}function bk1(J){var Q;if(J.type===m6.pki.oids.contentType)Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.value).getBytes());else if(J.type===m6.pki.oids.messageDigest)Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.value.bytes());else if(J.type===m6.pki.oids.signingTime){var Y=new Date("1950-01-01T00:00:00Z"),X=new Date("2050-01-01T00:00:00Z"),G=J.value;if(typeof G==="string"){var Z=Date.parse(G);if(!isNaN(Z))G=new Date(Z);else if(G.length===13)G=Y0.utcTimeToDate(G);else G=Y0.generalizedTimeToDate(G)}if(G>=Y&&G<X)Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.UTCTIME,!1,Y0.dateToUtcTime(G));else Q=Y0.create(Y0.Class.UNIVERSAL,Y0.Type.GENERALIZEDTIME,!1,Y0.dateToGeneralizedTime(G))}return Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.type).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SET,!0,[Q])])}function eD8(J){return[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(m6.pki.oids.data).getBytes()),Y0.create(Y0.Class.UNIVERSAL,Y0.Type.SEQUENCE,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OID,!1,Y0.oidToDer(J.algorithm).getBytes()),!J.parameter?void 0:Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.parameter.getBytes())]),Y0.create(Y0.Class.CONTEXT_SPECIFIC,0,!0,[Y0.create(Y0.Class.UNIVERSAL,Y0.Type.OCTETSTRING,!1,J.content.getBytes())])]}function uk1(J,Q,Y){var X={},G=[];if(!Y0.validate(Q,Y,X,G)){var Z=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw Z.errors=Z,Z}var q=Y0.derToOid(X.contentType);if(q!==m6.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(X.encryptedContent){var V="";if(m6.util.isArray(X.encryptedContent))for(var K=0;K<X.encryptedContent.length;++K){if(X.encryptedContent[K].type!==Y0.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");V+=X.encryptedContent[K].value}else V=X.encryptedContent;J.encryptedContent={algorithm:Y0.derToOid(X.encAlgorithm),parameter:m6.util.createBuffer(X.encParameter.value),content:m6.util.createBuffer(V)}}if(X.content){var V="";if(m6.util.isArray(X.content))for(var K=0;K<X.content.length;++K){if(X.content[K].type!==Y0.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");V+=X.content[K].value}else V=X.content;J.content=m6.util.createBuffer(V)}return J.version=X.version.charCodeAt(0),J.rawCapture=X,X}function TX6(J){if(J.encryptedContent.key===void 0)throw Error("Symmetric key not available.");if(J.content===void 0){var Q;switch(J.encryptedContent.algorithm){case m6.pki.oids["aes128-CBC"]:case m6.pki.oids["aes192-CBC"]:case m6.pki.oids["aes256-CBC"]:Q=m6.aes.createDecryptionCipher(J.encryptedContent.key);break;case m6.pki.oids.desCBC:case m6.pki.oids["des-EDE3-CBC"]:Q=m6.des.createDecryptionCipher(J.encryptedContent.key);break;default:throw Error("Unsupported symmetric cipher, OID "+J.encryptedContent.algorithm)}if(Q.start(J.encryptedContent.parameter),Q.update(J.encryptedContent.content),!Q.finish())throw Error("Symmetric decryption failed.");J.content=Q.output}}});var jX6=h((mZ5,SX6)=>{var p7=m8();eB();FC();o81();DC();i9();var L91=SX6.exports=p7.ssh=p7.ssh||{};L91.privateKeyToPutty=function(J,Q,Y){Y=Y||"",Q=Q||"";var X="ssh-rsa",G=Q===""?"none":"aes256-cbc",Z="PuTTY-User-Key-File-2: "+X+`\r
|
|
4049
4049
|
`;Z+="Encryption: "+G+`\r
|
|
4050
4050
|
`,Z+="Comment: "+Y+`\r
|
|
4051
4051
|
`;var q=p7.util.createBuffer();TC(q,X),mK(q,J.e),mK(q,J.n);var V=p7.util.encode64(q.bytes(),64),K=Math.floor(V.length/66)+1;Z+="Public-Lines: "+K+`\r
|
|
@@ -4053,10 +4053,10 @@ ${Y.error.stderr}`;return Z}case"connected":{let Z=J.tools;if(Z instanceof Error
|
|
|
4053
4053
|
Private-Lines: `+K+`\r
|
|
4054
4054
|
`,Z+=H;var L=M91("putty-private-key-file-mac-key",Q),w=p7.util.createBuffer();TC(w,X),TC(w,G),TC(w,Y),w.putInt32(q.length()),w.putBuffer(q),w.putInt32(W.length()),w.putBuffer(W);var I=p7.hmac.create();return I.start("sha1",L),I.update(w.bytes()),Z+=`\r
|
|
4055
4055
|
Private-MAC: `+I.digest().toHex()+`\r
|
|
4056
|
-
`,Z};L91.publicKeyToOpenSSH=function(J,Q){var Y="ssh-rsa";Q=Q||"";var X=p7.util.createBuffer();return TC(X,Y),mK(X,J.e),mK(X,J.n),Y+" "+p7.util.encode64(X.bytes())+" "+Q};L91.privateKeyToOpenSSH=function(J,Q){if(!Q)return p7.pki.privateKeyToPem(J);return p7.pki.encryptRsaPrivateKey(J,Q,{legacy:!0,algorithm:"aes128"})};L91.getPublicKeyFingerprint=function(J,Q){Q=Q||{};var Y=Q.md||p7.md.md5.create(),X="ssh-rsa",G=p7.util.createBuffer();TC(G,X),mK(G,J.e),mK(G,J.n),Y.start(),Y.update(G.getBytes());var Z=Y.digest();if(Q.encoding==="hex"){var q=Z.toHex();if(Q.delimiter)return q.match(/.{2}/g).join(Q.delimiter);return q}else if(Q.encoding==="binary")return Z.getBytes();else if(Q.encoding)throw Error('Unknown encoding "'+Q.encoding+'".');return Z};function mK(J,Q){var Y=Q.toString(16);if(Y[0]>="8")Y="00"+Y;var X=p7.util.hexToBytes(Y);J.putInt32(X.length),J.putBytes(X)}function TC(J,Q){J.putInt32(Q.length),J.putString(Q)}function M91(){var J=p7.md.sha1.create(),Q=arguments.length;for(var Y=0;Y<Q;++Y)J.update(arguments[Y]);return J.digest()}});var kX6=h((
|
|
4056
|
+
`,Z};L91.publicKeyToOpenSSH=function(J,Q){var Y="ssh-rsa";Q=Q||"";var X=p7.util.createBuffer();return TC(X,Y),mK(X,J.e),mK(X,J.n),Y+" "+p7.util.encode64(X.bytes())+" "+Q};L91.privateKeyToOpenSSH=function(J,Q){if(!Q)return p7.pki.privateKeyToPem(J);return p7.pki.encryptRsaPrivateKey(J,Q,{legacy:!0,algorithm:"aes128"})};L91.getPublicKeyFingerprint=function(J,Q){Q=Q||{};var Y=Q.md||p7.md.md5.create(),X="ssh-rsa",G=p7.util.createBuffer();TC(G,X),mK(G,J.e),mK(G,J.n),Y.start(),Y.update(G.getBytes());var Z=Y.digest();if(Q.encoding==="hex"){var q=Z.toHex();if(Q.delimiter)return q.match(/.{2}/g).join(Q.delimiter);return q}else if(Q.encoding==="binary")return Z.getBytes();else if(Q.encoding)throw Error('Unknown encoding "'+Q.encoding+'".');return Z};function mK(J,Q){var Y=Q.toString(16);if(Y[0]>="8")Y="00"+Y;var X=p7.util.hexToBytes(Y);J.putInt32(X.length),J.putBytes(X)}function TC(J,Q){J.putInt32(Q.length),J.putString(Q)}function M91(){var J=p7.md.sha1.create(),Q=arguments.length;for(var Y=0;Y<Q;++Y)J.update(arguments[Y]);return J.digest()}});var kX6=h((pZ5,_X6)=>{_X6.exports=m8();eB();JX6();Mq();d81();Kg();DX6();FC();AX6();wX6();PX6();Hk1();J91();VA();Xk1();Uk1();CX6();Nk1();Zk1();o_1();q91();SG();e_1();jX6();Ek1();i9()});var vX6=h((dZ5,yX6)=>{yX6.exports={dc:"0.9.2342.19200300.100.1.25"}});var gk1=h((cZ5,xX6)=>{var A91;xX6.exports=JO8;function JO8(){var J,Q,Y,X;if(!A91){A91=kX6(),J=A91.oids;for(Q in Y=vX6())X=Y[Q],J[Q]==null&&(J[Q]=X),J[X]==null&&(J[X]=Q)}return A91}});var Lg=h((lZ5,mX6)=>{var E91,pk1,Mg,mk1,fX6,hX6,dk1;mX6.exports=w91;E91=gk1();pk1={der:bX6,pem:uX6,txt:QO8,asn1:gX6,x509:YO8};Mg=[];for(mk1 in pk1)fX6=pk1[mk1],w91[mk1]=Mg.length,Mg.push(fX6);w91.forge=w91.x509;hX6=Buffer.isBuffer;dk1=Buffer.from||function(J,Q){return new Buffer(J,Q)};function w91(J,Q){var Y=Mg[J]||Mg[0];if(Q!=null)return Y(Q);else return Y}function bX6(J){if(hX6(J))return J;else return dk1(J,"binary")}function uX6(J){var Q,Y,X,G;J=bX6(J).toString("base64"),Q=["-----BEGIN CERTIFICATE-----"];for(Y=0,X=J.length;Y<X;Y+=64)G=Y,Q.push(J.substr(G,64));return Q.push("-----END CERTIFICATE-----",""),Q.join(`\r
|
|
4057
4057
|
`)}function QO8(J){var Q=gX6(J);return"Subject\t"+Q.subject.value.map(function(Y){return dk1(Y.value[0].value[1].value,"binary").toString("utf8")}).join("/")+`
|
|
4058
4058
|
Valid `+Q.valid.value.map(function(Y){return Y.value}).join(" - ")+`
|
|
4059
|
-
`+uX6(J)}function gX6(J){var Q,Y,X,G;return Q=E91().asn1,J=J.toString("binary"),Y=Q.fromDer(J).value[0].value,X=Y[0],G=X.tagClass===Q.Class.CONTEXT_SPECIFIC&&X.type===0&&X.constructed,Y=Y.slice(G),{serial:Y[0],valid:Y[3],issuer:Y[2],subject:Y[4]}}function YO8(J){return E91().pki.certificateFromAsn1(E91().asn1.fromDer(J.toString("binary")))}});var dX6=h((GO8)=>{GO8.all=XO8;GO8.each=pX6;pX6.async=$O8;function pX6(){var J;ck1(arguments,J={unique:!0,ondata:function(Q){if(typeof J.$cb=="function")J.$cb(Q)}})}function $O8(){var J;ck1(arguments,J={async:!0,ondata:function(Q){if(typeof J.$cb=="function")J.$cb(void 0,Q)},onend:function(){if(typeof J.$cb=="function")J.$cb()}})}function XO8(){var J;return ck1(arguments,{ondata:J=[]}),J}function ck1(J,Q){var Y,X;Y=RC(),X=J[0],Q.unique==null&&(Q.unique=!1),Q.format=X!=null?X:Y.der2.x509,Q.$cb=J[1]||X,Y(Q)}});var rk1=h((iZ5,iX6)=>{var nk1,cX6,lk1,Ag,ak1,ik1;nk1=S1("crypto");cX6=gk1();lk1=Lg();Ag=cX6().asn1;ak1=lk1(lk1.asn1);iX6.exports=WO8;ik1=Buffer.from||function(J,Q){return new Buffer(J,Q)};function VO8(J){var Q=nk1.createHash("sha1");return ak1(J).subject.value.forEach(function(Y){var X,G;if(Y=Ag.copy(Y),X=Y.value[0].value[1],!X.value)return;X.type=Ag.Type.UTF8,G=ik1(X.value,"binary").toString("utf8"),G=G.trim().replace(/[A-Z]+/g,function(Z){return Z.toLowerCase()}).replace(/\s+/g," "),X.value=ik1(G,"utf8").toString("binary"),Q.update(Ag.toDer(Y).getBytes(),"binary")}),lX6(Q)}function KO8(J){var Q,Y;return Q=nk1.createHash("md5"),Y=ak1(J).subject,Q.update(Ag.toDer(Y).getBytes(),"binary"),lX6(Q)}function lX6(J){return J=J.digest().slice(0,4),J.writeUInt32LE(J.readUInt32BE(0),0),J.toString("hex")}function WO8(J,Q){var Y=J===0?KO8:VO8;if(Q!=null)return Y(Q);else return Y}});var sk1=h((nZ5,tX6)=>{var aX6,Eg,ok1,rX6,I91,VN,Ig,wg;aX6=S1("https");Eg=S1("tls");ok1=Lg();tX6.exports=oX6;oX6.inject=sX6;rX6=ok1(ok1.pem);I91=aX6.globalAgent.options;VN=[];function oX6(J){return sX6(J,[]),HO8}function HO8(J){VN.push(rX6(J))}Ig=0;function sX6(J,Q){if(Q)VN.length=0,VN.push.apply(VN,Q);if(J=J==="+"?2:J?1:0,J===Ig)return;switch(Ig){case 1:if(I91.ca===VN)delete I91.ca;break;case 2:if(Eg.createSecureContext===nX6)Eg.createSecureContext=wg,wg=void 0}switch(Ig=J){case 1:I91.ca=VN;break;case 2:if(!wg)wg=Eg.createSecureContext,Eg.createSecureContext=nX6}}function nX6(J){var Q,Y,X,G,Z;if(Q=wg.apply(this,arguments),Ig===2&&!(J!=null&&J.ca))for(Y=0,G=(X=VN).length;Y<G;++Y)Z=X[Y],Q.context.addCACert(Z);return Q}});var QG6=h((eX6,JG6)=>{var zO8=S1("stream");eX6=JG6.exports=tk1;tk1.through=tk1;function tk1(J,Q,Y){J=J||function(H){this.queue(H)},Q=Q||function(){this.queue(null)};var X=!1,G=!1,Z=[],q=!1,V=new zO8;V.readable=V.writable=!0,V.paused=!1,V.autoDestroy=!(Y&&Y.autoDestroy===!1),V.write=function(H){return J.call(this,H),!V.paused};function K(){while(Z.length&&!V.paused){var H=Z.shift();if(H===null)return V.emit("end");else V.emit("data",H)}}V.queue=V.push=function(H){if(q)return V;if(H===null)q=!0;return Z.push(H),K(),V},V.on("end",function(){if(V.readable=!1,!V.writable&&V.autoDestroy)process.nextTick(function(){V.destroy()})});function W(){if(V.writable=!1,Q.call(V),!V.readable&&V.autoDestroy)V.destroy()}return V.end=function(H){if(X)return;if(X=!0,arguments.length)V.write(H);return W(),V},V.destroy=function(){if(G)return;return G=!0,X=!0,Z.length=0,V.writable=V.readable=!1,V.emit("close"),V},V.pause=function(){if(V.paused)return;return V.paused=!0,V},V.resume=function(){if(V.paused)V.paused=!1,V.emit("resume");if(K(),!V.paused)V.emit("drain");return V},V}});var $G6=h((aZ5,YG6)=>{var FO8=QG6(),UO8=S1("string_decoder").StringDecoder;YG6.exports=BO8;function BO8(J,Q,Y){var X=new UO8,G="",Z=Y&&Y.maxLength,q=Y&&Y.trailing===!1?!1:!0;if(typeof J==="function")Q=J,J=null;if(!J)J=/\r?\n/;function V(W,H){if(Q){try{H=Q(H)}catch(z){return W.emit("error",z)}if(typeof H<"u")W.queue(H)}else W.queue(H)}function K(W,H){var z=((G!=null?G:"")+H).split(J);if(G=z.pop(),Z&&G.length>Z)return W.emit("error",Error("maximum buffer reached"));for(var U=0;U<z.length;U++){var N=z[U];V(W,N)}}return FO8(function(W){K(this,X.write(W))},function(){if(X.end)K(this,X.end());if(q&&G!=null)V(this,G);this.queue(null)})}});var Yy1=h((P91)=>{var __dirname="/home/runner/work/amp/amp/node_modules/.pnpm/win-ca@3.5.1/node_modules/win-ca/lib",XG6,ek1,GG6,T91,Jy1,ZG6,Qy1=typeof P91<"u"&&P91||P91;XG6=S1("path");ek1=S1("child_process");GG6=$G6();Jy1={maxBuffer:1073741824};function qG6(J){var Q;return J==null&&(J="roots.exe"),Q=T91,T91=XG6.resolve(__dirname,J),Q}qG6();Qy1.exe=qG6;Qy1.sync=NO8;function NO8(J){var Q,Y;return{run:Z,next:X,done:G};function X(){if(!Q)Q=[],Y=0,Z(function(q){if(q)Q.push(q)});if(Y<Q.length)return Q[Y++];Q=[]}function G(){Q=[]}function Z(q){VG6(q).on("end",function(){q()}).end(ek1.execFileSync(T91,J,Jy1))}}Qy1.async=DO8;function DO8(J){var Q,Y,X;return{run:K,next:G,done:q};function G(){if(!Q)Q=[],Y=[],K(Z);return Q.length?Promise.resolve(Q.shift()):X?Promise.resolve():new Promise(function(W){Y.push(W)})}function Z(W){if(X)return;if(!W)V();else if(Y.length)Y.shift()(W);else Q.push(W)}function q(){Q=[],V()}function V(){var W,H,z,U;X=!0;for(W=0,z=(H=Y).length;W<z;++W)U=H[W],U()}function K(W){ek1.execFile(T91,J,Jy1,function(){}).stdout.pipe(VG6(W)).on("end",function(){W()})}}function VG6(J){return GG6(function(Q){if(Q.length)J(ZG6(Q,"hex"))})}ZG6=Buffer.from||function(J,Q){return new Buffer(J,Q)}});var HG6=h((R91)=>{var OO8,KG6=typeof R91<"u"&&R91||R91;KG6.sync=WG6;function WG6(){return{next:function(){},done:function(){},run:function(J){return J()}}}KG6.async=OO8=WG6});var UG6=h((C91)=>{var $y1,zG6=typeof C91<"u"&&C91||C91;$y1=S1("./crypt32-"+process.arch);zG6.sync=FG6;function FG6(J){var Q,Y;return Y=J.length?0:-1,{next:X,done:G,run:Z};function X(){var q;while(Y<J.length){if(Q==null&&(Q=Y<0?$y1():$y1(J[Y])),q=Q.next())return q;Q.done(),Q=void 0,Y++}}function G(){if(Q!=null)Q.done();Q=void 0,Y=J.length}function Z(q){var V;while(V=X())q(V);q()}}zG6.async=MO8;function MO8(J){var Q,Y;return Q=FG6(J),Y=Q.next,Q.run=X,Q;function X(G){function Z(){return Promise.resolve().then(Y).then(function(q){if(q)return G(q),Z();G()})}Z()}}});var DG6=h((eZ5,NG6)=>{var BG6;BG6=S1("crypto");NG6.exports=LO8;function LO8(){var J=new Set;function Q(Y){var X=BG6.createHash("sha256").update(Y).digest("base64");if(!J.has(X))return J.add(X),!0}return Q}});var LG6=h((Jq5,MG6)=>{var OG6=(J,Q)=>function(){let Y=Q.promiseModule,X=Array(arguments.length);for(let G=0;G<arguments.length;G++)X[G]=arguments[G];return new Y((G,Z)=>{if(Q.errorFirst)X.push(function(q,V){if(Q.multiArgs){let K=Array(arguments.length-1);for(let W=1;W<arguments.length;W++)K[W-1]=arguments[W];if(q)K.unshift(q),Z(K);else G(K)}else if(q)Z(q);else G(V)});else X.push(function(q){if(Q.multiArgs){let V=Array(arguments.length-1);for(let K=0;K<arguments.length;K++)V[K]=arguments[K];G(V)}else G(q)});J.apply(this,X)})};MG6.exports=(J,Q)=>{Q=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},Q);let Y=(G)=>{let Z=(q)=>typeof q==="string"?G===q:q.test(G);return Q.include?Q.include.some(Z):!Q.exclude.some(Z)},X;if(typeof J==="function")X=function(){if(Q.excludeMain)return J.apply(this,arguments);return OG6(J,Q).apply(this,arguments)};else X=Object.create(Object.getPrototypeOf(J));for(let G in J){let Z=J[G];X[G]=typeof Z==="function"&&Y(G)?OG6(Z,Q):Z}return X}});var IG6=h((Qq5,Xy1)=>{var AO8=S1("fs"),DA=S1("path"),AG6=LG6(),EG6={mode:511&~process.umask(),fs:AO8},wG6=(J)=>{if(process.platform==="win32"){if(/[<>:"|?*]/.test(J.replace(DA.parse(J).root,""))){let Y=Error(`Path contains invalid characters: ${J}`);throw Y.code="EINVAL",Y}}};Xy1.exports=(J,Q)=>Promise.resolve().then(()=>{wG6(J),Q=Object.assign({},EG6,Q);let Y=AG6(Q.fs.mkdir),X=AG6(Q.fs.stat),G=(Z)=>{return Y(Z,Q.mode).then(()=>Z).catch((q)=>{if(q.code==="ENOENT"){if(q.message.includes("null bytes")||DA.dirname(Z)===Z)throw q;return G(DA.dirname(Z)).then(()=>G(Z))}return X(Z).then((V)=>V.isDirectory()?Z:Promise.reject()).catch(()=>{throw q})})};return G(DA.resolve(J))});Xy1.exports.sync=(J,Q)=>{wG6(J),Q=Object.assign({},EG6,Q);let Y=(X)=>{try{Q.fs.mkdirSync(X,Q.mode)}catch(G){if(G.code==="ENOENT"){if(G.message.includes("null bytes")||DA.dirname(X)===X)throw G;return Y(DA.dirname(X)),Y(X)}try{if(!Q.fs.statSync(X).isDirectory())throw Error("The path is not a directory")}catch(Z){throw G}}return X};return Y(DA.resolve(J))}});var vG6=h((Yq5,yG6)=>{var __dirname="/home/runner/work/amp/amp/node_modules/.pnpm/win-ca@3.5.1/node_modules/win-ca/lib",Tg,PG6,Pg,TG6,Zy1,RG6,CG6,SG6,jG6,_G6,kG6;Tg=S1("fs");PG6=S1("os");Pg=S1("path");TG6=IG6();Zy1=Lg();RG6=rk1();yG6.exports=EO8;CG6=Zy1(Zy1.txt);SG6=RG6();jG6=qy1(Tg.writeFile);_G6=qy1(Tg.readdir);kG6=qy1(Tg.unlink);function EO8(J){var Q,Y,X,G,Z;return G={},Z=new Set,q;function q(z){return Promise.resolve(z).then(V)}function V(z){if(z)Y||(Y=IO8(J.save||J.$ave).then(function(U){return Q=U})),Y=Y.then(function(){if(Q)return K(z)});else if(Y)Y.then(H).then(function(){if(X!=null)X.end();if(Q&&J.$ave)process.env.SSL_CERT_DIR=RC().path=Q;if(typeof J.onsave=="function")J.onsave(Q)});else if(typeof J.onsave=="function")J.onsave()}function K(z){var U,N;return(X||(X=Tg.createWriteStream(W("roots.pem")))).write(U=CG6(z)),G[N=SG6(z)]||(G[N]=0),jG6(W(N+"."+G[N]++),U).catch(Gy1)}function W(z){return Z.add(z),Pg.join(Q,z)}function H(){if(Q)_G6(Q).then(function(z){return Promise.all(z.filter(function(U){return!Z.has(U)}).map(function(U){return Pg.join(Q,U)}).map(function(U){return kG6(U).catch(Gy1)}))}).catch(Gy1)}}function wO8(){return[Pg.join(__dirname,"../pem"),Pg.join(PG6.homedir(),".local/win-ca/pem")]}function IO8(J){var Q;if(typeof J==="string")J=[J];else if(!Array.isArray(J))J=wO8();return Q=0,Y();function Y(){if(Q<J.length)return TG6(J[Q++]).catch(Y);else return Promise.resolve()}}function qy1(J){return function(){var Q,Y=this;return Q=[].slice.call(arguments),new Promise(function(X,G){Q.push(Z),J.apply(Y,Q);function Z(q,V){if(q)G(q);else X(V)}})}}function Gy1(){}});var RC=h(($q5,bG6)=>{var Vy1,fG6,hG6;bG6.exports=dQ;dQ.disabled=Vy1=process.platform!=="win32";dQ.nApi=fG6=!!process.versions.napi&&dQ===RC()&&!(dQ.electron=LY6()());dQ.der2=hG6=Lg();dQ.hash=PO8;dQ.inject=TO8;dQ.exe=RO8;CO8(dQ,dX6());if(!Vy1&&dQ===RC())dQ({inject:!0,$ave:!0,async:!0});function PO8(){return(dQ.hash=rk1()).apply(this,arguments)}function TO8(){return(dQ.inject=sk1().inject).apply(this,arguments)}function RO8(){return(dQ.exe=Yy1().exe).apply(this,arguments)}function dQ(J){var Q,Y,X,G,Z,q,V,K,W;if(J==null&&(J={}),Q=Vy1||J.disabled?HG6():((Y=J.fallback)!=null?Y:!fG6)?Yy1():UG6(),!(X=J.store))X=[];else if(!Array.isArray(X))X=[X];if(Q=Q[(G=J.async)?"async":"sync"](X),Z=G?z:H,J.unique!==!1)q=DG6()();if(V=hG6(J.format),Array.isArray(J.ondata))J.ondata=J.ondata.push.bind(J.ondata);if(J.save||J.$ave)K=vG6()(J);if(J.inject)W=sk1()(J.inject);if(J.generator)return(G?N:U)();Q.run(function(I){if(!I||!q||q(I))Z(I)});function H(I){if(K)K(I);if(I){if(W)W(I);if(typeof J.ondata=="function")J.ondata(V(I))}else if(typeof J.onend=="function")J.onend()}function z(I){Promise.resolve(I).then(H)}function U(){var I;return I={},I[Symbol.iterator]=xG6,I.return=M,I.next=L,I}function N(){var I,P;return I={},I[(P=Symbol.asyncIterator)!=null?P:"@"]=xG6,I.return=M,I.next=w,I}function O(I){return Z(I),{done:!I,value:I!=null?V(I):I}}function M(I){return Q.done(),{done:!0,value:I}}function L(){var I;while((I=Q.next())&&q&&!q(I));return O(I)}function w(){function I(){return Promise.resolve().then(Q.next).then(function(P){if(P&&q&&!q(P))return I();else return O(P)})}return I()}}function xG6(){return this}function CO8(J,Q){for(var Y in Q)J[Y]=Q[Y];return J}});var uG6={};v8(uG6,{initializeToolProviders:()=>_O8});function SO8(J){return"invokeTool"in J}function jO8(J){return{...J.toolService,registerTool:(Y)=>J.registerTool(Y)}}async function _O8({toolServices:J,providers:Q,initialTimeout:Y=5000}){let X=new Map,G=new Map,Z=SO8(J)?J:jO8(J);for(let q of Q)try{let V=q.registerToolsWithToolService(Z);X.set(q.name,V),x.debug(`Started continuous registration for ${q.name}`)}catch(V){x.error(`Failed to start registration for ${q.name}:`,V),G.set(q.name,V)}return await Promise.all(Q.map(async(q)=>{try{await Promise.race([q.initialized,new Promise((V,K)=>setTimeout(()=>K(Error("Initial scan timeout")),Y))]),x.debug(`${q.name} initial scan complete`)}catch(V){x.warn(`${q.name} initial scan slow:`,V),G.set(q.name,V)}})),{registrations:X,initErrors:G}}var gG6=G1(()=>{H0()});PW();H0();var E_=q6(j6(),1),lH0=q6(Tm(),1),TX1=q6(J8(),1),iH0=q6(it1(),1),nH0=q6(QZ(),1),aH0=q6(uH0(),1),Yw=q6(VD(),1),mc=q6(uz(),1);import{appendFileSync as TJ4,mkdirSync as RJ4}from"node:fs";import CJ4,{join as SJ4}from"node:path";var jJ4=CJ4.join(VV,"traces");class rH0 extends iH0.InstrumentationBase{originalFetch;constructor(J={}){super("fetch-instrumentation","1.0.0",J)}init(){}enable(){this.originalFetch=globalThis.fetch;let J=this.tracer,Q=this.originalFetch;globalThis.fetch=async function(Y,X){let G=typeof Y==="string"?new URL(Y):Y instanceof URL?Y:new URL(Y.url),Z=X?.method||"GET";return J.startActiveSpan(`fetch ${G.pathname}${G.searchParams.size>0?"?"+G.searchParams.toString():""}`,{kind:E_.SpanKind.CLIENT,attributes:{[mc.ATTR_HTTP_REQUEST_METHOD]:Z,[mc.ATTR_URL_FULL]:G.toString()}},async(q)=>{try{let V=await Q.call(globalThis,Y,X);if(q.setAttribute("http.response.status_code",V.status),V.status>=400)q.setStatus({code:E_.SpanStatusCode.ERROR,message:`HTTP ${V.status}`});return q.end(),V}catch(V){throw q.recordException(V instanceof Error?V:Error(String(V))),q.setStatus({code:E_.SpanStatusCode.ERROR,message:V instanceof Error?V.message:String(V)}),q.end(),V}})}}disable(){if(this.originalFetch)globalThis.fetch=this.originalFetch}}class oH0{filepath;constructor(J){RJ4(J,{recursive:!0});let Q=new Date().toISOString().replace(/[:.]/g,"-");this.filepath=SJ4(J,`trace-${Q}.json`)}export(J,Q){try{let Y=Buffer.from(`
|
|
4059
|
+
`+uX6(J)}function gX6(J){var Q,Y,X,G;return Q=E91().asn1,J=J.toString("binary"),Y=Q.fromDer(J).value[0].value,X=Y[0],G=X.tagClass===Q.Class.CONTEXT_SPECIFIC&&X.type===0&&X.constructed,Y=Y.slice(G),{serial:Y[0],valid:Y[3],issuer:Y[2],subject:Y[4]}}function YO8(J){return E91().pki.certificateFromAsn1(E91().asn1.fromDer(J.toString("binary")))}});var dX6=h((GO8)=>{GO8.all=XO8;GO8.each=pX6;pX6.async=$O8;function pX6(){var J;ck1(arguments,J={unique:!0,ondata:function(Q){if(typeof J.$cb=="function")J.$cb(Q)}})}function $O8(){var J;ck1(arguments,J={async:!0,ondata:function(Q){if(typeof J.$cb=="function")J.$cb(void 0,Q)},onend:function(){if(typeof J.$cb=="function")J.$cb()}})}function XO8(){var J;return ck1(arguments,{ondata:J=[]}),J}function ck1(J,Q){var Y,X;Y=RC(),X=J[0],Q.unique==null&&(Q.unique=!1),Q.format=X!=null?X:Y.der2.x509,Q.$cb=J[1]||X,Y(Q)}});var rk1=h((nZ5,iX6)=>{var nk1,cX6,lk1,Ag,ak1,ik1;nk1=S1("crypto");cX6=gk1();lk1=Lg();Ag=cX6().asn1;ak1=lk1(lk1.asn1);iX6.exports=WO8;ik1=Buffer.from||function(J,Q){return new Buffer(J,Q)};function VO8(J){var Q=nk1.createHash("sha1");return ak1(J).subject.value.forEach(function(Y){var X,G;if(Y=Ag.copy(Y),X=Y.value[0].value[1],!X.value)return;X.type=Ag.Type.UTF8,G=ik1(X.value,"binary").toString("utf8"),G=G.trim().replace(/[A-Z]+/g,function(Z){return Z.toLowerCase()}).replace(/\s+/g," "),X.value=ik1(G,"utf8").toString("binary"),Q.update(Ag.toDer(Y).getBytes(),"binary")}),lX6(Q)}function KO8(J){var Q,Y;return Q=nk1.createHash("md5"),Y=ak1(J).subject,Q.update(Ag.toDer(Y).getBytes(),"binary"),lX6(Q)}function lX6(J){return J=J.digest().slice(0,4),J.writeUInt32LE(J.readUInt32BE(0),0),J.toString("hex")}function WO8(J,Q){var Y=J===0?KO8:VO8;if(Q!=null)return Y(Q);else return Y}});var sk1=h((aZ5,tX6)=>{var aX6,Eg,ok1,rX6,I91,VN,Ig,wg;aX6=S1("https");Eg=S1("tls");ok1=Lg();tX6.exports=oX6;oX6.inject=sX6;rX6=ok1(ok1.pem);I91=aX6.globalAgent.options;VN=[];function oX6(J){return sX6(J,[]),HO8}function HO8(J){VN.push(rX6(J))}Ig=0;function sX6(J,Q){if(Q)VN.length=0,VN.push.apply(VN,Q);if(J=J==="+"?2:J?1:0,J===Ig)return;switch(Ig){case 1:if(I91.ca===VN)delete I91.ca;break;case 2:if(Eg.createSecureContext===nX6)Eg.createSecureContext=wg,wg=void 0}switch(Ig=J){case 1:I91.ca=VN;break;case 2:if(!wg)wg=Eg.createSecureContext,Eg.createSecureContext=nX6}}function nX6(J){var Q,Y,X,G,Z;if(Q=wg.apply(this,arguments),Ig===2&&!(J!=null&&J.ca))for(Y=0,G=(X=VN).length;Y<G;++Y)Z=X[Y],Q.context.addCACert(Z);return Q}});var QG6=h((eX6,JG6)=>{var zO8=S1("stream");eX6=JG6.exports=tk1;tk1.through=tk1;function tk1(J,Q,Y){J=J||function(H){this.queue(H)},Q=Q||function(){this.queue(null)};var X=!1,G=!1,Z=[],q=!1,V=new zO8;V.readable=V.writable=!0,V.paused=!1,V.autoDestroy=!(Y&&Y.autoDestroy===!1),V.write=function(H){return J.call(this,H),!V.paused};function K(){while(Z.length&&!V.paused){var H=Z.shift();if(H===null)return V.emit("end");else V.emit("data",H)}}V.queue=V.push=function(H){if(q)return V;if(H===null)q=!0;return Z.push(H),K(),V},V.on("end",function(){if(V.readable=!1,!V.writable&&V.autoDestroy)process.nextTick(function(){V.destroy()})});function W(){if(V.writable=!1,Q.call(V),!V.readable&&V.autoDestroy)V.destroy()}return V.end=function(H){if(X)return;if(X=!0,arguments.length)V.write(H);return W(),V},V.destroy=function(){if(G)return;return G=!0,X=!0,Z.length=0,V.writable=V.readable=!1,V.emit("close"),V},V.pause=function(){if(V.paused)return;return V.paused=!0,V},V.resume=function(){if(V.paused)V.paused=!1,V.emit("resume");if(K(),!V.paused)V.emit("drain");return V},V}});var $G6=h((rZ5,YG6)=>{var FO8=QG6(),UO8=S1("string_decoder").StringDecoder;YG6.exports=BO8;function BO8(J,Q,Y){var X=new UO8,G="",Z=Y&&Y.maxLength,q=Y&&Y.trailing===!1?!1:!0;if(typeof J==="function")Q=J,J=null;if(!J)J=/\r?\n/;function V(W,H){if(Q){try{H=Q(H)}catch(z){return W.emit("error",z)}if(typeof H<"u")W.queue(H)}else W.queue(H)}function K(W,H){var z=((G!=null?G:"")+H).split(J);if(G=z.pop(),Z&&G.length>Z)return W.emit("error",Error("maximum buffer reached"));for(var U=0;U<z.length;U++){var N=z[U];V(W,N)}}return FO8(function(W){K(this,X.write(W))},function(){if(X.end)K(this,X.end());if(q&&G!=null)V(this,G);this.queue(null)})}});var Yy1=h((P91)=>{var __dirname="/home/runner/work/amp/amp/node_modules/.pnpm/win-ca@3.5.1/node_modules/win-ca/lib",XG6,ek1,GG6,T91,Jy1,ZG6,Qy1=typeof P91<"u"&&P91||P91;XG6=S1("path");ek1=S1("child_process");GG6=$G6();Jy1={maxBuffer:1073741824};function qG6(J){var Q;return J==null&&(J="roots.exe"),Q=T91,T91=XG6.resolve(__dirname,J),Q}qG6();Qy1.exe=qG6;Qy1.sync=NO8;function NO8(J){var Q,Y;return{run:Z,next:X,done:G};function X(){if(!Q)Q=[],Y=0,Z(function(q){if(q)Q.push(q)});if(Y<Q.length)return Q[Y++];Q=[]}function G(){Q=[]}function Z(q){VG6(q).on("end",function(){q()}).end(ek1.execFileSync(T91,J,Jy1))}}Qy1.async=DO8;function DO8(J){var Q,Y,X;return{run:K,next:G,done:q};function G(){if(!Q)Q=[],Y=[],K(Z);return Q.length?Promise.resolve(Q.shift()):X?Promise.resolve():new Promise(function(W){Y.push(W)})}function Z(W){if(X)return;if(!W)V();else if(Y.length)Y.shift()(W);else Q.push(W)}function q(){Q=[],V()}function V(){var W,H,z,U;X=!0;for(W=0,z=(H=Y).length;W<z;++W)U=H[W],U()}function K(W){ek1.execFile(T91,J,Jy1,function(){}).stdout.pipe(VG6(W)).on("end",function(){W()})}}function VG6(J){return GG6(function(Q){if(Q.length)J(ZG6(Q,"hex"))})}ZG6=Buffer.from||function(J,Q){return new Buffer(J,Q)}});var HG6=h((R91)=>{var OO8,KG6=typeof R91<"u"&&R91||R91;KG6.sync=WG6;function WG6(){return{next:function(){},done:function(){},run:function(J){return J()}}}KG6.async=OO8=WG6});var UG6=h((C91)=>{var $y1,zG6=typeof C91<"u"&&C91||C91;$y1=S1("./crypt32-"+process.arch);zG6.sync=FG6;function FG6(J){var Q,Y;return Y=J.length?0:-1,{next:X,done:G,run:Z};function X(){var q;while(Y<J.length){if(Q==null&&(Q=Y<0?$y1():$y1(J[Y])),q=Q.next())return q;Q.done(),Q=void 0,Y++}}function G(){if(Q!=null)Q.done();Q=void 0,Y=J.length}function Z(q){var V;while(V=X())q(V);q()}}zG6.async=MO8;function MO8(J){var Q,Y;return Q=FG6(J),Y=Q.next,Q.run=X,Q;function X(G){function Z(){return Promise.resolve().then(Y).then(function(q){if(q)return G(q),Z();G()})}Z()}}});var DG6=h((Jq5,NG6)=>{var BG6;BG6=S1("crypto");NG6.exports=LO8;function LO8(){var J=new Set;function Q(Y){var X=BG6.createHash("sha256").update(Y).digest("base64");if(!J.has(X))return J.add(X),!0}return Q}});var LG6=h((Qq5,MG6)=>{var OG6=(J,Q)=>function(){let Y=Q.promiseModule,X=Array(arguments.length);for(let G=0;G<arguments.length;G++)X[G]=arguments[G];return new Y((G,Z)=>{if(Q.errorFirst)X.push(function(q,V){if(Q.multiArgs){let K=Array(arguments.length-1);for(let W=1;W<arguments.length;W++)K[W-1]=arguments[W];if(q)K.unshift(q),Z(K);else G(K)}else if(q)Z(q);else G(V)});else X.push(function(q){if(Q.multiArgs){let V=Array(arguments.length-1);for(let K=0;K<arguments.length;K++)V[K]=arguments[K];G(V)}else G(q)});J.apply(this,X)})};MG6.exports=(J,Q)=>{Q=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},Q);let Y=(G)=>{let Z=(q)=>typeof q==="string"?G===q:q.test(G);return Q.include?Q.include.some(Z):!Q.exclude.some(Z)},X;if(typeof J==="function")X=function(){if(Q.excludeMain)return J.apply(this,arguments);return OG6(J,Q).apply(this,arguments)};else X=Object.create(Object.getPrototypeOf(J));for(let G in J){let Z=J[G];X[G]=typeof Z==="function"&&Y(G)?OG6(Z,Q):Z}return X}});var IG6=h((Yq5,Xy1)=>{var AO8=S1("fs"),DA=S1("path"),AG6=LG6(),EG6={mode:511&~process.umask(),fs:AO8},wG6=(J)=>{if(process.platform==="win32"){if(/[<>:"|?*]/.test(J.replace(DA.parse(J).root,""))){let Y=Error(`Path contains invalid characters: ${J}`);throw Y.code="EINVAL",Y}}};Xy1.exports=(J,Q)=>Promise.resolve().then(()=>{wG6(J),Q=Object.assign({},EG6,Q);let Y=AG6(Q.fs.mkdir),X=AG6(Q.fs.stat),G=(Z)=>{return Y(Z,Q.mode).then(()=>Z).catch((q)=>{if(q.code==="ENOENT"){if(q.message.includes("null bytes")||DA.dirname(Z)===Z)throw q;return G(DA.dirname(Z)).then(()=>G(Z))}return X(Z).then((V)=>V.isDirectory()?Z:Promise.reject()).catch(()=>{throw q})})};return G(DA.resolve(J))});Xy1.exports.sync=(J,Q)=>{wG6(J),Q=Object.assign({},EG6,Q);let Y=(X)=>{try{Q.fs.mkdirSync(X,Q.mode)}catch(G){if(G.code==="ENOENT"){if(G.message.includes("null bytes")||DA.dirname(X)===X)throw G;return Y(DA.dirname(X)),Y(X)}try{if(!Q.fs.statSync(X).isDirectory())throw Error("The path is not a directory")}catch(Z){throw G}}return X};return Y(DA.resolve(J))}});var vG6=h(($q5,yG6)=>{var __dirname="/home/runner/work/amp/amp/node_modules/.pnpm/win-ca@3.5.1/node_modules/win-ca/lib",Tg,PG6,Pg,TG6,Zy1,RG6,CG6,SG6,jG6,_G6,kG6;Tg=S1("fs");PG6=S1("os");Pg=S1("path");TG6=IG6();Zy1=Lg();RG6=rk1();yG6.exports=EO8;CG6=Zy1(Zy1.txt);SG6=RG6();jG6=qy1(Tg.writeFile);_G6=qy1(Tg.readdir);kG6=qy1(Tg.unlink);function EO8(J){var Q,Y,X,G,Z;return G={},Z=new Set,q;function q(z){return Promise.resolve(z).then(V)}function V(z){if(z)Y||(Y=IO8(J.save||J.$ave).then(function(U){return Q=U})),Y=Y.then(function(){if(Q)return K(z)});else if(Y)Y.then(H).then(function(){if(X!=null)X.end();if(Q&&J.$ave)process.env.SSL_CERT_DIR=RC().path=Q;if(typeof J.onsave=="function")J.onsave(Q)});else if(typeof J.onsave=="function")J.onsave()}function K(z){var U,N;return(X||(X=Tg.createWriteStream(W("roots.pem")))).write(U=CG6(z)),G[N=SG6(z)]||(G[N]=0),jG6(W(N+"."+G[N]++),U).catch(Gy1)}function W(z){return Z.add(z),Pg.join(Q,z)}function H(){if(Q)_G6(Q).then(function(z){return Promise.all(z.filter(function(U){return!Z.has(U)}).map(function(U){return Pg.join(Q,U)}).map(function(U){return kG6(U).catch(Gy1)}))}).catch(Gy1)}}function wO8(){return[Pg.join(__dirname,"../pem"),Pg.join(PG6.homedir(),".local/win-ca/pem")]}function IO8(J){var Q;if(typeof J==="string")J=[J];else if(!Array.isArray(J))J=wO8();return Q=0,Y();function Y(){if(Q<J.length)return TG6(J[Q++]).catch(Y);else return Promise.resolve()}}function qy1(J){return function(){var Q,Y=this;return Q=[].slice.call(arguments),new Promise(function(X,G){Q.push(Z),J.apply(Y,Q);function Z(q,V){if(q)G(q);else X(V)}})}}function Gy1(){}});var RC=h((Xq5,bG6)=>{var Vy1,fG6,hG6;bG6.exports=dQ;dQ.disabled=Vy1=process.platform!=="win32";dQ.nApi=fG6=!!process.versions.napi&&dQ===RC()&&!(dQ.electron=LY6()());dQ.der2=hG6=Lg();dQ.hash=PO8;dQ.inject=TO8;dQ.exe=RO8;CO8(dQ,dX6());if(!Vy1&&dQ===RC())dQ({inject:!0,$ave:!0,async:!0});function PO8(){return(dQ.hash=rk1()).apply(this,arguments)}function TO8(){return(dQ.inject=sk1().inject).apply(this,arguments)}function RO8(){return(dQ.exe=Yy1().exe).apply(this,arguments)}function dQ(J){var Q,Y,X,G,Z,q,V,K,W;if(J==null&&(J={}),Q=Vy1||J.disabled?HG6():((Y=J.fallback)!=null?Y:!fG6)?Yy1():UG6(),!(X=J.store))X=[];else if(!Array.isArray(X))X=[X];if(Q=Q[(G=J.async)?"async":"sync"](X),Z=G?z:H,J.unique!==!1)q=DG6()();if(V=hG6(J.format),Array.isArray(J.ondata))J.ondata=J.ondata.push.bind(J.ondata);if(J.save||J.$ave)K=vG6()(J);if(J.inject)W=sk1()(J.inject);if(J.generator)return(G?N:U)();Q.run(function(I){if(!I||!q||q(I))Z(I)});function H(I){if(K)K(I);if(I){if(W)W(I);if(typeof J.ondata=="function")J.ondata(V(I))}else if(typeof J.onend=="function")J.onend()}function z(I){Promise.resolve(I).then(H)}function U(){var I;return I={},I[Symbol.iterator]=xG6,I.return=M,I.next=L,I}function N(){var I,P;return I={},I[(P=Symbol.asyncIterator)!=null?P:"@"]=xG6,I.return=M,I.next=w,I}function O(I){return Z(I),{done:!I,value:I!=null?V(I):I}}function M(I){return Q.done(),{done:!0,value:I}}function L(){var I;while((I=Q.next())&&q&&!q(I));return O(I)}function w(){function I(){return Promise.resolve().then(Q.next).then(function(P){if(P&&q&&!q(P))return I();else return O(P)})}return I()}}function xG6(){return this}function CO8(J,Q){for(var Y in Q)J[Y]=Q[Y];return J}});var uG6={};v8(uG6,{initializeToolProviders:()=>_O8});function SO8(J){return"invokeTool"in J}function jO8(J){return{...J.toolService,registerTool:(Y)=>J.registerTool(Y)}}async function _O8({toolServices:J,providers:Q,initialTimeout:Y=5000}){let X=new Map,G=new Map,Z=SO8(J)?J:jO8(J);for(let q of Q)try{let V=q.registerToolsWithToolService(Z);X.set(q.name,V),x.debug(`Started continuous registration for ${q.name}`)}catch(V){x.error(`Failed to start registration for ${q.name}:`,V),G.set(q.name,V)}return await Promise.all(Q.map(async(q)=>{try{await Promise.race([q.initialized,new Promise((V,K)=>setTimeout(()=>K(Error("Initial scan timeout")),Y))]),x.debug(`${q.name} initial scan complete`)}catch(V){x.warn(`${q.name} initial scan slow:`,V),G.set(q.name,V)}})),{registrations:X,initErrors:G}}var gG6=G1(()=>{H0()});PW();H0();var E_=q6(j6(),1),lH0=q6(Tm(),1),TX1=q6(J8(),1),iH0=q6(it1(),1),nH0=q6(QZ(),1),aH0=q6(uH0(),1),Yw=q6(VD(),1),mc=q6(uz(),1);import{appendFileSync as TJ4,mkdirSync as RJ4}from"node:fs";import CJ4,{join as SJ4}from"node:path";var jJ4=CJ4.join(VV,"traces");class rH0 extends iH0.InstrumentationBase{originalFetch;constructor(J={}){super("fetch-instrumentation","1.0.0",J)}init(){}enable(){this.originalFetch=globalThis.fetch;let J=this.tracer,Q=this.originalFetch;globalThis.fetch=async function(Y,X){let G=typeof Y==="string"?new URL(Y):Y instanceof URL?Y:new URL(Y.url),Z=X?.method||"GET";return J.startActiveSpan(`fetch ${G.pathname}${G.searchParams.size>0?"?"+G.searchParams.toString():""}`,{kind:E_.SpanKind.CLIENT,attributes:{[mc.ATTR_HTTP_REQUEST_METHOD]:Z,[mc.ATTR_URL_FULL]:G.toString()}},async(q)=>{try{let V=await Q.call(globalThis,Y,X);if(q.setAttribute("http.response.status_code",V.status),V.status>=400)q.setStatus({code:E_.SpanStatusCode.ERROR,message:`HTTP ${V.status}`});return q.end(),V}catch(V){throw q.recordException(V instanceof Error?V:Error(String(V))),q.setStatus({code:E_.SpanStatusCode.ERROR,message:V instanceof Error?V.message:String(V)}),q.end(),V}})}}disable(){if(this.originalFetch)globalThis.fetch=this.originalFetch}}class oH0{filepath;constructor(J){RJ4(J,{recursive:!0});let Q=new Date().toISOString().replace(/[:.]/g,"-");this.filepath=SJ4(J,`trace-${Q}.json`)}export(J,Q){try{let Y=Buffer.from(`
|
|
4060
4060
|
`,"utf8"),X=[];for(let G of J){let Z=nH0.JsonTraceSerializer.serializeRequest([G])??new Uint8Array;X.push(Z,Y)}TJ4(this.filepath,Buffer.concat(X)),Q({code:TX1.ExportResultCode.SUCCESS})}catch(Y){x.error("failed to export trace spans",{filepath:this.filepath,error:Y}),Q({code:TX1.ExportResultCode.FAILED,error:Y instanceof Error?Y:Error(String(Y))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}function _J4(){let J=process.env.AMP_ENABLE_TRACING?new Yw.AlwaysOnSampler:new Yw.AlwaysOffSampler;return new aH0.NodeSDK({serviceName:"amp.cli",sampler:J,contextManager:new lH0.AsyncLocalStorageContextManager,spanProcessors:[new Yw.SimpleSpanProcessor(new oH0(jJ4))],instrumentations:[new rH0]})}var kJ4=_J4();kJ4.start();import{randomBytes as kO8}from"node:crypto";import{mkdir as yO8,readFile as cG6,writeFile as vO8}from"node:fs/promises";import xO8 from"node:os";import Ky1 from"node:path";import{stderr as hG,stdout as d5}from"node:process";lc();H0();var iJ4=60;class SX1{deps;constructor(J){this.deps=J}getRelativePath(J){for(let Q of this.deps.workspaceRoots)if(t0.hasPrefix(J,Q)){let Y=t0.relativePath(Q,J);if(Y)return Y}if(this.deps.workspaceRoots.length===0)return J.path.startsWith("/")?J.path.slice(1):J.path;return null}async getCurrentFile(){let J=this.deps.getCurrentFile?.();if(!J)return[];let Q=this.getRelativePath(J);return Q?[Q]:[]}async getOpenFiles(){let J=this.deps.getOpenFiles?.()??[],Q=this.deps.getCurrentFile?.(),Y=J.filter((G)=>!Q||!t0.equalURIs(G,Q)).slice(0,iJ4),X=new Set;for(let G of Y){let Z=this.getRelativePath(G);if(Z)X.add(Z)}return Array.from(X)}async getContext(){let[J,Q]=await Promise.all([this.getCurrentFile(),this.getOpenFiles()]),Y={currentFile:J,openFilesContext:Q};return x.debug("[Ads] Collected codebase context",{currentFile:J,openFilesContext:Q.slice(0,10)}),Y}}g0();H0();var eJ4={workspacePaths:[".agents/commands"],globalPaths:["~/.config/amp/commands"],enableWatching:!0};function JQ4(J,Q){if(J.length!==Q.length)return!1;for(let Y=0;Y<J.length;Y++){let X=J[Y],G=Q[Y];if(!X||!G)return!1;if(X.name!==G.name||X.available!==G.available||X.lastModified!==G.lastModified)return!1}return!0}function mX1(J=eJ4,Q=null){let Y=new f5([]),X=!1,G=null,Z,q=Y.pipe(P4(JQ4),s7((U)=>{return x.warn("Command stream error, using fallback",{error:U}),J0.of([])}),d8());async function V(){if(G)return;let U=await H6(Q);if(!U)return;let{CommandDiscovery:N}=await Promise.resolve().then(() => (jz0(),Sz0));G=new N(J,U),Z={dispose:G.commandChanges.subscribe((O)=>{if(!X)Y.next(O)}).unsubscribe}}async function K(){if(await V(),!G)return x.debug("No workspace roots available, skipping command discovery"),[];return await G.discoverCommands()}async function W(){if(X)return;try{let U=await K();Y.next(U)}catch(U){x.warn("Failed to refresh commands",{error:U})}}async function H(U,N){let M=(await H6(q)).find((P)=>P.name===U&&(!N||P.source===N));if(!M)return;let{available:L,unavailableReason:w,...I}=M;return I}async function z(U,N){return(await H6(q)).find((L)=>L.name===U&&(!N||L.source===N))?.available??!1}return W(),{commands:q,getCommand:H,refreshCommands:W,isCommandAvailable:z,dispose(){X=!0,Z?.dispose(),G?.dispose()}}}H0();import{exec as QQ4}from"node:child_process";import{platform as YQ4}from"node:os";import{promisify as $Q4}from"node:util";var pX1=$Q4(QQ4);async function dJ(J,Q){try{let Y=YQ4(),X={timeout:5000,signal:Q};switch(Y){case"win32":await pX1(`start "" "${J}"`,X);break;case"darwin":await pX1(`open "${J}"`,X);break;default:await pX1(`xdg-open "${J}"`,X);break}x.info("Opened browser with auth URL",{url:J})}catch(Y){throw x.error("Failed to open browser",{error:Y}),Y}}class w8 extends Error{userMessage;exitCode;suggestion;constructor(J,Q=1,Y){super(J);this.userMessage=J;this.exitCode=Q;this.suggestion=Y;this.name="AmpError"}}H0();g0();import HQ4 from"node:fs";import zQ4 from"node:os";function j_(J,Q=!1){let Y=J.length,X=0,G="",Z=0,q=16,V=0,K=0,W=0,H=0,z=0;function U(P,R){let j=0,y=0;while(j<P||!R){let f=J.charCodeAt(X);if(f>=48&&f<=57)y=y*16+f-48;else if(f>=65&&f<=70)y=y*16+f-65+10;else if(f>=97&&f<=102)y=y*16+f-97+10;else break;X++,j++}if(j<P)y=-1;return y}function N(P){X=P,G="",Z=0,q=16,z=0}function O(){let P=X;if(J.charCodeAt(X)===48)X++;else{X++;while(X<J.length&&Vw(J.charCodeAt(X)))X++}if(X<J.length&&J.charCodeAt(X)===46)if(X++,X<J.length&&Vw(J.charCodeAt(X))){X++;while(X<J.length&&Vw(J.charCodeAt(X)))X++}else return z=3,J.substring(P,X);let R=X;if(X<J.length&&(J.charCodeAt(X)===69||J.charCodeAt(X)===101)){if(X++,X<J.length&&J.charCodeAt(X)===43||J.charCodeAt(X)===45)X++;if(X<J.length&&Vw(J.charCodeAt(X))){X++;while(X<J.length&&Vw(J.charCodeAt(X)))X++;R=X}else z=3}return J.substring(P,R)}function M(){let P="",R=X;while(!0){if(X>=Y){P+=J.substring(R,X),z=2;break}let j=J.charCodeAt(X);if(j===34){P+=J.substring(R,X),X++;break}if(j===92){if(P+=J.substring(R,X),X++,X>=Y){z=2;break}switch(J.charCodeAt(X++)){case 34:P+='"';break;case 92:P+="\\";break;case 47:P+="/";break;case 98:P+="\b";break;case 102:P+="\f";break;case 110:P+=`
|
|
4061
4061
|
`;break;case 114:P+="\r";break;case 116:P+="\t";break;case 117:let f=U(4,!0);if(f>=0)P+=String.fromCharCode(f);else z=4;break;default:z=5}R=X;continue}if(j>=0&&j<=31)if(S_(j)){P+=J.substring(R,X),z=2;break}else z=6;X++}return P}function L(){if(G="",z=0,Z=X,K=V,H=W,X>=Y)return Z=Y,q=17;let P=J.charCodeAt(X);if(dX1(P)){do X++,G+=String.fromCharCode(P),P=J.charCodeAt(X);while(dX1(P));return q=15}if(S_(P)){if(X++,G+=String.fromCharCode(P),P===13&&J.charCodeAt(X)===10)X++,G+=`
|
|
4062
4062
|
`;return V++,W=X,q=14}switch(P){case 123:return X++,q=1;case 125:return X++,q=2;case 91:return X++,q=3;case 93:return X++,q=4;case 58:return X++,q=6;case 44:return X++,q=5;case 34:return X++,G=M(),q=10;case 47:let R=X-1;if(J.charCodeAt(X+1)===47){X+=2;while(X<Y){if(S_(J.charCodeAt(X)))break;X++}return G=J.substring(R,X),q=12}if(J.charCodeAt(X+1)===42){X+=2;let j=Y-1,y=!1;while(X<j){let f=J.charCodeAt(X);if(f===42&&J.charCodeAt(X+1)===47){X+=2,y=!0;break}if(X++,S_(f)){if(f===13&&J.charCodeAt(X)===10)X++;V++,W=X}}if(!y)X++,z=1;return G=J.substring(R,X),q=13}return G+=String.fromCharCode(P),X++,q=16;case 45:if(G+=String.fromCharCode(P),X++,X===Y||!Vw(J.charCodeAt(X)))return q=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return G+=O(),q=11;default:while(X<Y&&w(P))X++,P=J.charCodeAt(X);if(Z!==X){switch(G=J.substring(Z,X),G){case"true":return q=8;case"false":return q=9;case"null":return q=7}return q=16}return G+=String.fromCharCode(P),X++,q=16}}function w(P){if(dX1(P)||S_(P))return!1;switch(P){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function I(){let P;do P=L();while(P>=12&&P<=15);return P}return{setPosition:N,getPosition:()=>X,scan:Q?I:L,getToken:()=>q,getTokenValue:()=>G,getTokenOffset:()=>Z,getTokenLength:()=>X-Z,getTokenStartLine:()=>K,getTokenStartCharacter:()=>Z-H,getTokenError:()=>z}}function dX1(J){return J===32||J===9}function S_(J){return J===10||J===13}function Vw(J){return J>=48&&J<=57}var _z0;(function(J){J[J.lineFeed=10]="lineFeed",J[J.carriageReturn=13]="carriageReturn",J[J.space=32]="space",J[J._0=48]="_0",J[J._1=49]="_1",J[J._2=50]="_2",J[J._3=51]="_3",J[J._4=52]="_4",J[J._5=53]="_5",J[J._6=54]="_6",J[J._7=55]="_7",J[J._8=56]="_8",J[J._9=57]="_9",J[J.a=97]="a",J[J.b=98]="b",J[J.c=99]="c",J[J.d=100]="d",J[J.e=101]="e",J[J.f=102]="f",J[J.g=103]="g",J[J.h=104]="h",J[J.i=105]="i",J[J.j=106]="j",J[J.k=107]="k",J[J.l=108]="l",J[J.m=109]="m",J[J.n=110]="n",J[J.o=111]="o",J[J.p=112]="p",J[J.q=113]="q",J[J.r=114]="r",J[J.s=115]="s",J[J.t=116]="t",J[J.u=117]="u",J[J.v=118]="v",J[J.w=119]="w",J[J.x=120]="x",J[J.y=121]="y",J[J.z=122]="z",J[J.A=65]="A",J[J.B=66]="B",J[J.C=67]="C",J[J.D=68]="D",J[J.E=69]="E",J[J.F=70]="F",J[J.G=71]="G",J[J.H=72]="H",J[J.I=73]="I",J[J.J=74]="J",J[J.K=75]="K",J[J.L=76]="L",J[J.M=77]="M",J[J.N=78]="N",J[J.O=79]="O",J[J.P=80]="P",J[J.Q=81]="Q",J[J.R=82]="R",J[J.S=83]="S",J[J.T=84]="T",J[J.U=85]="U",J[J.V=86]="V",J[J.W=87]="W",J[J.X=88]="X",J[J.Y=89]="Y",J[J.Z=90]="Z",J[J.asterisk=42]="asterisk",J[J.backslash=92]="backslash",J[J.closeBrace=125]="closeBrace",J[J.closeBracket=93]="closeBracket",J[J.colon=58]="colon",J[J.comma=44]="comma",J[J.dot=46]="dot",J[J.doubleQuote=34]="doubleQuote",J[J.minus=45]="minus",J[J.openBrace=123]="openBrace",J[J.openBracket=91]="openBracket",J[J.plus=43]="plus",J[J.slash=47]="slash",J[J.formFeed=12]="formFeed",J[J.tab=9]="tab"})(_z0||(_z0={}));var $$=Array(20).fill(0).map((J,Q)=>{return" ".repeat(Q)});var cX1={" ":{"\n":Array(200).fill(0).map((J,Q)=>{return`
|
|
@@ -4397,11 +4397,11 @@ Actual: ${G}`)}async function KG8(J,Q,Y){let{execSync:X}=await import("node:ch
|
|
|
4397
4397
|
${N}`;if(G==="pnpm"&&N.includes("Unable to find the global bin directory"))O+=`
|
|
4398
4398
|
|
|
4399
4399
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
4400
|
-
npm install -g @sourcegraph/amp`;V(Error(O))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}H0();H0();async function _61(J,Q){let X=Q||"https://registry.npmjs.org";try{let G=new AbortController,Z=setTimeout(()=>G.abort(),5000),q=await fetch(`${X}/@sourcegraph/amp`,{signal:G.signal});if(clearTimeout(Z),!q.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let V=await q.json(),K=V["dist-tags"]?.latest;if(!K)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=UG8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],O=V.time[K],M=Date.now();if(N)z=Math.floor((M-new Date(N).getTime())/3600000);if(O)U=Math.floor((M-new Date(O).getTime())/3600000)}return x.info("NPM version comparison",{currentVersion:J,latestVersion:K,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:K,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(G){return x.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function UG8(J,Q){let Y=(q)=>{let[V,K]=q.split("-");return{parts:V?.split(".").map(Number)||[],label:K}},X=Y(J),G=Y(Q),Z=Math.max(X.parts.length,G.parts.length);for(let q=0;q<Z;q++){let V=X.parts[q]||0,K=G.parts[q]||0;if(V<K)return-1;if(V>K)return 1}if(X.label===G.label)return 0;if(!X.label&&G.label)return 1;if(X.label&&!G.label)return-1;if(X.label&&G.label)return X.label<G.label?-1:1;return 0}g0();function k61(J,Q){let Y=new b4,X=Y.pipe(d8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new KV().scoped("update"),Z=X.subscribe({next:(q)=>{G.debug("emit new state",q)}});try{let q=process.env.AMP_TEST_UPDATE_STATUS;if(q){G.debug("using fake update status for testing",{status:q}),await LU(500),Y.next(q);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){G.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let V=await Q.get("updates.mode");if(V==="disabled"){G.debug("checking disabled");return}G.debug("checking",{currentVersion:J,mode:V});let K=yL(),W=await _61(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await j61();if(!V)V=z==="pnpm"?"warn":"auto",G.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:V});if(V==="warn"){if(!H())Y.next("update-available");return}if(!z){if(G.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}try{await Hu(W.latestVersion,z);let U=await kB(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await LU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as EK}from"node:process";function v96(J){let Q=new ML().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(X)=>{await NR1(X.force||!1,X.verbose||!1,"0.0.
|
|
4400
|
+
npm install -g @sourcegraph/amp`;V(Error(O))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}H0();H0();async function _61(J,Q){let X=Q||"https://registry.npmjs.org";try{let G=new AbortController,Z=setTimeout(()=>G.abort(),5000),q=await fetch(`${X}/@sourcegraph/amp`,{signal:G.signal});if(clearTimeout(Z),!q.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let V=await q.json(),K=V["dist-tags"]?.latest;if(!K)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=UG8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],O=V.time[K],M=Date.now();if(N)z=Math.floor((M-new Date(N).getTime())/3600000);if(O)U=Math.floor((M-new Date(O).getTime())/3600000)}return x.info("NPM version comparison",{currentVersion:J,latestVersion:K,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:K,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(G){return x.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function UG8(J,Q){let Y=(q)=>{let[V,K]=q.split("-");return{parts:V?.split(".").map(Number)||[],label:K}},X=Y(J),G=Y(Q),Z=Math.max(X.parts.length,G.parts.length);for(let q=0;q<Z;q++){let V=X.parts[q]||0,K=G.parts[q]||0;if(V<K)return-1;if(V>K)return 1}if(X.label===G.label)return 0;if(!X.label&&G.label)return 1;if(X.label&&!G.label)return-1;if(X.label&&G.label)return X.label<G.label?-1:1;return 0}g0();function k61(J,Q){let Y=new b4,X=Y.pipe(d8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new KV().scoped("update"),Z=X.subscribe({next:(q)=>{G.debug("emit new state",q)}});try{let q=process.env.AMP_TEST_UPDATE_STATUS;if(q){G.debug("using fake update status for testing",{status:q}),await LU(500),Y.next(q);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){G.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let V=await Q.get("updates.mode");if(V==="disabled"){G.debug("checking disabled");return}G.debug("checking",{currentVersion:J,mode:V});let K=yL(),W=await _61(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await j61();if(!V)V=z==="pnpm"?"warn":"auto",G.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:V});if(V==="warn"){if(!H())Y.next("update-available");return}if(!z){if(G.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}try{await Hu(W.latestVersion,z);let U=await kB(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await LU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as EK}from"node:process";function v96(J){let Q=new ML().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(X)=>{await NR1(X.force||!1,X.verbose||!1,"0.0.1764086485-g394076"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new ML("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(X)=>{await BG8(X.targetVersion)});J.addCommand(Y)}async function BG8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")EK.write(C4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
4401
4401
|
|
|
4402
4402
|
`));try{if(!J){EK.write(C4.blue(`Checking for updates...
|
|
4403
|
-
`));let Y=yL(),{hasUpdate:X,latestVersion:G}=await _61("0.0.
|
|
4404
|
-
`));let Z=await kB("0.0.
|
|
4403
|
+
`));let Y=yL(),{hasUpdate:X,latestVersion:G}=await _61("0.0.1764086485-g394076",Y);if(!X){EK.write(C4.green(`✓ Amp CLI is already up to date.
|
|
4404
|
+
`));let Z=await kB("0.0.1764086485-g394076");if(Z.warning)EK.write(`
|
|
4405
4405
|
`+C4.yellow(Z.warning)+`
|
|
4406
4406
|
`);process.exit(0)}if(!G)EK.write(C4.yellow("[WARN] could not find latest version")),process.exit(0);J=G}EK.write(C4.blue(`Updating to version ${J}...
|
|
4407
4407
|
`)),await Hu(J,void 0,(Y)=>{EK.write(C4.dim(`Running: ${Y}
|
|
@@ -5009,7 +5009,7 @@ exit code: ${Z}`,new U1({color:X.foreground,dim:!0,italic:!0})));if(q)V.push(new
|
|
|
5009
5009
|
(${q}, command and output not shown to agent)`,new U1({color:X.foreground,dim:!0,italic:!0})));else if(Q.hidden)V.push(new Q1(`
|
|
5010
5010
|
|
|
5011
5011
|
(Command and output not shown to agent)`,new U1({color:X.foreground,dim:!0,italic:!0})));if(V.length===0)return null;return new l1({text:new Q1("",void 0,V),selectable:!0})}function z81(J,Q){let Y=f6.of(Q),X=gB(J);if(X?.visibility===uB)return Y.app.shellModeHidden;if(X?.visibility===S41)return Y.app.shellMode;return M1.green}function rJ6(J,Q,Y){if(Q.length===0)return null;let G=f6.maybeOf(J)?.colors??v4.of(J).colorScheme,Z=[new Q1("Images: ",new U1({color:G.foreground,dim:!0}))];for(let q=0;q<Q.length;q++)if(Z.push(new Q1(`[image ${q+1}]`,Y)),q<Q.length-1)Z.push(new Q1(" ",new U1({color:G.foreground,dim:!0})));return new g6({padding:k0.only({}),child:new l1({text:new Q1("",void 0,Z),selectable:!0})})}function kj1(J,Q,Y){let X=[];if(X.push(new Q1(J,Q)),Y)X.push(new Q1(" (interrupted)",new U1({color:M1.yellow,italic:!0})));return new l1({text:new Q1("",void 0,X),selectable:!0})}class qC extends T6{props;constructor(J){super();this.props=J}build(J){let Q=this.props.message,X=f6.of(J).colors,G="",Z,q,V=null;if(Q.role==="info"){let z=xl(Q);if(!z)return new e0;G=`${j41(z.hidden??!1)} ${z.args.cmd}`;let N=z81(G,J);Z=N,q=N,V=vj1(J,z)}else G=y7(Q.content).trim(),q=Q.interrupted?M1.yellow:X.success,Z=Q.interrupted?M1.yellow:z81(G,J);let K=new U1({color:q,italic:!0}),W=[];if(Q.role==="user"){let z=Q.content.filter((N)=>N.type==="image"),U=rJ6(J,z,K);if(U)W.push(U)}if(G){if(W.length>0)W.push(new N0({height:1}));W.push(kj1(G,K,Q.role==="user"?Q.interrupted:void 0))}if(V){if(W.length>0)W.push(new N0({height:1}));W.push(V)}let H;if(W.length===0)H=new e0;else if(W.length===1)H=W[0];else H=new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:W});return new e0({decoration:{border:new i4(void 0,void 0,void 0,new S4(Z,2,"solid"))},padding:k0.only({left:1}),child:H})}}class F81 extends T6{props;constructor(J){super();this.props=J}build(J){let Q=f6.of(J),Y=Q.colors,X=this.props.message,G="",Z=aJ6,q=null,V=xl(X);if(V)G=`${V.hidden?"$$":"$"} ${V.args.cmd}`,Z=z81(G,J),q=vj1(J,V);else G=y7(X.content).trim(),Z=z81(G,J);let K=new U1({color:Z,italic:!0}),W=[];if(X.role==="user"){let L=X.content.filter((I)=>I.type==="image"),w=rJ6(J,L,K);if(w)W.push(w)}if(G){if(W.length>0)W.push(new N0({height:1}));W.push(kj1(G,K,X.role==="user"?X.interrupted:void 0))}if(q){if(W.length>0)W.push(new N0({height:1}));W.push(q)}let H;if(W.length===0)H=new e0;else if(W.length===1)H=W[0];else H=new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:W});let z=new e0({decoration:{border:i4.all(new S4(Z,2,"solid"))},padding:k0.only({left:1,right:1}),width:1/0,child:H});if(this.props.isShowingRestoreConfirmation){let M=new sJ6({affectedFiles:this.props.affectedFiles,onConfirm:this.props.onRestoreConfirm,onCancel:this.props.onRestoreCancel});return new l0({children:[new yj1,new N0({height:1}),M,new N0({height:1}),new a$({forceDim:!0,child:new e0({decoration:{border:new i4(void 0,void 0,void 0,new S4(Z,2,"solid"))},padding:k0.only({left:1,right:1}),width:1/0,child:H})})]})}if(this.props.isShowingEditConfirmation){let M=new tJ6({affectedFiles:this.props.affectedFiles,onConfirm:this.props.onEditConfirm,onCancel:this.props.onEditCancel}),L=this.props.pendingEditText??G,w=kj1(L,K,void 0),I=new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:[w,new N0({height:1}),M]});return new e0({decoration:{border:i4.all(new S4(Z,2,"solid"))},padding:k0.only({left:1,right:1}),width:1/0,child:I})}let U=Q.app,N=[new Q1("e",new U1({color:U.keybind})),new Q1(" to edit",new U1({color:Y.foreground,dim:!0}))],O=new W41({child:new t5({children:[z,new f3({left:2,right:0,bottom:0,child:new l1({text:new Q1("",void 0,N)})})]})});if(!this.props.isFirstMessage)return new g6({padding:k0.only({}),child:O});return new g6({padding:k0.only({}),child:new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:[new yj1,new N0({height:1}),O]})})}}class yj1 extends T6{build(J){let Q=f6.of(J),Y=Q.colors,X=Q.app,G=[new Q1(" r",new U1({color:X.keybind})),new Q1(" to restore, ",new U1({color:Y.foreground,dim:!0})),new Q1("f",new U1({color:X.keybind})),new Q1(" to fork ",new U1({color:Y.foreground,dim:!0}))];return new t5({children:[new e0({decoration:{border:new i4(new S4(Y.selection,2,"solid"),void 0,void 0,void 0)},width:1/0,height:1}),new f3({left:0,right:0,top:0,child:new $8({child:new l1({text:new Q1("",void 0,G)})})})]})}}function oJ6(J,Q){if(Q.length===0)return null;let X=f6.of(J).colors,G=[];for(let Z=0;Z<Q.length;Z++){let q=Q[Z];if(Z>0)G.push(new Q1(`
|
|
5012
|
-
`));G.push(new Q1(` • ${q}`,new U1({color:X.foreground,dim:!0})))}return new l1({text:new Q1("",void 0,G)})}class sJ6 extends T6{props;constructor(J){super();this.props=J}build(J){let Q=this.props.affectedFiles,Y=Q.length>0,G=[new l1({text:new Q1(Y?"This will delete this message and any subsequent messages in the thread, and will restore the following files:":"This will delete this message and any subsequent messages in the thread.",new U1({color:M1.yellow,bold:!0}))}),new N0({height:1})],Z=oJ6(J,Q);if(Z)G.push(Z),G.push(new N0({height:1}));let q=[{value:"confirm",label:Y?"Delete and restore":"Delete"},{value:"cancel",label:"Cancel"}];return G.push(new fY({options:q,onSelect:(V)=>{if(V==="confirm")this.props.onConfirm();else this.props.onCancel()},padding:k0.all(0),showDismissalMessage:!1,enableMouseInteraction:!1,showBorder:!1})),new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:G})}}class tJ6 extends T6{props;constructor(J){super();this.props=J}build(J){let Q=this.props.affectedFiles,Y=[],X=oJ6(J,Q);if(X)Y.push(new l1({text:new Q1("This will restore the following files:",new U1({color:M1.yellow,bold:!0}))})),Y.push(new N0({height:1})),Y.push(X),Y.push(new N0({height:1}));let G=[{value:"confirm",label:"Confirm edit"},{value:"cancel",label:"Cancel"}];return Y.push(new fY({options:G,onSelect:(Z)=>{if(Z==="confirm")this.props.onConfirm();else this.props.onCancel()},padding:k0.all(0),showDismissalMessage:!1,enableMouseInteraction:!1,showBorder:!1})),new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:Y})}}class U81 extends Q6{initialText;onSubmitted;message;constructor(J){super();this.initialText=J.initialText,this.onSubmitted=J.onSubmitted,this.message=J.message}createState(){return new eJ6}}class eJ6 extends J6{controller=new CG;currentShellModeStatus;initState(){this.controller.text=this.widget.initialText,this.controller.addListener(this.textChangeListener);let J=gB(this.widget.initialText);this.currentShellModeStatus=J?.visibility}dispose(){this.controller.removeListener(this.textChangeListener),this.controller.dispose(),super.dispose()}textChangeListener=()=>{let J=this.controller.text,Y=gB(J)?.visibility;if(Y!==this.currentShellModeStatus)this.currentShellModeStatus=Y,this.setState(()=>{})};handleSubmit=(J)=>{this.widget.onSubmitted(J)};build(J){let Q=f6.of(J),Y=Q.colors,X=Q.app,G=this.currentShellModeStatus?O76(Q,this.currentShellModeStatus):aJ6,Z=null,q=this.widget.message&&xl(this.widget.message);if(q)Z=vj1(J,q);let V=new XA({controller:this.controller,triggers:[],ampURL:"",onSubmitted:this.handleSubmit,theme:Y,placeholder:"",enabled:!0,autofocus:!0,shellPromptRules:_41(Q),showMenuBelow:!1,imageAttachments:[],minLines:1,textColor:G}),K=[];if(K.push(V),Z)K.push(new N0({height:1})),K.push(Z);let W;if(K.length===1)W=K[0];else W=new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:K});let H=new e0({decoration:{border:i4.all(new S4(G,2,"solid"))},padding:k0.only({left:1,right:1}),child:W}),z=[];if(this.currentShellModeStatus===uB)z.push(new Q1("shell mode (incognito)",new U1({color:Q.app.shellModeHidden})));else if(this.currentShellModeStatus===S41)z.push(new Q1("shell mode",new U1({color:Q.app.shellMode})));else z.push(new Q1("esc",new U1({color:X.keybind})),new Q1(" to cancel",new U1({color:Y.foreground,dim:!0})));let U=new f3({left:2,bottom:0,child:new l1({text:new Q1("",void 0,z)})});return new W41({child:new t5({children:[H,U]})})}}class B81 extends l2{}class N81 extends l2{}class xj1 extends l2{}class fj1 extends l2{}class hj1 extends l2{}class bj1 extends l2{}class uj1 extends l2{}class gj1 extends l2{}var uz8=0;function gz8(J,Q,Y){let G=f6.maybeOf(J)?.colors??v4.of(J).colorScheme,q=Q.trimStart().startsWith("You're absolutely right"),V=new c2(`${Y}-text`),K=[];if(q)K.push(new Oj1({key:V,markdown:Q,defaultColor:G.foreground}));else K.push(new k2({key:V,markdown:Q}));if(K.length===1)return K[0];return new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:K})}function mz8(J,Q){let X=v4.of(J).colorScheme;if(Q.summary.type!=="message")return new e0;return new l0({crossAxisAlignment:"start",children:[new l1({text:new Q1("Summary:",new U1({color:X.foreground,dim:!0,bold:!0,italic:!0})),selectable:!0}),new N0({height:1}),new k2({markdown:Q.summary.summary,styleScheme:{text:new U1({color:X.foreground,dim:!0,italic:!0}),inlineCode:new U1({color:X.foreground,dim:!0,italic:!0}),codeBlock:new U1({color:X.foreground,dim:!0,italic:!0}),tableBorder:X.foreground,link:new U1({color:X.foreground,dim:!0,italic:!0}),syntaxHighlight:{keyword:X.foreground,string:X.foreground,number:X.foreground,comment:X.foreground,function:X.foreground,variable:X.foreground,type:X.foreground,operator:X.foreground}}})]})}class D81 extends Q6{items;subagentToolsByParentID;controller;autofocus;onNewMessage;showScrollbar;onCopy;onMessageEditSubmit;onShellCommandSubmit;onMessageRestoreSubmit;onMessageForkSubmit;getAffectedFiles;thread;focusNode;onDismissFocus;isInSelectionMode=!1;get userMessageIndices(){let J=[];for(let Q=0;Q<this.items.length;Q++){let Y=this.items[Q];if(Y?.type==="message"){if(Y.message.role==="user"||uw(Y.message))J.push(Q)}}return J}constructor({key:J,items:Q,subagentToolsByParentID:Y={},controller:X,autofocus:G=!1,onNewMessage:Z,showScrollbar:q=!0,onCopy:V,onMessageEditSubmit:K,onMessageRestoreSubmit:W,onMessageForkSubmit:H,getAffectedFiles:z,thread:U,focusNode:N,onDismissFocus:O,isInSelectionMode:M=!1}){super(J?{key:J}:{});this.items=Q,this.subagentToolsByParentID=Y,this.controller=X,this.autofocus=G,this.onNewMessage=Z,this.showScrollbar=q,this.onCopy=V,this.onMessageEditSubmit=K,this.onMessageRestoreSubmit=W,this.onMessageForkSubmit=H,this.getAffectedFiles=z,this.thread=U,this.focusNode=N,this.onDismissFocus=O,this.isInSelectionMode=M}createState(){return new JQ6}}class JQ6 extends J6{_controller=null;_isDisposed=!1;_thinkingBlockStates=new Map;_globalToggleListener;_streamingIndexes=new Set;_viewportHeight=25;_widgetCache=new Map;_lastCostDisplayState=null;_selectedUserMessageOrdinal=null;_editingMessageOrdinal=null;_isShowingRestoreConfirmation=!1;_isShowingEditConfirmation=!1;_pendingEditText=null;_affectedFiles=[];get controller(){return this._controller}dismiss(){N9.instance.addPostFrameCallback(()=>{this.widget.focusNode?.unfocus()}),this.widget.onDismissFocus?.()}_navigateUp(J,Q){if(Q<=0)return null;if(J===null)return Q-1;if(J<=0)return 0;return J-1}_navigateDown(J,Q){if(Q<=0)return null;if(J===null)return null;if(J>=Q-1)return null;return J+1}_ordinalToIndex(J,Q){if(Q===null)return null;if(Q<0||Q>=J.length)return null;return J[Q]??null}_getUserCount(){return this.widget.userMessageIndices.length}_clearSelectedUserMessage(){let J=this._selectedUserMessageOrdinal,Q=J!==null?this.getUserMessageIndexFromOrdinal(J):null;this.setState(()=>{if(Q!=null)this._widgetCache.delete(Q);this._selectedUserMessageOrdinal=null})}_selectUserMessageByOrdinal(J){let Q=this._selectedUserMessageOrdinal,Y=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,G=this.getUserMessageIndexFromOrdinal(Y);if(X!==null)this._widgetCache.delete(X);if(G!==null)this._widgetCache.delete(G);if(this.setState(()=>{this._selectedUserMessageOrdinal=Y}),G!==null)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(G,{animated:!0,offset:uz8,edge:"top",duration:200})})}_selectEditingUserMessageByOrdinal(J){let Q=this._editingMessageOrdinal,Y=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,G=Y!==null?this.getUserMessageIndexFromOrdinal(Y):null;if(X!==null)this._widgetCache.delete(X);if(G!==null)this._widgetCache.delete(G);this.setState(()=>{this._editingMessageOrdinal=Y})}getUserMessageIndexFromOrdinal(J){return this.widget.userMessageIndices[J]??null}getOrdinalFromUserMessageIndex(J){let Y=this.widget.userMessageIndices.indexOf(J);return Y>=0?Y:null}getLatestUserMessageOrdinal(){let J=this.widget.userMessageIndices;return J.length>0?J.length-1:null}navigateToUserMessage(J){let Q=this._getUserCount(),Y=J==="up"?this._navigateUp(this._selectedUserMessageOrdinal,Q):this._navigateDown(this._selectedUserMessageOrdinal,Q);if(Y===null&&J==="down"){this._controller?.animateToBottom(100),this._clearSelectedUserMessage(),this.dismiss();return}if(Y!==null)this._selectUserMessageByOrdinal(Y)}handleNavigateUserMessageUp=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("up"),"handled"};handleNavigateUserMessageDown=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("down"),"handled"};handleEscape=()=>{if(this._editingMessageOrdinal!==null)return this.setState(()=>{let J=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(J!=null)this._widgetCache.delete(J);this._editingMessageOrdinal=null}),"handled";else if(this._selectedUserMessageOrdinal!==null)return this._clearSelectedUserMessage(),this.setState(()=>{this._editingMessageOrdinal=null}),this.dismiss(),this._controller?.animateToBottom(100),"handled";return"ignored"};handleScrollDown=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollDown(1),"handled";return"ignored"};handleScrollUp=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollUp(1),"handled";return"ignored"};handleEditMessage=()=>{if(this._selectedUserMessageOrdinal!==null)return this._selectEditingUserMessageByOrdinal(this._selectedUserMessageOrdinal),"handled";return"ignored"};handleRestoreMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||uw(Q.message)))this.showRestoreConfirmation(J)}return"handled"}return"ignored"};async showRestoreConfirmation(J){let Q=[];if(this.widget.getAffectedFiles)try{Q=await this.widget.getAffectedFiles(J)}catch{Q=[]}if(this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!0,this._affectedFiles=Q}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}handleRestoreConfirm=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||Q.message.role==="info"))this.widget.onMessageRestoreSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!1,this._affectedFiles=[]}),this.dismiss()}return"handled"}return"ignored"};handleRestoreCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!1,this._affectedFiles=[]}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}}return"handled"};handleForkMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||uw(Q.message))){if(J===0)return"ignored";this.widget.onMessageForkSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{}),this.dismiss()}}return"handled"}return"ignored"};handleEditConfirmationRequest=async(J)=>{if(J.trim()==="")return;if(this._editingMessageOrdinal!==null){let Q=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(Q!=null){let Y=[];if(this.widget.getAffectedFiles)try{Y=await this.widget.getAffectedFiles(Q)}catch{Y=[]}if(this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!0,this._pendingEditText=J,this._affectedFiles=Y,this._editingMessageOrdinal=null}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(Q)})}}};handleEditConfirm=()=>{if(this._selectedUserMessageOrdinal!==null&&this._pendingEditText!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||Q.message.role==="info"))this.widget.onMessageEditSubmit?.(Q.message,this._pendingEditText),this._clearSelectedUserMessage(),this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!1,this._pendingEditText=null,this._affectedFiles=[]}),this.dismiss(),this.controller.animateToBottom(100)}}};handleEditCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!1,this._pendingEditText=null,this._affectedFiles=[]}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}}};_signatureFor(J){if(J.type==="message"){let Q=J.message;if(Q.role==="user"){let Y=y7(Q.content),X=Q.content.filter((G)=>G.type==="image").length;return`${J.id}|user|${Q.interrupted?1:0}|${X}|${Y}`}else if(Q.role==="assistant"){let Y=y7(Q.content),X=Q.state.type==="complete",G=Q.content.filter((K)=>K.type==="thinking"),Z=Q.content.filter((K)=>K.type==="tool_use"),q=Q.usage,V=q?`${q.credits??""}|${q.inputTokens}|${q.outputTokens}|${q.cacheCreationInputTokens??""}|${q.cacheReadInputTokens??""}|${q.model??""}`:"no-usage";return`${J.id}|assistant|${X?1:0}|${G.length}|${Z.length}|${Y}|${V}`}else{let X=Q.content.map((G)=>G.type).join(",");return`${J.id}|info|${X}`}}else{let Y=J.toolResult.run.status,X=this.widget.thread&&Y==="done"?jo(this.widget.thread,J.toolUse.id):void 0;return`${J.id}|tool|${Y}|${J.toolUse.id}|${X??""}`}}getThinkingBlockExpanded(J,Q){let Y=`${J}-${Q}`;return this._thinkingBlockStates.get(Y)??OJ.instance.allExpanded}toggleThinkingBlock=(J,Q)=>{return(Y)=>{let X=`${J}-${Q}`;this.setState(()=>{this._thinkingBlockStates.set(X,Y),this._widgetCache.delete(J)})}};buildThinkingBlock(J,Q,Y,X){let G=Y===X.content.length-1,Z=X.state?.type==="streaming"&&G;return new QA({key:new c2(`thinking-${Q}-${Y}`),thinkingBlock:J,expanded:this.getThinkingBlockExpanded(Q,Y),onToggle:this.toggleThinkingBlock(Q,Y),isStreaming:Z})}buildAssistantMessageWidget(J,Q,Y,X){let G=Q.content.map((U,N)=>({block:U,index:N})).filter((U)=>U.block.type==="thinking"&&Z81(U.block.thinking).length>0),Z=G.some(({block:U})=>Z81(U.thinking).length>0),q=Q.content.filter((U)=>U.type==="text"),V=[];if(V.push(...G.map(({block:U,index:N})=>this.buildThinkingBlock(U,Y,N,Q))),Z&&q.length>0)V.push(new N0({height:1}));let K=y7(q);if(K.trim())V.push(gz8(J,K,X));let W=Jz(J),H=Q.usage!=null&&(Q.usage.inputTokens>0||Q.usage.outputTokens>0);if(W&&H){let N=f6.maybeOf(J)?.colors??v4.of(J).colorScheme,O=u26(Q.usage);V.push(new g6({padding:k0.only({top:1}),child:new l1({text:new Q1(O,new U1({color:N.foreground,dim:!0}))})}))}let z;if(V.length===0)z=new e0;else if(V.length===1)z=V[0];else z=new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:V});return z}buildThreadItemWidget(J,Q,Y){let X=new c2(`thread-item-${Q.id}`);if(Q.type==="message"){let G=Q.message;if(G.role==="user"){if(!this.widget.isInSelectionMode)return new qC({message:G,isFirstMessage:Y>0});let Z=this.getOrdinalFromUserMessageIndex(Y);if(Z===null)return new qC({message:G,isFirstMessage:Y>0});if(this._editingMessageOrdinal===Z)return new U81({initialText:y7(G.content),message:G,onSubmitted:(V)=>{this.handleEditConfirmationRequest(V)}});if(this._selectedUserMessageOrdinal===Z)return new F81({message:G,isFirstMessage:Y>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,isShowingEditConfirmation:this._isShowingEditConfirmation,affectedFiles:this._affectedFiles,pendingEditText:this._pendingEditText??void 0,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()},onEditConfirm:()=>{this.handleEditConfirm()},onEditCancel:()=>{this.handleEditCancel()}});else return new qC({message:G,isFirstMessage:Y>0})}else if(G.role==="assistant"){let Z=this.buildAssistantMessageWidget(J,G,Y,Q.id);return new e0({key:X,child:Z})}else{let Z=G,q=[],V=this.getOrdinalFromUserMessageIndex(Y),K=this.widget.isInSelectionMode&&V!==null&&this._selectedUserMessageOrdinal===V;for(let W of Z.content)if(W.type==="manual_bash_invocation")if(this._editingMessageOrdinal===V){let z=`${j41(W.hidden??!1)}${W.args.cmd}`;q.push(new U81({initialText:z,message:Z,onSubmitted:(U)=>{this.handleEditConfirmationRequest(U)}}))}else if(!this.widget.isInSelectionMode||!K)q.push(new qC({message:Z,isFirstMessage:Y>0}));else q.push(new F81({message:Z,isFirstMessage:Y>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,isShowingEditConfirmation:this._isShowingEditConfirmation,affectedFiles:this._affectedFiles,pendingEditText:this._pendingEditText??void 0,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()},onEditConfirm:()=>{this.handleEditConfirm()},onEditCancel:()=>{this.handleEditCancel()}}));else if(W.type==="summary"&&W.summary.type==="message")q.push(mz8(J,W));if(q.length===0)return new e0;if(q.length===1)return q[0];return new l0({crossAxisAlignment:"stretch",children:q})}}else{let G=new Xz({toolUse:Q.toolUse,toolRun:Q.toolResult.run,subagentTools:this.widget.subagentToolsByParentID[Q.toolUse.id],thread:this.widget.thread});return new e0({key:X,child:G})}return new e0}initState(){if(super.initState(),this._controller=this.widget.controller||new h3,this._globalToggleListener=()=>{this.setState(()=>{this._thinkingBlockStates.clear(),this._widgetCache.clear()})},OJ.instance.addListener(this._globalToggleListener),this.widget.items.length>0)N9.instance.requestFrame()}didUpdateWidget(J){if(super.didUpdateWidget(J),!J.isInSelectionMode&&this.widget.isInSelectionMode){this.widget.focusNode?.requestFocus();let Y=this.getLatestUserMessageOrdinal();if(Y!==null)this._selectUserMessageByOrdinal(Y)}if(J.items===this.widget.items)return;let Q=Math.min(J.items.length,this.widget.items.length);for(let Y=0;Y<Q;Y++){let X=J.items[Y],G=this.widget.items[Y];if(X&&G){if(X.type!==G.type){this._widgetCache.delete(Y);continue}if(X.type==="toolResult"&&G.type==="toolResult"){let Z=X.toolResult.run,q=G.toolResult.run;if(Z.status!==q.status||"result"in Z!=="result"in q||"error"in Z!=="error"in q)this._widgetCache.delete(Y)}if(X.type==="message"&&G.type==="message"){let Z=X.message,q=G.message;if(Z.content!==q.content)this._widgetCache.delete(Y)}}}if(this.widget.items.length<J.items.length)this._cleanupOrphanedCacheEntries();this._updateStreamingIndexes();for(let Y of this._streamingIndexes)if(Y>=this.widget.items.length)this._streamingIndexes.delete(Y)}_cleanupOrphanedCacheEntries(){for(let J of this._widgetCache.keys())if(J>=this.widget.items.length)this._widgetCache.delete(J)}_isMessageStreaming(J){if(J.type!=="message")return!1;let Q=J.message;if(Q.role!=="assistant")return!1;if(Q.state.type==="streaming")return!0;return Q.content.at(-1)?.type==="thinking"}_updateStreamingIndexes(){for(let J of this._streamingIndexes)if(J>=this.widget.items.length)this._streamingIndexes.delete(J);for(let J=0;J<this.widget.items.length;J++){let Q=this.widget.items[J];if(!Q)continue;let Y=this._isMessageStreaming(Q);if(Y&&!this._streamingIndexes.has(J))this._streamingIndexes.add(J);else if(!Y&&this._streamingIndexes.has(J))this._streamingIndexes.delete(J)}}_getViewportHeight(){let J=this.context.findRenderObject();if(J&&"size"in J){let Q=J.size;if(typeof Q.height==="number"&&Q.height>0)return this._viewportHeight=Q.height,Q.height}return this._viewportHeight}dispose(){if(this._isDisposed=!0,this._widgetCache.clear(),this._globalToggleListener)OJ.instance.removeListener(this._globalToggleListener);if(!this.widget.controller)this._controller?.dispose();this.widget.focusNode?.dispose(),super.dispose()}build(J){let Q=f6.of(J),Y=Jz(J);if(this._lastCostDisplayState!==null&&this._lastCostDisplayState!==Y)this._widgetCache.clear();this._lastCostDisplayState=Y;let X=this._getTotalItemCount(J),G=[];for(let U=0;U<X;U++)if(G.push(this._buildItemAtIndex(J,U)),U<X-1)G.push(new N0({height:1}));let Z=new M7({controller:this._controller,autofocus:this.widget.autofocus,position:"bottom",child:new l0({key:new c2("message-list-column"),crossAxisAlignment:"start",children:G})}),V=[new g6({padding:k0.only({left:2,right:this.widget.showScrollbar?3:2,bottom:1}),child:Z})];if(this.widget.showScrollbar&&this._controller){let U=new s$({controller:this._controller,getScrollInfo:()=>this._getScrollbarInfo(),thickness:1,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack});V.push(new f3({right:1,top:0,bottom:0,child:new N0({width:1,child:U})}))}let K=new t5({children:V}),W=new gL({key:new c2("message-view-selection-area"),child:K,onCopy:this.widget.onCopy}),H=new Map([[B81,new a8(this.handleNavigateUserMessageUp)],[N81,new a8(this.handleNavigateUserMessageDown)],[xj1,new a8(this.handleEscape)],[fj1,new a8(this.handleScrollDown)],[hj1,new a8(this.handleScrollUp)],[bj1,new a8(this.handleEditMessage)],[uj1,new a8(this.handleRestoreMessage)],[gj1,new a8(this.handleForkMessage)]]),z=new Map([[K4.key("Tab"),new B81],[K4.shift("Tab"),new N81],[K4.key("Escape"),new xj1],[K4.key("j"),new fj1],[K4.key("k"),new hj1],[K4.key("e"),new bj1],[K4.key("r"),new uj1],[K4.key("f"),new gj1]]);if(!m7())z.set(K4.key("ArrowUp"),new B81),z.set(K4.key("ArrowDown"),new N81);if(this.widget.focusNode)return new r8({focusNode:this.widget.focusNode,child:new fQ({actions:H,child:new Bq({shortcuts:z,focusNode:this.widget.focusNode,child:W})})});return W}_getTotalItemCount(J){return this.widget.items.length}_shouldDimItem(J){if(this._isShowingRestoreConfirmation||this._isShowingEditConfirmation){let Q=this._selectedUserMessageOrdinal;if(Q===null)return!1;let Y=this.getUserMessageIndexFromOrdinal(Q);if(Y===null)return!1;return J>Y}if(this._editingMessageOrdinal!==null){let Q=this.getUserMessageIndexFromOrdinal(this._editingMessageOrdinal);if(Q===null)return!1;return J>Q}return!1}_buildItemAtIndex(J,Q){let Y=this.widget.items[Q];if(!Y)return new e0;let X=Y.type==="message"&&this._isMessageStreaming(Y),G=Y.type==="toolResult"&&(Y.toolResult.run.status==="queued"||Y.toolResult.run.status==="in-progress")&&!("result"in Y.toolResult.run)&&!("error"in Y.toolResult.run),Z=this._shouldDimItem(Q);if(!X&&!G){let K=`${this._signatureFor(Y)}|dim:${Z?1:0}`,W=this._widgetCache.get(Q);if(W&&W.sig===K)return W.widget;let H=this.buildThreadItemWidget(J,Y,Q),z=Z?new a$({forceDim:!0,child:H}):H;return this._widgetCache.set(Q,{sig:K,widget:z}),z}let V=this.buildThreadItemWidget(J,Y,Q);return Z?new a$({forceDim:!0,child:V}):V}onNewMessage(){if(this._isDisposed)return;this.widget.onNewMessage?.()}scrollToTop(){if(this._isDisposed||!this._controller)return;this._controller.scrollToTop()}scrollToMessage(J,{animated:Q=!1,offset:Y=0,edge:X="top",duration:G}={}){if(this._isDisposed||!this._controller)return!1;let Z=this._getMessageRelativeOffset(J,X);if(Z===null)return!1;let q=Z-Y;if(Q)this._controller.animateTo(q,G);else this._controller.jumpTo(q);return!0}_getColumnElement(){let J=this.context.element;if(!J)return null;let Q=new c2("message-list-column"),Y=(X)=>{if(X.widget.key?.equals(Q))return X;for(let G of X.children){let Z=Y(G);if(Z)return Z}return null};return Y(J)}_getMessageRelativeOffset(J,Q){let Y=this._getColumnElement();if(!Y)return null;let X=J*2,G=Y.children[X];if(!G?.renderObject)return null;let Z=G.renderObject,q=Y.renderObject;if(!q)return null;let V=Z.localToGlobal({x:0,y:0}),K=q.localToGlobal({x:0,y:0}),W=0;if(Q==="bottom")W=Z.size.height;return V.y+W-K.y}_getScrollbarInfo(){let J=this._controller?.maxScrollExtent??0,Q=this._getViewportHeight(),Y=this._controller?.offset??0,X=J+Q;return{totalContentHeight:Math.max(X,0),viewportHeight:Math.max(Q,1),scrollOffset:Math.max(Y,0)}}}ZI();class mj1 extends T6{thread;onExecute;onEdit;constructor({thread:J,onExecute:Q,onEdit:Y}){super();this.thread=J,this.onExecute=Q,this.onEdit=Y}build(J){if(this.thread.agentMode!=="plan")return new N0({width:0,height:0});let Q=f6.of(J),Y=Q.colors,X=hF(this.thread);if(!fL(this.thread))return new N0({width:0,height:0});let Z=[];return Z.push(new G4({mainAxisSize:"max",mainAxisAlignment:"spaceBetween",crossAxisAlignment:"center",children:[new l1({text:new Q1("\uD83D\uDCCB Plan",new U1({color:Y.foreground,bold:!0})),textAlign:"left"}),new G4({mainAxisSize:"min",children:[new P8({onClick:this.onExecute,cursor:"pointer",child:new l1({text:new Q1("[Execute]",new U1({color:Y.success})),textAlign:"right"})}),new N0({width:1,height:1}),new P8({onClick:this.onEdit,cursor:"pointer",child:new l1({text:new Q1("[Edit]",new U1({color:Y.secondary})),textAlign:"right"})})]})]})),Z.push(m5.vertical(1)),Z.push(new k2({markdown:X,textAlign:"left",styleScheme:{text:new U1({color:Y.mutedForeground,dim:!0}),inlineCode:new U1({color:Y.secondary,bold:!0}),codeBlock:new U1({color:Y.mutedForeground,dim:!0}),tableBorder:Y.border,link:new U1({color:Y.secondary,underline:!0}),syntaxHighlight:Q.app.syntaxHighlight}})),Z.push(m5.vertical(1)),Z.push(new l1({text:new Q1("",void 0,[new Q1("Ctrl+O ",new U1({color:Y.secondary})),new Q1("→ Execute Plan",new U1({color:Y.mutedForeground,dim:!0}))]),textAlign:"left"})),new l0({mainAxisSize:"min",mainAxisAlignment:"start",crossAxisAlignment:"start",children:Z})}}class O81 extends Q6{props;constructor(J){super();this.props=J}createState(){return new QQ6}}class QQ6 extends J6{viewportHeight=1;scrollListenerAttached=!1;initState(){if(!this.scrollListenerAttached)this.widget.props.controller.addListener(()=>{this.updateViewportHeight()}),this.scrollListenerAttached=!0}build(J){let{thread:Q,onExecute:Y,onEdit:X,controller:G,appTheme:Z}=this.widget.props;return new G4({crossAxisAlignment:"stretch",children:[new F4({child:new M7({controller:G,autofocus:!1,child:new mj1({thread:Q,onExecute:Y,onEdit:X})})}),new s$({controller:G,thumbColor:Z.app.scrollbarThumb,trackColor:Z.app.scrollbarTrack,getScrollInfo:()=>{let{maxScrollExtent:q,offset:V}=G,K=this.viewportHeight,W=q+K;return{totalContentHeight:Math.max(W,0),viewportHeight:Math.max(K,1),scrollOffset:Math.max(V,0)}}})]})}updateViewportHeight(){let J=this.getViewportHeight();if(J!==this.viewportHeight)this.viewportHeight=J}getViewportHeight(){let J=this.context.findRenderObject();if(!J)return this.viewportHeight;let Q=(X,G=0)=>{if(X&&"size"in X&&"children"in X){let Z=X.children||[];for(let q of Z){if(q&&"size"in q){let K=q.size;if(typeof K?.height==="number"&&K.height>0)return K.height}let V=Q(q,G+1);if(V>0)return V}}return 0},Y=Q(J);if(Y>0)return Y;if("size"in J){let X=J.size;if(typeof X?.height==="number"&&X.height>0)return X.height}return this.viewportHeight}}class M81 extends T6{agentMode;tryOpus;constructor(J={}){super(J.key?{key:J.key}:{});this.agentMode=J.agentMode,this.tryOpus=J.tryOpus??!1}build(J){let Y=v4.of(J).colorScheme,G=f6.of(J).app,q=q8.of(J).capabilities.animationSupport,V=this.tryOpus&&this.agentMode==="smart",K=!this.tryOpus&&this.agentMode==="smart",W=V?{type:"note",text:"You are trying Claude Opus 4.5.",url:"https://ampcode.com/news/try-opus"}:K?{type:"note",text:"Try Claude Opus 4.5 with `amp --try-opus`.",url:"https://ampcode.com/news/try-opus"}:{type:"prompt",text:"Smart mode now uses Gemini 3 Pro."},H=W.type==="quote"?new U1({color:Y.foreground,dim:!0}):W.type==="hint"?new U1({color:Y.secondary}):new U1({color:W.type==="prompt"||W.type==="note"?Y.primary:Y.warning}),z=new U1({color:G.keybind}),U=new U1({color:G.command}),N=new U1({color:Y.secondary}),O=new U1({color:Y.foreground,dim:!0}),M=[];if(W.type==="hint"){let P=W.text.split(/(`[^`]+`)/g);for(let R of P)if(R.startsWith("`")&&R.endsWith("`")){let j=R.slice(1,-1);M.push(new Q1(j,U))}else M.push(new Q1(R,H))}else M.push(new Q1(W.text,H));let L=[new Q1("Welcome to Amp",new U1({color:Y.foreground})),new Q1(`
|
|
5012
|
+
`));G.push(new Q1(` • ${q}`,new U1({color:X.foreground,dim:!0})))}return new l1({text:new Q1("",void 0,G)})}class sJ6 extends T6{props;constructor(J){super();this.props=J}build(J){let Q=this.props.affectedFiles,Y=Q.length>0,G=[new l1({text:new Q1(Y?"This will delete this message and any subsequent messages in the thread, and will restore the following files:":"This will delete this message and any subsequent messages in the thread.",new U1({color:M1.yellow,bold:!0}))}),new N0({height:1})],Z=oJ6(J,Q);if(Z)G.push(Z),G.push(new N0({height:1}));let q=[{value:"confirm",label:Y?"Delete and restore":"Delete"},{value:"cancel",label:"Cancel"}];return G.push(new fY({options:q,onSelect:(V)=>{if(V==="confirm")this.props.onConfirm();else this.props.onCancel()},padding:k0.all(0),showDismissalMessage:!1,enableMouseInteraction:!1,showBorder:!1})),new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:G})}}class tJ6 extends T6{props;constructor(J){super();this.props=J}build(J){let Q=this.props.affectedFiles,Y=[],X=oJ6(J,Q);if(X)Y.push(new l1({text:new Q1("This will restore the following files:",new U1({color:M1.yellow,bold:!0}))})),Y.push(new N0({height:1})),Y.push(X),Y.push(new N0({height:1}));let G=[{value:"confirm",label:"Confirm edit"},{value:"cancel",label:"Cancel"}];return Y.push(new fY({options:G,onSelect:(Z)=>{if(Z==="confirm")this.props.onConfirm();else this.props.onCancel()},padding:k0.all(0),showDismissalMessage:!1,enableMouseInteraction:!1,showBorder:!1})),new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:Y})}}class U81 extends Q6{initialText;onSubmitted;message;constructor(J){super();this.initialText=J.initialText,this.onSubmitted=J.onSubmitted,this.message=J.message}createState(){return new eJ6}}class eJ6 extends J6{controller=new CG;currentShellModeStatus;initState(){this.controller.text=this.widget.initialText,this.controller.addListener(this.textChangeListener);let J=gB(this.widget.initialText);this.currentShellModeStatus=J?.visibility}dispose(){this.controller.removeListener(this.textChangeListener),this.controller.dispose(),super.dispose()}textChangeListener=()=>{let J=this.controller.text,Y=gB(J)?.visibility;if(Y!==this.currentShellModeStatus)this.currentShellModeStatus=Y,this.setState(()=>{})};handleSubmit=(J)=>{this.widget.onSubmitted(J)};build(J){let Q=f6.of(J),Y=Q.colors,X=Q.app,G=this.currentShellModeStatus?O76(Q,this.currentShellModeStatus):aJ6,Z=null,q=this.widget.message&&xl(this.widget.message);if(q)Z=vj1(J,q);let V=new XA({controller:this.controller,triggers:[],ampURL:"",onSubmitted:this.handleSubmit,theme:Y,placeholder:"",enabled:!0,autofocus:!0,shellPromptRules:_41(Q),showMenuBelow:!1,imageAttachments:[],minLines:1,textColor:G}),K=[];if(K.push(V),Z)K.push(new N0({height:1})),K.push(Z);let W;if(K.length===1)W=K[0];else W=new l0({mainAxisSize:"min",crossAxisAlignment:"start",children:K});let H=new e0({decoration:{border:i4.all(new S4(G,2,"solid"))},padding:k0.only({left:1,right:1}),child:W}),z=[];if(this.currentShellModeStatus===uB)z.push(new Q1("shell mode (incognito)",new U1({color:Q.app.shellModeHidden})));else if(this.currentShellModeStatus===S41)z.push(new Q1("shell mode",new U1({color:Q.app.shellMode})));else z.push(new Q1("esc",new U1({color:X.keybind})),new Q1(" to cancel",new U1({color:Y.foreground,dim:!0})));let U=new f3({left:2,bottom:0,child:new l1({text:new Q1("",void 0,z)})});return new W41({child:new t5({children:[H,U]})})}}class B81 extends l2{}class N81 extends l2{}class xj1 extends l2{}class fj1 extends l2{}class hj1 extends l2{}class bj1 extends l2{}class uj1 extends l2{}class gj1 extends l2{}var uz8=0;function gz8(J,Q,Y){let G=f6.maybeOf(J)?.colors??v4.of(J).colorScheme,q=Q.trimStart().startsWith("You're absolutely right"),V=new c2(`${Y}-text`),K=[];if(q)K.push(new Oj1({key:V,markdown:Q,defaultColor:G.foreground}));else K.push(new k2({key:V,markdown:Q}));if(K.length===1)return K[0];return new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:K})}function mz8(J,Q){let X=v4.of(J).colorScheme;if(Q.summary.type!=="message")return new e0;return new l0({crossAxisAlignment:"start",children:[new l1({text:new Q1("Summary:",new U1({color:X.foreground,dim:!0,bold:!0,italic:!0})),selectable:!0}),new N0({height:1}),new k2({markdown:Q.summary.summary,styleScheme:{text:new U1({color:X.foreground,dim:!0,italic:!0}),inlineCode:new U1({color:X.foreground,dim:!0,italic:!0}),codeBlock:new U1({color:X.foreground,dim:!0,italic:!0}),tableBorder:X.foreground,link:new U1({color:X.foreground,dim:!0,italic:!0}),syntaxHighlight:{keyword:X.foreground,string:X.foreground,number:X.foreground,comment:X.foreground,function:X.foreground,variable:X.foreground,type:X.foreground,operator:X.foreground}}})]})}class D81 extends Q6{items;subagentToolsByParentID;controller;autofocus;onNewMessage;showScrollbar;onCopy;onMessageEditSubmit;onShellCommandSubmit;onMessageRestoreSubmit;onMessageForkSubmit;getAffectedFiles;thread;focusNode;onDismissFocus;isInSelectionMode=!1;get userMessageIndices(){let J=[];for(let Q=0;Q<this.items.length;Q++){let Y=this.items[Q];if(Y?.type==="message"){if(Y.message.role==="user"||uw(Y.message))J.push(Q)}}return J}constructor({key:J,items:Q,subagentToolsByParentID:Y={},controller:X,autofocus:G=!1,onNewMessage:Z,showScrollbar:q=!0,onCopy:V,onMessageEditSubmit:K,onMessageRestoreSubmit:W,onMessageForkSubmit:H,getAffectedFiles:z,thread:U,focusNode:N,onDismissFocus:O,isInSelectionMode:M=!1}){super(J?{key:J}:{});this.items=Q,this.subagentToolsByParentID=Y,this.controller=X,this.autofocus=G,this.onNewMessage=Z,this.showScrollbar=q,this.onCopy=V,this.onMessageEditSubmit=K,this.onMessageRestoreSubmit=W,this.onMessageForkSubmit=H,this.getAffectedFiles=z,this.thread=U,this.focusNode=N,this.onDismissFocus=O,this.isInSelectionMode=M}createState(){return new JQ6}}class JQ6 extends J6{_controller=null;_isDisposed=!1;_thinkingBlockStates=new Map;_globalToggleListener;_streamingIndexes=new Set;_viewportHeight=25;_widgetCache=new Map;_lastCostDisplayState=null;_selectedUserMessageOrdinal=null;_editingMessageOrdinal=null;_isShowingRestoreConfirmation=!1;_isShowingEditConfirmation=!1;_pendingEditText=null;_affectedFiles=[];get controller(){return this._controller}dismiss(){N9.instance.addPostFrameCallback(()=>{this.widget.focusNode?.unfocus()}),this.widget.onDismissFocus?.()}_navigateUp(J,Q){if(Q<=0)return null;if(J===null)return Q-1;if(J<=0)return 0;return J-1}_navigateDown(J,Q){if(Q<=0)return null;if(J===null)return null;if(J>=Q-1)return null;return J+1}_ordinalToIndex(J,Q){if(Q===null)return null;if(Q<0||Q>=J.length)return null;return J[Q]??null}_getUserCount(){return this.widget.userMessageIndices.length}_clearSelectedUserMessage(){let J=this._selectedUserMessageOrdinal,Q=J!==null?this.getUserMessageIndexFromOrdinal(J):null;this.setState(()=>{if(Q!=null)this._widgetCache.delete(Q);this._selectedUserMessageOrdinal=null})}_selectUserMessageByOrdinal(J){let Q=this._selectedUserMessageOrdinal,Y=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,G=this.getUserMessageIndexFromOrdinal(Y);if(X!==null)this._widgetCache.delete(X);if(G!==null)this._widgetCache.delete(G);if(this.setState(()=>{this._selectedUserMessageOrdinal=Y}),G!==null)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(G,{animated:!0,offset:uz8,edge:"top",duration:200})})}_selectEditingUserMessageByOrdinal(J){let Q=this._editingMessageOrdinal,Y=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,G=Y!==null?this.getUserMessageIndexFromOrdinal(Y):null;if(X!==null)this._widgetCache.delete(X);if(G!==null)this._widgetCache.delete(G);this.setState(()=>{this._editingMessageOrdinal=Y})}getUserMessageIndexFromOrdinal(J){return this.widget.userMessageIndices[J]??null}getOrdinalFromUserMessageIndex(J){let Y=this.widget.userMessageIndices.indexOf(J);return Y>=0?Y:null}getLatestUserMessageOrdinal(){let J=this.widget.userMessageIndices;return J.length>0?J.length-1:null}navigateToUserMessage(J){let Q=this._getUserCount(),Y=J==="up"?this._navigateUp(this._selectedUserMessageOrdinal,Q):this._navigateDown(this._selectedUserMessageOrdinal,Q);if(Y===null&&J==="down"){this._controller?.animateToBottom(100),this._clearSelectedUserMessage(),this.dismiss();return}if(Y!==null)this._selectUserMessageByOrdinal(Y)}handleNavigateUserMessageUp=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("up"),"handled"};handleNavigateUserMessageDown=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("down"),"handled"};handleEscape=()=>{if(this._editingMessageOrdinal!==null)return this.setState(()=>{let J=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(J!=null)this._widgetCache.delete(J);this._editingMessageOrdinal=null}),"handled";else if(this._selectedUserMessageOrdinal!==null)return this._clearSelectedUserMessage(),this.setState(()=>{this._editingMessageOrdinal=null}),this.dismiss(),this._controller?.animateToBottom(100),"handled";return"ignored"};handleScrollDown=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollDown(1),"handled";return"ignored"};handleScrollUp=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollUp(1),"handled";return"ignored"};handleEditMessage=()=>{if(this._selectedUserMessageOrdinal!==null)return this._selectEditingUserMessageByOrdinal(this._selectedUserMessageOrdinal),"handled";return"ignored"};handleRestoreMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||uw(Q.message)))this.showRestoreConfirmation(J)}return"handled"}return"ignored"};async showRestoreConfirmation(J){let Q=[];if(this.widget.getAffectedFiles)try{Q=await this.widget.getAffectedFiles(J)}catch{Q=[]}if(this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!0,this._affectedFiles=Q}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}handleRestoreConfirm=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||Q.message.role==="info"))this.widget.onMessageRestoreSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!1,this._affectedFiles=[]}),this.dismiss()}return"handled"}return"ignored"};handleRestoreCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(this.setState(()=>{this._widgetCache.clear(),this._isShowingRestoreConfirmation=!1,this._affectedFiles=[]}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}}return"handled"};handleForkMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||uw(Q.message))){if(J===0)return"ignored";this.widget.onMessageForkSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{}),this.dismiss()}}return"handled"}return"ignored"};handleEditConfirmationRequest=async(J)=>{if(J.trim()==="")return;if(this._editingMessageOrdinal!==null){let Q=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(Q!=null){let Y=[];if(this.widget.getAffectedFiles)try{Y=await this.widget.getAffectedFiles(Q)}catch{Y=[]}if(this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!0,this._pendingEditText=J,this._affectedFiles=Y,this._editingMessageOrdinal=null}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(Q)})}}};handleEditConfirm=()=>{if(this._selectedUserMessageOrdinal!==null&&this._pendingEditText!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&(Q.message.role==="user"||Q.message.role==="info"))this.widget.onMessageEditSubmit?.(Q.message,this._pendingEditText),this._clearSelectedUserMessage(),this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!1,this._pendingEditText=null,this._affectedFiles=[]}),this.dismiss(),this.controller.animateToBottom(100)}}};handleEditCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(this.setState(()=>{this._widgetCache.clear(),this._isShowingEditConfirmation=!1,this._pendingEditText=null,this._affectedFiles=[]}),this.controller.atBottom)N9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}}};_signatureFor(J){if(J.type==="message"){let Q=J.message;if(Q.role==="user"){let Y=y7(Q.content),X=Q.content.filter((G)=>G.type==="image").length;return`${J.id}|user|${Q.interrupted?1:0}|${X}|${Y}`}else if(Q.role==="assistant"){let Y=y7(Q.content),X=Q.state.type==="complete",G=Q.content.filter((K)=>K.type==="thinking"),Z=Q.content.filter((K)=>K.type==="tool_use"),q=Q.usage,V=q?`${q.credits??""}|${q.inputTokens}|${q.outputTokens}|${q.cacheCreationInputTokens??""}|${q.cacheReadInputTokens??""}|${q.model??""}`:"no-usage";return`${J.id}|assistant|${X?1:0}|${G.length}|${Z.length}|${Y}|${V}`}else{let X=Q.content.map((G)=>G.type).join(",");return`${J.id}|info|${X}`}}else{let Y=J.toolResult.run.status,X=this.widget.thread&&Y==="done"?jo(this.widget.thread,J.toolUse.id):void 0;return`${J.id}|tool|${Y}|${J.toolUse.id}|${X??""}`}}getThinkingBlockExpanded(J,Q){let Y=`${J}-${Q}`;return this._thinkingBlockStates.get(Y)??OJ.instance.allExpanded}toggleThinkingBlock=(J,Q)=>{return(Y)=>{let X=`${J}-${Q}`;this.setState(()=>{this._thinkingBlockStates.set(X,Y),this._widgetCache.delete(J)})}};buildThinkingBlock(J,Q,Y,X){let G=Y===X.content.length-1,Z=X.state?.type==="streaming"&&G;return new QA({key:new c2(`thinking-${Q}-${Y}`),thinkingBlock:J,expanded:this.getThinkingBlockExpanded(Q,Y),onToggle:this.toggleThinkingBlock(Q,Y),isStreaming:Z})}buildAssistantMessageWidget(J,Q,Y,X){let G=Q.content.map((U,N)=>({block:U,index:N})).filter((U)=>U.block.type==="thinking"&&Z81(U.block.thinking).length>0),Z=G.some(({block:U})=>Z81(U.thinking).length>0),q=Q.content.filter((U)=>U.type==="text"),V=[];if(V.push(...G.map(({block:U,index:N})=>this.buildThinkingBlock(U,Y,N,Q))),Z&&q.length>0)V.push(new N0({height:1}));let K=y7(q);if(K.trim())V.push(gz8(J,K,X));let W=Jz(J),H=Q.usage!=null&&(Q.usage.inputTokens>0||Q.usage.outputTokens>0);if(W&&H){let N=f6.maybeOf(J)?.colors??v4.of(J).colorScheme,O=u26(Q.usage);V.push(new g6({padding:k0.only({top:1}),child:new l1({text:new Q1(O,new U1({color:N.foreground,dim:!0}))})}))}let z;if(V.length===0)z=new e0;else if(V.length===1)z=V[0];else z=new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:V});return z}buildThreadItemWidget(J,Q,Y){let X=new c2(`thread-item-${Q.id}`);if(Q.type==="message"){let G=Q.message;if(G.role==="user"){if(!this.widget.isInSelectionMode)return new qC({message:G,isFirstMessage:Y>0});let Z=this.getOrdinalFromUserMessageIndex(Y);if(Z===null)return new qC({message:G,isFirstMessage:Y>0});if(this._editingMessageOrdinal===Z)return new U81({initialText:y7(G.content),message:G,onSubmitted:(V)=>{this.handleEditConfirmationRequest(V)}});if(this._selectedUserMessageOrdinal===Z)return new F81({message:G,isFirstMessage:Y>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,isShowingEditConfirmation:this._isShowingEditConfirmation,affectedFiles:this._affectedFiles,pendingEditText:this._pendingEditText??void 0,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()},onEditConfirm:()=>{this.handleEditConfirm()},onEditCancel:()=>{this.handleEditCancel()}});else return new qC({message:G,isFirstMessage:Y>0})}else if(G.role==="assistant"){let Z=this.buildAssistantMessageWidget(J,G,Y,Q.id);return new e0({key:X,child:Z})}else{let Z=G,q=[],V=this.getOrdinalFromUserMessageIndex(Y),K=this.widget.isInSelectionMode&&V!==null&&this._selectedUserMessageOrdinal===V;for(let W of Z.content)if(W.type==="manual_bash_invocation")if(this._editingMessageOrdinal===V){let z=`${j41(W.hidden??!1)}${W.args.cmd}`;q.push(new U81({initialText:z,message:Z,onSubmitted:(U)=>{this.handleEditConfirmationRequest(U)}}))}else if(!this.widget.isInSelectionMode||!K)q.push(new qC({message:Z,isFirstMessage:Y>0}));else q.push(new F81({message:Z,isFirstMessage:Y>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,isShowingEditConfirmation:this._isShowingEditConfirmation,affectedFiles:this._affectedFiles,pendingEditText:this._pendingEditText??void 0,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()},onEditConfirm:()=>{this.handleEditConfirm()},onEditCancel:()=>{this.handleEditCancel()}}));else if(W.type==="summary"&&W.summary.type==="message")q.push(mz8(J,W));if(q.length===0)return new e0;if(q.length===1)return q[0];return new l0({crossAxisAlignment:"stretch",children:q})}}else{let G=new Xz({toolUse:Q.toolUse,toolRun:Q.toolResult.run,subagentTools:this.widget.subagentToolsByParentID[Q.toolUse.id],thread:this.widget.thread});return new e0({key:X,child:G})}return new e0}initState(){if(super.initState(),this._controller=this.widget.controller||new h3,this._globalToggleListener=()=>{this.setState(()=>{this._thinkingBlockStates.clear(),this._widgetCache.clear()})},OJ.instance.addListener(this._globalToggleListener),this.widget.items.length>0)N9.instance.requestFrame()}didUpdateWidget(J){if(super.didUpdateWidget(J),!J.isInSelectionMode&&this.widget.isInSelectionMode){this.widget.focusNode?.requestFocus();let Y=this.getLatestUserMessageOrdinal();if(Y!==null)this._selectUserMessageByOrdinal(Y)}if(J.items===this.widget.items)return;let Q=Math.min(J.items.length,this.widget.items.length);for(let Y=0;Y<Q;Y++){let X=J.items[Y],G=this.widget.items[Y];if(X&&G){if(X.type!==G.type){this._widgetCache.delete(Y);continue}if(X.type==="toolResult"&&G.type==="toolResult"){let Z=X.toolResult.run,q=G.toolResult.run;if(Z.status!==q.status||"result"in Z!=="result"in q||"error"in Z!=="error"in q)this._widgetCache.delete(Y)}if(X.type==="message"&&G.type==="message"){let Z=X.message,q=G.message;if(Z.content!==q.content)this._widgetCache.delete(Y)}}}if(this.widget.items.length<J.items.length)this._cleanupOrphanedCacheEntries();this._updateStreamingIndexes();for(let Y of this._streamingIndexes)if(Y>=this.widget.items.length)this._streamingIndexes.delete(Y)}_cleanupOrphanedCacheEntries(){for(let J of this._widgetCache.keys())if(J>=this.widget.items.length)this._widgetCache.delete(J)}_isMessageStreaming(J){if(J.type!=="message")return!1;let Q=J.message;if(Q.role!=="assistant")return!1;if(Q.state.type==="streaming")return!0;return Q.content.at(-1)?.type==="thinking"}_updateStreamingIndexes(){for(let J of this._streamingIndexes)if(J>=this.widget.items.length)this._streamingIndexes.delete(J);for(let J=0;J<this.widget.items.length;J++){let Q=this.widget.items[J];if(!Q)continue;let Y=this._isMessageStreaming(Q);if(Y&&!this._streamingIndexes.has(J))this._streamingIndexes.add(J);else if(!Y&&this._streamingIndexes.has(J))this._streamingIndexes.delete(J)}}_getViewportHeight(){let J=this.context.findRenderObject();if(J&&"size"in J){let Q=J.size;if(typeof Q.height==="number"&&Q.height>0)return this._viewportHeight=Q.height,Q.height}return this._viewportHeight}dispose(){if(this._isDisposed=!0,this._widgetCache.clear(),this._globalToggleListener)OJ.instance.removeListener(this._globalToggleListener);if(!this.widget.controller)this._controller?.dispose();this.widget.focusNode?.dispose(),super.dispose()}build(J){let Q=f6.of(J),Y=Jz(J);if(this._lastCostDisplayState!==null&&this._lastCostDisplayState!==Y)this._widgetCache.clear();this._lastCostDisplayState=Y;let X=this._getTotalItemCount(J),G=[];for(let U=0;U<X;U++)if(G.push(this._buildItemAtIndex(J,U)),U<X-1)G.push(new N0({height:1}));let Z=new M7({controller:this._controller,autofocus:this.widget.autofocus,position:"bottom",child:new l0({key:new c2("message-list-column"),crossAxisAlignment:"start",children:G})}),V=[new g6({padding:k0.only({left:2,right:this.widget.showScrollbar?3:2,bottom:1}),child:Z})];if(this.widget.showScrollbar&&this._controller){let U=new s$({controller:this._controller,getScrollInfo:()=>this._getScrollbarInfo(),thickness:1,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack});V.push(new f3({right:1,top:0,bottom:0,child:new N0({width:1,child:U})}))}let K=new t5({children:V}),W=new gL({key:new c2("message-view-selection-area"),child:K,onCopy:this.widget.onCopy}),H=new Map([[B81,new a8(this.handleNavigateUserMessageUp)],[N81,new a8(this.handleNavigateUserMessageDown)],[xj1,new a8(this.handleEscape)],[fj1,new a8(this.handleScrollDown)],[hj1,new a8(this.handleScrollUp)],[bj1,new a8(this.handleEditMessage)],[uj1,new a8(this.handleRestoreMessage)],[gj1,new a8(this.handleForkMessage)]]),z=new Map([[K4.key("Tab"),new B81],[K4.shift("Tab"),new N81],[K4.key("Escape"),new xj1],[K4.key("j"),new fj1],[K4.key("k"),new hj1],[K4.key("e"),new bj1],[K4.key("r"),new uj1],[K4.key("f"),new gj1]]);if(!m7())z.set(K4.key("ArrowUp"),new B81),z.set(K4.key("ArrowDown"),new N81);if(this.widget.focusNode)return new r8({focusNode:this.widget.focusNode,child:new fQ({actions:H,child:new Bq({shortcuts:z,focusNode:this.widget.focusNode,child:W})})});return W}_getTotalItemCount(J){return this.widget.items.length}_shouldDimItem(J){if(this._isShowingRestoreConfirmation||this._isShowingEditConfirmation){let Q=this._selectedUserMessageOrdinal;if(Q===null)return!1;let Y=this.getUserMessageIndexFromOrdinal(Q);if(Y===null)return!1;return J>Y}if(this._editingMessageOrdinal!==null){let Q=this.getUserMessageIndexFromOrdinal(this._editingMessageOrdinal);if(Q===null)return!1;return J>Q}return!1}_buildItemAtIndex(J,Q){let Y=this.widget.items[Q];if(!Y)return new e0;let X=Y.type==="message"&&this._isMessageStreaming(Y),G=Y.type==="toolResult"&&(Y.toolResult.run.status==="queued"||Y.toolResult.run.status==="in-progress")&&!("result"in Y.toolResult.run)&&!("error"in Y.toolResult.run),Z=this._shouldDimItem(Q);if(!X&&!G){let K=`${this._signatureFor(Y)}|dim:${Z?1:0}`,W=this._widgetCache.get(Q);if(W&&W.sig===K)return W.widget;let H=this.buildThreadItemWidget(J,Y,Q),z=Z?new a$({forceDim:!0,child:H}):H;return this._widgetCache.set(Q,{sig:K,widget:z}),z}let V=this.buildThreadItemWidget(J,Y,Q);return Z?new a$({forceDim:!0,child:V}):V}onNewMessage(){if(this._isDisposed)return;this.widget.onNewMessage?.()}scrollToTop(){if(this._isDisposed||!this._controller)return;this._controller.scrollToTop()}scrollToMessage(J,{animated:Q=!1,offset:Y=0,edge:X="top",duration:G}={}){if(this._isDisposed||!this._controller)return!1;let Z=this._getMessageRelativeOffset(J,X);if(Z===null)return!1;let q=Z-Y;if(Q)this._controller.animateTo(q,G);else this._controller.jumpTo(q);return!0}_getColumnElement(){let J=this.context.element;if(!J)return null;let Q=new c2("message-list-column"),Y=(X)=>{if(X.widget.key?.equals(Q))return X;for(let G of X.children){let Z=Y(G);if(Z)return Z}return null};return Y(J)}_getMessageRelativeOffset(J,Q){let Y=this._getColumnElement();if(!Y)return null;let X=J*2,G=Y.children[X];if(!G?.renderObject)return null;let Z=G.renderObject,q=Y.renderObject;if(!q)return null;let V=Z.localToGlobal({x:0,y:0}),K=q.localToGlobal({x:0,y:0}),W=0;if(Q==="bottom")W=Z.size.height;return V.y+W-K.y}_getScrollbarInfo(){let J=this._controller?.maxScrollExtent??0,Q=this._getViewportHeight(),Y=this._controller?.offset??0,X=J+Q;return{totalContentHeight:Math.max(X,0),viewportHeight:Math.max(Q,1),scrollOffset:Math.max(Y,0)}}}ZI();class mj1 extends T6{thread;onExecute;onEdit;constructor({thread:J,onExecute:Q,onEdit:Y}){super();this.thread=J,this.onExecute=Q,this.onEdit=Y}build(J){if(this.thread.agentMode!=="plan")return new N0({width:0,height:0});let Q=f6.of(J),Y=Q.colors,X=hF(this.thread);if(!fL(this.thread))return new N0({width:0,height:0});let Z=[];return Z.push(new G4({mainAxisSize:"max",mainAxisAlignment:"spaceBetween",crossAxisAlignment:"center",children:[new l1({text:new Q1("\uD83D\uDCCB Plan",new U1({color:Y.foreground,bold:!0})),textAlign:"left"}),new G4({mainAxisSize:"min",children:[new P8({onClick:this.onExecute,cursor:"pointer",child:new l1({text:new Q1("[Execute]",new U1({color:Y.success})),textAlign:"right"})}),new N0({width:1,height:1}),new P8({onClick:this.onEdit,cursor:"pointer",child:new l1({text:new Q1("[Edit]",new U1({color:Y.secondary})),textAlign:"right"})})]})]})),Z.push(m5.vertical(1)),Z.push(new k2({markdown:X,textAlign:"left",styleScheme:{text:new U1({color:Y.mutedForeground,dim:!0}),inlineCode:new U1({color:Y.secondary,bold:!0}),codeBlock:new U1({color:Y.mutedForeground,dim:!0}),tableBorder:Y.border,link:new U1({color:Y.secondary,underline:!0}),syntaxHighlight:Q.app.syntaxHighlight}})),Z.push(m5.vertical(1)),Z.push(new l1({text:new Q1("",void 0,[new Q1("Ctrl+O ",new U1({color:Y.secondary})),new Q1("→ Execute Plan",new U1({color:Y.mutedForeground,dim:!0}))]),textAlign:"left"})),new l0({mainAxisSize:"min",mainAxisAlignment:"start",crossAxisAlignment:"start",children:Z})}}class O81 extends Q6{props;constructor(J){super();this.props=J}createState(){return new QQ6}}class QQ6 extends J6{viewportHeight=1;scrollListenerAttached=!1;initState(){if(!this.scrollListenerAttached)this.widget.props.controller.addListener(()=>{this.updateViewportHeight()}),this.scrollListenerAttached=!0}build(J){let{thread:Q,onExecute:Y,onEdit:X,controller:G,appTheme:Z}=this.widget.props;return new G4({crossAxisAlignment:"stretch",children:[new F4({child:new M7({controller:G,autofocus:!1,child:new mj1({thread:Q,onExecute:Y,onEdit:X})})}),new s$({controller:G,thumbColor:Z.app.scrollbarThumb,trackColor:Z.app.scrollbarTrack,getScrollInfo:()=>{let{maxScrollExtent:q,offset:V}=G,K=this.viewportHeight,W=q+K;return{totalContentHeight:Math.max(W,0),viewportHeight:Math.max(K,1),scrollOffset:Math.max(V,0)}}})]})}updateViewportHeight(){let J=this.getViewportHeight();if(J!==this.viewportHeight)this.viewportHeight=J}getViewportHeight(){let J=this.context.findRenderObject();if(!J)return this.viewportHeight;let Q=(X,G=0)=>{if(X&&"size"in X&&"children"in X){let Z=X.children||[];for(let q of Z){if(q&&"size"in q){let K=q.size;if(typeof K?.height==="number"&&K.height>0)return K.height}let V=Q(q,G+1);if(V>0)return V}}return 0},Y=Q(J);if(Y>0)return Y;if("size"in J){let X=J.size;if(typeof X?.height==="number"&&X.height>0)return X.height}return this.viewportHeight}}class M81 extends T6{agentMode;tryOpus;constructor(J={}){super(J.key?{key:J.key}:{});this.agentMode=J.agentMode,this.tryOpus=J.tryOpus??!1}build(J){let Y=v4.of(J).colorScheme,G=f6.of(J).app,q=q8.of(J).capabilities.animationSupport,V=this.tryOpus&&this.agentMode==="smart",K=!this.tryOpus&&this.agentMode==="smart",W=V?{type:"opus",text:"You are trying Claude Opus 4.5.",url:"https://ampcode.com/news/try-opus"}:K?{type:"opus",text:"Try Claude Opus 4.5 with `amp --try-opus`.",url:"https://ampcode.com/news/try-opus"}:{type:"prompt",text:"Smart mode now uses Gemini 3 Pro."},H=W.type==="quote"?new U1({color:Y.foreground,dim:!0}):W.type==="hint"?new U1({color:Y.secondary}):new U1({color:W.type==="opus"?M1.rgb(255,60,70):W.type==="prompt"||W.type==="note"?Y.primary:Y.warning}),z=new U1({color:G.keybind}),U=new U1({color:G.command}),N=new U1({color:Y.secondary}),O=new U1({color:Y.foreground,dim:!0}),M=[];if(W.type==="hint"){let P=W.text.split(/(`[^`]+`)/g);for(let R of P)if(R.startsWith("`")&&R.endsWith("`")){let j=R.slice(1,-1);M.push(new Q1(j,U))}else M.push(new Q1(R,H))}else M.push(new Q1(W.text,H));let L=[new Q1("Welcome to Amp",new U1({color:Y.foreground})),new Q1(`
|
|
5013
5013
|
|
|
5014
5014
|
|
|
5015
5015
|
`),new Q1("Ctrl+O",z),new Q1(" to execute ",O),new Q1("commands",U),new Q1(`
|
|
@@ -5023,7 +5023,7 @@ exit code: ${Z}`,new U1({color:X.foreground,dim:!0,italic:!0})));if(q)V.push(new
|
|
|
5023
5023
|
`,O),...M],w=[new l1({text:new Q1("",void 0,L)})];if(W.url){let P=W.url.replace(/^https?:\/\//,"");w.push(new G4({children:[new l1({text:new Q1("See more: ",O)}),new b3({uri:W.url,text:P,style:new U1({color:Y.secondary,underline:!0})})]}))}let I=new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:w});return $8.child(new e0({constraints:new d6(40,120,0,1/0),child:new G4({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[new F4({flex:1,child:new UC1({width:40,height:40,agentMode:this.agentMode,...V&&{primaryColor:{r:100,g:20,b:20},secondaryColor:{r:255,g:60,b:70}},fps:q==="fast"?60:q==="slow"?15:0,...q==="disabled"&&{seed:42,t:3}})}),new N0({width:1}),new F4({flex:2,child:I})]})}))}}H0();K9();Z4();V5();K9();g0();function pz8(J,Q){return`${J}:${Q}`}class pj1{threadService;workers=new Map;threadsMap=new Map;subthreadsMap=new Map;mainThreadSubs=new Map;subthreadsSubs=new Map;workerStatusSubs=new Map;subthreadPatchSubs=new Map;mainThreadObservable;subthreadObservable;workerStatusObservable;emitMainThread=null;emitSubthread=null;emitWorkerStatus=null;constructor(J){this.threadService=J;this.mainThreadObservable=new J0((Q)=>{return this.emitMainThread=(Y)=>Q.next(Y),()=>{this.emitMainThread=null}}),this.subthreadObservable=new J0((Q)=>{return this.emitSubthread=(Y)=>Q.next(Y),()=>{this.emitSubthread=null}}),this.workerStatusObservable=new J0((Q)=>{return this.emitWorkerStatus=(Y)=>Q.next(Y),()=>{this.emitWorkerStatus=null}})}registerWorker(J){let Q=J.thread.id;if(this.workers.has(Q))this.unregisterWorker(Q);this.threadsMap.set(Q,J.thread),this.subthreadsMap.set(Q,[]),this.workers.set(Q,{state:"initial"});let Y=this.threadService.observePatches(Q).pipe(QO()).subscribe((Z)=>{this.threadsMap.set(Q,Z);let q=this.subthreadsMap.get(Q)||[],V=this.workers.get(Q)||{state:"initial"};if(this.emitMainThread)this.emitMainThread({threadID:Q,mainThread:Z,subthreads:q,workerStatus:V})});this.mainThreadSubs.set(Q,Y);let X=J.status.subscribe((Z)=>{if(this.workers.set(Q,Z),this.emitWorkerStatus)this.emitWorkerStatus({threadID:Q,status:Z})});this.workerStatusSubs.set(Q,X);let G=J.subthreads.subscribe((Z)=>{this.subthreadsMap.set(Q,Z);for(let q of Z){let V=pz8(Q,q.toolUse.id);if(this.subthreadPatchSubs.has(V))continue;let K=this.threadService.observePatches(q.threadID).pipe(QO()).subscribe((W)=>{if(this.emitSubthread)this.emitSubthread({threadID:Q,thread:W,subthread:q})});this.subthreadPatchSubs.set(V,K)}});this.subthreadsSubs.set(Q,G)}unregisterWorker(J){let Q=this.mainThreadSubs.get(J);if(Q)Q.unsubscribe(),this.mainThreadSubs.delete(J);let Y=this.workerStatusSubs.get(J);if(Y)Y.unsubscribe(),this.workerStatusSubs.delete(J);let X=this.subthreadsSubs.get(J);if(X)X.unsubscribe(),this.subthreadsSubs.delete(J);for(let[G,Z]of this.subthreadPatchSubs.entries())if(G.startsWith(`${J}:`))Z.unsubscribe(),this.subthreadPatchSubs.delete(G);this.workers.delete(J),this.threadsMap.delete(J),this.subthreadsMap.delete(J)}observeThread(J){return{mainThread:new J0((Q)=>{return this.mainThreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),subthreads:new J0((Q)=>{return this.subthreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),workerStatus:new J0((Q)=>{return this.workerStatusObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})})}}get threadViewStates(){let J={};for(let[Q,Y]of this.threadsMap){let X=this.workers.get(Q);if(X)J[Q]=QL(Y,X)}return J}dispose(){for(let J of this.mainThreadSubs.values())J.unsubscribe();for(let J of this.subthreadsSubs.values())J.unsubscribe();for(let J of this.workerStatusSubs.values())J.unsubscribe();for(let J of this.subthreadPatchSubs.values())J.unsubscribe();this.mainThreadSubs.clear(),this.subthreadsSubs.clear(),this.workerStatusSubs.clear(),this.subthreadPatchSubs.clear(),this.workers.clear(),this.threadsMap.clear(),this.subthreadsMap.clear()}}function dz8(J,Q){switch(Q.type){case"subthread-patch":{let{thread:Y,subthread:X}=Q,G=J.subagents[X.threadID];if(!G){if(G={subThreadID:Y.id,parentToolID:X.toolUse.id,taskDescription:X.toolUse.input.description||"Task",isCompleted:!1,agentState:{type:"idle"}},J.mainThread){let W=nJ(J.mainThread);G.isCompleted=YQ6(W,X.toolUse.id)}}let Z=cz8(Y,G.agentState),q=G.agentState===Z?G:{...G,agentState:Z},V={...J.tools},K=VC(Y).items.filter((W)=>W.type==="toolResult");for(let W of K)V[W.id]={id:W.id,subthreadID:Y.id,toolRun:W.toolResult.run,toolUse:W.toolUse};return{subagents:{...J.subagents,[X.threadID]:q},tools:V,items:J.items,viewState:J.viewState,todosList:J.todosList,mainThread:J.mainThread}}case"main-thread-patch":{let{thread:Y,subthreads:X,workerStatus:G}=Q,Z=nJ(Y),q={...J.subagents};for(let z of X){let U=q[z.threadID];if(!U)continue;let N=YQ6(Z,z.toolUse.id);q[z.threadID]={...U,isCompleted:N}}let{items:V}=VC(Y),K=QL(Y,G),W=gw({messages:Y.messages}),H=Array.isArray(W)?W:[];return{...J,subagents:q,items:V,viewState:K,todosList:H,mainThread:Y}}case"worker-status-change":{if(!J.mainThread)return J;let Y=QL(J.mainThread,Q.workerStatus);if(Y===J.viewState)return J;return{...J,viewState:Y}}default:return J}}function VC(J){let Q=[],Y=new Map,X=new Set;for(let[G,Z]of J.messages.entries()){let q=`${Z.role}-${G}`;switch(Z.role){case"assistant":{let V=Z.state.type==="streaming";for(let W of Z.content)if(W.type==="tool_use"){if(Y.set(W.id,W),V)X.add(W.id)}if(Z.content.some((W)=>W.type==="text"&&W.text.trim()||W.type==="thinking"))Q.push({type:"message",id:q,message:Z});for(let W of Z.content)if(W.type==="tool_use"){let H=!1;for(let z=G+1;z<J.messages.length;z++){let U=J.messages[z];if(U){for(let N of U.content)if(N.type==="tool_result"&&N.toolUseID===W.id){H=!0;break}}if(H)break}if(!H)Q.push({type:"toolResult",id:W.id,toolUse:W,toolResult:{type:"tool_result",toolUseID:W.id,run:{status:V?"in-progress":"queued"}}})}break}case"info":Q.push({type:"message",id:q,message:Z});break;case"user":{if(Z.content.some((K)=>K.type==="text"&&K.text.trim()||K.type==="image"))Q.push({type:"message",id:q,message:Z});for(let K of Z.content)if(K.type==="tool_result"){let W=Y.get(K.toolUseID)??V$(J,K.toolUseID);if(!W)throw Error(`(bug) tool use ${K.toolUseID} not found`);Q.push({type:"toolResult",id:K.toolUseID,toolUse:W,toolResult:K})}break}}}return{items:Q}}function YQ6(J,Q){let Y=J.get(Q);return(Y&&V7(Y.run))??!1}function cz8(J,Q){let Y=J.messages.at(-1);if(Y?.content.some((G)=>G.type==="tool_result"&&G.run.status==="blocked-on-user"))return x.info("Subagent status: idle (blocked-on-user)",{threadID:J.id}),{type:"idle"};if(VC(J).items.some((G)=>G.type==="toolResult"&&G.toolResult.run.status==="in-progress")){let G=Q?.type==="running-tools"?Q.startTime:Date.now();return x.info("Subagent status: running-tools",{threadID:J.id,startTime:G,hasStartTime:!!G}),{type:"running-tools",startTime:G}}if(Y&&Y.role==="assistant"&&Y.state.type==="streaming")switch(Y.content.at(-1)?.type){case"text":return x.info("Subagent status: streaming-text",{threadID:J.id}),{type:"streaming-text"};case"thinking":return x.info("Subagent status: streaming-thinking",{threadID:J.id}),{type:"streaming-thinking"};case"tool_use":{let Z=Q?.type==="running-tools"?Q.startTime:Date.now();return x.info("Subagent status: running-tools (streaming tool_use)",{threadID:J.id,startTime:Z,hasStartTime:!!Z}),{type:"running-tools",startTime:Z}}default:return x.info("Subagent status: streaming-text (default)",{threadID:J.id}),{type:"streaming-text"}}return x.info("Subagent status: idle (default)",{threadID:J.id}),{type:"idle"}}class dj1 extends Q6{props;constructor(J){super();this.props=J}createState(){return new $Q6}}class $Q6 extends J6{state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null};workerController;subscriptions=[];currentWorker;constructor(){super();this.workerController=null,this.currentWorker=null}initState(){let{threadService:J,worker:Q}=this.widget.props;this.workerController=new pj1(J),this.currentWorker=Q,this.setupSubscriptions(Q)}dispose(){this.cleanup()}didUpdateWidget(J){if(J.props.threadService!==this.widget.props.threadService||J.props.worker!==this.widget.props.worker)this.cleanup(),this.setupSubscriptions(this.widget.props.worker)}setupSubscriptions(J){this.workerController.registerWorker(J);let Q=this.workerController.observeThread(J.thread.id),Y=Q.mainThread.subscribe((Z)=>{this.dispatch({type:"main-thread-patch",thread:Z.mainThread,subthreads:Z.subthreads,workerStatus:Z.workerStatus})});this.subscriptions.push(Y);let X=Q.subthreads.subscribe((Z)=>{this.dispatch({type:"subthread-patch",thread:Z.thread,subthread:Z.subthread})});this.subscriptions.push(X);let G=Q.workerStatus.subscribe((Z)=>{this.dispatch({type:"worker-status-change",workerStatus:Z.status})});this.subscriptions.push(G)}cleanup(){this.subscriptions.forEach((J)=>J.unsubscribe()),this.subscriptions=[]}switchWorker(J){this.cleanup(),this.setState(()=>{this.currentWorker=J}),this.setState(()=>{this.state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null}}),this.setupSubscriptions(J)}dispatch(J){this.setState(()=>{this.state=dz8(this.state,J)})}getThreadData(){let J=Object.values(this.state.tools).map((Z)=>({toolUse:Z.toolUse,toolRun:Z.toolRun,subthreadID:Z.subthreadID})),Q={};for(let Z of Object.values(this.state.subagents)){let q=J.filter((V)=>V.subthreadID===Z.subThreadID);Q[Z.parentToolID]=q}let Y=(Z)=>Z===a5||Z===e8||Z===Sw||Z===RF||Z===CF||Z===jw||Z===_w||Z===q$,X=new Map;for(let Z of this.state.items)if(Z.type==="toolResult"&&Y(Z.toolUse.name))X.set(Z.toolUse.id,{toolUseId:Z.toolUse.id,toolName:Z.toolUse.name,toolRun:Z.toolResult.run});let G=Array.from(X.values());for(let{toolUseId:Z,toolRun:q}of G){let V=[],K;if(q.status==="in-progress"||q.status==="done"||q.status==="error"||q.status==="cancelled")K=q.progress;if(K){let W=0;for(let H of K)if(H.tool_uses)for(let z of H.tool_uses){let U=`${Z}:progress:${W++}`;V.push({toolUse:hw(z.tool_name,z.input,U),toolRun:{status:z.status}})}}Q[Z]=V}return{...this.state,subagents:Object.values(this.state.subagents),subagentActiveTools:J,subagentToolsByParentID:Q}}build(J){let Q=this.getThreadData();return this.widget.props.builder(J,Q,this.workerController,(Y)=>this.switchWorker(Y),()=>this.currentWorker)}}class cj1 extends Q6{props;constructor(J){super({key:J.key});this.props=J}createState(){return new XQ6}}class XQ6 extends J6{build(J){let Y=f6.of(J).colors,{todos:X,title:G="TODOs"}=this.widget.props;if(!Array.isArray(X)||X.length===0)return new N0({width:0,height:0});let Z=X.map((q)=>this.buildTodoItem(q,Y));return new e0({child:new g6({padding:k0.symmetric(1,0),child:new l0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new l1({text:new Q1(G,new U1({bold:!0,color:Y.foreground}))}),...Z]})})})}buildTodoItem(J,Q){let Y=this.getStatusIcon(J.status),X=J.status==="completed",G=new U1({bold:J.status==="in-progress",color:Q.foreground,dim:X}),Z=new U1({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:X});return new G4({crossAxisAlignment:"start",children:[new l1({text:new Q1(Y,G)}),new N0({width:1}),new F4({child:new l1({text:new Q1(J.content,Z)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class lj1 extends T6{ad;onDismiss;onButtonClick;constructor({key:J,ad:Q,onDismiss:Y,onButtonClick:X}){super({key:J});this.ad=Q,this.onDismiss=Y,this.onButtonClick=X}build(J){let Q=f6.of(J),Y=Q.colors.primary,X=Q.colors.foreground;return new e0({decoration:new T8(void 0,new i4(new S4(Y,1,"rounded"),new S4(Y,1,"rounded"),void 0,new S4(Y,1,"rounded"))),child:new g6({padding:k0.horizontal(1),child:new l0({children:[new G4({crossAxisAlignment:"start",children:[new F4({child:new l1({text:new Q1(this.ad.content,new U1({color:X}))})}),new N0({width:4}),new b3({uri:"https://ampcode.com/free",text:"Ad",style:new U1({color:X,dim:!0}),onError:(G)=>{}})]}),new G4({crossAxisAlignment:"start",children:[new TC1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:k0.horizontal(1),color:Y,reverse:!0}),new N0({width:2}),new l1({text:new Q1(this.ad.destinationUrlHostname,new U1({color:X,dim:!0}))})]})]})})})}}class ij1 extends Q6{props;constructor(J){super();this.props=J}createState(){return new GQ6(this.props.autofocus??!0)}}class GQ6 extends J6{autofocus;constructor(J){super();this.autofocus=J}build(J){let Q=(V)=>{if(V.key==="Enter"&&this.widget.props.showCopyOption)return this.widget.props.onSelect("copy"),"handled";if(V.ctrlKey&&V.key==="c"||V.key==="Escape")return this.widget.props.onSelect(null),"handled";return"ignored"},Y=q8.sizeOf(J),X=Math.min(60,Y.width-4),G=Y.height-4,Z=[];if(this.widget.props.title)Z.push(new l1({text:new Q1(this.widget.props.title,new U1({bold:!0,color:M1.blue}))}),new N0({height:1}));if(this.widget.props.message)Z.push(new l1({text:new Q1(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)Z.push(new N0({height:1}));let q=[];if(this.widget.props.showCopyOption)q.push(new l1({text:new Q1("Enter to copy",new U1({dim:!0}))}));return q.push(new l1({text:new Q1("Escape to close",new U1({dim:!0}))})),Z.push(new G4({children:q.flatMap((V,K)=>K<q.length-1?[V,new N0({width:1}),new l1({text:new Q1("•",new U1({dim:!0}))}),new N0({width:1})]:[V]),mainAxisSize:"min"})),new $8({child:new e0({constraints:new d6(X,X,0,G),decoration:new T8(M1.default(),new i4(new S4(M1.blue,1,"rounded"),new S4(M1.blue,1,"rounded"),new S4(M1.blue,1,"rounded"),new S4(M1.blue,1,"rounded"))),padding:new k0(2,2,2,2),child:new r8({autofocus:this.autofocus,onKey:Q,child:new l0({children:Z,mainAxisSize:"min"})})})})}}class L81 extends Error{constructor(J="Command timed out"){super(J);this.name="CommandTimeoutError",Object.setPrototypeOf(this,L81.prototype)}}class A81 extends Error{constructor(J){let Q=`${J.noun}: ${J.verb} command cancelled`;super(Q);this.name="CommandCancelledError",Object.setPrototypeOf(this,A81.prototype)}}function nj1(J){let Q=J.match(/"([^"]*)"|'([^']*)'|([^\s"']+)/g);if(!Q)return[];return Q.map((Y)=>{if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);return Y})}vF();H0();import{spawn as lz8}from"node:child_process";import{promises as iz8}from"node:fs";function ZQ6(J){return J.kind==="executable"}function qQ6(J){return J.kind==="markdown"}var Gz=50000,VQ6=300000;async function aj1(J,Q,Y,X={}){let{timeoutMs:G=VQ6,signal:Z,source:q}=X;try{let V=await Y.getCommand(J,q);if(!V)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Y.isCommandAvailable(J,q))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(x.debug("Executing command",{commandName:J,filePath:V.filePath,args:Q}),qQ6(V))return await nz8(V,Q);else if(ZQ6(V))return await az8(V,Q,G,Z);else return{success:!1,output:"",error:"Unsupported command type"}}catch(V){return x.error("Failed to execute command",{commandName:J,error:V}),{success:!1,output:"",error:V instanceof Error?V.message:"Unknown error occurred"}}}async function nz8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Y=await iz8.readFile(J.filePath,"utf8");return{success:!0,output:(Y.length>Gz?Y.slice(0,Gz)+`
|
|
5024
5024
|
... (output truncated at ${Gz} characters)`:Y).trim(),exitCode:0}}catch(Y){return{success:!1,output:"",error:Y instanceof Error?Y.message:"Failed to read markdown file"}}}async function az8(J,Q,Y=VQ6,X){return new Promise((G)=>{let[Z,q]=rz8(J,Q);x.debug("Spawning command",{spawnCommand:Z,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Y});let V=vN0(X),K=!1,W=setTimeout(()=>{K=!0,V.abort(),x.warn("Command execution timed out",{commandName:J.name,timeoutMs:Y})},Y),H=lz8(Z,q,{stdio:["pipe","pipe","pipe"],signal:V.signal,detached:!0}),z=[],U=[],N=0;H.stdout?.on("data",(O)=>{let M=O.toString();if(N+=M.length,N<=Gz)z.push(M);else{let L=Gz-(N-M.length);if(L>0)z.push(M.slice(0,L))}}),H.stderr?.on("data",(O)=>{let M=O.toString();if(N+=M.length,N<=Gz)U.push(M);else{let L=Gz-(N-M.length);if(L>0)U.push(M.slice(0,L))}}),H.on("close",(O)=>{if(clearTimeout(W),K){G({success:!1,output:z.join(""),error:`Command timed out after ${Y}ms`,exitCode:void 0});return}if(V.signal.aborted){G({success:!1,output:z.join(""),error:"The command was aborted",exitCode:O??void 0});return}let M=O===0||O===1,L=z.join(""),w=U.join(""),I=L;if(!M&&!L.trim()&&w.trim())I=w;else if(w.trim())I+=L?`
|
|
5025
5025
|
${w}`:w;if(N>Gz)I+=`
|
|
5026
|
-
... (output truncated at ${Gz} characters)`;G({success:M,output:I.trim(),error:!M?w.trim()||"Command failed":void 0,exitCode:O??void 0})}),H.on("error",(O)=>{clearTimeout(W);let M=O.message;if(K)M=`Command timed out after ${Y}ms`;else if(O.message.includes("operation was aborted")||O.name==="AbortError")M="The command was aborted";G({success:!1,output:z.join(""),error:M})})})}function rz8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return sz8(Y,X?[...X]:null,G,Q);else return oz8(Y,X?[...X]:null,G,Q)}function oz8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function sz8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}H0();cZ();C5();_W();dZ();pZ();AV();FH();ze();V5();I_();g0();var DQ6=q6(FU(),1);import{writeFile as UQ6}from"fs/promises";import BQ6 from"path";H0();dZ();class rj1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Y])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.
|
|
5026
|
+
... (output truncated at ${Gz} characters)`;G({success:M,output:I.trim(),error:!M?w.trim()||"Command failed":void 0,exitCode:O??void 0})}),H.on("error",(O)=>{clearTimeout(W);let M=O.message;if(K)M=`Command timed out after ${Y}ms`;else if(O.message.includes("operation was aborted")||O.name==="AbortError")M="The command was aborted";G({success:!1,output:z.join(""),error:M})})})}function rz8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return sz8(Y,X?[...X]:null,G,Q);else return oz8(Y,X?[...X]:null,G,Q)}function oz8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function sz8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}H0();cZ();C5();_W();dZ();pZ();AV();FH();ze();V5();I_();g0();var DQ6=q6(FU(),1);import{writeFile as UQ6}from"fs/promises";import BQ6 from"path";H0();dZ();class rj1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Y])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1764086485-g394076"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await To(Q,this.configService)}catch(Q){x.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class oj1 extends Q6{props;constructor(J){super();this.props=J}createState(){return new KQ6}}class KQ6 extends J6{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(J){let Q=(Y)=>{this.setState(()=>{this._state=Y(this._state)})};return this.widget.props.builder(J,Q,this._state)}}class WQ6 extends J6{controller=new CG;focusNode=new g8({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(J){let Q=f6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=i4.all(new S4(Y.foreground,1,"solid")),K=new dL({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(N)=>{let O=N.trim();if(G&&O.length===0)return;this.widget.props.onSubmit(O)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new G4({children:[new e0({decoration:{color:M1.default()},child:new l1({text:new Q1(">",new U1({color:Y.foreground}))})}),new F4({child:K})]}),H=new e0({padding:k0.symmetric(1,0),child:new l1({text:new Q1("",void 0,[new Q1("Command: ",new U1({color:Y.foreground})),new Q1(this.widget.props.commandName,new U1({color:M1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new Q1("Enter",new U1({color:X.keybind}))),z.push(new Q1(" to submit, ",new U1({color:Y.foreground,dim:!0})));z.push(new Q1("Esc",new U1({color:X.keybind}))),z.push(new Q1(" to cancel",new U1({color:Y.foreground,dim:!0})));let U=new e0({padding:k0.symmetric(1,0),child:new l1({text:new Q1("",void 0,z)})});return new e0({decoration:{border:V,color:M1.default()},padding:k0.all(1),child:new l0({children:[H,new N0({height:1}),W,new m5,U]})})}}class E81 extends Q6{props;constructor(J){super();this.props=J}createState(){return new WQ6}}AV();class HQ6 extends J6{controller=new CG;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new g8({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=(J)=>{if(this.imageAttachments.length>=fF)return!1;let Q=lR(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,J]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(J){let Q=f6.of(J),{colors:Y,app:X}=Q,Z=q8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new XA({controller:this.controller,triggers:[new aB],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(N)=>{this.widget.props.onSubmit(N.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:D9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new r8({focusNode:this.focusNode,child:V}),W=new e0({constraints:new d6({maxHeight:q}),padding:k0.symmetric(1,0),child:K}),H=new e0({padding:k0.symmetric(1,0),child:new l1({text:new Q1("",void 0,[new Q1("Command: ",new U1({color:Y.foreground})),new Q1(this.widget.props.commandName,new U1({color:M1.yellow,bold:!0}))])})}),z=new e0({padding:k0.symmetric(1,0),child:new l1({text:this.isConfirmingClearInput?new Q1("",void 0,[new Q1("Esc",new U1({color:X.keybind})),new Q1(" again to clear input",new U1({color:Y.foreground,dim:!0}))]):new Q1("",void 0,[new Q1("Press ",new U1({color:Y.foreground,dim:!0})),new Q1("Enter",new U1({color:X.keybind})),new Q1(" to submit, ",new U1({color:Y.foreground,dim:!0})),new Q1("Esc",new U1({color:X.keybind})),new Q1(" to clear",new U1({color:Y.foreground,dim:!0}))])})}),U=[H,new N0({height:1}),new F4({child:W}),new N0({height:1}),z];return new e0({decoration:{border:i4.all(new S4(Y.foreground,1,"solid")),color:M1.default()},padding:k0.all(1),child:new l0({children:U})})}}class GA extends Q6{props;constructor(J){super();this.props=J}createState(){return new HQ6}}class sj1 extends T6{props;constructor(J){super();this.props=J}build(){return new $8({child:new l1({text:new Q1("",void 0,[new Q1(`Forked to new thread:
|
|
5027
5027
|
|
|
5028
5028
|
`,new U1({color:M1.white,dim:!0})),new Q1(`"${this.props.newThreadTitle||"Untitled"}"`,new U1({color:M1.white}))]),textAlign:"center"})})}}class Zz extends Q6{props;constructor(J){super();this.props=J}createState(){return new zQ6}}class zQ6 extends J6{_spinner=new _K;animationInterval=null;initState(){super.initState(),this.animationInterval=setInterval(()=>{this._spinner.step(),this.setState(()=>{})},100)}dispose(){if(this.animationInterval)clearInterval(this.animationInterval),this.animationInterval=null;super.dispose()}build(J){let Q=f6.of(J),{colors:Y}=Q,X=i4.all(new S4(Y.foreground,1,"solid")),G=this._spinner.toBraille(),Z=new l1({textAlign:"center",text:new Q1("",void 0,[new Q1(G,new U1({color:M1.yellow})),new Q1(" ",void 0),new Q1(this.widget.props.message,new U1({color:Y.foreground}))])}),V=[new F4({child:new l0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[Z]})})];if(this.widget.props.onAbort)V.push(new N0({height:2,child:new e0({padding:k0.symmetric(2,0),child:new l1({text:new Q1("",new U1({dim:!0}),[new Q1("Press ",new U1({color:Y.foreground})),new Q1("Esc",new U1({color:Y.info})),new Q1(" to cancel",new U1({color:Y.foreground}))])})})}));let K=new e0({decoration:new T8(M1.default(),X),child:new N0({width:60,height:7,child:new l0({mainAxisAlignment:"start",children:V})})});if(this.widget.props.onAbort)return new r8({debugLabel:"LoadingDialog",autofocus:!0,onKey:(W)=>{if(W.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:K});return K}}class qz extends Q6{props;constructor(J){super();this.props=J}createState(){return new FQ6}}class FQ6 extends J6{dispose(){super.dispose()}isWidgetMessage(J){return J instanceof RK}build(J){let Q=this.widget.props.message,Y=(()=>{if(this.isWidgetMessage(Q))return{title:Q.title,type:Q.type};if(Q instanceof Error&&Q.name==="CommandCancelledError")return{title:"Cancelled",type:"info",description:Q.message};if(Q instanceof Error&&Q.name==="CommandTimeoutError")return{title:"Timeout",type:"error",description:Q.message};let W=C41(Q);return{title:W.title,type:W.type,description:W.description}})(),X=Y.type==="error"?M1.red:M1.yellow,G=i4.all(new S4(M1.default(),1,"solid")),Z=new e0({padding:k0.symmetric(1,0),child:new l1({text:new Q1(Y.title,new U1({color:X,bold:!0}))})}),q=this.isWidgetMessage(Q)?Q.widget:new l1({text:new Q1(Y.description,new U1({color:M1.default()})),selectable:!0}),V=new F4({child:new gL({child:new e0({padding:k0.symmetric(1,0),child:q})})}),K=new e0({padding:k0.symmetric(1,0),child:new l1({text:this.widget.props.onRetry?new Q1("",void 0,[new Q1("Press ",new U1({color:M1.default(),dim:!0})),new Q1("R",new U1({color:M1.yellow})),new Q1(" to retry, ",new U1({color:M1.default(),dim:!0})),new Q1("Esc",new U1({color:M1.yellow})),new Q1(" to cancel",new U1({color:M1.default(),dim:!0}))]):new Q1("Press any key to close",new U1({color:M1.default(),dim:!0,italic:!0}))})});return new r8({onKey:(W)=>{if(this.widget.props.onRetry&&W.key==="r")return this.widget.props.onRetry(),"handled";if(W.key==="Escape")return this.widget.props.onDismiss(),"handled";if(!this.widget.props.onRetry)return this.widget.props.onDismiss(),"handled";return"ignored"},autofocus:!0,child:new e0({decoration:{border:G,color:M1.default()},padding:k0.all(1),child:new l0({mainAxisAlignment:"center",children:[Z,new N0({height:1}),V,K]})})})}}class tj1 extends T6{build(){return new $8({child:new l1({text:new Q1("",void 0,[new Q1(`✓ Thread Shared
|
|
5029
5029
|
|
|
@@ -5109,7 +5109,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
|
|
|
5109
5109
|
`)?`${V}...`:G,W=new U1({color:M1.index(8)}),H=[new Q1(K,W)];if(q>0){let z=new U1({color:Y.success});for(let U=1;U<=q;U++)H.push(new Q1(" ")),H.push(new Q1(`[${U}]`,z))}return new g6({padding:k0.only({bottom:0}),child:new G4({crossAxisAlignment:"start",children:[new g6({padding:k0.only({right:1}),child:new l1({text:new Q1("•",new U1({color:M1.index(8)}))})}),new F4({child:new l1({text:new Q1("",void 0,H)})})]})})}}class C_1 extends Q6{createState(){return new KY6}}class KY6 extends J6{_animationTimer;_visible=!0;initState(){super.initState(),this._startAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._visible=!this._visible})},500)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let Q=new U1({color:M1.red}),Y=new U1({color:this._visible?M1.red:M1.transparent()});return new G4({children:[new l1({text:new Q1("⏺",Y)}),new N0({width:1}),new l1({text:new Q1("Replay",Q)})]})}}function qU8(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/3600000),G=Math.floor(X/24),Z=Math.floor(G/7),q=Math.floor(G/30);if(X<1)return"Just now";if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;if(Z<=4)return`${Z}w ago`;return`${q}mo ago`}class S_1{threadHistoryService;constructor(J){this.threadHistoryService=J}async fetchThreadSummaries(J=""){try{return{ok:!0,threads:(await new Promise((G)=>{let Z=this.threadHistoryService.observeThreadList().subscribe((q)=>{Z.unsubscribe(),G(q)})})).filter((G)=>{if(!J.trim())return!0;let Z=G.title?.toLowerCase()||"untitled",q=G.id.toLowerCase(),V=J.toLowerCase();return Z.includes(V)||q.includes(V)}).map((G)=>{let Z=new Date(G.userLastInteractedAt),q=qU8(Z),V=G.id.slice(-8),K=G.env?.initial.trees?.[0]?.uri;return{id:G.id,title:G.title||"Untitled",updatedAt:new Date(G.userLastInteractedAt).toISOString(),description:{timeAgo:q,title:G.title||"Untitled",shortThreadID:V},diffStats:G.summaryStats?.diffStats,workspaceURI:K,parentRelationships:G.parentRelationships}})}}catch(Q){return{ok:!1,errorMsg:Q instanceof Error?Q.message:"An unexpected error occurred"}}}}H0();K9();class j_1{currentId=null;current=null;subscribeTimer=null;subscription=null;listeners=[];threadService=null;scrollController=new h3;constructor(){}setThreadService(J){this.threadService=J}async select(J){if(!this.threadService){x.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId===J)return;this.cancelTimerAndSubscription(),this.currentId=J;let Q=await this.threadService.get(J);if(Q){if(this.currentId===J)this.current=Q,this.notifyListeners()}this.subscribeTimer=setTimeout(()=>{this.subscribeLive(J)},1000)}clear(){this.cancelTimerAndSubscription(),this.currentId=null,this.current=null,this.notifyListeners()}addListener(J){this.listeners.push(J)}removeListener(J){let Q=this.listeners.indexOf(J);if(Q!==-1)this.listeners.splice(Q,1)}dispose(){this.cancelTimerAndSubscription(),this.scrollController.dispose(),this.listeners=[]}subscribeLive(J){if(!this.threadService){x.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId!==J)return;this.subscription=this.threadService.observePatches(J).pipe(QO()).subscribe((Q)=>{if(this.currentId===J)this.current=Q,this.notifyListeners()})}cancelTimerAndSubscription(){if(this.subscribeTimer)clearTimeout(this.subscribeTimer),this.subscribeTimer=null;if(this.subscription)this.subscription.unsubscribe(),this.subscription=null}notifyListeners(){for(let J of this.listeners)J(this.current)}}function WY6(J,Q){switch(J){case"update-available":return[new Q1("A newer Amp is available. Run ",new U1({color:Q.foreground,dim:!0})),new Q1("amp update",new U1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new Q1("Update complete, run ",new U1({color:Q.foreground,dim:!0})),new Q1("amp update",new U1({color:Q.warning})),new Q1(" to see warnings",new U1({color:Q.foreground,dim:!0}))];case"update-error":return[new Q1("Update failed, run ",new U1({color:Q.foreground,dim:!0})),new Q1("amp update",new U1({color:Q.warning})),new Q1(" to see warnings",new U1({color:Q.foreground,dim:!0}))];case"hidden":return null}}async function zU8(J){return new Promise((Q)=>{KU8("git",["branch","--show-current"],{cwd:J},(Y,X)=>{if(Y){Q(null);return}let G=X.trim();Q(G||null)})})}class UY6 extends Q6{dependencies;constructor(J){super();this.dependencies=J}createState(){return new BY6}}class BY6 extends J6{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;connectedClientsStatusExpanded=!1;randomAd=null;adSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isExiting=!1;isConfirmingClearInput=!1;isConfirmingCancelProcessing=!1;copyMessageTimer=null;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingCostBreakdownOverlay=!1;confirmationOverlayContent="";exitConfirmTimeout=null;clearInputConfirmTimeout=null;cancelProcessingConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;threadsForPicker=[];isLoadingThreads=!1;threadPreviewController=new j_1;previewThread=null;planScrollController=(()=>{let J=new h3;return J.followMode=!1,J})();todoScrollController=(()=>{let J=new h3;return J.followMode=!1,J})();showingSelectionCopiedHint=!1;isShowingStandaloneThreadPicker=!1;filterThreadPickerByWorkspace=!0;agentModePulseSeq=0;currentGitBranch=null;messageViewFocusNode=new g8({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new g8({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showingCannotToggleMessage=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;bottomGridUserHeight=void 0;bottomGridDragStartY=null;bottomGridDragStartHeight=null;pendingMCPServers=[];mcpTrustSubscription=null;agentModeSubscription=null;currentAgentMode="smart";hasToggledAgentMode=!1;inMemoryAgentModeOverride=null;cachedVisibleModes=zG();freeTierStatus=void 0;tryOpus=!1;updateState="hidden";updateServiceSubscription=null;isMessageViewInSelectionMode=!1;threadBackStack=[];threadForwardStack=[];replayDisplayedMessages=[];replayAbortController=new AbortController;replayTypingTimer=null;recordNavigation(J){this.threadBackStack.push(J),this.threadForwardStack=[]}navigateBack=async()=>{if(this.threadBackStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadBackStack.pop();this.threadForwardStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};navigateForward=async()=>{if(this.threadForwardStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadForwardStack.pop();this.threadBackStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};startAndSwitchToNewThread=async()=>{let J=this.widget.dependencies.worker.thread.id;this.recordNavigation(J);let Q=await this.widget.dependencies.startNewThread();return this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,this.widget.dependencies.switchWorker(Q),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),Q};async startReplay(){let J=this.widget.dependencies.replayMode;if(!J)return;let{thread:Q,typingEnabled:Y,baseWpm:X}=J,G=Q.messages;for(let Z=0;Z<G.length;Z++){if(this.replayAbortController.signal.aborted)break;let q=G[Z];if(!q)continue;if(Z>0)await this.replaySleep(J.messageDelayMs);if(q.role==="user"&&Y){let W=q.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
|
|
5110
5110
|
`);if(W)await this.replayTypeMessage(W,X)}if(q.role==="assistant"){let W=q.content.some((U)=>U.type==="tool_use"),H=G[Z+1],z=H?.role==="user"&&H.content.some((U)=>U.type==="tool_result");if(W&&z){let U={...q,state:{type:"streaming"}};this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,U],this.textController.clear()});let N=J.thread.id;this.getMessageScrollController(N).scrollToBottom(),await this.replaySleep(J.toolProgressDelayMs),this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages.slice(0,-1),q]});continue}}this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,q],this.textController.clear()});let V=J.thread.id;this.getMessageScrollController(V).scrollToBottom()}await this.replaySleep(J.exitDelayMs),D9.instance.stop()}async replayTypeMessage(J,Q){this.textController.clear();let Y=J.split(/(?<=\s)/),X=60000/Q;for(let G of Y){if(this.replayAbortController.signal.aborted)break;let Z=X/G.length;for(let q of G){this.textController.text=this.textController.text+q,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{});let V=0.8+Math.random()*0.4,K=Z*V;await this.replaySleep(K)}}}replaySleep(J){return new Promise((Q)=>{this.replayTypingTimer=setTimeout(Q,J)})}getEffectiveAgentMode(){return J41(this.widget.dependencies.worker.thread,this.inMemoryAgentModeOverride?{agentMode:this.inMemoryAgentModeOverride}:null,this.freeTierStatus,{"experimental.agentMode":this.currentAgentMode})}isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(J.viewState.state!=="active")return!1;if(Boolean(J.viewState.inferenceState==="running"))return!0;let Y=J.items.filter((Z)=>Z.type==="toolResult").filter((Z)=>Z.toolResult.run.status==="in-progress"||Z.toolResult.run.status==="queued"),X=J.subagentActiveTools.filter((Z)=>Z.toolRun.status==="in-progress"||Z.toolRun.status==="queued");return[...Y,...X].length>0}showSubmitDisabledHint(J){if(this.submitDisabledHintTimer)clearTimeout(this.submitDisabledHintTimer);this.setState(()=>{this.submitDisabledHint=J}),this.submitDisabledHintTimer=setTimeout(()=>{this.setState(()=>{this.submitDisabledHint=null}),this.submitDisabledHintTimer=null},3000)}getUIHint(){let J=this.themeColors?.colorScheme;if(!J)return null;let Q=this.themeApp;if(!Q)return null;if(this.submitDisabledHint)return new Q1(this.submitDisabledHint,new U1({color:J.foreground,dim:!0}));if(this.isExiting)return new Q1("Exiting...",new U1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new Q1("",void 0,[new Q1("Ctrl+C",new U1({color:Q.keybind})),new Q1(" again to exit",new U1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new Q1("",void 0,[new Q1("Esc",new U1({color:Q.keybind})),new Q1(" again to clear input",new U1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new Q1("",void 0,[new Q1("Escape",new U1({color:Q.keybind})),new Q1(" to close help",new U1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let G=this.getEffectiveAgentMode(),Z=v_1(G,this.tryOpus);return new Q1("",void 0,[new Q1("Images aren't supported in ",new U1({color:J.warning,dim:!1})),new Q1(G,new U1({color:Z})),new Q1(" mode.",new U1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0){if(this.isConfirmingCancelProcessing)return new Q1("",void 0,[new Q1("Esc",new U1({color:Q.keybind})),new Q1(" again to cancel",new U1({color:J.foreground,dim:!0}))]);return new Q1("",void 0,[new Q1("Esc",new U1({color:Q.keybind})),new Q1(" to cancel",new U1({color:J.foreground,dim:!0}))])}if(this.showingSelectionCopiedHint)return new Q1("Selection copied to clipboard",new U1({color:J.foreground,dim:!0}));if(this.showingCannotToggleMessage)return new Q1(this.showingCannotToggleMessage,new U1({color:J.warning,dim:!1}));let Y=WY6(this.updateState,J);if(Y)return new Q1("",void 0,Y);let X=this.widget.dependencies.worker.thread;if(X.agentMode==="plan"&&fL(X))return new Q1("",void 0,[new Q1("Ctrl+O",new U1({color:Q.keybind})),new Q1(" → Execute Plan",new U1({color:J.foreground,dim:!0}))]);return null}isTranscriptEmpty(){let{threadState:J}=this.widget.dependencies;return J.items.length===0}handleMessageRestoreSubmit=async(J)=>{let{threadState:Q,worker:Y}=this.widget.dependencies;if(!Q.mainThread?.id)return;let G=Q.mainThread?.messages.findIndex((Z)=>Z===J);if(G===void 0||G===-1)return;try{this.cancelBashInvocations(),await Y.cancel(),await Y.handle({type:"thread:truncate",fromIndex:G}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(Z){x.error("Failed to edit message:",Z)}};forkMessage=async(J)=>{let{threadState:Q,workerDeps:Y,threadSyncService:X}=this.widget.dependencies,G=Q.mainThread?.id;if(!G)return;let Z=Q.mainThread?.messages.findIndex((q)=>q===J);if(Z===void 0||Z<=0)return;try{let q=await V3.getOrCreateForThread(Y,G),V=await BR(q,X,Z-1);await this.switchToExistingThread(V)}catch(q){x.error("Failed to fork thread:",q),this.showErrorMessage(`Failed to fork thread: ${q}`)}};handleMessageEditSubmit=async(J,Q)=>{let{threadState:Y,worker:X}=this.widget.dependencies,G=Y.mainThread;if(!G)return;let Z=G.messages.findIndex((q)=>q.messageId!==void 0&&q.messageId===J.messageId);if(Z===-1)return;try{this.cancelBashInvocations(),await X.cancel(),this.widget.dependencies.history.add(Q);let q=gB(Q);if(q)await X.handle({type:"thread:truncate",fromIndex:Z}),this.invokeBashCommand(q.cmd,{visibility:q.visibility});else{let V=[{type:"text",text:Q}];if(this.imageAttachments.length>0)V.push(...this.imageAttachments);let K={content:V,agentMode:G.agentMode},W=Z===0;if(G.agentMode&&!W&&K.agentMode!==G.agentMode){x.error(`Cannot edit message: This thread uses ${G.agentMode} mode. To change mode, create a new thread.`);return}await X.handle({type:"user:message",message:K,index:Z})}this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(q){x.error("Failed to edit message:",q)}};getAffectedFiles=async(J)=>{let{worker:Q}=this.widget.dependencies;try{return(await Q.getFilesAffectedByTruncation(J)).map(o3)}catch(Y){return x.error("Failed to get affected files:",Y),[]}};textController=new CG;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new h3);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let X=this.searchElementTreeByKey(J.child,Q);if(X)return X}if(J?.children)for(let X of J.children){let G=this.searchElementTreeByKey(X,Q);if(G)return G}return null}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{if(this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Y=process.cwd().replace(process.env.HOME||"","~"),X=Q?`amp - ${Q} - ${Y}`:"";process.stdout.write(_R1(X))}}_handleTextCopy(J){if(J&&J.length>0){if(this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}textFieldKey=new c2("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;paletteCommands=null;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Y=gB(J)?.visibility;if(Y!==this.currentShellModeStatus)this.currentShellModeStatus=Y,this.setState(()=>{})};navigateHistoryPrevious=()=>{let J=this.widget.dependencies.history.previous();if(J!==null){if(this.historyIndex===-1)this.historyDraft=this.textController.text;this.historyIndex++,this.textController.text=J,this.textController.moveCursorToStart()}};navigateHistoryNext=()=>{let J=this.widget.dependencies.history.next();if(J!==null)this.historyIndex--,this.textController.text=J,this.textController.moveCursorToEnd();else if(this.historyIndex>-1)this.historyIndex=-1,this.textController.text=this.historyDraft||"",this.textController.moveCursorToEnd(),this.historyDraft=null};resetHistory=()=>{this.widget.dependencies.history.reset(),this.historyIndex=-1,this.historyDraft=null};openJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!0})};dismissJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!1})};openIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!0})};dismissIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!1}),N9.instance.addPostFrameCallback(()=>{this.autocompleteFocusNode.requestFocus()})};handleIdeSelection=async(J,Q)=>{if(this.widget.dependencies.ideClient.getSelectedConfig()?.pid===J.pid){this.dismissIdePicker();return}try{await this.connectToSelectedIde(J,Q)}catch(Y){let X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.dismissIdePicker()};async connectToSelectedIde(J,Q){await this.widget.dependencies.ideClient.start(J,!0,Q)}previewControllerListener=(J)=>{this.setState(()=>{this.previewThread=J})};showStandaloneThreadPicker=()=>{this.loadThreadsForPicker(),this.setState(()=>{this.isShowingStandaloneThreadPicker=!0})};dismissStandaloneThreadPicker=()=>{this.exitApplication()};handleStandaloneThreadSelect=async(J)=>{try{await this.switchToExistingThread(J,{recordInNavigationHistory:!1}),this.threadPreviewController.clear(),this.setState(()=>{this.isShowingStandaloneThreadPicker=!1}),N9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker)this.autocompleteFocusNode.requestFocus()})}catch(Q){x.error("Failed to switch thread:",Q),this.showErrorMessage(`Failed to switch thread: ${Q}`)}};toggleThreadPickerWorkspaceFilter=()=>{this.setState(()=>{this.filterThreadPickerByWorkspace=!this.filterThreadPickerByWorkspace})};showCommandPalette(){if(this.setState(()=>{this.isShowingPalette=!this.isShowingPalette}),this.isShowingPalette)this.loadThreadsForPicker()}getPaletteCommands(){if(!this.paletteCommands)this.paletteCommands=new J_1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})},this.widget.dependencies.isDogfooding);return this.paletteCommands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new $_1(this.widget.dependencies.fuzzyServer,this.widget.dependencies.threadFuzzyIndexer);return this.completionBuilder}dismissPalette=()=>{this.setState(()=>{this.isShowingPalette=!1})};getCommandPaletteContext=()=>{let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return null;let Q=p0.file(process.cwd()),Y=F6(Q);return{worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:J.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.openInEditor,takeImageAttachments:()=>{let X=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),X},setImageAttachments:(X)=>{this.setState(()=>{this.imageAttachments=X})},editorDispatch:(X)=>{switch(X.type){case"set-input":this.textController.clear(),this.textController.insertText(X.input);break;case"insert-text":this.textController.insertText(X.text);break;case"clear":this.textController.clear();break}},submitMessage:(X)=>{return this.proceedWithUserMessage(X)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,mcpService:this.widget.dependencies.mcpService,startNewThread:async()=>{await this.startAndSwitchToNewThread()},navigateBack:this.navigateBack,navigateForward:this.navigateForward,canNavigateBack:this.threadBackStack.length>0,canNavigateForward:this.threadForwardStack.length>0,canUseAmpFree:this.widget.dependencies.freeTierStatus?.canUseAmpFree??!1,switchToThread:async(X)=>{return await this.switchToExistingThread(X),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.widget.dependencies.worker},generateHandoffPrompt:async(X,G,Z)=>{let q=this.widget.dependencies.threadState.mainThread?.id;if(!q)throw Error("No active thread");let V=setTimeout(()=>{Z.throwIfAborted()},60000);try{let K=await this.widget.dependencies.threadService.generateHandoffPrompt(q,X,G,this.widget.dependencies.configService,Z);return clearTimeout(V),K}catch(K){throw clearTimeout(V),K}},handleHandoff:async(X,G)=>{let{goal:Z,generatedPrompt:q,images:V}=G;if(!Z&&!q)return{ok:!1,error:Error("Either goal or generatedPrompt required")};try{let K=this.widget.dependencies.threadState.mainThread?.id;if(!K)return{ok:!1,error:Error("No active thread")};let W=setTimeout(()=>X.abort(new L81("Handoff took too long and was aborted (timeout: 60s)")),60000);try{let H=await this.widget.dependencies.threadService.createHandoffThread(K,{goal:Z,generatedPrompt:q,images:V},this.widget.dependencies.configService,X.signal);return clearTimeout(W),await this.switchToExistingThread(H),{ok:!0}}catch(H){if(clearTimeout(W),H instanceof Error&&(H.name==="AbortError"||H.message.includes("aborted")))throw X.signal.reason;throw H}}catch(K){return x.error("Failed to create handoff thread",K),{ok:!1,error:K instanceof Error?K:Error(String(K))}}},getGuidanceFiles:async(X)=>{if(!J.mainThread)return[];return(await hr({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},J.mainThread,X)).map((Z)=>({uri:Z.uri,type:Z.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(X)=>{this.setState(()=>{this.inMemoryAgentModeOverride=X,this.hasToggledAgentMode=!0})},toggleAgentMode:this.toggleAgentMode,getEffectiveAgentMode:()=>this.getEffectiveAgentMode(),getEditorText:()=>this.textController.text,workspace:this.widget.dependencies.workspace??null,handleExecutePlan:async()=>{try{let X=J.mainThread?.id;if(!X){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let G=await this.widget.dependencies.threadService.createPlanExecutionThread(X,"smart");await this.switchToExistingThread(G)}catch(X){x.error("Failed to execute plan",X),this.setState(()=>{this.displayMessage=Error(`Failed to execute plan: ${X instanceof Error?X.message:String(X)}`)})}},planFileManager:this.widget.dependencies.planFileManager,completionBuilder:this.getCompletionBuilder(),threads:this.threadsForPicker,previewController:this.threadPreviewController,isLoadingThreads:this.isLoadingThreads,filterByWorkspace:this.filterThreadPickerByWorkspace,currentWorkspace:Y,threadViewStates:this.widget.dependencies.workerController.threadViewStates}};async loadThreadsForPicker(){if(this.isLoadingThreads)return;this.setState(()=>{this.isLoadingThreads=!0});try{let Q=await new S_1(this.widget.dependencies.threadHistoryService).fetchThreadSummaries();if(Q.ok)this.setState(()=>{this.threadsForPicker=Q.threads})}finally{this.setState(()=>{this.isLoadingThreads=!1})}}updateGitBranch=async()=>{let J=await zU8(process.cwd());this.setState(()=>{this.currentGitBranch=J})};removeBashInvocation=(J)=>{this.setState(()=>{this.bashInvocations=this.bashInvocations.filter((Q)=>Q.id!==J)})};invokeBashCommand=(J,{visibility:Q})=>{let Y=Date.now(),X=`bash-${Y}-${Math.random().toString(36).substring(7)}`,G={cmd:J},Z=new AbortController;this.widget.dependencies.worker.invokeBashTool(G,Z.signal,Q===uB).subscribe({next:(q)=>{this.setState(()=>{if(this.bashInvocations.find((K)=>K.id===X))this.bashInvocations=this.bashInvocations.map((K)=>K.id===X?{...K,toolRun:q}:K);else{let K={id:X,args:G,toolRun:q,startTime:Y,abortController:Z,hidden:Q===uB};this.bashInvocations=[...this.bashInvocations,K]}})},error:()=>this.removeBashInvocation(X),complete:()=>this.removeBashInvocation(X)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};toggleConnectedClientsStatus=()=>{this.setState(()=>{this.connectedClientsStatusExpanded=!this.connectedClientsStatusExpanded})};toggleAgentMode=()=>{let J=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker;if(AZ(J.thread)>0)return;if(this.freeTierStatus?.canUseAmpFree){let X=this.getEffectiveAgentMode(),G=Vb(X,this.cachedVisibleModes);if(G!==X)this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=G,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1});return}let Q=this.getEffectiveAgentMode(),Y=Vb(Q,this.cachedVisibleModes);if(Y===Q)return;if(this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=Y,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1}),K5(Y))this.checkAndShowFreeModeModal()};checkAndShowFreeModeModal=()=>{if(this.freeTierStatus?.canUseAmpFree)return;if(this.freeTierStatus){if(!this.freeTierStatus.eligible){this.setState(()=>{this.showingCannotToggleMessage="Amp Free is unavailable. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}else if(!this.freeTierStatus.workspaceAllowsAmpFree){this.setState(()=>{this.showingCannotToggleMessage="Your workspace does not allow Amp Free. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}}};isInRestrictedFreeMode(){if(this.getEffectiveAgentMode()!=="free")return!1;if(this.freeTierStatus?.canUseAmpFree)return!1;return!0}handleInsertImage=(J)=>{let Q=this.getEffectiveAgentMode();if(!vh(Q)){if(this.imageUnsupportedHintTimer)clearTimeout(this.imageUnsupportedHintTimer);return this.setState(()=>{this.showImageUnsupportedHint=!0}),this.imageUnsupportedHintTimer=setTimeout(()=>{this.setState(()=>{this.showImageUnsupportedHint=!1}),this.imageUnsupportedHintTimer=null},5000),!1}if(this.imageAttachments.length>=fF)return!1;let Y=lR(J);if(typeof Y==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Y]}),!1;return this.setState(()=>{this.displayMessage=Error(`Failed to attach image: ${Y}`)}),!1};handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1)})};openInEditor=async(J)=>{let{mkdtemp:Q,readFile:Y,unlink:X,rmdir:G,writeFile:Z}=await import("node:fs/promises"),{tmpdir:q}=await import("node:os"),V=await import("node:path");try{let K=await Q(V.join(q(),"amp-edit-")),W=V.join(K,"message.amp.md");await Z(W,J,"utf-8"),await tH(W);try{let H=await Y(W,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")x.error("Failed to read temporary file",H)}try{await X(W),await G(K)}catch(H){x.warn("Failed to clean up temporary file",H)}}catch(K){x.error("Error opening editor:",K)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=gB(J);if(Q)if(!Q.cmd){this.showSubmitDisabledHint("No command provided");return}else if(this.isProcessing()){this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}else{this.invokeBashCommand(Q.cmd,{visibility:Q.visibility}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();return}this.textController.clear(),this.resetHistory(),await this.updateGitBranch(),await this.sendUserMessage(J)};initState(){if(c$.getInstance().interceptConsole(),this.threadPreviewController.setThreadService(this.widget.dependencies.threadService),this.threadPreviewController.addListener(this.previewControllerListener),this.widget.dependencies.openThreadSwitcher)this.showStandaloneThreadPicker();D9.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),D9.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),D9.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Y)=>{N9.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Y.hasFocus})})}),this.freeTierStatus=this.widget.dependencies.freeTierStatus,H6(this.widget.dependencies.configService.config).then((Y)=>{let X=J41(this.widget.dependencies.worker.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,Y.settings);if(x.info(`[initState] Resolved agentMode: ${X}`),this.widget.dependencies.sessionState?.agentMode)this.setState(()=>{this.inMemoryAgentModeOverride=X})}),this.updateGitBranch(),this.adSubscription=sR1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{return(this.inMemoryAgentModeOverride&&K5(this.inMemoryAgentModeOverride)||this.randomAd===null)&&oR1(this.lastUserInteractionTime)}).subscribe({next:(Y)=>{if(Y){let X=WU8(16).toString("hex");this.lastAdImpressionId=X,Promise.resolve().then(() => (m81(),g81)).then(({recordAdEvent:G})=>{let Z=this.widget.dependencies.worker.thread,q=Z.messages[Z.messages.length-1];G("viewed",{adId:Y.id,advertiserId:Y.advertiserId,threadId:Z.id,messageId:q?.messageId,impressionId:X,placement:"tui",matchType:Y.metadata?.matchType,matchedPatterns:Y.metadata?.matchedPatterns,candidateAdPoolCount:Y.metadata?.candidateAdPoolCount,clientRegion:Y.metadata?.clientRegion})})}this.setState(()=>{this.randomAd=Y}),N9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})}});let{mcpTrustHandler:J}=this.widget.dependencies;this.mcpTrustSubscription=J.pendingServers$.subscribe((Y)=>{this.setState(()=>{this.pendingMCPServers=Y})}),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Y)=>{this.setState(()=>{this.ideStatus=Y})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Y)=>{let X=this.widget.dependencies.getCurrentWorker();if(!X){x.warn("No active thread worker found to handle IDE message");return}await new Promise((G)=>setTimeout(G,50)),await X.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}}),x.debug("Message sent from IDE to agent",{message:Y.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Y)=>{this.textController.insertText(Y),x.debug("Appended text to CLI prompt from IDE",{text:Y.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((Y)=>{this.setState(()=>{this.connectedClientsStatus=Y})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Y)=>{this.setState(()=>{this.updateState=Y})}),this.agentModeSubscription=this.widget.dependencies.configService.config.subscribe((Y)=>{let X=zG(Y.settings,this.freeTierStatus?.canUseAmpFree);this.setState(()=>{this.cachedVisibleModes=X,this.tryOpus=Y.settings.tryOpus??!1})}),this.textController.addListener(this.textChangeListener),this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Y)=>{let X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller();if(this.widget.dependencies.replayMode)setTimeout(()=>this.startReplay(),100)}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}dispose(){if(this.replayAbortController.abort(),this.replayTypingTimer)clearTimeout(this.replayTypingTimer);if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.connectedClientsStatusSubscription)this.connectedClientsStatusSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeSubscription)this.agentModeSubscription.unsubscribe();if(this.adSubscription)this.adSubscription.unsubscribe();if(this.mcpTrustSubscription)this.mcpTrustSubscription.unsubscribe();if(this.threadPreviewController.removeListener(this.previewControllerListener),this.threadPreviewController.dispose(),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.textController.removeListener(this.textChangeListener);for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(_R1("")),this.shouldUseProgressBar())process.stdout.write(w56())}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,X=[...J.items.filter((V)=>V.type==="toolResult").map((V)=>({toolUse:V.toolUse,toolRun:V.toolResult.run,subthreadID:void 0})),...J.subagentActiveTools].filter((V)=>V.toolRun.status==="blocked-on-user");if(X.length===0)return null;let G=X[0],Z=G.toolRun.status==="blocked-on-user"?G.toolRun.toAllow??[]:[],q=G.toolRun.status==="blocked-on-user"?G.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:G.toolUse,toAllow:Z}],subthreadID:G.subthreadID,reason:q}}shouldUseProgressBar(){return!1}updateProgressBar(){}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){x.error("No current tool confirmation found");return}let Y=Q.tools[0]?.useBlock;if(!Y){x.error("No tool use block found in confirmation");return}if(J==="allow-all-session")_X("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0,"global")}catch(G){if(G&&G instanceof Error)this.setState(()=>{this.displayMessage=G});else x.error("Failed to write dangerouslyAllowAll setting:",G);return}if(J==="always-guarded"){let G=Q.tools[0]?.toAllow??[],Z=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],q=[...G,...Z];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",q,"global")}if(J==="connect-github"){let G=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();try{await dJ(G)}catch(Z){x.error("Failed to open settings page:",Z),await this.showErrorMessage(`Cannot open browser. Please go to ${G} to connect to GitHub`)}return}if(J==="disable-librarian"){let G=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!G.includes(q$))await this.widget.dependencies.settingsStorage.set("tools.disable",[...G,q$],"global")}let X=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let G={type:"user:tool-input",toolUse:Y.id,value:{accepted:X}};if(Q.subthreadID)await(await V3.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(G);else await this.widget.dependencies.worker.handle(G)}catch(G){x.error("Failed to send tool confirmation:",G)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};getErrorKey(J){return`${J.constructor.name}:${J.message}`}getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;let Y=this.getErrorKey(Q.ephemeralError);if(this.dismissedEphemeralErrorKey===Y)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.getCurrentEphemeralError(),Y=this.widget.dependencies.worker;switch(J){case"retry":this.dismissedEphemeralErrorKey=null,await Y.retry();break;case"dismiss":if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);break;case"new-thread":{this.setState(()=>{this.dismissedEphemeralErrorKey=null}),await this.startAndSwitchToNewThread();break}case"new-smart-thread":{this.setState(()=>{this.inMemoryAgentModeOverride="smart",this.dismissedEphemeralErrorKey=null}),h61({agentMode:"smart"}),await this.startAndSwitchToNewThread();break}}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};handleMCPTrustOpenSettings=async()=>{let{mcpTrustHandler:J,settingsStorage:Q}=this.widget.dependencies;await J.deny();try{await tH(Q.getSettingsFilePath())}catch(Y){let X=Y instanceof Error?Y.message:String(Y);await this.showErrorMessage(`Failed to open settings: ${X}`)}};cancelStreamingMessage=async()=>{await V3.cancel(this.widget.dependencies.threadID)};markLastUserMessageAsInterrupted=async()=>{let J=this.widget.dependencies.threadState.mainThread;if(!J)return;for(let Q=J.messages.length-1;Q>=0;Q--){let Y=J.messages[Q];if(Y?.role==="user"&&!Y.interrupted){await this.widget.dependencies.worker.handle({type:"user:message:interrupt",messageIndex:Q});break}}};switchToExistingThread=async(J,Q={})=>{let{recordInNavigationHistory:Y=!0}=Q;if(Y){let X=this.widget.dependencies.worker.thread.id;if(X!==J)this.recordNavigation(X)}try{x.info(`[switchToExistingThread] Switching to thread: ${J}`);let X=await this.widget.dependencies.switchToThread(J);x.info(`[switchToExistingThread] Got worker for thread ${J}, thread.agentMode: ${X.thread.agentMode}`);let G=await this.widget.dependencies.configService.getLatest(),Z=J41(X.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,G.settings);if(x.info(`[switchToExistingThread] Thread ${J} resolved agentMode: ${Z}`),this.widget.dependencies.worker=X,this.widget.dependencies.threadID=X.thread.id,this.widget.dependencies.switchWorker(X),this.setState(()=>{x.info("[switchToExistingThread] Clearing inMemoryAgentModeOverride"),this.inMemoryAgentModeOverride=null}),X.thread.draft)if(x.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),typeof X.thread.draft==="string")this.textController.insertText(X.thread.draft);else{let q=X.thread.draft.filter((W)=>W.type==="text"),V=X.thread.draft.filter((W)=>W.type==="image"),K=q.map((W)=>W.text).join(`
|
|
5111
5111
|
`);if(K)this.textController.insertText(K);if(V.length>0)this.setState(()=>{this.imageAttachments=V})}}catch(X){throw x.error("Failed to switch to thread:",J,X),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.widget.dependencies.history.add(J);let Q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,Y=AZ(Q.thread)===0,X=this.getEffectiveAgentMode();if(Q.thread.agentMode&&!Y&&X!==Q.thread.agentMode){await this.showErrorMessage(`This thread uses ${Q.thread.agentMode} mode. To change mode, edit the first message or create a new thread.`);return}let G=[{type:"text",text:J}];if(this.imageAttachments.length>0)G.push(...this.imageAttachments);if(await Q.handle({type:"user:message",message:{content:G,agentMode:X}}),Y)h61({agentMode:X});this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]}),N9.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}exitApplication=async()=>{this.setState(()=>{this.isExiting=!0});let J=this.widget.dependencies.threadState.mainThread;if(J?.messages.length===0){if(J.relationships?.find((X)=>X.type==="handoff"&&X.role==="child"))await this.widget.dependencies.threadService.discardHandoffThread(J.id).catch(()=>{})}let Q=this.getEffectiveAgentMode();h61({agentMode:Q}).catch((Y)=>{x.warn("Failed to save session state on exit:",Y)}).finally(()=>{D9.instance.stop()})};onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;this.exitApplication()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=HU8();if(J===Q)return"~";if(J.startsWith(Q+Xg.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(Xg.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(Xg.sep),"…",Q.slice(-2).join(Xg.sep)].join(Xg.sep)}build(J){let Q=q8.of(J),Y=f6.of(J),X=Y.base;this.themeColors=X;let{colors:G,app:Z}=Y;this.themeApp=Z;let q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,V=q.thread.agentMode&&K5(q.thread.agentMode)&&this.randomAd!==null,{threadState:K}=this.widget.dependencies;this.updateTerminalTitle(),this.updateProgressBar();let W=this.getCurrentConfirmation(),H=this.widget.dependencies.replayMode,z=Boolean(H),U=K.items,N=K.mainThread||void 0,O=K.subagentToolsByParentID,M=K.todosList;if(z){let G6={...H.thread,messages:this.replayDisplayedMessages};U=VC(G6).items,N=G6,O={};let o6=gw({messages:this.replayDisplayedMessages});M=Array.isArray(o6)?o6:[]}let L=N?.id,w=N,I=z?this.replayDisplayedMessages.length===0:this.isTranscriptEmpty(),P=(G6)=>new D81({key:new c2(`preview-message-view-${G6.id}`),items:VC(G6).items,controller:this.threadPreviewController.scrollController,autofocus:!1,thread:G6,focusNode:new g8({debugLabel:"PreviewFocus"})}),R=this.previewThread,j=R?R.messages.length>2000?new l0({mainAxisSize:"max",children:[new F4({child:new N0}),new g6({padding:k0.all(2),child:new $8({child:new l1({text:new Q1("Thread too long for preview",new U1({color:G.mutedForeground,dim:!0}))})})})]}):P(R):I?new M81({agentMode:this.getEffectiveAgentMode(),tryOpus:this.tryOpus}):new D81({key:L?new c2(`message-view-${L}`):void 0,items:U,subagentToolsByParentID:O,controller:L?this.getMessageScrollController(L):new h3,autofocus:!1,onCopy:z?void 0:this._handleTextCopy.bind(this),thread:w,onMessageEditSubmit:z?void 0:this.handleMessageEditSubmit,onMessageRestoreSubmit:z?void 0:this.handleMessageRestoreSubmit,onMessageForkSubmit:z?void 0:this.forkMessage,getAffectedFiles:z?void 0:this.getAffectedFiles,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{if(this.setState(()=>{this.isMessageViewInSelectionMode=!1}),!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),y=Math.max(Math.floor(Q.size.height*0.4),12),f=this.getCurrentEphemeralError(),g=this.buildBottomWidget(f,W,G,Y,K,M,y,V?this.randomAd:null,z),p=Q.size.width<40,b=K.mainThread?qU0(K.mainThread):void 0,i=new y41({threadViewState:K.viewState,threadTokenUsage:b,threadID:L??null,thread:K.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onCostBreakdownClick:()=>{this.setState(()=>{this.isShowingCostBreakdownOverlay=!this.isShowingCostBreakdownOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,isNarrow:p,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!W,showingEphemeralError:Boolean(K.viewState.state==="active"&&K.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),J1=new k41({bashInvocations:this.bashInvocations}),n=[],m=this.getEffectiveAgentMode(),s=this.currentShellModeStatus,q1=v_1(m,this.tryOpus),W1=!s?m.length+1:0,r=Q.capabilities.animationSupport,o=r==="disabled"?0:r==="slow"?30:60,l=HK(m)?.uiHints?.fasterAnimation?3:1,z1=o>0&&this.agentModePulseSeq>0?new t5({children:[g,new f3({top:0,left:1,right:1,height:1,child:new P_1({color:q1,trigger:this.agentModePulseSeq,fps:o,speed:l,leftOffset:W1})})]}):g;n.push(new F4({child:j}),J1);let j1=new t5({children:[new l0({mainAxisSize:"min",children:[V?new lj1({ad:this.randomAd,onButtonClick:async()=>{let G6=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (m81(),g81)).then(({recordAdEvent:o6})=>{let h4=this.widget.dependencies.worker.thread,s4=h4.messages[h4.messages.length-1];o6("clicked",{adId:G6.id,advertiserId:G6.advertiserId,threadId:h4.id,messageId:s4?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to",matchType:G6.metadata?.matchType,matchedPatterns:G6.metadata?.matchedPatterns,candidateAdPoolCount:G6.metadata?.candidateAdPoolCount,clientRegion:G6.metadata?.clientRegion})});try{await dJ(G6.shortDestinationUrl)}catch(o6){let s4=D9.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:s4,url:G6.shortDestinationUrl}})}}}):new N0({height:0}),new e0({constraints:new d6(0,Q.size.width,0,y),child:z1})]}),V?new f3({top:0,left:0,right:0,child:new OY6({userHeight:this.bottomGridUserHeight,maxHeight:y,onInitializeHeight:(G6)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(G6,y)})},onDrag:(G6)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(G6.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let o6=Math.floor(G6.localPosition.y)-this.bottomGridDragStartY,h4=Math.max(4,this.bottomGridDragStartHeight-o6),s4=Math.min(h4,y),c5=Math.floor(s4);if(this.bottomGridUserHeight!==c5)this.setState(()=>{this.bottomGridUserHeight=c5})},onRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null}})}):new N0({height:0})]});n.push(j1,new N0({height:1,child:new g6({padding:k0.horizontal(1),child:i})}));let t=new l0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:n}),y1=z?new t5({children:[t,new f3({top:0,left:0,child:new C_1})]}):t,R1=new a8(()=>{if(this.isShowingPalette)return this.dismissPalette(),"handled";if(this.pendingMCPServers.length>0)return this.widget.dependencies.mcpTrustHandler.deny(),"handled";if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingCostBreakdownOverlay)return this.setState(()=>{this.isShowingCostBreakdownOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.textController.hasSelection)return this.textController.clearSelection(),"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.isConfirmingCancelProcessing){if(this.bashInvocations.length>0)this.cancelBashInvocations();if(this.isProcessing())this.markLastUserMessageAsInterrupted().catch((o6)=>{x.error("Failed to mark message as interrupted:",o6)}),this.cancelStreamingMessage().catch((o6)=>{x.error("Failed to cancel streaming message:",o6)});if(this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout),this.cancelProcessingConfirmTimeout=null;return"handled"}if(this.executingCommand)return x.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.bashInvocations.length>0||this.isProcessing()){if(this.setState(()=>{this.isConfirmingCancelProcessing=!0}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout);return this.cancelProcessingConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout=null},1000),"handled"}if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),D0=new a8(()=>{return this.onExitPressed(),"handled"}),T1=new a8(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),a1=new a8(()=>{return OJ.instance.toggleAll(),"handled"}),F1=new a8(()=>{return this.widget.dependencies.configService.getLatest().then((G6)=>{_X("internal.showCost",!(G6.settings["internal.showCost"]??!0))}),"handled"}),Y1=new a8(()=>{return D9.instance.toggleFrameStatsOverlay(),"handled"}),O1=new a8(()=>{return D9.instance.tuiInstance.getScreen().markForRefresh(),N9.instance.requestFrame(),"handled"}),L1=new a8(()=>{return this.toggleAgentMode(),"handled"}),E1=new a8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:h4}=this.widget.dependencies,s4=h4.mainThread?.id;return s4?this.getMessageScrollController(s4):null})();if(o6){let h4=Math.max(Math.floor(Q.size.height*0.4),10),s4=Q.size.height-h4;o6.animatePageUp(s4,100)}return"handled"}),A1=new a8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:h4}=this.widget.dependencies,s4=h4.mainThread?.id;return s4?this.getMessageScrollController(s4):null})();if(o6){let h4=Math.max(Math.floor(Q.size.height*0.4),10),s4=Q.size.height-h4;o6.animatePageDown(s4,100)}return"handled"}),u1=new a8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:h4}=this.widget.dependencies,s4=h4.mainThread?.id;return s4?this.getMessageScrollController(s4):null})();if(o6)o6.animateTo(0,100);return"handled"}),v1=new a8(()=>{let o6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:h4}=this.widget.dependencies,s4=h4.mainThread?.id;return s4?this.getMessageScrollController(s4):null})();if(o6)o6.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),n1=new a8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:G6}=this.widget.dependencies;if(!G6.mainThread?.messages.some((h4)=>h4.role==="user"||uw(h4)))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),$0=new a8((G6)=>{if(G6.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),Q0=new a8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return R41().then(async(G6)=>{if(G6)try{this.handleInsertImage(G6)}finally{try{let{unlink:o6}=await import("node:fs/promises");await o6(G6)}catch{}}}),"handled"}),A0=new Map([[K4.ctrl("c"),new ku],[K4.ctrl("l"),new hu],[K4.ctrl("o"),new D41],[K4.ctrl("v"),new ju],[K4.alt("s"),new nR],[K4.ctrl("s"),new nR],[K4.alt("p"),new fu],[K4.ctrl("r"),new vu],[K4.alt("d"),new xu],[K4.ctrl("t"),new bu],[K4.key("PageUp"),new F41],[K4.key("PageDown"),new U41],[K4.key("Home"),new B41],[K4.key("End"),new N41],[K4.key("Escape"),new _u],[K4.ctrl("p"),new aR("previous")],[K4.ctrl("n"),new aR("next")],[K4.key("Tab"),new uu]]);if(!m7())A0.set(K4.key("ArrowUp"),new uu);if(!1)A0.set(K4.alt("c"),new yu);let U6=new a8(()=>{if(this.isShowingStandaloneThreadPicker)return"handled";return this.showCommandPalette(),"handled"}),B4=new a8(()=>{return this.toggleThreadPickerWorkspaceFilter(),"handled"}),f4=new Map([[_u,R1],[hu,O1],[nR,L1],[D41,U6],[ju,Q0],[yu,T1],[vu,a1],[xu,F1],[fu,Y1],[bu,B4],[ku,D0],[F41,E1],[U41,A1],[B41,u1],[N41,v1],[uu,n1],[aR,$0]]),V8=[y1];if(this.isShowingConsoleOverlay)V8.push(new Z_1);if(this.isShowingHelp){let G6=this.getPaletteCommands().getAllCommands();V8.push(new K_1({commands:G6}))}if(this.adActionModal)V8.push(new ij1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(G6)=>{let o6=this.adActionModal.url;if(G6==="copy")try{await D9.instance.tuiInstance.clipboard.writeText(o6),this.setState(()=>{this.displayMessage=new r$("Link copied to clipboard")})}catch(h4){x.error("Failed to copy to clipboard",{error:h4}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.pendingMCPServers.length>0){let{mcpTrustHandler:G6}=this.widget.dependencies;V8.push(new T_1({servers:this.pendingMCPServers,onAlwaysTrust:G6.trustAlways.bind(G6),onTrustOnce:G6.trustOnce.bind(G6),onOpenSettings:this.handleMCPTrustOpenSettings,onDismiss:G6.deny.bind(G6)}))}if(this.isShowingFileChangesOverlay)V8.push(new nC1({threadData:K}));if(this.isShowingCostBreakdownOverlay&&K.mainThread)V8.push(new q_1({thread:K.mainThread}));if(this.isShowingConfirmationOverlay)V8.push(new X_1({details:this.confirmationOverlayContent}));let M0=this.getCommandPaletteContext();if(M0&&this.isShowingPalette)V8.push(new $8({child:new e0({constraints:d6.loose(80,20),child:new Y_1({commandContext:M0,mainThread:K.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette})})}));if(this.isShowingIdePicker)V8.push(new H_1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));if(this.isShowingStandaloneThreadPicker){let G6=p0.file(process.cwd()),o6=F6(G6);V8.push(new $8({child:new e0({constraints:d6.loose(80,20),child:new eR({threads:this.threadsForPicker,title:"Continue Thread",onSelect:this.handleStandaloneThreadSelect,onDismiss:this.dismissStandaloneThreadPicker,previewController:this.threadPreviewController,isLoading:this.isLoadingThreads,currentWorkspaceURI:o6,filterByWorkspace:this.filterThreadPickerByWorkspace,threadViewStates:this.widget.dependencies.workerController.threadViewStates})})}))}let x0=new t5({children:V8});if(this.isShowingJetBrainsInstaller)return new pL({child:new fQ({actions:f4,child:new Bq({shortcuts:A0,debugLabel:"jetbrains-installer-shortcuts",child:new I_1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});let c6=new mB({onError:(G6)=>{this.showErrorMessage(G6.message)},child:x0});return new pL({child:new fQ({actions:f4,child:new Bq({shortcuts:A0,debugLabel:"main-app-shortcuts",child:c6})})})}buildScrollableTodoList(J,Q,Y){return new NY6({todos:J,enabled:Q,controller:this.todoScrollController,appTheme:Y})}buildBottomWidget(J,Q,Y,X,G,Z,q,V,K){if(J)return new V_1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new G_1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new R_1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let W=X.app,H=_41(X),z=this.isInRestrictedFreeMode(),U=new XA({key:this.textFieldKey,controller:this.textController,triggers:K?[]:[new aB],completionBuilder:K?void 0:this.getCompletionBuilder(),ampURL:this.widget.dependencies.ampURL,onSubmitted:K?void 0:this.onTextSubmitted,theme:Y,placeholder:K?"Press Ctrl+C to exit":z?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,enabled:this.isTextfieldAndAutocompleteFocused&&!z&&!this.isShowingStandaloneThreadPicker,shellPromptRules:H,focusNode:this.autocompleteFocusNode,autofocus:!this.isMessageViewInSelectionMode&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker,clipboard:D9.instance.tuiInstance.clipboard,onCopy:this._handleTextCopy.bind(this),onInsertImage:this.handleInsertImage,imageAttachments:this.imageAttachments,popImage:this.handlePopImage}),N=G.mainThread?.queuedMessages??[],O=Array.isArray(Z)&&Z.length>0,M=Array.isArray(N)&&N.length>0,L=G.mainThread?.agentMode==="plan"&&fL(G.mainThread),w,I;if(L){if(w=new NC1(new O81({thread:G.mainThread,onExecute:async()=>{let b=this.getCommandPaletteContext();if(b)await this.getPaletteCommands().execute("execute-plan",b,void 0,new AbortController)},onEdit:async()=>{try{let b=process.env.EDITOR||process.env.VISUAL||"nano",{filePath:i}=await this.widget.dependencies.planFileManager.ensureSync(G.mainThread.id);D9.instance.tuiInstance.suspend();let{execSync:J1}=await import("child_process");J1(`${b} "${i}"`,{stdio:"inherit"}),D9.instance.tuiInstance.resume()}catch(b){x.error("Failed to edit plan",b),this.setState(()=>{this.displayMessage=Error("Failed to edit plan")})}},controller:this.planScrollController,appTheme:X}),{clipBehavior:"antiAlias"}),M)I=new u81({queuedMessages:N});else if(O)I=this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!z,X)}else w=M?new u81({queuedMessages:N}):void 0,I=O?this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!z,X):void 0;let P=[],R=this.currentShellModeStatus;if(R)P.push({text:new Q1(R==="hidden"?"shell mode (incognito)":"shell mode",new U1({color:R==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left"});if(!R&&this.cachedVisibleModes.length>1){let b=this.previewThread,i=b?b.agentMode??this.getEffectiveAgentMode():this.getEffectiveAgentMode(),J1=v_1(i,this.tryOpus);if(b)P.push({text:new Q1(i,new U1({color:J1})),position:"top-left",offsetY:0});else{let m=Vb(i,this.cachedVisibleModes)!==i,s=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,q1=AZ(s.thread)===0,r=z||!this.hasToggledAgentMode&&m&&q1?new Q1("",void 0,[new Q1(i,new U1({color:J1})),new Q1(" (click or ",new U1({color:Y.foreground,dim:!0})),new Q1("Ctrl+S",new U1({color:W.keybind})),new Q1(" to switch)",new U1({color:Y.foreground,dim:!0}))]):new Q1(i,new U1({color:J1}));P.push({text:r,position:"top-left",offsetY:0,onClick:q1?this.toggleAgentMode:void 0})}}if(this.connectedClientsStatus&&this.connectedClientsStatus.enabled){let b=this.connectedClientsStatus,i=b.mode||"disconnected",J1=!!b.errorMessage,n=b.clientID||"unknown",m,s;if(J1)m="●",s=M1.red;else if(i==="presence")m="○",s=M1.yellow;else if(i==="connected"&&b.connected)m="●",s=M1.green;else m="○",s=M1.yellow;let q1=this.connectedClientsStatusExpanded?`${n} ${m}`:m;P.push({text:new Q1(q1,new U1({color:s})),position:"top-right",offsetX:-2,offsetY:0,onClick:this.toggleConnectedClientsStatus})}let j=K?this.widget.dependencies.replayMode.thread.env?.initial.trees?.[0]?.uri:G.mainThread?.env?.initial.trees?.[0]?.uri,y;if(j)y=p0.parse(j).fsPath;else y=process.cwd();let f=this.toHomeRelative(y),g=this.shorten(f),p=!K&&this.currentGitBranch?`${g} (${this.currentGitBranch})`:g;return P.push({text:new Q1(p,new U1({color:Y.foreground,dim:!0})),position:"bottom-right"}),new bC1({leftChild:new F4({child:U}),rightChild1:w,rightChild2:I,maxHeight:q,overlayTexts:P,borderColor:z||!this.isTextfieldAndAutocompleteFocused?M1.index(8):void 0,hasBanner:V!==null,userHeight:this.bottomGridUserHeight,onInitializeHeight:(b)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(b,q)})},onDrag:(b)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(b.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let i=Math.floor(b.localPosition.y)-this.bottomGridDragStartY,J1=Math.max(4,this.bottomGridDragStartHeight-i),n=Math.min(J1,q),m=Math.floor(n);if(this.bottomGridUserHeight!==m)this.setState(()=>{this.bottomGridUserHeight=m})},onDragRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null},enableResize:V===null})}}async function x_1(J){if((await J.configService.getLatest()).settings["terminal.animation"]===!1)D9.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:!0}});let X=()=>null,Z=!1,q=new oH(Z,1000,J.inspectorPort),V=J.features?.find((L)=>L.name==="amp-connect")?.enabled??!1,K=new dj1({threadService:J.threadService,worker:J.worker,builder:(L,w,I,P,R)=>{if(X=R,J.threadDependencies&&V)QC1(J.threadDependencies,J.configService,R,P,J.connectedClientsService,J.startNewThread,J.switchToThread,J.clientId).catch((g)=>{x.error("Failed to start automatic presence:",g)});let j=R(),y=j.thread.id,f={...J,worker:j,threadID:y};return new UY6({...f,threadState:w,workerController:I,switchWorker:P,getCurrentWorker:R})}}),W=new dC1({configService:J.configService,child:K}),H=new gC1({configService:J.configService,child:W}),z=new RC1(H),U=new f6({data:oR.fromBaseTheme(RG.default()),child:z});try{await iR1(U,{onRootElementMounted:(L)=>{if(x.info("TUI input ready for user interaction"),Z)q.start(L)}})}finally{if(Z)q.stop();if(J.threadDependencies&&V){let{stopGlobalSession:L}=await Promise.resolve().then(() => (YC1(),B26));L()}}let O=X()?.thread.id||J.threadID,M=await J.threadService.get(O);if(M&&M.messages.length>0){let L=`${J.ampURL.replace(/\/$/,"")}/threads/${O}`;h26(M,L,J.stdout)}}function v_1(J,Q){return J==="smart"?Q?M1.rgb(255,60,70):M1.rgb(145,119,199):J==="rush"?M1.rgb(228,180,2):K5(J)?M1.rgb(0,184,255):J==="plan"?M1.rgb(153,102,255):FU8(J)}class NY6 extends Q6{props;constructor(J){super();this.props=J}createState(){return new DY6}}class DY6 extends J6{viewportHeight=1;scrollListenerAttached=!1;initState(){if(!this.scrollListenerAttached)this.widget.props.controller.addListener(()=>{this.updateViewportHeight()}),this.scrollListenerAttached=!0}build(J){let{todos:Q,controller:Y,appTheme:X}=this.widget.props;return new G4({crossAxisAlignment:"stretch",children:[new F4({child:new M7({controller:Y,autofocus:!1,child:new cj1({todos:Q})})}),new s$({controller:Y,thumbColor:X.app.scrollbarThumb,trackColor:X.app.scrollbarTrack,getScrollInfo:()=>{let{maxScrollExtent:G,offset:Z}=Y,q=this.viewportHeight,V=G+q;return{totalContentHeight:Math.max(V,0),viewportHeight:Math.max(q,1),scrollOffset:Math.max(Z,0)}}})]})}updateViewportHeight(){let J=this.getViewportHeight();if(J!==this.viewportHeight)this.viewportHeight=J}getViewportHeight(){let J=this.context.findRenderObject();if(!J)return this.viewportHeight;let Q=(X,G=0)=>{if(X&&"size"in X&&"children"in X){let Z=X.children||[];for(let q of Z){if(q&&"size"in q){let K=q.size;if(typeof K?.height==="number"&&K.height>0)return K.height}let V=Q(q,G+1);if(V>0)return V}}return 0},Y=Q(J);if(Y>0)return Y;if("size"in J){let X=J.size;if(typeof X?.height==="number"&&X.height>0)return X.height}return this.viewportHeight}}class OY6 extends T6{props;constructor(J){super();this.props=J}build(J){return new P8({child:new N0({height:1}),cursor:b9.NS_RESIZE,onDrag:(Q)=>{if(this.props.userHeight===void 0){let X=J.findRenderObject()?.size.height??0;if(X>0){this.props.onInitializeHeight(X);return}}this.props.onDrag(Q)},onRelease:this.props.onRelease})}}function FU8(J){let Q=0;for(let G=0;G<J.length;G++){let Z=J.charCodeAt(G);Q=(Q<<5)-Q+Z,Q=Q&Q}let Y=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Y.length;return M1.index(Y[X])}lR1();try{if(process.platform==="win32")await Promise.resolve().then(() => q6(RC(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){hG.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
5112
|
-
`)}var Wy1=Ky1.join(gH0||Ky1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function fO8(J){process.emitWarning=function(Q,Y,X,G){let Z=typeof Q==="string"?Q:Q.message||String(Q),q=Y||"Warning",V=!1;J.warn(Z,{name:q,code:X})}}function Aq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")_X("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")_X("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("tryOpus")==="cli"&&Q.tryOpus)_X("tryOpus",!0);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")_X("model.sonnet",Q.useSonnet)}async function zy1(J){try{await yO8(Ky1.dirname(Wy1),{recursive:!0}),await vO8(Wy1,J,"utf-8")}catch(Q){x.debug("Failed to save last thread ID",Q)}}async function hO8(){try{return(await cG6(Wy1,"utf-8")).trim()}catch(J){return null}}var mG6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??EG,description:`Custom settings file path (overrides the default location ${EG})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(x).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${oT1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:m7(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Gemini 3":"Use default model (Gemini 3)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"Try Claude Opus 4.5 in Amp's smart mode",hidden:!1},{name:"mode",long:"mode",short:"m",type:"option",default:sT.SMART.key,description:`Set the agent mode (${zG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:zG().map((J)=>J.mode)}],pG6=(J)=>("deprecated"in J)&&J.deprecated===!0,bO8=(J)=>("hidden"in J)&&J.hidden===!0,uO8=(J)=>("default"in J),gO8=(J)=>("default"in J)?J.default:void 0;function mO8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new w8(AG.unknownCommand(Y),1,q)}}var lG6=null;function
|
|
5112
|
+
`)}var Wy1=Ky1.join(gH0||Ky1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function fO8(J){process.emitWarning=function(Q,Y,X,G){let Z=typeof Q==="string"?Q:Q.message||String(Q),q=Y||"Warning",V=!1;J.warn(Z,{name:q,code:X})}}function Aq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")_X("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")_X("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("tryOpus")==="cli"&&Q.tryOpus)_X("tryOpus",!0);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")_X("model.sonnet",Q.useSonnet)}async function zy1(J){try{await yO8(Ky1.dirname(Wy1),{recursive:!0}),await vO8(Wy1,J,"utf-8")}catch(Q){x.debug("Failed to save last thread ID",Q)}}async function hO8(){try{return(await cG6(Wy1,"utf-8")).trim()}catch(J){return null}}var mG6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??EG,description:`Custom settings file path (overrides the default location ${EG})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(x).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${oT1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:m7(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Gemini 3":"Use default model (Gemini 3)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"Try Claude Opus 4.5 in Amp's smart mode",hidden:!1},{name:"mode",long:"mode",short:"m",type:"option",default:sT.SMART.key,description:`Set the agent mode (${zG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:zG().map((J)=>J.mode)}],pG6=(J)=>("deprecated"in J)&&J.deprecated===!0,bO8=(J)=>("hidden"in J)&&J.hidden===!0,uO8=(J)=>("default"in J),gO8=(J)=>("default"in J)?J.default:void 0;function mO8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new w8(AG.unknownCommand(Y),1,q)}}var lG6=null;function vV5(){return lG6}function Rg(J){return{...J,getThreadEnvironment:z61,vfs:YD0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new Sh(J.fileSystem),generateThreadTitle:Ke0,deleteThread:(Q)=>J.threadService.delete(Q)}}var Fy1=p0.file(xO8.homedir()),iG6=process.env.XDG_CONFIG_HOME?p0.file(process.env.XDG_CONFIG_HOME):t0.joinPath(Fy1,".config");async function Eq(J,Q){MU0("0.0.1764086485-g394076");let Y=Dw1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:J0.of([p0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Fy1,userConfigDir:iG6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (m81(),g81));X(Y);let G=await Y.getLatest();x.debug("Global configuration initialized",{settingsKeys:Object.keys(G.settings)});let Z=new JL({configService:Y}),q=new Map,V=()=>q.clear(),K=new lI1(Y,J.settings.getWorkspaceRootPath()),W=gt0({configService:Y,trustStore:K,createOAuthProvider:async(J1)=>{let n=q.get(J1);if(n)return x.debug("Reusing existing OAuth provider for server",{serverName:J1}),n;x.debug("Creating OAuth provider for server",{serverName:J1});let m=(async()=>{let s=new DL(J.secrets),q1=await s.getClientInfo(J1),W1=new SI1({storage:s,serverName:J1,clientId:q1?.clientId,clientSecret:q1?.clientSecret,scopes:q1?.scopes});return x.debug("OAuth provider created",{serverName:J1,hasManualClientId:!!q1?.clientId,willUseDCR:!q1?.clientId}),W1})();return q.set(J1,m),m}}),H=T11({configService:Y,filesystem:W5,spawn:zL}),{initializeToolProviders:z}=await Promise.resolve().then(() => (gG6(),uG6)),{registrations:U,initErrors:N}=await z({toolServices:Z,providers:[W,H],initialTimeout:J.executeMode?15000:5000});for(let[J1,n]of N)x.warn(`${J1} provider initialization slow or failed:`,n);if(Q.jetbrains)pw("JetBrains");else if(Q.ide&&D96())pw("VS Code");else if(Q.ide&&O96())pw("Neovim");if(J.executeMode)LU0(!0);let O,M=U7.status.pipe(o0((J1)=>Boolean(J1.connected&&J1.authenticated)),P4()).subscribe((J1)=>{if(J1){if(!O)O=Z.registerTool(XT)}else O?.dispose(),O=void 0}),L;if(!J.executeMode)L=new w61(process.cwd(),{},!0);else L=new class extends w61{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(d5.write(`No API key found. Starting login flow...
|
|
5113
5113
|
`),!await pO8(J))await _L(),process.exit(1)}let w=await Qe0({isDevelopment:!1}),I=new sI1(w,Y),P=new aI1(w,{lazy:!0}),R=new iI1(I,(J1,n)=>{let m=V3.get(J1);if(m)m.handle(n).catch((s)=>{x.error("Failed to apply artifact delta",s)})}),j=Q.notifications!==void 0?Q.notifications:!J.executeMode,y=Ne0({playNotificationSound:async(J1)=>{if(j){Be0(J1);let n=dR1(),m=cR1();if((!n||m)&&G.settings["notifications.system.enabled"]!==!1){if(J1==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(J1==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:I,configService:Y});x.info("Starting Amp background services");let f=He0({threadService:I,threadHistoryService:P,configService:Y,isExtensionDevelopment:!1}),g;U7.status.subscribe((J1)=>{g=J1});let p=new SX1({workspaceRoots:[p0.file(process.cwd())],getCurrentFile:()=>{if(!g?.openFile)return;try{return p0.parse(g.openFile)}catch(J1){x.warn("Failed to parse current file URI",{uri:g.openFile,error:J1});return}},getOpenFiles:()=>{if(!g?.visibleFiles?.length)return[];let J1=g.openFile;return g.visibleFiles.filter((n)=>n!==J1).map((n)=>{try{return p0.parse(n)}catch(m){return x.warn("Failed to parse visible file URI",{uri:n,error:m}),null}}).filter((n)=>n!==null)}}),b=new nR1,i={codebaseContextService:p,configService:Y,toolServices:Z,mcpService:W,trustStore:K,threadService:I,threadHistoryService:P,threadSyncService:f,planFileManager:R,threadStorage:w,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:L,notificationService:y,fileSystem:Q.jetbrains||Q.ide?rt0:W5,terminal:b};return{...i,async asyncDispose(){for(let J1 of U.values())J1.dispose();await i.mcpService.dispose(),V(),await i.threadService.asyncDispose(),i.configService.unsubscribe(),i.toolServices.dispose(),i.fuzzyServer.dispose(),i.threadSyncService.dispose(),i.settingsStorage[Symbol.dispose](),M.unsubscribe(),O?.dispose()}}}async function pO8(J){if(!J.executeMode){if(!await AR1("Would you like to log in to Amp? [(y)es, (n)o]: "))return d5.write(`Login cancelled. Run the command again to retry.
|
|
5114
5114
|
`),!1}return await nG6(J)}async function nG6(J){let Q=kO8(32).toString("hex"),Y=await LR1(J.ampURL,Q),X=new AbortController;try{await dJ(Y,X.signal)}catch(Z){x.error("Error opening browser",{error:Z})}let G=await LR1(J.ampURL,Q,!1);d5.write(`If your browser does not open automatically, visit:
|
|
5115
5115
|
|
|
@@ -5119,15 +5119,15 @@ ${C4.blue.bold(G)}
|
|
|
5119
5119
|
Login successful! You can now use the Amp CLI.
|
|
5120
5120
|
`),!0}catch(Z){return x.error("Login failed",{error:Z}),hG.write(`
|
|
5121
5121
|
Login failed: ${Z instanceof Error?Z.message:String(Z)}
|
|
5122
|
-
`),!1}}function dO8(){let J=new ML().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)SR(),process.exit(0);let z=H.originalError??H;z86(z)}),J.option("-V, --version","Print the version number and exit",()=>{d5.write(`0.0.
|
|
5122
|
+
`),!1}}function dO8(){let J=new ML().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)SR(),process.exit(0);let z=H.originalError??H;z86(z)}),J.option("-V, --version","Print the version number and exit",()=>{d5.write(`0.0.1764086485-g394076 (released 2025-11-25T16:06:47.514Z)
|
|
5123
5123
|
`),process.exit(0)}),J.addHelpText("after",U96()),J.configureHelp({formatHelp:B96}),J.command("logout").description("Log out by removing stored API key").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await cQ(U);await nO8(N)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await cQ(U);await iO8(N,await KR1(U,N.settings))});let Q=async(H,z,U)=>{Dw1({storage:z.settings,secretStorage:z.secrets,workspaceRoots:J0.of([p0.file(process.cwd())]),defaultAmpURL:z.ampURL,homeDir:Fy1,userConfigDir:iG6});let N={...z,executeMode:!1};await Hy1(N,{...H,openThreadSwitcher:!0},U)},Y=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await cQ(U);await dG6(U,N,z)});Y.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await cQ(U);await JM8(U,N,z)}),Y.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, shows an interactive picker with the most recently used thread at the top. Use --last to continue the last thread directly without the picker.").option("--last","Continue the last thread directly without showing the picker").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(H,z,U)=>{let N=U.optsWithGlobals(),O=await cQ(N);if(z.pick)hG.write(`${C4.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
5124
5124
|
`);if(z.last||H||O.executeMode)await eO8(N,O,H,U);else await Q(N,O,U)}),Y.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(H,z,U)=>{let N=U.optsWithGlobals(),O=await cQ(N);await tO8(N,O,H,U)}),Y.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await cQ(U);await dG6(U,N,z)}),Y.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, unlisted, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, unlisted, workspace, group)").option("--support [message]","Share thread with Amp support for debugging").action(async(H,z,U)=>{let N=U.optsWithGlobals(),O=await cQ(N);await sO8(N,O,H,U,z.support)}),Y.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(H,z,U,N)=>{let O=N.optsWithGlobals(),M=await cQ(O);await aO8(O,M,H,z,N)}),Y.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(H,z,U)=>{let N=U.optsWithGlobals(),O=await cQ(N);await rO8(N,O,H,U)}),Y.command("replay <threadId>").alias("p").summary("Replay a thread").description("Replay a thread by downloading it and playing through all interactions. User messages are simulated with variable typing speed.").option("--wpm <wpm>","Typing speed in words per minute (default: 120)","120").option("--no-typing","Disable typing simulation and display messages instantly").option("--message-delay <ms>","Delay between messages in milliseconds (default: 1000)","1000").option("--tool-progress-delay <ms>","Delay to show tool in-progress state in milliseconds (default: 800)","800").option("--exit-delay <seconds>","Delay in seconds before exiting after replay completes (default: 3)","3").option("--no-indicator","Hide the replay progress indicator").action(async(H,z,U)=>{let N=U.optsWithGlobals(),O=await cQ(N);await oO8(N,O,H,z,U)}),W26(J,async(H,z)=>{let U=await cQ(z);Aq(H,z);let N=await Eq(U,z);return{context:U,mcpService:N.mcpService,toolService:N.toolServices,toolServices:N.toolServices,configService:N.configService,cleanupTerminal:SR,asyncDispose:N.asyncDispose.bind(N)}}),t96(J,async(H)=>{let z=H.optsWithGlobals();return await cQ(z)}),p96(J,async(H)=>{let z=await cQ(H);return{settings:z.settings,secretStorage:z.secrets,getThreadDeps:async(U)=>{Aq(U,H);let N=await Eq(z,H);return{mcpService:N.mcpService,settings:z.settings,asyncDispose:N.asyncDispose.bind(N)}}}});function G(H,z,U){let O=typeof H.description==="string"?H.description:U===void 0?H.description(!0):H.description(U),M=new wB(z,O),L=gO8(H);if(L)M.default(L);if(M.hidden=bO8(H)||pG6(H),"choices"in H)M.choices([...H.choices]);return M}for(let H of mG6)switch(H.type){case"flag":{J.addOption(G(H,`--${H.long}`)),J.addOption(G(H,`--no-${H.long}`,!1));break}case"switch":{J.addOption(G(H,`--${H.long}`,!0));break}default:{J.addOption(G(H,`${"short"in H?`-${H.short}, `:""}--${H.long} <value>`));break}}let Z=new wB("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(Z);let q=new wB("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(q);let V=new wB("--stream-json","When used with --execute, output in Claude Code-compatible stream JSON format instead of plain text.").default(!1);J.addOption(V);let K=new wB("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(K);let W=new wB("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(W),process.env.AMP_CONNECT==="1"){let H=new wB("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(H)}return J.action(async(H,z)=>{let U=H,N=await cQ(U);if(Object.keys(U).forEach((O)=>{let M=mG6.find((L)=>L.name===O);if(M&&pG6(M)&&!uO8(M))hG.write(C4.yellow(`Warning: '--${O}' flag is deprecated
|
|
5125
5125
|
`))}),z.args.length>0)mO8(N,z);await Hy1(N,U,z)}),v96(J),J}async function S91(J,Q){let{thread:Y,visibility:X}=Q,G=Y?.id??MZ(),Z=Rg(J);if(Y)await J.threadStorage.set(G,Y);let q=await V3.getOrCreateForThread(Z,G),V=await J.threadStorage.get(G);if(Q.agentMode&&!V?.agentMode&&AZ(q.thread)===0)await q.handle({type:"agent-mode",mode:Q.agentMode});if(X)await J.threadSyncService.updateThreadMeta(G,x61(X));let K=J.threadService.observe(G).subscribe(async(W)=>{if(JJ(W,"assistant"))await zy1(G),K.unsubscribe()});return await q.resume(),q}async function Hy1(J,Q,Y){let X=v61(Q);if(X instanceof Error)fG(X.message);let G,Z=null;if(Q.streamJsonInput)G="";else if(typeof Q.execute==="string"){G=Q.execute;let i=(await ER1()).trimEnd();if(i)Z=i}else G=(await ER1()).trimEnd();if(Q.remote&&!J.executeMode)throw new w8("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new w8("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new w8("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new w8("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if((J.executeMode||Q.streamJson)&&K5(Q.mode))throw new w8(`Execute mode is not permitted with --mode '${Q.mode}'`,1);if(Q.stats&&!J.executeMode)throw new w8("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new w8("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&G===""&&!Q.streamJsonInput)throw new w8("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
|
|
5126
5126
|
Or pipe via stdin: echo "your message" | amp --execute`);Aq(Y,Q);let q=await Eq(J,Q);lG6=q;let V=Rg(q),K=async(i)=>{let J1=await cG6(i,"utf-8"),n=JSON.parse(J1);if(!LZ(n.id))throw new w8(AG.invalidThreadId);return S91(q,{visibility:X,agentMode:Q.mode,thread:n})},W=async(i)=>{if(!LZ(i))throw new w8(AG.invalidThreadId);try{let[n,m]=await Promise.all([O5.getThreadLinkInfo({thread:i},{config:q.configService}),O5.getUserInfo({},{config:q.configService})]);if(n.ok&&m.ok){let s=n.result.creatorUserID,q1=m.result.id;if(s&&s!==q1&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new w8(`Cannot resume thread created by another user.
|
|
5127
5127
|
|
|
5128
5128
|
This thread belongs to a different user and cannot be continued for security reasons. Set AMP_RESUME_OTHER_USER_THREADS_INSECURE=1 to bypass this check.`)}}catch(n){if(n instanceof w8)throw n;x.warn("Failed to validate thread ownership in CLI, allowing to open",{error:n})}let J1=await q.threadService.get(i)??void 0;return x.info(`[fetchAndStartThread] Loaded thread ${i}, agentMode: ${J1?.agentMode??"undefined"}`),S91(q,{visibility:X,agentMode:J1?void 0:Q.mode,thread:J1})},H=async()=>{try{if(Q.threadId)return W(Q.threadId);else return S91(q,{visibility:X})}catch(i){if(i instanceof w8)throw i;throw await eb(i,Q.threadId),Error("handleError should have called process.exit()")}},z=async()=>{return S91(q,{visibility:X})};if(Q.format==="jsonl")hG.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
5129
|
-
`),await _L(),process.exit(1);if(J.executeMode&&Q.remote)await e96(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)l96(q.mcpService,J.settings),await T86(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,O=!1;if(Q.jetbrains||Q.ide){await Rx0();let i=$T({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)O=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let J1=i[0];if(J1)U7.selectConfig(J1)}else N=!0}let M=k61("0.0.
|
|
5130
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await t86({...J,workspaceTrust:{current:!0,changes:T_},getHook:process.env.AMP_URL?(Z,q)=>{if(Z==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let Z=await d96(J.mcpConfig);X=c96(X,Z)}let G=await X.get("url","global");if(!G)G=XY;if(!NF(G))x.info("Targeting custom Amp server",{ampURL:G});return X=uz0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:J56(await KR1(J,X))}}function cO8(J){let Q={};for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X?.startsWith("--")){let Z=X.slice(2).replace(/-([a-z])/g,(V,K)=>K.toUpperCase()),q=J[Y+1];if(q&&!q.startsWith("--"))Q[Z]=q,Y++}}return Q}async function lO8(){let J=cO8(process.argv);if($86({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),fO8(x),x.info("Starting Amp CLI.",{version:"0.0.
|
|
5129
|
+
`),await _L(),process.exit(1);if(J.executeMode&&Q.remote)await e96(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)l96(q.mcpService,J.settings),await T86(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,O=!1;if(Q.jetbrains||Q.ide){await Rx0();let i=$T({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)O=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let J1=i[0];if(J1)U7.selectConfig(J1)}else N=!0}let M=k61("0.0.1764086485-g394076",q.settingsStorage),L=new y01(q.threadStorage),w=J0.of([p0.file(process.cwd())]),I=mX1(void 0,w),P=new y61(q.mcpService,J.settings.getWorkspaceRootPath());if(G)U.handle({type:"user:message",message:{content:[{type:"text",text:G}]}});let R=(async()=>{try{let i=await O5.getUserFreeTierStatus({},{config:q.configService,signal:AbortSignal.timeout(5000)});if(i.ok)return x.info("User free tier status:",i),i.result}catch(i){x.error("Failed to fetch free tier status:",i)}})(),j=(async()=>{try{let i=await O5.getUserInfo({},{config:q.configService});if(i.ok)return i.result}catch(i){x.debug("Failed to fetch user workspace info:",i)}})(),[y,f]=await Promise.all([R,j]),g=f?.email,p=g&&(g.endsWith("@sourcegraph.com")||g.endsWith("@ampcode.com")||g==="auth-bypass-user@example.com");if(p)q.toolServices.registerTool(Ue0);let b=await $56();x.info("Loaded session state:",b),await x_1({codebaseContextService:q.codebaseContextService,stdout:process.stdout,history:new N61,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadHistoryService:q.threadHistoryService,threadSyncService:q.threadSyncService,planFileManager:q.planFileManager,threadID:U.threadID,threadFuzzyIndexer:L,worker:U,workerDeps:V,configService:q.configService,internalAPIClient:O5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:U7,connectedClientsService:new k11,commandRegistry:I,mcpService:q.mcpService,mcpTrustHandler:P,showJetBrainsInstaller:O,showIdePicker:N,openThreadSwitcher:Q.openThreadSwitcher,updateService:M,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:b,freeTierStatus:y,workspace:f?.team??null,features:f?.features??[],isDogfooding:p||!1,threadDependencies:q}),await q.asyncDispose(),process.exit(0)}async function cQ(J){if(J.interactive)hG.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
5130
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await t86({...J,workspaceTrust:{current:!0,changes:T_},getHook:process.env.AMP_URL?(Z,q)=>{if(Z==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let Z=await d96(J.mcpConfig);X=c96(X,Z)}let G=await X.get("url","global");if(!G)G=XY;if(!NF(G))x.info("Targeting custom Amp server",{ampURL:G});return X=uz0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:J56(await KR1(J,X))}}function cO8(J){let Q={};for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X?.startsWith("--")){let Z=X.slice(2).replace(/-([a-z])/g,(V,K)=>K.toUpperCase()),q=J[Y+1];if(q&&!q.startsWith("--"))Q[Z]=q,Y++}}return Q}async function lO8(){let J=cO8(process.argv);if($86({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),fO8(x),x.info("Starting Amp CLI.",{version:"0.0.1764086485-g394076",buildTimestamp:"2025-11-25T16:06:47.514Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new w8(AG.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await dO8().parseAsync(process.argv)}lA1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await lO8().catch(eb)});async function iO8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),d5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
5131
5131
|
`);else if(!NF(J.ampURL))d5.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
5132
5132
|
`);let Y=process.env.AMP_API_KEY;if(Y)d5.write(`API key found in environment variable, storing...
|
|
5133
5133
|
`),await Q.set("apiKey",Y,J.ampURL),d5.write(`API key successfully stored.
|
|
@@ -5140,7 +5140,7 @@ This thread belongs to a different user and cannot be continued for security rea
|
|
|
5140
5140
|
`);else d5.write(`Successfully logged out from ${new URL(J.ampURL).hostname}.
|
|
5141
5141
|
`);process.exit(0)}async function aO8(J,Q,Y,X,G){Aq(G,J);let Z=await Eq(Q,J);try{let q=j91(Y);if(!q)_91(Y);let V=q,K=X.trim();if(K.length===0)fG("Thread name cannot be empty");if(K.length>256)fG("Thread name cannot exceed 256 characters");if(!(await CC(V,Z)).messages.length)fG("Cannot rename an empty thread.");let H=Rg(Z);await(await V3.getOrCreateForThread(H,V)).handle({type:"title",value:K}),x.info("GOT HERE"),await Z.threadSyncService.sync(),x.info("GOT THERE"),d5.write(C4.green(`✓ Thread ${V} renamed to "${K}"
|
|
5142
5142
|
`)),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose();let V=`Failed to rename thread: ${q instanceof Error?q.message:String(q)}`;fG(V)}}async function rO8(J,Q,Y,X){Aq(X,J);let G=await Eq(Q,J);try{let Z=j91(Y);if(!Z)_91(Y);let V=await CC(Z,G),K=CT(V);d5.write(K+`
|
|
5143
|
-
`),await G.asyncDispose(),process.exit(0)}catch(Z){await G.asyncDispose();let q=`Failed to render thread as markdown: ${Z instanceof Error?Z.message:String(Z)}`;fG(q)}}async function oO8(J,Q,Y,X,G){Aq(G,J);let Z=await Eq(Q,J);try{let q=await Uy1(Y),V=await CC(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,O=Rg(Z),M=V.id;await Z.threadStorage.set(M,V);let L=await V3.getOrCreateForThread(O,M);await L.resume();let w=k01.fromWorker(L),I=new y01(Z.threadStorage),P=J0.of([p0.file(process.cwd())]),R=mX1(void 0,P),j=new y61(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=k61("0.0.
|
|
5143
|
+
`),await G.asyncDispose(),process.exit(0)}catch(Z){await G.asyncDispose();let q=`Failed to render thread as markdown: ${Z instanceof Error?Z.message:String(Z)}`;fG(q)}}async function oO8(J,Q,Y,X,G){Aq(G,J);let Z=await Eq(Q,J);try{let q=await Uy1(Y),V=await CC(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,O=Rg(Z),M=V.id;await Z.threadStorage.set(M,V);let L=await V3.getOrCreateForThread(O,M);await L.resume();let w=k01.fromWorker(L),I=new y01(Z.threadStorage),P=J0.of([p0.file(process.cwd())]),R=mX1(void 0,P),j=new y61(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=k61("0.0.1764086485-g394076",Z.settingsStorage);await x_1({codebaseContextService:Z.codebaseContextService,stdout:process.stdout,history:new N61,fuzzyServer:Z.fuzzyServer,settingsStorage:Z.settingsStorage,threadService:Z.threadService,threadHistoryService:Z.threadHistoryService,threadSyncService:Z.threadSyncService,planFileManager:Z.planFileManager,threadID:M,threadFuzzyIndexer:I,worker:w,workerDeps:O,configService:Z.configService,internalAPIClient:O5,ampURL:Q.ampURL,startNewThread:async()=>w,switchToThread:async()=>w,ideClient:U7,connectedClientsService:new k11,commandRegistry:R,mcpService:Z.mcpService,mcpTrustHandler:j,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:V,typingEnabled:K,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:N}}),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),await eb(q,Y)}}async function sO8(J,Q,Y,X,G){Aq(X,J);let Z=await Eq(Q,J);try{let q=j91(Y);if(!q)_91(Y);let V=q,K=await O5.getUserInfo({},{config:Z.configService}),W=K.ok?K.result:null,H=v61(J,W);if(!H&&!G)fG("Must specify either --visibility or --support");if(H&&G)fG("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)fG(H.message);if(H)await Z.threadSyncService.updateThreadMeta(V,x61(H)),d5.write(C4.green("✓ ")+`Thread ${V} visibility changed to ${H}.
|
|
5144
5144
|
`);if(G){await CC(V,Z);let z=typeof G==="string"?G:void 0;await Ik0(Z.threadService,V,Z.configService,z),d5.write(C4.green("✓ ")+`Thread ${V} has been shared with Amp support. These thread reports will be aggregated and analysed.
|
|
5145
5145
|
`)}await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),fG(`Failed to update thread: ${q instanceof Error?q.message:String(q)}`)}}async function tO8(J,Q,Y,X){Aq(X,J);let G=await Eq(Q,J),Z=Rg(G);try{let q=await Uy1(Y),K=(await CC(q,G)).messages.length-1,W=await V3.getOrCreateForThread(Z,q),H=await BR(W,G.threadSyncService,K);await Promise.all([G.threadSyncService.uploadThread(q),G.threadSyncService.uploadThread(H)]),await zy1(H),d5.write(`${H}
|
|
5146
5146
|
`),await G.asyncDispose(),process.exit(0)}catch(q){hG.write(`Error forking thread: ${q instanceof Error?q.message:String(q)}
|
|
@@ -5155,4 +5155,4 @@ This thread belongs to a different user and cannot be continued for security rea
|
|
|
5155
5155
|
`);let M=N.map((L)=>"─".repeat(L)).join(V);d5.write(M+`
|
|
5156
5156
|
`);for(let L of Q){let w=L.map((I,P)=>{let R=N[P],j=X[P];if(j)return j(I,R);return(I.length>R?I.substring(0,R-3)+"...":I).padEnd(R)});d5.write(w.join(V)+`
|
|
5157
5157
|
`)}}process.on("uncaughtException",(J)=>{let Q=J instanceof Error?J.message:String(J);x.error("[CLEANUP] Uncaught exception detected, cleaning up terminal...",{error:J,message:Q}),SR(),_L().then(()=>process.exit(1))});process.on("unhandledRejection",(J)=>{x.error("[CLEANUP] Unhandled rejection detected, cleaning up terminal...",{reason:J}),SR(),_L().then(()=>process.exit(1))});function fG(J){hG.write(C4.red.bold("Error: ")+J+`
|
|
5158
|
-
`),process.exit(1)}function
|
|
5158
|
+
`),process.exit(1)}function xV5(J){return parseInt(process.version.slice(1).split(".")[0]??"")>=J}export{xV5 as meetsNodeVersion,vV5 as getMainThreadDependencies};
|