From 5bd4398da425279bdf747726551d9e32a84ded10 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 11 Apr 2026 03:25:51 +0000 Subject: [PATCH] fix: deno.json import map for Edge Function deployment Map all externalized bare imports (anthropic, aws-sdk, gray-matter, child_process) and MCP SDK subpath imports to explicit npm:/node: specifiers for Deno compatibility. --- .gitignore | 1 + supabase/functions/gbrain-mcp/deno.json | 8 +- supabase/functions/gbrain-mcp/gbrain-core.js | 220 ++++++++++--------- 3 files changed, 127 insertions(+), 102 deletions(-) diff --git a/.gitignore b/.gitignore index df915ad5a..b3d8ad376 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ bin/ .18a49dfd730ff378-00000000.bun-build .18a49f9dfb996f70-00000000.bun-build .gstack/ +supabase/.temp/ diff --git a/supabase/functions/gbrain-mcp/deno.json b/supabase/functions/gbrain-mcp/deno.json index 23fe78234..b960dbe1c 100644 --- a/supabase/functions/gbrain-mcp/deno.json +++ b/supabase/functions/gbrain-mcp/deno.json @@ -2,7 +2,13 @@ "imports": { "postgres": "npm:postgres@3", "openai": "npm:openai@4", - "@modelcontextprotocol/sdk/": "npm:@modelcontextprotocol/sdk@1/", + "@anthropic-ai/sdk": "npm:@anthropic-ai/sdk@0", + "@aws-sdk/client-s3": "npm:@aws-sdk/client-s3@3", + "gray-matter": "npm:gray-matter@4", + "child_process": "node:child_process", + "@modelcontextprotocol/sdk/server/index.js": "npm:@modelcontextprotocol/sdk@1/server/index.js", + "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js": "npm:@modelcontextprotocol/sdk@1/server/webStandardStreamableHttp.js", + "@modelcontextprotocol/sdk/types.js": "npm:@modelcontextprotocol/sdk@1/types.js", "hono": "npm:hono@4", "hono/cors": "npm:hono@4/cors", "crypto": "node:crypto" diff --git a/supabase/functions/gbrain-mcp/gbrain-core.js b/supabase/functions/gbrain-mcp/gbrain-core.js index a852ec2d7..0ecd31949 100644 --- a/supabase/functions/gbrain-mcp/gbrain-core.js +++ b/supabase/functions/gbrain-mcp/gbrain-core.js @@ -1,29 +1,30 @@ -var{defineProperty:eE,getOwnPropertyNames:jY,getOwnPropertyDescriptor:NY}=Object,BY=Object.prototype.hasOwnProperty;function xY(T){return this[T]}var h0=(T)=>{var Y=(EI??=new WeakMap).get(T),G;if(Y)return Y;if(Y=eE({},"__esModule",{value:!0}),T&&typeof T==="object"||typeof T==="function"){for(var K of jY(T))if(!BY.call(Y,K))eE(Y,K,{get:xY.bind(T,K),enumerable:!(G=NY(T,K))||G.enumerable})}return EI.set(T,Y),Y},EI,gY=(T,Y)=>()=>(Y||T((Y={exports:{}}).exports,Y),Y.exports);var wY=(T)=>T;function yY(T,Y){this[T]=wY.bind(null,Y)}var jU=(T,Y)=>{for(var G in Y)eE(T,G,{get:Y[G],enumerable:!0,configurable:!0,set:yY.bind(Y,G)})};var GU=(T,Y)=>()=>(T&&(Y=T(T=0)),Y);var iE=((T)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(T,{get:(Y,G)=>(typeof require<"u"?require:Y)[G]}):T)(function(T){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+T+'" is not supported')});var KU={};jU(KU,{transcode:()=>DZ,resolveObjectURL:()=>HZ,kStringMaxLength:()=>GI,kMaxLength:()=>OE,isUtf8:()=>RZ,isAscii:()=>CZ,default:()=>zZ,constants:()=>nY,btoa:()=>bY,atob:()=>dY,INSPECT_MAX_BYTES:()=>JI,File:()=>lY,Buffer:()=>J0,Blob:()=>oY});function fY(T){var Y=T.length;if(Y%4>0)throw Error("Invalid string. Length must be a multiple of 4");var G=T.indexOf("=");if(G===-1)G=Y;var K=G===Y?0:4-G%4;return[G,K]}function cY(T,Y){return(T+Y)*3/4-Y}function pY(T){var Y,G=fY(T),K=G[0],L=G[1],W=new Uint8Array(cY(K,L)),O=0,z=L>0?K-4:K,q;for(q=0;q>16&255,W[O++]=Y>>8&255,W[O++]=Y&255;if(L===2)Y=kU[T.charCodeAt(q)]<<2|kU[T.charCodeAt(q+1)]>>4,W[O++]=Y&255;if(L===1)Y=kU[T.charCodeAt(q)]<<10|kU[T.charCodeAt(q+1)]<<4|kU[T.charCodeAt(q+2)]>>2,W[O++]=Y>>8&255,W[O++]=Y&255;return W}function hY(T){return NU[T>>18&63]+NU[T>>12&63]+NU[T>>6&63]+NU[T&63]}function uY(T,Y,G){var K,L=[];for(var W=Y;Wz?z:O+W));if(K===1)Y=T[G-1],L.push(NU[Y>>2]+NU[Y<<4&63]+"==");else if(K===2)Y=(T[G-2]<<8)+T[G-1],L.push(NU[Y>>10]+NU[Y>>4&63]+NU[Y<<2&63]+"=");return L.join("")}function PE(T,Y,G,K,L){var W,O,z=L*8-K-1,q=(1<>1,C=-7,F=G?L-1:0,R=G?-1:1,M=T[Y+F];F+=R,W=M&(1<<-C)-1,M>>=-C,C+=z;for(;C>0;W=W*256+T[Y+F],F+=R,C-=8);O=W&(1<<-C)-1,W>>=-C,C+=K;for(;C>0;O=O*256+T[Y+F],F+=R,C-=8);if(W===0)W=1-D;else if(W===q)return O?NaN:(M?-1:1)*(1/0);else O=O+Math.pow(2,K),W=W-D;return(M?-1:1)*O*Math.pow(2,W-K)}function QI(T,Y,G,K,L,W){var O,z,q,D=W*8-L-1,C=(1<>1,R=L===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:W-1,P=K?1:-1,k=Y<0||Y===0&&1/Y<0?1:0;if(Y=Math.abs(Y),isNaN(Y)||Y===1/0)z=isNaN(Y)?1:0,O=C;else{if(O=Math.floor(Math.log(Y)/Math.LN2),Y*(q=Math.pow(2,-O))<1)O--,q*=2;if(O+F>=1)Y+=R/q;else Y+=R*Math.pow(2,1-F);if(Y*q>=2)O++,q/=2;if(O+F>=C)z=0,O=C;else if(O+F>=1)z=(Y*q-1)*Math.pow(2,L),O=O+F;else z=Y*Math.pow(2,F-1)*Math.pow(2,L),O=0}for(;L>=8;T[G+M]=z&255,M+=P,z/=256,L-=8);O=O<0;T[G+M]=O&255,M+=P,O/=256,D-=8);T[G+M-P]|=k*128}function wU(T){if(T>OE)throw RangeError('The value "'+T+'" is invalid for option "size"');let Y=new Uint8Array(T);return Object.setPrototypeOf(Y,J0.prototype),Y}function YX(T,Y,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:Y.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}function J0(T,Y,G){if(typeof T==="number"){if(typeof Y==="string")throw TypeError('The "string" argument must be of type string. Received type number');return ZX(T)}return VI(T,Y,G)}function VI(T,Y,G){if(typeof T==="string")return tY(T,Y);if(ArrayBuffer.isView(T))return aY(T);if(T==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(BU(T,ArrayBuffer)||T&&BU(T.buffer,ArrayBuffer))return IX(T,Y,G);if(typeof SharedArrayBuffer<"u"&&(BU(T,SharedArrayBuffer)||T&&BU(T.buffer,SharedArrayBuffer)))return IX(T,Y,G);if(typeof T==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=T.valueOf&&T.valueOf();if(K!=null&&K!==T)return J0.from(K,Y,G);let L=eY(T);if(L)return L;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return J0.from(T[Symbol.toPrimitive]("string"),Y,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}function AI(T){if(typeof T!=="number")throw TypeError('"size" argument must be of type number');else if(T<0)throw RangeError('The value "'+T+'" is invalid for option "size"')}function rY(T,Y,G){if(AI(T),T<=0)return wU(T);if(Y!==void 0)return typeof G==="string"?wU(T).fill(Y,G):wU(T).fill(Y);return wU(T)}function ZX(T){return AI(T),wU(T<0?0:OX(T)|0)}function tY(T,Y){if(typeof Y!=="string"||Y==="")Y="utf8";if(!J0.isEncoding(Y))throw TypeError("Unknown encoding: "+Y);let G=LI(T,Y)|0,K=wU(G),L=K.write(T,Y);if(L!==G)K=K.slice(0,L);return K}function XX(T){let Y=T.length<0?0:OX(T.length)|0,G=wU(Y);for(let K=0;K=OE)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+OE.toString(16)+" bytes");return T|0}function LI(T,Y){if(J0.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||BU(T,ArrayBuffer))return T.byteLength;if(typeof T!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let G=T.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&G===0)return 0;let L=!1;for(;;)switch(Y){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return TX(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return zI(T).length;default:if(L)return K?-1:TX(T).length;Y=(""+Y).toLowerCase(),L=!0}}function iY(T,Y,G){let K=!1;if(Y===void 0||Y<0)Y=0;if(Y>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,Y>>>=0,G<=Y)return"";if(!T)T="utf8";while(!0)switch(T){case"hex":return JZ(this,Y,G);case"utf8":case"utf-8":return KI(this,Y,G);case"ascii":return OZ(this,Y,G);case"latin1":case"binary":return QZ(this,Y,G);case"base64":return YZ(this,Y,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return GZ(this,Y,G);default:if(K)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),K=!0}}function oU(T,Y,G){let K=T[Y];T[Y]=T[G],T[G]=K}function $I(T,Y,G,K,L){if(T.length===0)return-1;if(typeof G==="string")K=G,G=0;else if(G>2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=L?0:T.length-1;if(G<0)G=T.length+G;if(G>=T.length)if(L)return-1;else G=T.length-1;else if(G<0)if(L)G=0;else return-1;if(typeof Y==="string")Y=J0.from(Y,K);if(J0.isBuffer(Y)){if(Y.length===0)return-1;return YI(T,Y,G,K,L)}else if(typeof Y==="number"){if(Y=Y&255,typeof Uint8Array.prototype.indexOf==="function")if(L)return Uint8Array.prototype.indexOf.call(T,Y,G);else return Uint8Array.prototype.lastIndexOf.call(T,Y,G);return YI(T,[Y],G,K,L)}throw TypeError("val must be string, number or Buffer")}function YI(T,Y,G,K,L){let W=1,O=T.length,z=Y.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if(T.length<2||Y.length<2)return-1;W=2,O/=2,z/=2,G/=2}}function q(C,F){if(W===1)return C[F];else return C.readUInt16BE(F*W)}let D;if(L){let C=-1;for(D=G;DO)G=O-z;for(D=G;D>=0;D--){let C=!0;for(let F=0;FL)K=L;let W=Y.length;if(K>W/2)K=W/2;let O;for(O=0;O239?4:W>223?3:W>191?2:1;if(L+z<=G){let q,D,C,F;switch(z){case 1:if(W<128)O=W;break;case 2:if(q=T[L+1],(q&192)===128){if(F=(W&31)<<6|q&63,F>127)O=F}break;case 3:if(q=T[L+1],D=T[L+2],(q&192)===128&&(D&192)===128){if(F=(W&15)<<12|(q&63)<<6|D&63,F>2047&&(F<55296||F>57343))O=F}break;case 4:if(q=T[L+1],D=T[L+2],C=T[L+3],(q&192)===128&&(D&192)===128&&(C&192)===128){if(F=(W&15)<<18|(q&63)<<12|(D&63)<<6|C&63,F>65535&&F<1114112)O=F}}}if(O===null)O=65533,z=1;else if(O>65535)O-=65536,K.push(O>>>10&1023|55296),O=56320|O&1023;K.push(O),L+=z}return ZZ(K)}function ZZ(T){let Y=T.length;if(Y<=ZI)return String.fromCharCode.apply(String,T);let G="",K=0;while(KK)G=K;let L="";for(let W=Y;WG)throw RangeError("Trying to access beyond buffer length")}function MU(T,Y,G,K,L,W){if(!J0.isBuffer(T))throw TypeError('"buffer" argument must be a Buffer instance');if(Y>L||YT.length)throw RangeError("Index out of range")}function FI(T,Y,G,K,L){DI(Y,K,L,T,G,7);let W=Number(Y&BigInt(4294967295));T[G++]=W,W=W>>8,T[G++]=W,W=W>>8,T[G++]=W,W=W>>8,T[G++]=W;let O=Number(Y>>BigInt(32)&BigInt(4294967295));return T[G++]=O,O=O>>8,T[G++]=O,O=O>>8,T[G++]=O,O=O>>8,T[G++]=O,G}function WI(T,Y,G,K,L){DI(Y,K,L,T,G,7);let W=Number(Y&BigInt(4294967295));T[G+7]=W,W=W>>8,T[G+6]=W,W=W>>8,T[G+5]=W,W=W>>8,T[G+4]=W;let O=Number(Y>>BigInt(32)&BigInt(4294967295));return T[G+3]=O,O=O>>8,T[G+2]=O,O=O>>8,T[G+1]=O,O=O>>8,T[G]=O,G+8}function HI(T,Y,G,K,L,W){if(G+K>T.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function RI(T,Y,G,K,L){if(Y=+Y,G=G>>>0,!L)HI(T,Y,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return QI(T,Y,G,K,23,4),G+4}function CI(T,Y,G,K,L){if(Y=+Y,G=G>>>0,!L)HI(T,Y,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return QI(T,Y,G,K,52,8),G+8}function OI(T){let Y="",G=T.length,K=T[0]==="-"?1:0;for(;G>=K+4;G-=3)Y=`_${T.slice(G-3,G)}${Y}`;return`${T.slice(0,G)}${Y}`}function VZ(T,Y,G){if(iU(Y,"offset"),T[Y]===void 0||T[Y+G]===void 0)QE(Y,T.length-(G+1))}function DI(T,Y,G,K,L,W){if(T>G||T3)if(Y===0||Y===BigInt(0))z=`>= 0${O} and < 2${O} ** ${(W+1)*8}${O}`;else z=`>= -(2${O} ** ${(W+1)*8-1}${O}) and < 2 ** ${(W+1)*8-1}${O}`;else z=`>= ${Y}${O} and <= ${G}${O}`;throw new EX("value",z,T)}VZ(K,L,W)}function iU(T,Y){if(typeof T!=="number")throw new sY(Y,"number",T)}function QE(T,Y,G){if(Math.floor(T)!==T)throw iU(T,G),new EX(G||"offset","an integer",T);if(Y<0)throw new mY;throw new EX(G||"offset",`>= ${G?1:0} and <= ${Y}`,T)}function LZ(T){if(T=T.split("=")[0],T=T.trim().replace(AZ,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function TX(T,Y){Y=Y||1/0;let G,K=T.length,L=null,W=[];for(let O=0;O55295&&G<57344){if(!L){if(G>56319){if((Y-=3)>-1)W.push(239,191,189);continue}else if(O+1===K){if((Y-=3)>-1)W.push(239,191,189);continue}L=G;continue}if(G<56320){if((Y-=3)>-1)W.push(239,191,189);L=G;continue}G=(L-55296<<10|G-56320)+65536}else if(L){if((Y-=3)>-1)W.push(239,191,189)}if(L=null,G<128){if((Y-=1)<0)break;W.push(G)}else if(G<2048){if((Y-=2)<0)break;W.push(G>>6|192,G&63|128)}else if(G<65536){if((Y-=3)<0)break;W.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((Y-=4)<0)break;W.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return W}function $Z(T){let Y=[];for(let G=0;G>8,L=G%256,W.push(L),W.push(K)}return W}function zI(T){return pY(LZ(T))}function _E(T,Y,G,K){let L;for(L=0;L=Y.length||L>=T.length)break;Y[L+G]=T[L]}return L}function BU(T,Y){return T instanceof Y||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===Y.name}function hU(T){return typeof BigInt>"u"?WZ:T}function WZ(){throw Error("BigInt not supported")}function QX(T){return()=>{throw Error(T+" is not implemented for node:buffer browser polyfill")}}var NU,kU,UX="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lU,XI,TI,JI=50,OE=2147483647,GI=536870888,bY,dY,lY,oY,nY,mY,sY,EX,ZI=4096,AZ,FZ,HZ,RZ,CZ=(T)=>{for(let Y of T)if(Y.charCodeAt(0)>127)return!1;return!0},DZ,zZ;var FU=GU(()=>{NU=[],kU=[];for(lU=0,XI=UX.length;lU4294967296)L=OI(String(G));else if(typeof G==="bigint"){if(L=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))L=OI(L);L+="n"}return K+=` It must be ${Y}. Received ${L}`,K},RangeError);Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;J0.from=function(T,Y,G){return VI(T,Y,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);J0.alloc=function(T,Y,G){return rY(T,Y,G)};J0.allocUnsafe=function(T){return ZX(T)};J0.allocUnsafeSlow=function(T){return ZX(T)};J0.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==J0.prototype};J0.compare=function(T,Y){if(BU(T,Uint8Array))T=J0.from(T,T.offset,T.byteLength);if(BU(Y,Uint8Array))Y=J0.from(Y,Y.offset,Y.byteLength);if(!J0.isBuffer(T)||!J0.isBuffer(Y))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===Y)return 0;let G=T.length,K=Y.length;for(let L=0,W=Math.min(G,K);LK.length){if(!J0.isBuffer(W))W=J0.from(W);W.copy(K,L)}else Uint8Array.prototype.set.call(K,W,L);else if(!J0.isBuffer(W))throw TypeError('"list" argument must be an Array of Buffers');else W.copy(K,L);L+=W.length}return K};J0.byteLength=LI;J0.prototype._isBuffer=!0;J0.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let Y=0;YY)T+=" ... ";return""};if(TI)J0.prototype[TI]=J0.prototype.inspect;J0.prototype.compare=function(T,Y,G,K,L){if(BU(T,Uint8Array))T=J0.from(T,T.offset,T.byteLength);if(!J0.isBuffer(T))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(Y===void 0)Y=0;if(G===void 0)G=T?T.length:0;if(K===void 0)K=0;if(L===void 0)L=this.length;if(Y<0||G>T.length||K<0||L>this.length)throw RangeError("out of range index");if(K>=L&&Y>=G)return 0;if(K>=L)return-1;if(Y>=G)return 1;if(Y>>>=0,G>>>=0,K>>>=0,L>>>=0,this===T)return 0;let W=L-K,O=G-Y,z=Math.min(W,O),q=this.slice(K,L),D=T.slice(Y,G);for(let C=0;C>>0,isFinite(G)){if(G=G>>>0,K===void 0)K="utf8"}else K=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let L=this.length-Y;if(G===void 0||G>L)G=L;if(T.length>0&&(G<0||Y<0)||Y>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let W=!1;for(;;)switch(K){case"hex":return UZ(this,T,Y,G);case"utf8":case"utf-8":return EZ(this,T,Y,G);case"ascii":case"latin1":case"binary":return XZ(this,T,Y,G);case"base64":return IZ(this,T,Y,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return TZ(this,T,Y,G);default:if(W)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),W=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};J0.prototype.slice=function(T,Y){let G=this.length;if(T=~~T,Y=Y===void 0?G:~~Y,T<0){if(T+=G,T<0)T=0}else if(T>G)T=G;if(Y<0){if(Y+=G,Y<0)Y=0}else if(Y>G)Y=G;if(Y>>0,Y=Y>>>0,!G)$U(T,Y,this.length);let K=this[T],L=1,W=0;while(++W>>0,Y=Y>>>0,!G)$U(T,Y,this.length);let K=this[T+--Y],L=1;while(Y>0&&(L*=256))K+=this[T+--Y]*L;return K};J0.prototype.readUint8=J0.prototype.readUInt8=function(T,Y){if(T=T>>>0,!Y)$U(T,1,this.length);return this[T]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(T,Y){if(T=T>>>0,!Y)$U(T,2,this.length);return this[T]|this[T+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(T,Y){if(T=T>>>0,!Y)$U(T,2,this.length);return this[T]<<8|this[T+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(T,Y){if(T=T>>>0,!Y)$U(T,4,this.length);return(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(T,Y){if(T=T>>>0,!Y)$U(T,4,this.length);return this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])};J0.prototype.readBigUInt64LE=hU(function(T){T=T>>>0,iU(T,"offset");let Y=this[T],G=this[T+7];if(Y===void 0||G===void 0)QE(T,this.length-8);let K=Y+this[++T]*256+this[++T]*65536+this[++T]*16777216,L=this[++T]+this[++T]*256+this[++T]*65536+G*16777216;return BigInt(K)+(BigInt(L)<>>0,iU(T,"offset");let Y=this[T],G=this[T+7];if(Y===void 0||G===void 0)QE(T,this.length-8);let K=Y*16777216+this[++T]*65536+this[++T]*256+this[++T],L=this[++T]*16777216+this[++T]*65536+this[++T]*256+G;return(BigInt(K)<>>0,Y=Y>>>0,!G)$U(T,Y,this.length);let K=this[T],L=1,W=0;while(++W=L)K-=Math.pow(2,8*Y);return K};J0.prototype.readIntBE=function(T,Y,G){if(T=T>>>0,Y=Y>>>0,!G)$U(T,Y,this.length);let K=Y,L=1,W=this[T+--K];while(K>0&&(L*=256))W+=this[T+--K]*L;if(L*=128,W>=L)W-=Math.pow(2,8*Y);return W};J0.prototype.readInt8=function(T,Y){if(T=T>>>0,!Y)$U(T,1,this.length);if(!(this[T]&128))return this[T];return(255-this[T]+1)*-1};J0.prototype.readInt16LE=function(T,Y){if(T=T>>>0,!Y)$U(T,2,this.length);let G=this[T]|this[T+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(T,Y){if(T=T>>>0,!Y)$U(T,2,this.length);let G=this[T+1]|this[T]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(T,Y){if(T=T>>>0,!Y)$U(T,4,this.length);return this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24};J0.prototype.readInt32BE=function(T,Y){if(T=T>>>0,!Y)$U(T,4,this.length);return this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]};J0.prototype.readBigInt64LE=hU(function(T){T=T>>>0,iU(T,"offset");let Y=this[T],G=this[T+7];if(Y===void 0||G===void 0)QE(T,this.length-8);let K=this[T+4]+this[T+5]*256+this[T+6]*65536+(G<<24);return(BigInt(K)<>>0,iU(T,"offset");let Y=this[T],G=this[T+7];if(Y===void 0||G===void 0)QE(T,this.length-8);let K=(Y<<24)+this[++T]*65536+this[++T]*256+this[++T];return(BigInt(K)<>>0,!Y)$U(T,4,this.length);return PE(this,T,!0,23,4)};J0.prototype.readFloatBE=function(T,Y){if(T=T>>>0,!Y)$U(T,4,this.length);return PE(this,T,!1,23,4)};J0.prototype.readDoubleLE=function(T,Y){if(T=T>>>0,!Y)$U(T,8,this.length);return PE(this,T,!0,52,8)};J0.prototype.readDoubleBE=function(T,Y){if(T=T>>>0,!Y)$U(T,8,this.length);return PE(this,T,!1,52,8)};J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(T,Y,G,K){if(T=+T,Y=Y>>>0,G=G>>>0,!K){let O=Math.pow(2,8*G)-1;MU(this,T,Y,G,O,0)}let L=1,W=0;this[Y]=T&255;while(++W>>0,G=G>>>0,!K){let O=Math.pow(2,8*G)-1;MU(this,T,Y,G,O,0)}let L=G-1,W=1;this[Y+L]=T&255;while(--L>=0&&(W*=256))this[Y+L]=T/W&255;return Y+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,1,255,0);return this[Y]=T&255,Y+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,2,65535,0);return this[Y]=T&255,this[Y+1]=T>>>8,Y+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,2,65535,0);return this[Y]=T>>>8,this[Y+1]=T&255,Y+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,4,4294967295,0);return this[Y+3]=T>>>24,this[Y+2]=T>>>16,this[Y+1]=T>>>8,this[Y]=T&255,Y+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,4,4294967295,0);return this[Y]=T>>>24,this[Y+1]=T>>>16,this[Y+2]=T>>>8,this[Y+3]=T&255,Y+4};J0.prototype.writeBigUInt64LE=hU(function(T,Y=0){return FI(this,T,Y,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=hU(function(T,Y=0){return WI(this,T,Y,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(T,Y,G,K){if(T=+T,Y=Y>>>0,!K){let z=Math.pow(2,8*G-1);MU(this,T,Y,G,z-1,-z)}let L=0,W=1,O=0;this[Y]=T&255;while(++L>0)-O&255}return Y+G};J0.prototype.writeIntBE=function(T,Y,G,K){if(T=+T,Y=Y>>>0,!K){let z=Math.pow(2,8*G-1);MU(this,T,Y,G,z-1,-z)}let L=G-1,W=1,O=0;this[Y+L]=T&255;while(--L>=0&&(W*=256)){if(T<0&&O===0&&this[Y+L+1]!==0)O=1;this[Y+L]=(T/W>>0)-O&255}return Y+G};J0.prototype.writeInt8=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,1,127,-128);if(T<0)T=255+T+1;return this[Y]=T&255,Y+1};J0.prototype.writeInt16LE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,2,32767,-32768);return this[Y]=T&255,this[Y+1]=T>>>8,Y+2};J0.prototype.writeInt16BE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,2,32767,-32768);return this[Y]=T>>>8,this[Y+1]=T&255,Y+2};J0.prototype.writeInt32LE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,4,2147483647,-2147483648);return this[Y]=T&255,this[Y+1]=T>>>8,this[Y+2]=T>>>16,this[Y+3]=T>>>24,Y+4};J0.prototype.writeInt32BE=function(T,Y,G){if(T=+T,Y=Y>>>0,!G)MU(this,T,Y,4,2147483647,-2147483648);if(T<0)T=4294967295+T+1;return this[Y]=T>>>24,this[Y+1]=T>>>16,this[Y+2]=T>>>8,this[Y+3]=T&255,Y+4};J0.prototype.writeBigInt64LE=hU(function(T,Y=0){return FI(this,T,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=hU(function(T,Y=0){return WI(this,T,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeFloatLE=function(T,Y,G){return RI(this,T,Y,!0,G)};J0.prototype.writeFloatBE=function(T,Y,G){return RI(this,T,Y,!1,G)};J0.prototype.writeDoubleLE=function(T,Y,G){return CI(this,T,Y,!0,G)};J0.prototype.writeDoubleBE=function(T,Y,G){return CI(this,T,Y,!1,G)};J0.prototype.copy=function(T,Y,G,K){if(!J0.isBuffer(T))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!K&&K!==0)K=this.length;if(Y>=T.length)Y=T.length;if(!Y)Y=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if(T.length-Y>>0,G=G===void 0?this.length:G>>>0,!T)T=0;let L;if(typeof T==="number")for(L=Y;LBZ,promisify:()=>kI,log:()=>qI,isUndefined:()=>UE,isSymbol:()=>gZ,isString:()=>xE,isRegExp:()=>kE,isPrimitive:()=>wZ,isObject:()=>EE,isNumber:()=>MI,isNullOrUndefined:()=>xZ,isNull:()=>BE,isFunction:()=>jE,isError:()=>vE,isDate:()=>AX,isBuffer:()=>yZ,isBoolean:()=>$X,isArray:()=>SI,inspect:()=>nU,inherits:()=>PI,format:()=>LX,deprecate:()=>MZ,default:()=>pZ,debuglog:()=>qZ,callbackifyOnRejected:()=>WX,callbackify:()=>vI,_extend:()=>FX,TextEncoder:()=>jI,TextDecoder:()=>NI});function LX(T,...Y){if(!xE(T)){var G=[T];for(var K=0;K=L)return z;switch(z){case"%s":return String(Y[K++]);case"%d":return Number(Y[K++]);case"%j":try{return JSON.stringify(Y[K++])}catch(q){return"[Circular]"}default:return z}});for(var O=Y[K];K"u"||process?.noDeprecation===!0)return T;var G=!1;function K(...L){if(!G){if(process.throwDeprecation)throw Error(Y);else if(process.traceDeprecation)console.trace(Y);else console.error(Y);G=!0}return T.apply(this,...L)}return K}function PZ(T,Y){var G=nU.styles[Y];if(G)return"\x1B["+nU.colors[G][0]+"m"+T+"\x1B["+nU.colors[G][1]+"m";else return T}function _Z(T,Y){return T}function kZ(T){var Y={};return T.forEach(function(G,K){Y[G]=!0}),Y}function NE(T,Y,G){if(T.customInspect&&Y&&jE(Y.inspect)&&Y.inspect!==nU&&!(Y.constructor&&Y.constructor.prototype===Y)){var K=Y.inspect(G,T);if(!xE(K))K=NE(T,K,G);return K}var L=vZ(T,Y);if(L)return L;var W=Object.keys(Y),O=kZ(W);if(T.showHidden)W=Object.getOwnPropertyNames(Y);if(vE(Y)&&(W.indexOf("message")>=0||W.indexOf("description")>=0))return JX(Y);if(W.length===0){if(jE(Y)){var z=Y.name?": "+Y.name:"";return T.stylize("[Function"+z+"]","special")}if(kE(Y))return T.stylize(RegExp.prototype.toString.call(Y),"regexp");if(AX(Y))return T.stylize(Date.prototype.toString.call(Y),"date");if(vE(Y))return JX(Y)}var q="",D=!1,C=["{","}"];if(SI(Y))D=!0,C=["[","]"];if(jE(Y)){var F=Y.name?": "+Y.name:"";q=" [Function"+F+"]"}if(kE(Y))q=" "+RegExp.prototype.toString.call(Y);if(AX(Y))q=" "+Date.prototype.toUTCString.call(Y);if(vE(Y))q=" "+JX(Y);if(W.length===0&&(!D||Y.length==0))return C[0]+q+C[1];if(G<0)if(kE(Y))return T.stylize(RegExp.prototype.toString.call(Y),"regexp");else return T.stylize("[Object]","special");T.seen.push(Y);var R;if(D)R=jZ(T,Y,G,O,W);else R=W.map(function(M){return VX(T,Y,G,O,M,D)});return T.seen.pop(),NZ(R,q,C)}function vZ(T,Y){if(UE(Y))return T.stylize("undefined","undefined");if(xE(Y)){var G="'"+JSON.stringify(Y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return T.stylize(G,"string")}if(MI(Y))return T.stylize(""+Y,"number");if($X(Y))return T.stylize(""+Y,"boolean");if(BE(Y))return T.stylize("null","null")}function JX(T){return"["+Error.prototype.toString.call(T)+"]"}function jZ(T,Y,G,K,L){var W=[];for(var O=0,z=Y.length;O{var Y=(TX??=new WeakMap).get(I),G;if(Y)return Y;if(Y=UT({},"__esModule",{value:!0}),I&&typeof I==="object"||typeof I==="function"){for(var K of jY(I))if(!BY.call(Y,K))UT(Y,K,{get:xY.bind(I,K),enumerable:!(G=NY(I,K))||G.enumerable})}return TX.set(I,Y),Y},TX,gY=(I,Y)=>()=>(Y||I((Y={exports:{}}).exports,Y),Y.exports);var wY=(I)=>I;function yY(I,Y){this[I]=wY.bind(null,Y)}var jU=(I,Y)=>{for(var G in Y)UT(I,G,{get:Y[G],enumerable:!0,configurable:!0,set:yY.bind(Y,G)})};var VU=(I,Y)=>()=>(I&&(Y=I(I=0)),Y);var ET=((I)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(I,{get:(Y,G)=>(typeof require<"u"?require:Y)[G]}):I)(function(I){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+I+'" is not supported')});var KU={};jU(KU,{transcode:()=>CO,resolveObjectURL:()=>HO,kStringMaxLength:()=>VX,kMaxLength:()=>ZE,isUtf8:()=>RO,isAscii:()=>DO,default:()=>zO,constants:()=>nY,btoa:()=>bY,atob:()=>dY,INSPECT_MAX_BYTES:()=>GX,File:()=>lY,Buffer:()=>J0,Blob:()=>oY});function fY(I){var Y=I.length;if(Y%4>0)throw Error("Invalid string. Length must be a multiple of 4");var G=I.indexOf("=");if(G===-1)G=Y;var K=G===Y?0:4-G%4;return[G,K]}function cY(I,Y){return(I+Y)*3/4-Y}function pY(I){var Y,G=fY(I),K=G[0],L=G[1],W=new Uint8Array(cY(K,L)),Z=0,z=L>0?K-4:K,q;for(q=0;q>16&255,W[Z++]=Y>>8&255,W[Z++]=Y&255;if(L===2)Y=kU[I.charCodeAt(q)]<<2|kU[I.charCodeAt(q+1)]>>4,W[Z++]=Y&255;if(L===1)Y=kU[I.charCodeAt(q)]<<10|kU[I.charCodeAt(q+1)]<<4|kU[I.charCodeAt(q+2)]>>2,W[Z++]=Y>>8&255,W[Z++]=Y&255;return W}function hY(I){return NU[I>>18&63]+NU[I>>12&63]+NU[I>>6&63]+NU[I&63]}function uY(I,Y,G){var K,L=[];for(var W=Y;Wz?z:Z+W));if(K===1)Y=I[G-1],L.push(NU[Y>>2]+NU[Y<<4&63]+"==");else if(K===2)Y=(I[G-2]<<8)+I[G-1],L.push(NU[Y>>10]+NU[Y>>4&63]+NU[Y<<2&63]+"=");return L.join("")}function kE(I,Y,G,K,L){var W,Z,z=L*8-K-1,q=(1<>1,D=-7,F=G?L-1:0,R=G?-1:1,M=I[Y+F];F+=R,W=M&(1<<-D)-1,M>>=-D,D+=z;for(;D>0;W=W*256+I[Y+F],F+=R,D-=8);Z=W&(1<<-D)-1,W>>=-D,D+=K;for(;D>0;Z=Z*256+I[Y+F],F+=R,D-=8);if(W===0)W=1-C;else if(W===q)return Z?NaN:(M?-1:1)*(1/0);else Z=Z+Math.pow(2,K),W=W-C;return(M?-1:1)*Z*Math.pow(2,W-K)}function JX(I,Y,G,K,L,W){var Z,z,q,C=W*8-L-1,D=(1<>1,R=L===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:W-1,P=K?1:-1,k=Y<0||Y===0&&1/Y<0?1:0;if(Y=Math.abs(Y),isNaN(Y)||Y===1/0)z=isNaN(Y)?1:0,Z=D;else{if(Z=Math.floor(Math.log(Y)/Math.LN2),Y*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+F>=1)Y+=R/q;else Y+=R*Math.pow(2,1-F);if(Y*q>=2)Z++,q/=2;if(Z+F>=D)z=0,Z=D;else if(Z+F>=1)z=(Y*q-1)*Math.pow(2,L),Z=Z+F;else z=Y*Math.pow(2,F-1)*Math.pow(2,L),Z=0}for(;L>=8;I[G+M]=z&255,M+=P,z/=256,L-=8);Z=Z<0;I[G+M]=Z&255,M+=P,Z/=256,C-=8);I[G+M-P]|=k*128}function wU(I){if(I>ZE)throw RangeError('The value "'+I+'" is invalid for option "size"');let Y=new Uint8Array(I);return Object.setPrototypeOf(Y,J0.prototype),Y}function ZT(I,Y,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:Y.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}function J0(I,Y,G){if(typeof I==="number"){if(typeof Y==="string")throw TypeError('The "string" argument must be of type string. Received type number');return QT(I)}return AX(I,Y,G)}function AX(I,Y,G){if(typeof I==="string")return tY(I,Y);if(ArrayBuffer.isView(I))return aY(I);if(I==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(BU(I,ArrayBuffer)||I&&BU(I.buffer,ArrayBuffer))return YT(I,Y,G);if(typeof SharedArrayBuffer<"u"&&(BU(I,SharedArrayBuffer)||I&&BU(I.buffer,SharedArrayBuffer)))return YT(I,Y,G);if(typeof I==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=I.valueOf&&I.valueOf();if(K!=null&&K!==I)return J0.from(K,Y,G);let L=eY(I);if(L)return L;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]==="function")return J0.from(I[Symbol.toPrimitive]("string"),Y,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}function LX(I){if(typeof I!=="number")throw TypeError('"size" argument must be of type number');else if(I<0)throw RangeError('The value "'+I+'" is invalid for option "size"')}function rY(I,Y,G){if(LX(I),I<=0)return wU(I);if(Y!==void 0)return typeof G==="string"?wU(I).fill(Y,G):wU(I).fill(Y);return wU(I)}function QT(I){return LX(I),wU(I<0?0:JT(I)|0)}function tY(I,Y){if(typeof Y!=="string"||Y==="")Y="utf8";if(!J0.isEncoding(Y))throw TypeError("Unknown encoding: "+Y);let G=$X(I,Y)|0,K=wU(G),L=K.write(I,Y);if(L!==G)K=K.slice(0,L);return K}function IT(I){let Y=I.length<0?0:JT(I.length)|0,G=wU(Y);for(let K=0;K=ZE)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ZE.toString(16)+" bytes");return I|0}function $X(I,Y){if(J0.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||BU(I,ArrayBuffer))return I.byteLength;if(typeof I!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let G=I.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&G===0)return 0;let L=!1;for(;;)switch(Y){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return OT(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return SX(I).length;default:if(L)return K?-1:OT(I).length;Y=(""+Y).toLowerCase(),L=!0}}function iY(I,Y,G){let K=!1;if(Y===void 0||Y<0)Y=0;if(Y>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,Y>>>=0,G<=Y)return"";if(!I)I="utf8";while(!0)switch(I){case"hex":return JO(this,Y,G);case"utf8":case"utf-8":return FX(this,Y,G);case"ascii":return ZO(this,Y,G);case"latin1":case"binary":return QO(this,Y,G);case"base64":return YO(this,Y,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return GO(this,Y,G);default:if(K)throw TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),K=!0}}function oU(I,Y,G){let K=I[Y];I[Y]=I[G],I[G]=K}function KX(I,Y,G,K,L){if(I.length===0)return-1;if(typeof G==="string")K=G,G=0;else if(G>2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=L?0:I.length-1;if(G<0)G=I.length+G;if(G>=I.length)if(L)return-1;else G=I.length-1;else if(G<0)if(L)G=0;else return-1;if(typeof Y==="string")Y=J0.from(Y,K);if(J0.isBuffer(Y)){if(Y.length===0)return-1;return OX(I,Y,G,K,L)}else if(typeof Y==="number"){if(Y=Y&255,typeof Uint8Array.prototype.indexOf==="function")if(L)return Uint8Array.prototype.indexOf.call(I,Y,G);else return Uint8Array.prototype.lastIndexOf.call(I,Y,G);return OX(I,[Y],G,K,L)}throw TypeError("val must be string, number or Buffer")}function OX(I,Y,G,K,L){let W=1,Z=I.length,z=Y.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if(I.length<2||Y.length<2)return-1;W=2,Z/=2,z/=2,G/=2}}function q(D,F){if(W===1)return D[F];else return D.readUInt16BE(F*W)}let C;if(L){let D=-1;for(C=G;CZ)G=Z-z;for(C=G;C>=0;C--){let D=!0;for(let F=0;FL)K=L;let W=Y.length;if(K>W/2)K=W/2;let Z;for(Z=0;Z239?4:W>223?3:W>191?2:1;if(L+z<=G){let q,C,D,F;switch(z){case 1:if(W<128)Z=W;break;case 2:if(q=I[L+1],(q&192)===128){if(F=(W&31)<<6|q&63,F>127)Z=F}break;case 3:if(q=I[L+1],C=I[L+2],(q&192)===128&&(C&192)===128){if(F=(W&15)<<12|(q&63)<<6|C&63,F>2047&&(F<55296||F>57343))Z=F}break;case 4:if(q=I[L+1],C=I[L+2],D=I[L+3],(q&192)===128&&(C&192)===128&&(D&192)===128){if(F=(W&15)<<18|(q&63)<<12|(C&63)<<6|D&63,F>65535&&F<1114112)Z=F}}}if(Z===null)Z=65533,z=1;else if(Z>65535)Z-=65536,K.push(Z>>>10&1023|55296),Z=56320|Z&1023;K.push(Z),L+=z}return OO(K)}function OO(I){let Y=I.length;if(Y<=ZX)return String.fromCharCode.apply(String,I);let G="",K=0;while(KK)G=K;let L="";for(let W=Y;WG)throw RangeError("Trying to access beyond buffer length")}function MU(I,Y,G,K,L,W){if(!J0.isBuffer(I))throw TypeError('"buffer" argument must be a Buffer instance');if(Y>L||YI.length)throw RangeError("Index out of range")}function WX(I,Y,G,K,L){zX(Y,K,L,I,G,7);let W=Number(Y&BigInt(4294967295));I[G++]=W,W=W>>8,I[G++]=W,W=W>>8,I[G++]=W,W=W>>8,I[G++]=W;let Z=Number(Y>>BigInt(32)&BigInt(4294967295));return I[G++]=Z,Z=Z>>8,I[G++]=Z,Z=Z>>8,I[G++]=Z,Z=Z>>8,I[G++]=Z,G}function HX(I,Y,G,K,L){zX(Y,K,L,I,G,7);let W=Number(Y&BigInt(4294967295));I[G+7]=W,W=W>>8,I[G+6]=W,W=W>>8,I[G+5]=W,W=W>>8,I[G+4]=W;let Z=Number(Y>>BigInt(32)&BigInt(4294967295));return I[G+3]=Z,Z=Z>>8,I[G+2]=Z,Z=Z>>8,I[G+1]=Z,Z=Z>>8,I[G]=Z,G+8}function RX(I,Y,G,K,L,W){if(G+K>I.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function DX(I,Y,G,K,L){if(Y=+Y,G=G>>>0,!L)RX(I,Y,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return JX(I,Y,G,K,23,4),G+4}function CX(I,Y,G,K,L){if(Y=+Y,G=G>>>0,!L)RX(I,Y,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return JX(I,Y,G,K,52,8),G+8}function QX(I){let Y="",G=I.length,K=I[0]==="-"?1:0;for(;G>=K+4;G-=3)Y=`_${I.slice(G-3,G)}${Y}`;return`${I.slice(0,G)}${Y}`}function VO(I,Y,G){if(iU(Y,"offset"),I[Y]===void 0||I[Y+G]===void 0)QE(Y,I.length-(G+1))}function zX(I,Y,G,K,L,W){if(I>G||I3)if(Y===0||Y===BigInt(0))z=`>= 0${Z} and < 2${Z} ** ${(W+1)*8}${Z}`;else z=`>= -(2${Z} ** ${(W+1)*8-1}${Z}) and < 2 ** ${(W+1)*8-1}${Z}`;else z=`>= ${Y}${Z} and <= ${G}${Z}`;throw new XT("value",z,I)}VO(K,L,W)}function iU(I,Y){if(typeof I!=="number")throw new sY(Y,"number",I)}function QE(I,Y,G){if(Math.floor(I)!==I)throw iU(I,G),new XT(G||"offset","an integer",I);if(Y<0)throw new mY;throw new XT(G||"offset",`>= ${G?1:0} and <= ${Y}`,I)}function LO(I){if(I=I.split("=")[0],I=I.trim().replace(AO,""),I.length<2)return"";while(I.length%4!==0)I=I+"=";return I}function OT(I,Y){Y=Y||1/0;let G,K=I.length,L=null,W=[];for(let Z=0;Z55295&&G<57344){if(!L){if(G>56319){if((Y-=3)>-1)W.push(239,191,189);continue}else if(Z+1===K){if((Y-=3)>-1)W.push(239,191,189);continue}L=G;continue}if(G<56320){if((Y-=3)>-1)W.push(239,191,189);L=G;continue}G=(L-55296<<10|G-56320)+65536}else if(L){if((Y-=3)>-1)W.push(239,191,189)}if(L=null,G<128){if((Y-=1)<0)break;W.push(G)}else if(G<2048){if((Y-=2)<0)break;W.push(G>>6|192,G&63|128)}else if(G<65536){if((Y-=3)<0)break;W.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((Y-=4)<0)break;W.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return W}function $O(I){let Y=[];for(let G=0;G>8,L=G%256,W.push(L),W.push(K)}return W}function SX(I){return pY(LO(I))}function vE(I,Y,G,K){let L;for(L=0;L=Y.length||L>=I.length)break;Y[L+G]=I[L]}return L}function BU(I,Y){return I instanceof Y||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===Y.name}function hU(I){return typeof BigInt>"u"?WO:I}function WO(){throw Error("BigInt not supported")}function GT(I){return()=>{throw Error(I+" is not implemented for node:buffer browser polyfill")}}var NU,kU,TT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lU,XX,YX,GX=50,ZE=2147483647,VX=536870888,bY,dY,lY,oY,nY,mY,sY,XT,ZX=4096,AO,FO,HO,RO,DO=(I)=>{for(let Y of I)if(Y.charCodeAt(0)>127)return!1;return!0},CO,zO;var FU=VU(()=>{NU=[],kU=[];for(lU=0,XX=TT.length;lU4294967296)L=QX(String(G));else if(typeof G==="bigint"){if(L=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))L=QX(L);L+="n"}return K+=` It must be ${Y}. Received ${L}`,K},RangeError);Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;J0.from=function(I,Y,G){return AX(I,Y,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);J0.alloc=function(I,Y,G){return rY(I,Y,G)};J0.allocUnsafe=function(I){return QT(I)};J0.allocUnsafeSlow=function(I){return QT(I)};J0.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==J0.prototype};J0.compare=function(I,Y){if(BU(I,Uint8Array))I=J0.from(I,I.offset,I.byteLength);if(BU(Y,Uint8Array))Y=J0.from(Y,Y.offset,Y.byteLength);if(!J0.isBuffer(I)||!J0.isBuffer(Y))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===Y)return 0;let G=I.length,K=Y.length;for(let L=0,W=Math.min(G,K);LK.length){if(!J0.isBuffer(W))W=J0.from(W);W.copy(K,L)}else Uint8Array.prototype.set.call(K,W,L);else if(!J0.isBuffer(W))throw TypeError('"list" argument must be an Array of Buffers');else W.copy(K,L);L+=W.length}return K};J0.byteLength=$X;J0.prototype._isBuffer=!0;J0.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let Y=0;YY)I+=" ... ";return""};if(YX)J0.prototype[YX]=J0.prototype.inspect;J0.prototype.compare=function(I,Y,G,K,L){if(BU(I,Uint8Array))I=J0.from(I,I.offset,I.byteLength);if(!J0.isBuffer(I))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(Y===void 0)Y=0;if(G===void 0)G=I?I.length:0;if(K===void 0)K=0;if(L===void 0)L=this.length;if(Y<0||G>I.length||K<0||L>this.length)throw RangeError("out of range index");if(K>=L&&Y>=G)return 0;if(K>=L)return-1;if(Y>=G)return 1;if(Y>>>=0,G>>>=0,K>>>=0,L>>>=0,this===I)return 0;let W=L-K,Z=G-Y,z=Math.min(W,Z),q=this.slice(K,L),C=I.slice(Y,G);for(let D=0;D>>0,isFinite(G)){if(G=G>>>0,K===void 0)K="utf8"}else K=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let L=this.length-Y;if(G===void 0||G>L)G=L;if(I.length>0&&(G<0||Y<0)||Y>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let W=!1;for(;;)switch(K){case"hex":return UO(this,I,Y,G);case"utf8":case"utf-8":return EO(this,I,Y,G);case"ascii":case"latin1":case"binary":return TO(this,I,Y,G);case"base64":return XO(this,I,Y,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IO(this,I,Y,G);default:if(W)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),W=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};J0.prototype.slice=function(I,Y){let G=this.length;if(I=~~I,Y=Y===void 0?G:~~Y,I<0){if(I+=G,I<0)I=0}else if(I>G)I=G;if(Y<0){if(Y+=G,Y<0)Y=0}else if(Y>G)Y=G;if(Y>>0,Y=Y>>>0,!G)$U(I,Y,this.length);let K=this[I],L=1,W=0;while(++W>>0,Y=Y>>>0,!G)$U(I,Y,this.length);let K=this[I+--Y],L=1;while(Y>0&&(L*=256))K+=this[I+--Y]*L;return K};J0.prototype.readUint8=J0.prototype.readUInt8=function(I,Y){if(I=I>>>0,!Y)$U(I,1,this.length);return this[I]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(I,Y){if(I=I>>>0,!Y)$U(I,2,this.length);return this[I]|this[I+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(I,Y){if(I=I>>>0,!Y)$U(I,2,this.length);return this[I]<<8|this[I+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(I,Y){if(I=I>>>0,!Y)$U(I,4,this.length);return(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(I,Y){if(I=I>>>0,!Y)$U(I,4,this.length);return this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])};J0.prototype.readBigUInt64LE=hU(function(I){I=I>>>0,iU(I,"offset");let Y=this[I],G=this[I+7];if(Y===void 0||G===void 0)QE(I,this.length-8);let K=Y+this[++I]*256+this[++I]*65536+this[++I]*16777216,L=this[++I]+this[++I]*256+this[++I]*65536+G*16777216;return BigInt(K)+(BigInt(L)<>>0,iU(I,"offset");let Y=this[I],G=this[I+7];if(Y===void 0||G===void 0)QE(I,this.length-8);let K=Y*16777216+this[++I]*65536+this[++I]*256+this[++I],L=this[++I]*16777216+this[++I]*65536+this[++I]*256+G;return(BigInt(K)<>>0,Y=Y>>>0,!G)$U(I,Y,this.length);let K=this[I],L=1,W=0;while(++W=L)K-=Math.pow(2,8*Y);return K};J0.prototype.readIntBE=function(I,Y,G){if(I=I>>>0,Y=Y>>>0,!G)$U(I,Y,this.length);let K=Y,L=1,W=this[I+--K];while(K>0&&(L*=256))W+=this[I+--K]*L;if(L*=128,W>=L)W-=Math.pow(2,8*Y);return W};J0.prototype.readInt8=function(I,Y){if(I=I>>>0,!Y)$U(I,1,this.length);if(!(this[I]&128))return this[I];return(255-this[I]+1)*-1};J0.prototype.readInt16LE=function(I,Y){if(I=I>>>0,!Y)$U(I,2,this.length);let G=this[I]|this[I+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(I,Y){if(I=I>>>0,!Y)$U(I,2,this.length);let G=this[I+1]|this[I]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(I,Y){if(I=I>>>0,!Y)$U(I,4,this.length);return this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24};J0.prototype.readInt32BE=function(I,Y){if(I=I>>>0,!Y)$U(I,4,this.length);return this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]};J0.prototype.readBigInt64LE=hU(function(I){I=I>>>0,iU(I,"offset");let Y=this[I],G=this[I+7];if(Y===void 0||G===void 0)QE(I,this.length-8);let K=this[I+4]+this[I+5]*256+this[I+6]*65536+(G<<24);return(BigInt(K)<>>0,iU(I,"offset");let Y=this[I],G=this[I+7];if(Y===void 0||G===void 0)QE(I,this.length-8);let K=(Y<<24)+this[++I]*65536+this[++I]*256+this[++I];return(BigInt(K)<>>0,!Y)$U(I,4,this.length);return kE(this,I,!0,23,4)};J0.prototype.readFloatBE=function(I,Y){if(I=I>>>0,!Y)$U(I,4,this.length);return kE(this,I,!1,23,4)};J0.prototype.readDoubleLE=function(I,Y){if(I=I>>>0,!Y)$U(I,8,this.length);return kE(this,I,!0,52,8)};J0.prototype.readDoubleBE=function(I,Y){if(I=I>>>0,!Y)$U(I,8,this.length);return kE(this,I,!1,52,8)};J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(I,Y,G,K){if(I=+I,Y=Y>>>0,G=G>>>0,!K){let Z=Math.pow(2,8*G)-1;MU(this,I,Y,G,Z,0)}let L=1,W=0;this[Y]=I&255;while(++W>>0,G=G>>>0,!K){let Z=Math.pow(2,8*G)-1;MU(this,I,Y,G,Z,0)}let L=G-1,W=1;this[Y+L]=I&255;while(--L>=0&&(W*=256))this[Y+L]=I/W&255;return Y+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,1,255,0);return this[Y]=I&255,Y+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,2,65535,0);return this[Y]=I&255,this[Y+1]=I>>>8,Y+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,2,65535,0);return this[Y]=I>>>8,this[Y+1]=I&255,Y+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,4,4294967295,0);return this[Y+3]=I>>>24,this[Y+2]=I>>>16,this[Y+1]=I>>>8,this[Y]=I&255,Y+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,4,4294967295,0);return this[Y]=I>>>24,this[Y+1]=I>>>16,this[Y+2]=I>>>8,this[Y+3]=I&255,Y+4};J0.prototype.writeBigUInt64LE=hU(function(I,Y=0){return WX(this,I,Y,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=hU(function(I,Y=0){return HX(this,I,Y,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(I,Y,G,K){if(I=+I,Y=Y>>>0,!K){let z=Math.pow(2,8*G-1);MU(this,I,Y,G,z-1,-z)}let L=0,W=1,Z=0;this[Y]=I&255;while(++L>0)-Z&255}return Y+G};J0.prototype.writeIntBE=function(I,Y,G,K){if(I=+I,Y=Y>>>0,!K){let z=Math.pow(2,8*G-1);MU(this,I,Y,G,z-1,-z)}let L=G-1,W=1,Z=0;this[Y+L]=I&255;while(--L>=0&&(W*=256)){if(I<0&&Z===0&&this[Y+L+1]!==0)Z=1;this[Y+L]=(I/W>>0)-Z&255}return Y+G};J0.prototype.writeInt8=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,1,127,-128);if(I<0)I=255+I+1;return this[Y]=I&255,Y+1};J0.prototype.writeInt16LE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,2,32767,-32768);return this[Y]=I&255,this[Y+1]=I>>>8,Y+2};J0.prototype.writeInt16BE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,2,32767,-32768);return this[Y]=I>>>8,this[Y+1]=I&255,Y+2};J0.prototype.writeInt32LE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,4,2147483647,-2147483648);return this[Y]=I&255,this[Y+1]=I>>>8,this[Y+2]=I>>>16,this[Y+3]=I>>>24,Y+4};J0.prototype.writeInt32BE=function(I,Y,G){if(I=+I,Y=Y>>>0,!G)MU(this,I,Y,4,2147483647,-2147483648);if(I<0)I=4294967295+I+1;return this[Y]=I>>>24,this[Y+1]=I>>>16,this[Y+2]=I>>>8,this[Y+3]=I&255,Y+4};J0.prototype.writeBigInt64LE=hU(function(I,Y=0){return WX(this,I,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=hU(function(I,Y=0){return HX(this,I,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeFloatLE=function(I,Y,G){return DX(this,I,Y,!0,G)};J0.prototype.writeFloatBE=function(I,Y,G){return DX(this,I,Y,!1,G)};J0.prototype.writeDoubleLE=function(I,Y,G){return CX(this,I,Y,!0,G)};J0.prototype.writeDoubleBE=function(I,Y,G){return CX(this,I,Y,!1,G)};J0.prototype.copy=function(I,Y,G,K){if(!J0.isBuffer(I))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!K&&K!==0)K=this.length;if(Y>=I.length)Y=I.length;if(!Y)Y=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if(I.length-Y>>0,G=G===void 0?this.length:G>>>0,!I)I=0;let L;if(typeof I==="number")for(L=Y;LBO,promisify:()=>vX,log:()=>PX,isUndefined:()=>UE,isSymbol:()=>gO,isString:()=>wE,isRegExp:()=>jE,isPrimitive:()=>wO,isObject:()=>EE,isNumber:()=>qX,isNullOrUndefined:()=>xO,isNull:()=>gE,isFunction:()=>BE,isError:()=>NE,isDate:()=>$T,isBuffer:()=>yO,isBoolean:()=>FT,isArray:()=>MX,inspect:()=>nU,inherits:()=>_X,format:()=>KT,deprecate:()=>MO,default:()=>pO,debuglog:()=>qO,callbackifyOnRejected:()=>RT,callbackify:()=>jX,_extend:()=>HT,TextEncoder:()=>NX,TextDecoder:()=>BX});function KT(I,...Y){if(!wE(I)){var G=[I];for(var K=0;K=L)return z;switch(z){case"%s":return String(Y[K++]);case"%d":return Number(Y[K++]);case"%j":try{return JSON.stringify(Y[K++])}catch(q){return"[Circular]"}default:return z}});for(var Z=Y[K];K"u"||process?.noDeprecation===!0)return I;var G=!1;function K(...L){if(!G){if(process.throwDeprecation)throw Error(Y);else if(process.traceDeprecation)console.trace(Y);else console.error(Y);G=!0}return I.apply(this,...L)}return K}function PO(I,Y){var G=nU.styles[Y];if(G)return"\x1B["+nU.colors[G][0]+"m"+I+"\x1B["+nU.colors[G][1]+"m";else return I}function _O(I,Y){return I}function kO(I){var Y={};return I.forEach(function(G,K){Y[G]=!0}),Y}function xE(I,Y,G){if(I.customInspect&&Y&&BE(Y.inspect)&&Y.inspect!==nU&&!(Y.constructor&&Y.constructor.prototype===Y)){var K=Y.inspect(G,I);if(!wE(K))K=xE(I,K,G);return K}var L=vO(I,Y);if(L)return L;var W=Object.keys(Y),Z=kO(W);if(I.showHidden)W=Object.getOwnPropertyNames(Y);if(NE(Y)&&(W.indexOf("message")>=0||W.indexOf("description")>=0))return VT(Y);if(W.length===0){if(BE(Y)){var z=Y.name?": "+Y.name:"";return I.stylize("[Function"+z+"]","special")}if(jE(Y))return I.stylize(RegExp.prototype.toString.call(Y),"regexp");if($T(Y))return I.stylize(Date.prototype.toString.call(Y),"date");if(NE(Y))return VT(Y)}var q="",C=!1,D=["{","}"];if(MX(Y))C=!0,D=["[","]"];if(BE(Y)){var F=Y.name?": "+Y.name:"";q=" [Function"+F+"]"}if(jE(Y))q=" "+RegExp.prototype.toString.call(Y);if($T(Y))q=" "+Date.prototype.toUTCString.call(Y);if(NE(Y))q=" "+VT(Y);if(W.length===0&&(!C||Y.length==0))return D[0]+q+D[1];if(G<0)if(jE(Y))return I.stylize(RegExp.prototype.toString.call(Y),"regexp");else return I.stylize("[Object]","special");I.seen.push(Y);var R;if(C)R=jO(I,Y,G,Z,W);else R=W.map(function(M){return LT(I,Y,G,Z,M,C)});return I.seen.pop(),NO(R,q,D)}function vO(I,Y){if(UE(Y))return I.stylize("undefined","undefined");if(wE(Y)){var G="'"+JSON.stringify(Y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return I.stylize(G,"string")}if(qX(Y))return I.stylize(""+Y,"number");if(FT(Y))return I.stylize(""+Y,"boolean");if(gE(Y))return I.stylize("null","null")}function VT(I){return"["+Error.prototype.toString.call(I)+"]"}function jO(I,Y,G,K,L){var W=[];for(var Z=0,z=Y.length;Z-1)if(W)z=z.split(` -`).map(function(D){return" "+D}).join(` +`).map(function(C){return" "+C}).join(` `).slice(2);else z=` `+z.split(` -`).map(function(D){return" "+D}).join(` -`)}else z=T.stylize("[Circular]","special");if(UE(O)){if(W&&L.match(/^\d+$/))return z;if(O=JSON.stringify(""+L),O.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))O=O.slice(1,-1),O=T.stylize(O,"name");else O=O.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),O=T.stylize(O,"string")}return O+": "+z}function NZ(T,Y,G){var K=0,L=T.reduce(function(W,O){if(K++,O.indexOf(` -`)>=0)K++;return W+O.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(L>60)return G[0]+(Y===""?"":Y+` - `)+" "+T.join(`, - `)+" "+G[1];return G[0]+Y+" "+T.join(", ")+" "+G[1]}function SI(T){return Array.isArray(T)}function $X(T){return typeof T==="boolean"}function BE(T){return T===null}function xZ(T){return T==null}function MI(T){return typeof T==="number"}function xE(T){return typeof T==="string"}function gZ(T){return typeof T==="symbol"}function UE(T){return T===void 0}function kE(T){return EE(T)&&KX(T)==="[object RegExp]"}function EE(T){return typeof T==="object"&&T!==null}function AX(T){return EE(T)&&KX(T)==="[object Date]"}function vE(T){return EE(T)&&(KX(T)==="[object Error]"||T instanceof Error)}function jE(T){return typeof T==="function"}function wZ(T){return T===null||typeof T==="boolean"||typeof T==="number"||typeof T==="string"||typeof T==="symbol"||typeof T>"u"}function yZ(T){return T instanceof Buffer}function KX(T){return Object.prototype.toString.call(T)}function GX(T){return T<10?"0"+T.toString(10):T.toString(10)}function cZ(){var T=new Date,Y=[GX(T.getHours()),GX(T.getMinutes()),GX(T.getSeconds())].join(":");return[T.getDate(),fZ[T.getMonth()],Y].join(" ")}function qI(...T){console.log("%s - %s",cZ(),LX.apply(null,T))}function PI(T,Y){if(Y)T.super_=Y,T.prototype=Object.create(Y.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}})}function FX(T,Y){if(!Y||!EE(Y))return T;var G=Object.keys(Y),K=G.length;while(K--)T[G[K]]=Y[G[K]];return T}function _I(T,Y){return Object.prototype.hasOwnProperty.call(T,Y)}function WX(T,Y){if(!T){var G=Error("Promise was rejected with a falsy value");G.reason=T,T=G}return Y(T)}function vI(T){if(typeof T!=="function")throw TypeError('The "original" argument must be of type Function');function Y(...G){var K=G.pop();if(typeof K!=="function")throw TypeError("The last argument must be of type Function");var L=this,W=function(...O){return K.apply(L,...O)};T.apply(this,G).then(function(O){process.nextTick(W.bind(null,null,O))},function(O){process.nextTick(WX.bind(null,O,W))})}return Object.setPrototypeOf(Y,Object.getPrototypeOf(T)),Object.defineProperties(Y,Object.getOwnPropertyDescriptors(T)),Y}var SZ,qZ,nU,BZ=()=>{},fZ,kI,jI,NI,pZ;var xI=GU(()=>{SZ=/%[sdj%]/g;qZ=((T={},Y={},G)=>((G=typeof process<"u"&&!1)&&(G=G.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),Y=new RegExp("^"+G+"$","i"),(K)=>{if(K=K.toUpperCase(),!T[K])if(Y.test(K))T[K]=function(...L){console.error("%s: %s",K,pid,LX.apply(null,...L))};else T[K]=function(){};return T[K]}))(),nU=((T)=>(T.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},T.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},T.custom=Symbol.for("nodejs.util.inspect.custom"),T))(function(T,Y,...G){var K={seen:[],stylize:_Z};if(G.length>=1)K.depth=G[0];if(G.length>=2)K.colors=G[1];if($X(Y))K.showHidden=Y;else if(Y)FX(K,Y);if(UE(K.showHidden))K.showHidden=!1;if(UE(K.depth))K.depth=2;if(UE(K.colors))K.colors=!1;if(K.colors)K.stylize=PZ;return NE(K,T,K.depth)});fZ=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];kI=((T)=>(T.custom=Symbol.for("nodejs.util.promisify.custom"),T))(function(T){if(typeof T!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&T[kCustomPromisifiedSymbol]){var Y=T[kCustomPromisifiedSymbol];if(typeof Y!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(Y,kCustomPromisifiedSymbol,{value:Y,enumerable:!1,writable:!1,configurable:!0}),Y}function Y(...G){var K,L,W=new Promise(function(O,z){K=O,L=z});G.push(function(O,z){if(O)L(O);else K(z)});try{T.apply(this,G)}catch(O){L(O)}return W}if(Object.setPrototypeOf(Y,Object.getPrototypeOf(T)),kCustomPromisifiedSymbol)Object.defineProperty(Y,kCustomPromisifiedSymbol,{value:Y,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(Y,Object.getOwnPropertyDescriptors(T))});({TextEncoder:jI,TextDecoder:NI}=globalThis),pZ={TextEncoder:jI,TextDecoder:NI,promisify:kI,log:qI,inherits:PI,_extend:FX,callbackifyOnRejected:WX,callbackify:vI}});var GE={};jU(GE,{setMaxListeners:()=>lI,once:()=>bI,listenerCount:()=>oI,init:()=>uU,getMaxListeners:()=>mI,getEventListeners:()=>dI,default:()=>sZ,captureRejectionSymbol:()=>cI,addAbortListener:()=>sI,EventEmitter:()=>uU});function pI(T,Y){var{_events:G}=T;if(Y[0]??=Error("Unhandled error."),!G)throw Y[0];var K=G[fI];if(K)for(var L of wI.call(K))L.apply(T,Y);var W=G.error;if(!W)throw Y[0];for(var L of wI.call(W))L.apply(T,Y);return!0}function bZ(T,Y,G,K){Y.then(void 0,function(L){queueMicrotask(()=>dZ(T,L,G,K))})}function dZ(T,Y,G,K){if(typeof T[gI]==="function")T[gI](Y,G,...K);else try{T[mU]=!1,T.emit("error",Y)}finally{T[mU]=!0}}function hI(T,Y,G){G.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${G.length} ${String(Y)} listeners added to [${T.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=T,K.type=Y,K.count=G.length,console.warn(K)}function uI(T,Y,...G){this.removeListener(T,Y),Y.apply(this,G)}function bI(T,Y,G){var K=G?.signal;if(nI(K,"options.signal"),K?.aborted)throw new HX(void 0,{cause:K?.reason});let{resolve:L,reject:W,promise:O}=$newPromiseCapability(Promise),z=(C)=>{if(T.removeListener(Y,q),K!=null)gE(K,"abort",D);W(C)},q=(...C)=>{if(typeof T.removeListener==="function")T.removeListener("error",z);if(K!=null)gE(K,"abort",D);L(C)};if(yI(T,Y,q,{once:!0}),Y!=="error"&&typeof T.once==="function")T.once("error",z);function D(){gE(T,Y,q),gE(T,"error",z),W(new HX(void 0,{cause:K?.reason}))}if(K!=null)yI(K,"abort",D,{once:!0});return O}function dI(T,Y){return T.listeners(Y)}function lI(T,...Y){CX(T,"setMaxListeners",0);var G;if(Y&&(G=Y.length))for(let K=0;KK||(G!=null||K!=null)&&Number.isNaN(T))throw nZ(Y,`${G!=null?`>= ${G}`:""}${G!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,T)}function JE(T){if(typeof T!=="function")throw TypeError("The listener must be a function")}function mZ(T,Y){if(typeof T!=="boolean")throw XE(Y,"boolean",T)}function mI(T){return T?._maxListeners??sU}function sI(T,Y){if(T===void 0)throw XE("signal","AbortSignal",T);if(nI(T,"signal"),typeof Y!=="function")throw XE("listener","function",Y);let G;if(T.aborted)queueMicrotask(()=>Y());else T.addEventListener("abort",Y,{__proto__:null,once:!0}),G=()=>{T.removeEventListener("abort",Y)};return{__proto__:null,[Symbol.dispose](){G?.()}}}var RX,mU,fI,hZ,uZ,gI,cI,wI,sU=10,uU=function(T){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[mU]=T?.captureRejections?Boolean(T?.captureRejections):l0[mU])this.emit=oZ},l0,lZ=function(T,...Y){if(T==="error")return pI(this,Y);var{_events:G}=this;if(G===void 0)return!1;var K=G[T];if(K===void 0)return!1;let L=K.length>1?K.slice():K;for(let W=0,{length:O}=L;W1?K.slice():K;for(let W=0,{length:O}=L;W{RX=Symbol.for,mU=Symbol("kCapture"),fI=RX("events.errorMonitor"),hZ=Symbol("events.maxEventTargetListeners"),uZ=Symbol("events.maxEventTargetListenersWarned"),gI=RX("nodejs.rejection"),cI=RX("nodejs.rejection"),wI=Array.prototype.slice,l0=uU.prototype={};l0._events=void 0;l0._eventsCount=0;l0._maxListeners=void 0;l0.setMaxListeners=function(T){return CX(T,"setMaxListeners",0),this._maxListeners=T,this};l0.constructor=uU;l0.getMaxListeners=function(){return this?._maxListeners??sU};l0.emit=lZ;l0.addListener=function(T,Y){JE(Y);var G=this._events;if(!G)G=this._events={__proto__:null},this._eventsCount=0;else if(G.newListener)this.emit("newListener",T,Y.listener??Y);var K=G[T];if(!K)G[T]=[Y],this._eventsCount++;else{K.push(Y);var L=this._maxListeners??sU;if(L>0&&K.length>L&&!K.warned)hI(this,T,K)}return this};l0.on=l0.addListener;l0.prependListener=function(T,Y){JE(Y);var G=this._events;if(!G)G=this._events={__proto__:null},this._eventsCount=0;else if(G.newListener)this.emit("newListener",T,Y.listener??Y);var K=G[T];if(!K)G[T]=[Y],this._eventsCount++;else{K.unshift(Y);var L=this._maxListeners??sU;if(L>0&&K.length>L&&!K.warned)hI(this,T,K)}return this};l0.once=function(T,Y){JE(Y);let G=uI.bind(this,T,Y);return G.listener=Y,this.addListener(T,G),this};l0.prependOnceListener=function(T,Y){JE(Y);let G=uI.bind(this,T,Y);return G.listener=Y,this.prependListener(T,G),this};l0.removeListener=function(T,Y){JE(Y);var{_events:G}=this;if(!G)return this;var K=G[T];if(!K)return this;var L=K.length;let W=-1;for(let O=L-1;O>=0;O--)if(K[O]===Y||K[O].listener===Y){W=O;break}if(W<0)return this;if(W===0)K.shift();else K.splice(W,1);if(K.length===0)delete G[T],this._eventsCount--;return this};l0.off=l0.removeListener;l0.removeAllListeners=function(T){var{_events:Y}=this;if(T&&Y){if(Y[T])delete Y[T],this._eventsCount--}else this._events={__proto__:null};return this};l0.listeners=function(T){var{_events:Y}=this;if(!Y)return[];var G=Y[T];if(!G)return[];return G.map((K)=>K.listener??K)};l0.rawListeners=function(T){var{_events:Y}=this;if(!Y)return[];var G=Y[T];if(!G)return[];return G.slice()};l0.listenerCount=function(T){var{_events:Y}=this;if(!Y)return 0;return Y[T]?.length??0};l0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};l0[mU]=!1;HX=class HX extends Error{constructor(T="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw XE("options","Object",Y);super(T,Y);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(uU,{captureRejections:{get(){return l0[mU]},set(T){mZ(T,"EventEmitter.captureRejections"),l0[mU]=T},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return sU},set:(T)=>{CX(T,"defaultMaxListeners",0),sU=T}},kMaxEventTargetListeners:{value:hZ,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:uZ,enumerable:!1,configurable:!1,writable:!1}});Object.assign(uU,{once:bI,getEventListeners:dI,getMaxListeners:mI,setMaxListeners:lI,EventEmitter:uU,usingDomains:!1,captureRejectionSymbol:cI,errorMonitor:fI,addAbortListener:sI,init:uU,listenerCount:oI});sZ=uU});var MX=gY((KV,XT)=>{var u0=(T,Y)=>()=>(Y||T((Y={exports:{}}).exports,Y),Y.exports),o0=u0((T,Y)=>{class G extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let L="";for(let W=0;W{Y.exports={format(G,...K){return G.replace(/%([sdifj])/g,function(...[L,W]){let O=K.shift();if(W==="f")return O.toFixed(6);else if(W==="j")return JSON.stringify(O);else if(W==="s"&&typeof O==="object")return`${O.constructor!==Object?O.constructor.name:""} {}`.trim();else return O.toString()})},inspect(G){switch(typeof G){case"string":if(G.includes("'")){if(!G.includes('"'))return`"${G}"`;else if(!G.includes("`")&&!G.includes("${"))return`\`${G}\``}return`'${G}'`;case"number":if(isNaN(G))return"NaN";else if(Object.is(G,-0))return String(G);return G;case"bigint":return`${String(G)}n`;case"boolean":case"undefined":return String(G);case"object":return"{}"}}}}),zU=u0((T,Y)=>{var{format:G,inspect:K}=rI(),{AggregateError:L}=o0(),W=globalThis.AggregateError||L,O=Symbol("kIsNodeError"),z=["string","function","number","object","Function","Object","boolean","bigint","symbol"],q=/^([A-Z][a-z0-9]*)+$/,D={};function C(N,v){if(!N)throw new D.ERR_INTERNAL_ASSERTION(v)}function F(N){let v="",B=N.length,g=N[0]==="-"?1:0;for(;B>=g+4;B-=3)v=`_${N.slice(B-3,B)}${v}`;return`${N.slice(0,B)}${v}`}function R(N,v,B){if(typeof v==="function")return C(v.length<=B.length,`Code: ${N}; The provided arguments length (${B.length}) does not match the required ones (${v.length}).`),v(...B);let g=(v.match(/%[dfijoOs]/g)||[]).length;if(C(g===B.length,`Code: ${N}; The provided arguments length (${B.length}) does not match the required ones (${g}).`),B.length===0)return v;return G(v,...B)}function M(N,v,B){if(!B)B=Error;class g extends B{constructor(...y){super(R(N,v,y))}toString(){return`${this.name} [${N}]: ${this.message}`}}Object.defineProperties(g.prototype,{name:{value:B.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${N}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),g.prototype.code=N,g.prototype[O]=!0,D[N]=g}function P(N){let v="__node_internal_"+N.name;return Object.defineProperty(N,"name",{value:v}),N}function k(N,v){if(N&&v&&N!==v){if(Array.isArray(v.errors))return v.errors.push(N),v;let B=new W([v,N],v.message);return B.code=v.code,B}return N||v}class _ extends Error{constructor(N="The operation was aborted",v=void 0){if(v!==void 0&&typeof v!=="object")throw new D.ERR_INVALID_ARG_TYPE("options","Object",v);super(N,v);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(N,v,B)=>{if(C(typeof N==="string","'name' must be a string"),!Array.isArray(v))v=[v];let g="The ";if(N.endsWith(" argument"))g+=`${N} `;else g+=`"${N}" ${N.includes(".")?"property":"argument"} `;g+="must be ";let y=[],l=[],Y0=[];for(let Z0 of v)if(C(typeof Z0==="string","All expected entries have to be of type string"),z.includes(Z0))y.push(Z0.toLowerCase());else if(q.test(Z0))l.push(Z0);else C(Z0!=="object",'The value "object" should be written as "Object"'),Y0.push(Z0);if(l.length>0){let Z0=y.indexOf("object");if(Z0!==-1)y.splice(y,Z0,1),l.push("Object")}if(y.length>0){switch(y.length){case 1:g+=`of type ${y[0]}`;break;case 2:g+=`one of type ${y[0]} or ${y[1]}`;break;default:{let Z0=y.pop();g+=`one of type ${y.join(", ")}, or ${Z0}`}}if(l.length>0||Y0.length>0)g+=" or "}if(l.length>0){switch(l.length){case 1:g+=`an instance of ${l[0]}`;break;case 2:g+=`an instance of ${l[0]} or ${l[1]}`;break;default:{let Z0=l.pop();g+=`an instance of ${l.join(", ")}, or ${Z0}`}}if(Y0.length>0)g+=" or "}switch(Y0.length){case 0:break;case 1:if(Y0[0].toLowerCase()!==Y0[0])g+="an ";g+=`${Y0[0]}`;break;case 2:g+=`one of ${Y0[0]} or ${Y0[1]}`;break;default:{let Z0=Y0.pop();g+=`one of ${Y0.join(", ")}, or ${Z0}`}}if(B==null)g+=`. Received ${B}`;else if(typeof B==="function"&&B.name)g+=`. Received function ${B.name}`;else if(typeof B==="object"){var O0;if((O0=B.constructor)!==null&&O0!==void 0&&O0.name)g+=`. Received an instance of ${B.constructor.name}`;else{let Z0=K(B,{depth:-1});g+=`. Received ${Z0}`}}else{let Z0=K(B,{colors:!1});if(Z0.length>25)Z0=`${Z0.slice(0,25)}...`;g+=`. Received type ${typeof B} (${Z0})`}return g},TypeError),M("ERR_INVALID_ARG_VALUE",(N,v,B="is invalid")=>{let g=K(v);if(g.length>128)g=g.slice(0,128)+"...";return`The ${N.includes(".")?"property":"argument"} '${N}' ${B}. Received ${g}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(N,v,B)=>{var g;let y=B!==null&&B!==void 0&&(g=B.constructor)!==null&&g!==void 0&&g.name?`instance of ${B.constructor.name}`:`type ${typeof B}`;return`Expected ${N} to be returned from the "${v}" function but got ${y}.`},TypeError),M("ERR_MISSING_ARGS",(...N)=>{C(N.length>0,"At least one arg needs to be specified");let v,B=N.length;switch(N=(Array.isArray(N)?N:[N]).map((g)=>`"${g}"`).join(" or "),B){case 1:v+=`The ${N[0]} argument`;break;case 2:v+=`The ${N[0]} and ${N[1]} arguments`;break;default:{let g=N.pop();v+=`The ${N.join(", ")}, and ${g} arguments`}break}return`${v} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(N,v,B)=>{C(v,'Missing "range" argument');let g;if(Number.isInteger(B)&&Math.abs(B)>4294967296)g=F(String(B));else if(typeof B==="bigint"){g=String(B);let y=BigInt(2)**BigInt(32);if(B>y||B<-y)g=F(g);g+="n"}else g=K(B);return`The value of "${N}" is out of range. It must be ${v}. Received ${g}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Y.exports={AbortError:_,aggregateTwoErrors:P(k),hideStackFrames:P,codes:D}}),rZ=u0((T,Y)=>{Object.defineProperty(T,"__esModule",{value:!0});var G=new WeakMap,K=new WeakMap;function L(u){let i=G.get(u);return console.assert(i!=null,"'this' is expected an Event object, but got",u),i}function W(u){if(u.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",u.passiveListener);return}if(!u.event.cancelable)return;if(u.canceled=!0,typeof u.event.preventDefault==="function")u.event.preventDefault()}function O(u,i){G.set(this,{eventTarget:u,event:i,eventPhase:2,currentTarget:u,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:i.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let U=Object.keys(i);for(let I=0;I0){let u=Array(arguments.length);for(let i=0;i{Object.defineProperty(T,"__esModule",{value:!0});var G=rZ();class K extends G.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let C=O.get(this);if(typeof C!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return C}}G.defineEventAttribute(K.prototype,"abort");function L(){let C=Object.create(K.prototype);return G.EventTarget.call(C),O.set(C,!1),C}function W(C){if(O.get(C)!==!1)return;O.set(C,!0),C.dispatchEvent({type:"abort"})}var O=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class z{constructor(){q.set(this,L())}get signal(){return D(this)}abort(){W(D(this))}}var q=new WeakMap;function D(C){let F=q.get(C);if(F==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${C===null?"null":typeof C}`);return F}if(Object.defineProperties(z.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(z.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});T.AbortController=z,T.AbortSignal=K,T.default=z,Y.exports=z,Y.exports.AbortController=Y.exports.default=z,Y.exports.AbortSignal=K}),qU=u0((T,Y)=>{var G=(FU(),h0(KU)),{format:K,inspect:L}=rI(),{codes:{ERR_INVALID_ARG_TYPE:W}}=zU(),{kResistStopPropagation:O,AggregateError:z,SymbolDispose:q}=o0(),D=globalThis.AbortSignal||AE().AbortSignal,C=globalThis.AbortController||AE().AbortController,F=Object.getPrototypeOf(async function(){}).constructor,R=globalThis.Blob||G.Blob,M=typeof R<"u"?function(_){return _ instanceof R}:function(_){return!1},P=(_,N)=>{if(_!==void 0&&(_===null||typeof _!=="object"||!("aborted"in _)))throw new W(N,"AbortSignal",_)},k=(_,N)=>{if(typeof _!=="function")throw new W(N,"Function",_)};Y.exports={AggregateError:z,kEmptyObject:Object.freeze({}),once(_){let N=!1;return function(...v){if(N)return;N=!0,_.apply(this,v)}},createDeferredPromise:function(){let _,N;return{promise:new Promise((v,B)=>{_=v,N=B}),resolve:_,reject:N}},promisify(_){return new Promise((N,v)=>{_((B,...g)=>{if(B)return v(B);return N(...g)})})},debuglog(){return function(){}},format:K,inspect:L,types:{isAsyncFunction(_){return _ instanceof F},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:M,deprecate(_,N){return _},addAbortListener:(VE(),h0(GE)).addAbortListener||function(_,N){if(_===void 0)throw new W("signal","AbortSignal",_);P(_,"signal"),k(N,"listener");let v;if(_.aborted)queueMicrotask(()=>N());else _.addEventListener("abort",N,{__proto__:null,once:!0,[O]:!0}),v=()=>{_.removeEventListener("abort",N)};return{__proto__:null,[q](){var B;(B=v)===null||B===void 0||B()}}},AbortSignalAny:D.any||function(_){if(_.length===1)return _[0];let N=new C,v=()=>N.abort();return _.forEach((B)=>{P(B,"signals"),B.addEventListener("abort",v,{once:!0})}),N.signal.addEventListener("abort",()=>{_.forEach((B)=>B.removeEventListener("abort",v))},{once:!0}),N.signal}},Y.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),LE=u0((T,Y)=>{var{ArrayIsArray:G,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:L,ArrayPrototypeMap:W,NumberIsInteger:O,NumberIsNaN:z,NumberMAX_SAFE_INTEGER:q,NumberMIN_SAFE_INTEGER:D,NumberParseInt:C,ObjectPrototypeHasOwnProperty:F,RegExpPrototypeExec:R,String:M,StringPrototypeToUpperCase:P,StringPrototypeTrim:k}=o0(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:N,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:B,ERR_OUT_OF_RANGE:g,ERR_UNKNOWN_SIGNAL:y}}=zU(),{normalizeEncoding:l}=qU(),{isAsyncFunction:Y0,isArrayBufferView:O0}=qU().types,Z0={};function u(c){return c===(c|0)}function i(c){return c===c>>>0}var U=/^[0-7]+$/,I="must be a 32-bit unsigned integer or an octal string";function Q(c,o,x0){if(typeof c>"u")c=x0;if(typeof c==="string"){if(R(U,c)===null)throw new B(o,c,I);c=C(c,8)}return A(c,o),c}var X=_((c,o,x0=D,s=q)=>{if(typeof c!=="number")throw new v(o,"number",c);if(!O(c))throw new g(o,"an integer",c);if(cs)throw new g(o,`>= ${x0} && <= ${s}`,c)}),Z=_((c,o,x0=-2147483648,s=2147483647)=>{if(typeof c!=="number")throw new v(o,"number",c);if(!O(c))throw new g(o,"an integer",c);if(cs)throw new g(o,`>= ${x0} && <= ${s}`,c)}),A=_((c,o,x0=!1)=>{if(typeof c!=="number")throw new v(o,"number",c);if(!O(c))throw new g(o,"an integer",c);let s=x0?1:0,X0=4294967295;if(cX0)throw new g(o,`>= ${s} && <= ${X0}`,c)});function $(c,o){if(typeof c!=="string")throw new v(o,"string",c)}function J(c,o,x0=void 0,s){if(typeof c!=="number")throw new v(o,"number",c);if(x0!=null&&cs||(x0!=null||s!=null)&&z(c))throw new g(o,`${x0!=null?`>= ${x0}`:""}${x0!=null&&s!=null?" && ":""}${s!=null?`<= ${s}`:""}`,c)}var E=_((c,o,x0)=>{if(!K(x0,c)){let s="must be one of: "+L(W(x0,(X0)=>typeof X0==="string"?`'${X0}'`:M(X0)),", ");throw new B(o,c,s)}});function V(c,o){if(typeof c!=="boolean")throw new v(o,"boolean",c)}function S(c,o,x0){return c==null||!F(c,o)?x0:c[o]}var H=_((c,o,x0=null)=>{let s=S(x0,"allowArray",!1),X0=S(x0,"allowFunction",!1);if(!S(x0,"nullable",!1)&&c===null||!s&&G(c)||typeof c!=="object"&&(!X0||typeof c!=="function"))throw new v(o,"Object",c)}),j=_((c,o)=>{if(c!=null&&typeof c!=="object"&&typeof c!=="function")throw new v(o,"a dictionary",c)}),w=_((c,o,x0=0)=>{if(!G(c))throw new v(o,"Array",c);if(c.length{if(!O0(c))throw new v(o,["Buffer","TypedArray","DataView"],c)});function I0(c,o){let x0=l(o),s=c.length;if(x0==="hex"&&s%2!==0)throw new B("encoding",o,`is invalid for data of length ${s}`)}function m(c,o="Port",x0=!0){if(typeof c!=="number"&&typeof c!=="string"||typeof c==="string"&&k(c).length===0||+c!==+c>>>0||c>65535||c===0&&!x0)throw new N(o,c,x0);return c|0}var U0=_((c,o)=>{if(c!==void 0&&(c===null||typeof c!=="object"||!("aborted"in c)))throw new v(o,"AbortSignal",c)}),g0=_((c,o)=>{if(typeof c!=="function")throw new v(o,"Function",c)}),f=_((c,o)=>{if(typeof c!=="function"||Y0(c))throw new v(o,"Function",c)}),h=_((c,o)=>{if(c!==void 0)throw new v(o,"undefined",c)});function T0(c,o,x0){if(!K(x0,c))throw new v(o,`('${L(x0,"|")}')`,c)}var r=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function e(c,o){if(typeof c>"u"||!R(r,c))throw new B(o,c,'must be an array or string of format "; rel=preload; as=style"')}function C0(c){if(typeof c==="string")return e(c,"hints"),c;else if(G(c)){let o=c.length,x0="";if(o===0)return x0;for(let s=0;s; rel=preload; as=style"')}Y.exports={isInt32:u,isUint32:i,parseFileMode:Q,validateArray:w,validateStringArray:p,validateBooleanArray:n,validateAbortSignalArray:G0,validateBoolean:V,validateBuffer:d,validateDictionary:j,validateEncoding:I0,validateFunction:g0,validateInt32:Z,validateInteger:X,validateNumber:J,validateObject:H,validateOneOf:E,validatePlainFunction:f,validatePort:m,validateSignalName:t,validateString:$,validateUint32:A,validateUndefined:h,validateUnion:T0,validateAbortSignal:U0,validateLinkHeaderValue:C0}}),rU=u0((T,Y)=>{Y.exports=globalThis.process}),fU=u0((T,Y)=>{var{SymbolAsyncIterator:G,SymbolIterator:K,SymbolFor:L}=o0(),W=L("nodejs.stream.destroyed"),O=L("nodejs.stream.errored"),z=L("nodejs.stream.readable"),q=L("nodejs.stream.writable"),D=L("nodejs.stream.disturbed"),C=L("nodejs.webstream.isClosedPromise"),F=L("nodejs.webstream.controllerErrorFunction");function R(S,H=!1){var j;return!!(S&&typeof S.pipe==="function"&&typeof S.on==="function"&&(!H||typeof S.pause==="function"&&typeof S.resume==="function")&&(!S._writableState||((j=S._readableState)===null||j===void 0?void 0:j.readable)!==!1)&&(!S._writableState||S._readableState))}function M(S){var H;return!!(S&&typeof S.write==="function"&&typeof S.on==="function"&&(!S._readableState||((H=S._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function P(S){return!!(S&&typeof S.pipe==="function"&&S._readableState&&typeof S.on==="function"&&typeof S.write==="function")}function k(S){return S&&(S._readableState||S._writableState||typeof S.write==="function"&&typeof S.on==="function"||typeof S.pipe==="function"&&typeof S.on==="function")}function _(S){return!!(S&&!k(S)&&typeof S.pipeThrough==="function"&&typeof S.getReader==="function"&&typeof S.cancel==="function")}function N(S){return!!(S&&!k(S)&&typeof S.getWriter==="function"&&typeof S.abort==="function")}function v(S){return!!(S&&!k(S)&&typeof S.readable==="object"&&typeof S.writable==="object")}function B(S){return _(S)||N(S)||v(S)}function g(S,H){if(S==null)return!1;if(H===!0)return typeof S[G]==="function";if(H===!1)return typeof S[K]==="function";return typeof S[G]==="function"||typeof S[K]==="function"}function y(S){if(!k(S))return null;let{_writableState:H,_readableState:j}=S,w=H||j;return!!(S.destroyed||S[W]||w!==null&&w!==void 0&&w.destroyed)}function l(S){if(!M(S))return null;if(S.writableEnded===!0)return!0;let H=S._writableState;if(H!==null&&H!==void 0&&H.errored)return!1;if(typeof(H===null||H===void 0?void 0:H.ended)!=="boolean")return null;return H.ended}function Y0(S,H){if(!M(S))return null;if(S.writableFinished===!0)return!0;let j=S._writableState;if(j!==null&&j!==void 0&&j.errored)return!1;if(typeof(j===null||j===void 0?void 0:j.finished)!=="boolean")return null;return!!(j.finished||H===!1&&j.ended===!0&&j.length===0)}function O0(S){if(!R(S))return null;if(S.readableEnded===!0)return!0;let H=S._readableState;if(!H||H.errored)return!1;if(typeof(H===null||H===void 0?void 0:H.ended)!=="boolean")return null;return H.ended}function Z0(S,H){if(!R(S))return null;let j=S._readableState;if(j!==null&&j!==void 0&&j.errored)return!1;if(typeof(j===null||j===void 0?void 0:j.endEmitted)!=="boolean")return null;return!!(j.endEmitted||H===!1&&j.ended===!0&&j.length===0)}function u(S){if(S&&S[z]!=null)return S[z];if(typeof(S===null||S===void 0?void 0:S.readable)!=="boolean")return null;if(y(S))return!1;return R(S)&&S.readable&&!Z0(S)}function i(S){if(S&&S[q]!=null)return S[q];if(typeof(S===null||S===void 0?void 0:S.writable)!=="boolean")return null;if(y(S))return!1;return M(S)&&S.writable&&!l(S)}function U(S,H){if(!k(S))return null;if(y(S))return!0;if((H===null||H===void 0?void 0:H.readable)!==!1&&u(S))return!1;if((H===null||H===void 0?void 0:H.writable)!==!1&&i(S))return!1;return!0}function I(S){var H,j;if(!k(S))return null;if(S.writableErrored)return S.writableErrored;return(H=(j=S._writableState)===null||j===void 0?void 0:j.errored)!==null&&H!==void 0?H:null}function Q(S){var H,j;if(!k(S))return null;if(S.readableErrored)return S.readableErrored;return(H=(j=S._readableState)===null||j===void 0?void 0:j.errored)!==null&&H!==void 0?H:null}function X(S){if(!k(S))return null;if(typeof S.closed==="boolean")return S.closed;let{_writableState:H,_readableState:j}=S;if(typeof(H===null||H===void 0?void 0:H.closed)==="boolean"||typeof(j===null||j===void 0?void 0:j.closed)==="boolean")return(H===null||H===void 0?void 0:H.closed)||(j===null||j===void 0?void 0:j.closed);if(typeof S._closed==="boolean"&&Z(S))return S._closed;return null}function Z(S){return typeof S._closed==="boolean"&&typeof S._defaultKeepAlive==="boolean"&&typeof S._removedConnection==="boolean"&&typeof S._removedContLen==="boolean"}function A(S){return typeof S._sent100==="boolean"&&Z(S)}function $(S){var H;return typeof S._consuming==="boolean"&&typeof S._dumped==="boolean"&&((H=S.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function J(S){if(!k(S))return null;let{_writableState:H,_readableState:j}=S,w=H||j;return!w&&A(S)||!!(w&&w.autoDestroy&&w.emitClose&&w.closed===!1)}function E(S){var H;return!!(S&&((H=S[D])!==null&&H!==void 0?H:S.readableDidRead||S.readableAborted))}function V(S){var H,j,w,p,n,G0,t,d,I0,m;return!!(S&&((H=(j=(w=(p=(n=(G0=S[O])!==null&&G0!==void 0?G0:S.readableErrored)!==null&&n!==void 0?n:S.writableErrored)!==null&&p!==void 0?p:(t=S._readableState)===null||t===void 0?void 0:t.errorEmitted)!==null&&w!==void 0?w:(d=S._writableState)===null||d===void 0?void 0:d.errorEmitted)!==null&&j!==void 0?j:(I0=S._readableState)===null||I0===void 0?void 0:I0.errored)!==null&&H!==void 0?H:(m=S._writableState)===null||m===void 0?void 0:m.errored))}Y.exports={isDestroyed:y,kIsDestroyed:W,isDisturbed:E,kIsDisturbed:D,isErrored:V,kIsErrored:O,isReadable:u,kIsReadable:z,kIsClosedPromise:C,kControllerErrorFunction:F,kIsWritable:q,isClosed:X,isDuplexNodeStream:P,isFinished:U,isIterable:g,isReadableNodeStream:R,isReadableStream:_,isReadableEnded:O0,isReadableFinished:Z0,isReadableErrored:Q,isNodeStream:k,isWebStream:B,isWritable:i,isWritableNodeStream:M,isWritableStream:N,isWritableEnded:l,isWritableFinished:Y0,isWritableErrored:I,isServerRequest:$,isServerResponse:A,willEmitClose:J,isTransformStream:v}}),bU=u0((T,Y)=>{var G=rU(),{AbortError:K,codes:L}=zU(),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_PREMATURE_CLOSE:O}=L,{kEmptyObject:z,once:q}=qU(),{validateAbortSignal:D,validateFunction:C,validateObject:F,validateBoolean:R}=LE(),{Promise:M,PromisePrototypeThen:P,SymbolDispose:k}=o0(),{isClosed:_,isReadable:N,isReadableNodeStream:v,isReadableStream:B,isReadableFinished:g,isReadableErrored:y,isWritable:l,isWritableNodeStream:Y0,isWritableStream:O0,isWritableFinished:Z0,isWritableErrored:u,isNodeStream:i,willEmitClose:U,kIsClosedPromise:I}=fU(),Q;function X(E){return E.setHeader&&typeof E.abort==="function"}var Z=()=>{};function A(E,V,S){var H,j;if(arguments.length===2)S=V,V=z;else if(V==null)V=z;else F(V,"options");if(C(S,"callback"),D(V.signal,"options.signal"),S=q(S),B(E)||O0(E))return $(E,V,S);if(!i(E))throw new W("stream",["ReadableStream","WritableStream","Stream"],E);let w=(H=V.readable)!==null&&H!==void 0?H:v(E),p=(j=V.writable)!==null&&j!==void 0?j:Y0(E),n=E._writableState,G0=E._readableState,t=()=>{if(!E.writable)m()},d=U(E)&&v(E)===w&&Y0(E)===p,I0=Z0(E,!1),m=()=>{if(I0=!0,E.destroyed)d=!1;if(d&&(!E.readable||w))return;if(!w||U0)S.call(E)},U0=g(E,!1),g0=()=>{if(U0=!0,E.destroyed)d=!1;if(d&&(!E.writable||p))return;if(!p||I0)S.call(E)},f=(c)=>{S.call(E,c)},h=_(E),T0=()=>{h=!0;let c=u(E)||y(E);if(c&&typeof c!=="boolean")return S.call(E,c);if(w&&!U0&&v(E,!0)){if(!g(E,!1))return S.call(E,new O)}if(p&&!I0){if(!Z0(E,!1))return S.call(E,new O)}S.call(E)},r=()=>{h=!0;let c=u(E)||y(E);if(c&&typeof c!=="boolean")return S.call(E,c);S.call(E)},e=()=>{E.req.on("finish",m)};if(X(E)){if(E.on("complete",m),!d)E.on("abort",T0);if(E.req)e();else E.on("request",e)}else if(p&&!n)E.on("end",t),E.on("close",t);if(!d&&typeof E.aborted==="boolean")E.on("aborted",T0);if(E.on("end",g0),E.on("finish",m),V.error!==!1)E.on("error",f);if(E.on("close",T0),h)G.nextTick(T0);else if(n!==null&&n!==void 0&&n.errorEmitted||G0!==null&&G0!==void 0&&G0.errorEmitted){if(!d)G.nextTick(r)}else if(!w&&(!d||N(E))&&(I0||l(E)===!1))G.nextTick(r);else if(!p&&(!d||l(E))&&(U0||N(E)===!1))G.nextTick(r);else if(G0&&E.req&&E.aborted)G.nextTick(r);let C0=()=>{if(S=Z,E.removeListener("aborted",T0),E.removeListener("complete",m),E.removeListener("abort",T0),E.removeListener("request",e),E.req)E.req.removeListener("finish",m);E.removeListener("end",t),E.removeListener("close",t),E.removeListener("finish",m),E.removeListener("end",g0),E.removeListener("error",f),E.removeListener("close",T0)};if(V.signal&&!h){let c=()=>{let o=S;C0(),o.call(E,new K(void 0,{cause:V.signal.reason}))};if(V.signal.aborted)G.nextTick(c);else{Q=Q||qU().addAbortListener;let o=Q(V.signal,c),x0=S;S=q((...s)=>{o[k](),x0.apply(E,s)})}}return C0}function $(E,V,S){let H=!1,j=Z;if(V.signal)if(j=()=>{H=!0,S.call(E,new K(void 0,{cause:V.signal.reason}))},V.signal.aborted)G.nextTick(j);else{Q=Q||qU().addAbortListener;let p=Q(V.signal,j),n=S;S=q((...G0)=>{p[k](),n.apply(E,G0)})}let w=(...p)=>{if(!H)G.nextTick(()=>S.apply(E,p))};return P(E[I].promise,w,w),Z}function J(E,V){var S;let H=!1;if(V===null)V=z;if((S=V)!==null&&S!==void 0&&S.cleanup)R(V.cleanup,"cleanup"),H=V.cleanup;return new M((j,w)=>{let p=A(E,V,(n)=>{if(H)p();if(n)w(n);else j()})})}Y.exports=A,Y.exports.finished=J}),IE=u0((T,Y)=>{var G=rU(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:L},AbortError:W}=zU(),{Symbol:O}=o0(),{kIsDestroyed:z,isDestroyed:q,isFinished:D,isServerRequest:C}=fU(),F=O("kDestroy"),R=O("kConstruct");function M(U,I,Q){if(U){if(U.stack,I&&!I.errored)I.errored=U;if(Q&&!Q.errored)Q.errored=U}}function P(U,I){let Q=this._readableState,X=this._writableState,Z=X||Q;if(X!==null&&X!==void 0&&X.destroyed||Q!==null&&Q!==void 0&&Q.destroyed){if(typeof I==="function")I();return this}if(M(U,X,Q),X)X.destroyed=!0;if(Q)Q.destroyed=!0;if(!Z.constructed)this.once(F,function(A){k(this,K(A,U),I)});else k(this,U,I);return this}function k(U,I,Q){let X=!1;function Z(A){if(X)return;X=!0;let{_readableState:$,_writableState:J}=U;if(M(A,J,$),J)J.closed=!0;if($)$.closed=!0;if(typeof Q==="function")Q(A);if(A)G.nextTick(_,U,A);else G.nextTick(N,U)}try{U._destroy(I||null,Z)}catch(A){Z(A)}}function _(U,I){v(U,I),N(U)}function N(U){let{_readableState:I,_writableState:Q}=U;if(Q)Q.closeEmitted=!0;if(I)I.closeEmitted=!0;if(Q!==null&&Q!==void 0&&Q.emitClose||I!==null&&I!==void 0&&I.emitClose)U.emit("close")}function v(U,I){let{_readableState:Q,_writableState:X}=U;if(X!==null&&X!==void 0&&X.errorEmitted||Q!==null&&Q!==void 0&&Q.errorEmitted)return;if(X)X.errorEmitted=!0;if(Q)Q.errorEmitted=!0;U.emit("error",I)}function B(){let U=this._readableState,I=this._writableState;if(U)U.constructed=!0,U.closed=!1,U.closeEmitted=!1,U.destroyed=!1,U.errored=null,U.errorEmitted=!1,U.reading=!1,U.ended=U.readable===!1,U.endEmitted=U.readable===!1;if(I)I.constructed=!0,I.destroyed=!1,I.closed=!1,I.closeEmitted=!1,I.errored=null,I.errorEmitted=!1,I.finalCalled=!1,I.prefinished=!1,I.ended=I.writable===!1,I.ending=I.writable===!1,I.finished=I.writable===!1}function g(U,I,Q){let{_readableState:X,_writableState:Z}=U;if(Z!==null&&Z!==void 0&&Z.destroyed||X!==null&&X!==void 0&&X.destroyed)return this;if(X!==null&&X!==void 0&&X.autoDestroy||Z!==null&&Z!==void 0&&Z.autoDestroy)U.destroy(I);else if(I){if(I.stack,Z&&!Z.errored)Z.errored=I;if(X&&!X.errored)X.errored=I;if(Q)G.nextTick(v,U,I);else v(U,I)}}function y(U,I){if(typeof U._construct!=="function")return;let{_readableState:Q,_writableState:X}=U;if(Q)Q.constructed=!1;if(X)X.constructed=!1;if(U.once(R,I),U.listenerCount(R)>1)return;G.nextTick(l,U)}function l(U){let I=!1;function Q(X){if(I){g(U,X!==null&&X!==void 0?X:new L);return}I=!0;let{_readableState:Z,_writableState:A}=U,$=A||Z;if(Z)Z.constructed=!0;if(A)A.constructed=!0;if($.destroyed)U.emit(F,X);else if(X)g(U,X,!0);else G.nextTick(Y0,U)}try{U._construct((X)=>{G.nextTick(Q,X)})}catch(X){G.nextTick(Q,X)}}function Y0(U){U.emit(R)}function O0(U){return(U===null||U===void 0?void 0:U.setHeader)&&typeof U.abort==="function"}function Z0(U){U.emit("close")}function u(U,I){U.emit("error",I),G.nextTick(Z0,U)}function i(U,I){if(!U||q(U))return;if(!I&&!D(U))I=new W;if(C(U))U.socket=null,U.destroy(I);else if(O0(U))U.abort();else if(O0(U.req))U.req.abort();else if(typeof U.destroy==="function")U.destroy(I);else if(typeof U.close==="function")U.close();else if(I)G.nextTick(u,U,I);else G.nextTick(Z0,U);if(!U.destroyed)U[z]=!0}Y.exports={construct:y,destroyer:i,destroy:P,undestroy:B,errorOrDestroy:g}}),DX=u0((T,Y)=>{var{ArrayIsArray:G,ObjectSetPrototypeOf:K}=o0(),{EventEmitter:L}=(VE(),h0(GE));function W(z){L.call(this,z)}K(W.prototype,L.prototype),K(W,L),W.prototype.pipe=function(z,q){let D=this;function C(N){if(z.writable&&z.write(N)===!1&&D.pause)D.pause()}D.on("data",C);function F(){if(D.readable&&D.resume)D.resume()}if(z.on("drain",F),!z._isStdio&&(!q||q.end!==!1))D.on("end",M),D.on("close",P);let R=!1;function M(){if(R)return;R=!0,z.end()}function P(){if(R)return;if(R=!0,typeof z.destroy==="function")z.destroy()}function k(N){if(_(),L.listenerCount(this,"error")===0)this.emit("error",N)}O(D,"error",k),O(z,"error",k);function _(){D.removeListener("data",C),z.removeListener("drain",F),D.removeListener("end",M),D.removeListener("close",P),D.removeListener("error",k),z.removeListener("error",k),D.removeListener("end",_),D.removeListener("close",_),z.removeListener("close",_)}return D.on("end",_),D.on("close",_),z.on("close",_),z.emit("pipe",D),z};function O(z,q,D){if(typeof z.prependListener==="function")return z.prependListener(q,D);if(!z._events||!z._events[q])z.on(q,D);else if(G(z._events[q]))z._events[q].unshift(D);else z._events[q]=[D,z._events[q]]}Y.exports={Stream:W,prependListener:O}}),wE=u0((T,Y)=>{var{SymbolDispose:G}=o0(),{AbortError:K,codes:L}=zU(),{isNodeStream:W,isWebStream:O,kControllerErrorFunction:z}=fU(),q=bU(),{ERR_INVALID_ARG_TYPE:D}=L,C,F=(R,M)=>{if(typeof R!=="object"||!("aborted"in R))throw new D(M,"AbortSignal",R)};Y.exports.addAbortSignal=function(R,M){if(F(R,"signal"),!W(M)&&!O(M))throw new D("stream",["ReadableStream","WritableStream","Stream"],M);return Y.exports.addAbortSignalNoValidate(R,M)},Y.exports.addAbortSignalNoValidate=function(R,M){if(typeof R!=="object"||!("aborted"in R))return M;let P=W(M)?()=>{M.destroy(new K(void 0,{cause:R.reason}))}:()=>{M[z](new K(void 0,{cause:R.reason}))};if(R.aborted)P();else{C=C||qU().addAbortListener;let k=C(R,P);q(M,k[G])}return M}}),tZ=u0((T,Y)=>{var{StringPrototypeSlice:G,SymbolIterator:K,TypedArrayPrototypeSet:L,Uint8Array:W}=o0(),{Buffer:O}=(FU(),h0(KU)),{inspect:z}=qU();Y.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(q){let D={data:q,next:null};if(this.length>0)this.tail.next=D;else this.head=D;this.tail=D,++this.length}unshift(q){let D={data:q,next:this.head};if(this.length===0)this.tail=D;this.head=D,++this.length}shift(){if(this.length===0)return;let q=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,q}clear(){this.head=this.tail=null,this.length=0}join(q){if(this.length===0)return"";let D=this.head,C=""+D.data;while((D=D.next)!==null)C+=q+D.data;return C}concat(q){if(this.length===0)return O.alloc(0);let D=O.allocUnsafe(q>>>0),C=this.head,F=0;while(C)L(D,C.data,F),F+=C.data.length,C=C.next;return D}consume(q,D){let C=this.head.data;if(qR.length)D+=R,q-=R.length;else{if(q===R.length)if(D+=R,++F,C.next)this.head=C.next;else this.head=this.tail=null;else D+=G(R,0,q),this.head=C,C.data=G(R,q);break}++F}while((C=C.next)!==null);return this.length-=F,D}_getBuffer(q){let D=O.allocUnsafe(q),C=q,F=this.head,R=0;do{let M=F.data;if(q>M.length)L(D,M,C-q),q-=M.length;else{if(q===M.length)if(L(D,M,C-q),++R,F.next)this.head=F.next;else this.head=this.tail=null;else L(D,new W(M.buffer,M.byteOffset,q),C-q),this.head=F,F.data=M.slice(q);break}++R}while((F=F.next)!==null);return this.length-=R,D}[Symbol.for("nodejs.util.inspect.custom")](q,D){return z(this,{...D,depth:0,customInspect:!1})}}}),yE=u0((T,Y)=>{var{MathFloor:G,NumberIsInteger:K}=o0(),{validateInteger:L}=LE(),{ERR_INVALID_ARG_VALUE:W}=zU().codes,O=16384,z=16;function q(R,M,P){return R.highWaterMark!=null?R.highWaterMark:M?R[P]:null}function D(R){return R?z:O}function C(R,M){if(L(M,"value",0),R)z=M;else O=M}function F(R,M,P,k){let _=q(M,k,P);if(_!=null){if(!K(_)||_<0){let N=k?`options.${P}`:"options.highWaterMark";throw new W(N,_)}return G(_)}return D(R.objectMode)}Y.exports={getHighWaterMark:F,getDefaultHighWaterMark:D,setDefaultHighWaterMark:C}}),aZ=u0((T,Y)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var G=(FU(),h0(KU)),K=G.Buffer;function L(O,z){for(var q in O)z[q]=O[q]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)Y.exports=G;else L(G,T),T.Buffer=W;function W(O,z,q){return K(O,z,q)}W.prototype=Object.create(K.prototype),L(K,W),W.from=function(O,z,q){if(typeof O==="number")throw TypeError("Argument must not be a number");return K(O,z,q)},W.alloc=function(O,z,q){if(typeof O!=="number")throw TypeError("Argument must be a number");var D=K(O);if(z!==void 0)if(typeof q==="string")D.fill(z,q);else D.fill(z);else D.fill(0);return D},W.allocUnsafe=function(O){if(typeof O!=="number")throw TypeError("Argument must be a number");return K(O)},W.allocUnsafeSlow=function(O){if(typeof O!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(O)}}),eZ=u0((T)=>{var Y=aZ().Buffer,G=Y.isEncoding||function(v){switch(v=""+v,v&&v.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(v){if(!v)return"utf8";var B;while(!0)switch(v){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return v;default:if(B)return;v=(""+v).toLowerCase(),B=!0}}function L(v){var B=K(v);if(typeof B!=="string"&&(Y.isEncoding===G||!G(v)))throw Error("Unknown encoding: "+v);return B||v}T.StringDecoder=W;function W(v){this.encoding=L(v);var B;switch(this.encoding){case"utf16le":this.text=R,this.end=M,B=4;break;case"utf8":this.fillLast=D,B=4;break;case"base64":this.text=P,this.end=k,B=3;break;default:this.write=_,this.end=N;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Y.allocUnsafe(B)}W.prototype.write=function(v){if(v.length===0)return"";var B,g;if(this.lastNeed){if(B=this.fillLast(v),B===void 0)return"";g=this.lastNeed,this.lastNeed=0}else g=0;if(g>5===6)return 2;else if(v>>4===14)return 3;else if(v>>3===30)return 4;return v>>6===2?-1:-2}function z(v,B,g){var y=B.length-1;if(y=0){if(l>0)v.lastNeed=l-1;return l}if(--y=0){if(l>0)v.lastNeed=l-2;return l}if(--y=0){if(l>0)if(l===2)l=0;else v.lastNeed=l-3;return l}return 0}function q(v,B,g){if((B[0]&192)!==128)return v.lastNeed=0,"�";if(v.lastNeed>1&&B.length>1){if((B[1]&192)!==128)return v.lastNeed=1,"�";if(v.lastNeed>2&&B.length>2){if((B[2]&192)!==128)return v.lastNeed=2,"�"}}}function D(v){var B=this.lastTotal-this.lastNeed,g=q(this,v,B);if(g!==void 0)return g;if(this.lastNeed<=v.length)return v.copy(this.lastChar,B,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,B,0,v.length),this.lastNeed-=v.length}function C(v,B){var g=z(this,v,B);if(!this.lastNeed)return v.toString("utf8",B);this.lastTotal=g;var y=v.length-(g-this.lastNeed);return v.copy(this.lastChar,0,y),v.toString("utf8",B,y)}function F(v){var B=v&&v.length?this.write(v):"";if(this.lastNeed)return B+"�";return B}function R(v,B){if((v.length-B)%2===0){var g=v.toString("utf16le",B);if(g){var y=g.charCodeAt(g.length-1);if(y>=55296&&y<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1],g.slice(0,-1)}return g}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",B,v.length-1)}function M(v){var B=v&&v.length?this.write(v):"";if(this.lastNeed){var g=this.lastTotal-this.lastNeed;return B+this.lastChar.toString("utf16le",0,g)}return B}function P(v,B){var g=(v.length-B)%3;if(g===0)return v.toString("base64",B);if(this.lastNeed=3-g,this.lastTotal=3,g===1)this.lastChar[0]=v[v.length-1];else this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1];return v.toString("base64",B,v.length-g)}function k(v){var B=v&&v.length?this.write(v):"";if(this.lastNeed)return B+this.lastChar.toString("base64",0,3-this.lastNeed);return B}function _(v){return v.toString(this.encoding)}function N(v){return v&&v.length?this.write(v):""}}),tI=u0((T,Y)=>{var G=rU(),{PromisePrototypeThen:K,SymbolAsyncIterator:L,SymbolIterator:W}=o0(),{Buffer:O}=(FU(),h0(KU)),{ERR_INVALID_ARG_TYPE:z,ERR_STREAM_NULL_VALUES:q}=zU().codes;function D(C,F,R){let M;if(typeof F==="string"||F instanceof O)return new C({objectMode:!0,...R,read(){this.push(F),this.push(null)}});let P;if(F&&F[L])P=!0,M=F[L]();else if(F&&F[W])P=!1,M=F[W]();else throw new z("iterable",["Iterable"],F);let k=new C({objectMode:!0,highWaterMark:1,...R}),_=!1;k._read=function(){if(!_)_=!0,v()},k._destroy=function(B,g){K(N(B),()=>G.nextTick(g,B),(y)=>G.nextTick(g,y||B))};async function N(B){let g=B!==void 0&&B!==null,y=typeof M.throw==="function";if(g&&y){let{value:l,done:Y0}=await M.throw(B);if(await l,Y0)return}if(typeof M.return==="function"){let{value:l}=await M.return();await l}}async function v(){for(;;){try{let{value:B,done:g}=P?await M.next():M.next();if(g)k.push(null);else{let y=B&&typeof B.then==="function"?await B:B;if(y===null)throw _=!1,new q;else if(k.push(y))continue;else _=!1}}catch(B){k.destroy(B)}break}}return k}Y.exports=D}),fE=u0((T,Y)=>{var G=rU(),{ArrayPrototypeIndexOf:K,NumberIsInteger:L,NumberIsNaN:W,NumberParseInt:O,ObjectDefineProperties:z,ObjectKeys:q,ObjectSetPrototypeOf:D,Promise:C,SafeSet:F,SymbolAsyncDispose:R,SymbolAsyncIterator:M,Symbol:P}=o0();Y.exports=s,s.ReadableState=x0;var{EventEmitter:k}=(VE(),h0(GE)),{Stream:_,prependListener:N}=DX(),{Buffer:v}=(FU(),h0(KU)),{addAbortSignal:B}=wE(),g=bU(),y=qU().debuglog("stream",(x)=>{y=x}),l=tZ(),Y0=IE(),{getHighWaterMark:O0,getDefaultHighWaterMark:Z0}=yE(),{aggregateTwoErrors:u,codes:{ERR_INVALID_ARG_TYPE:i,ERR_METHOD_NOT_IMPLEMENTED:U,ERR_OUT_OF_RANGE:I,ERR_STREAM_PUSH_AFTER_EOF:Q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:X},AbortError:Z}=zU(),{validateObject:A}=LE(),$=P("kPaused"),{StringDecoder:J}=eZ(),E=tI();D(s.prototype,_.prototype),D(s,_);var V=()=>{},{errorOrDestroy:S}=Y0,H=1,j=2,w=4,p=8,n=16,G0=32,t=64,d=128,I0=256,m=512,U0=1024,g0=2048,f=4096,h=8192,T0=16384,r=32768,e=65536,C0=131072,c=262144;function o(x){return{enumerable:!1,get(){return(this.state&x)!==0},set(b){if(b)this.state|=x;else this.state&=~x}}}z(x0.prototype,{objectMode:o(H),ended:o(j),endEmitted:o(w),reading:o(p),constructed:o(n),sync:o(G0),needReadable:o(t),emittedReadable:o(d),readableListening:o(I0),resumeScheduled:o(m),errorEmitted:o(U0),emitClose:o(g0),autoDestroy:o(f),destroyed:o(h),closed:o(T0),closeEmitted:o(r),multiAwaitDrain:o(e),readingMore:o(C0),dataEmitted:o(c)});function x0(x,b,a){if(typeof a!=="boolean")a=b instanceof yU();if(this.state=g0|f|n|G0,x&&x.objectMode)this.state|=H;if(a&&x&&x.readableObjectMode)this.state|=H;if(this.highWaterMark=x?O0(this,x,"readableHighWaterMark",a):Z0(!1),this.buffer=new l,this.length=0,this.pipes=[],this.flowing=null,this[$]=null,x&&x.emitClose===!1)this.state&=~g0;if(x&&x.autoDestroy===!1)this.state&=~f;if(this.errored=null,this.defaultEncoding=x&&x.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,x&&x.encoding)this.decoder=new J(x.encoding),this.encoding=x.encoding}function s(x){if(!(this instanceof s))return new s(x);let b=this instanceof yU();if(this._readableState=new x0(x,this,b),x){if(typeof x.read==="function")this._read=x.read;if(typeof x.destroy==="function")this._destroy=x.destroy;if(typeof x.construct==="function")this._construct=x.construct;if(x.signal&&!b)B(x.signal,this)}_.call(this,x),Y0.construct(this,()=>{if(this._readableState.needReadable)H0(this,this._readableState)})}s.prototype.destroy=Y0.destroy,s.prototype._undestroy=Y0.undestroy,s.prototype._destroy=function(x,b){b(x)},s.prototype[k.captureRejectionSymbol]=function(x){this.destroy(x)},s.prototype[R]=function(){let x;if(!this.destroyed)x=this.readableEnded?null:new Z,this.destroy(x);return new C((b,a)=>g(this,(E0)=>E0&&E0!==x?a(E0):b(null)))},s.prototype.push=function(x,b){return X0(this,x,b,!1)},s.prototype.unshift=function(x,b){return X0(this,x,b,!0)};function X0(x,b,a,E0){y("readableAddChunk",b);let w0=x._readableState,A0;if((w0.state&H)===0){if(typeof b==="string"){if(a=a||w0.defaultEncoding,w0.encoding!==a)if(E0&&w0.encoding)b=v.from(b,a).toString(w0.encoding);else b=v.from(b,a),a=""}else if(b instanceof v)a="";else if(_._isUint8Array(b))b=_._uint8ArrayToBuffer(b),a="";else if(b!=null)A0=new i("chunk",["string","Buffer","Uint8Array"],b)}if(A0)S(x,A0);else if(b===null)w0.state&=~p,V0(x,w0);else if((w0.state&H)!==0||b&&b.length>0)if(E0)if((w0.state&w)!==0)S(x,new X);else if(w0.destroyed||w0.errored)return!1;else y0(x,w0,b,!0);else if(w0.ended)S(x,new Q);else if(w0.destroyed||w0.errored)return!1;else if(w0.state&=~p,w0.decoder&&!a)if(b=w0.decoder.write(b),w0.objectMode||b.length!==0)y0(x,w0,b,!1);else H0(x,w0);else y0(x,w0,b,!1);else if(!E0)w0.state&=~p,H0(x,w0);return!w0.ended&&(w0.length0){if((b.state&e)!==0)b.awaitDrainWriters.clear();else b.awaitDrainWriters=null;b.dataEmitted=!0,x.emit("data",a)}else{if(b.length+=b.objectMode?1:a.length,E0)b.buffer.unshift(a);else b.buffer.push(a);if((b.state&t)!==0)K0(x)}H0(x,b)}s.prototype.isPaused=function(){let x=this._readableState;return x[$]===!0||x.flowing===!1},s.prototype.setEncoding=function(x){let b=new J(x);this._readableState.decoder=b,this._readableState.encoding=this._readableState.decoder.encoding;let a=this._readableState.buffer,E0="";for(let w0 of a)E0+=b.write(w0);if(a.clear(),E0!=="")a.push(E0);return this._readableState.length=E0.length,this};var L0=1073741824;function $0(x){if(x>L0)throw new I("size","<= 1GiB",x);else x--,x|=x>>>1,x|=x>>>2,x|=x>>>4,x|=x>>>8,x|=x>>>16,x++;return x}function n0(x,b){if(x<=0||b.length===0&&b.ended)return 0;if((b.state&H)!==0)return 1;if(W(x)){if(b.flowing&&b.length)return b.buffer.first().length;return b.length}if(x<=b.length)return x;return b.ended?b.length:0}s.prototype.read=function(x){if(y("read",x),x===void 0)x=NaN;else if(!L(x))x=O(x,10);let b=this._readableState,a=x;if(x>b.highWaterMark)b.highWaterMark=$0(x);if(x!==0)b.state&=~d;if(x===0&&b.needReadable&&((b.highWaterMark!==0?b.length>=b.highWaterMark:b.length>0)||b.ended)){if(y("read: emitReadable",b.length,b.ended),b.length===0&&b.ended)AU(this);else K0(this);return null}if(x=n0(x,b),x===0&&b.ended){if(b.length===0)AU(this);return null}let E0=(b.state&t)!==0;if(y("need readable",E0),b.length===0||b.length-x0)w0=S0(x,b);else w0=null;if(w0===null)b.needReadable=b.length<=b.highWaterMark,x=0;else if(b.length-=x,b.multiAwaitDrain)b.awaitDrainWriters.clear();else b.awaitDrainWriters=null;if(b.length===0){if(!b.ended)b.needReadable=!0;if(a!==x&&b.ended)AU(this)}if(w0!==null&&!b.errorEmitted&&!b.closeEmitted)b.dataEmitted=!0,this.emit("data",w0);return w0};function V0(x,b){if(y("onEofChunk"),b.ended)return;if(b.decoder){let a=b.decoder.end();if(a&&a.length)b.buffer.push(a),b.length+=b.objectMode?1:a.length}if(b.ended=!0,b.sync)K0(x);else b.needReadable=!1,b.emittedReadable=!0,r0(x)}function K0(x){let b=x._readableState;if(y("emitReadable",b.needReadable,b.emittedReadable),b.needReadable=!1,!b.emittedReadable)y("emitReadable",b.flowing),b.emittedReadable=!0,G.nextTick(r0,x)}function r0(x){let b=x._readableState;if(y("emitReadable_",b.destroyed,b.length,b.ended),!b.destroyed&&!b.errored&&(b.length||b.ended))x.emit("readable"),b.emittedReadable=!1;b.needReadable=!b.flowing&&!b.ended&&b.length<=b.highWaterMark,z0(x)}function H0(x,b){if(!b.readingMore&&b.constructed)b.readingMore=!0,G.nextTick(W0,x,b)}function W0(x,b){while(!b.reading&&!b.ended&&(b.length1&&E0.pipes.includes(x))y("false write response, pause",E0.awaitDrainWriters.size),E0.awaitDrainWriters.add(x);a.pause()}if(!m0)m0=RU(a,x),x.on("drain",m0)}a.on("data",P0);function P0(d0){y("ondata");let b0=x.write(d0);if(y("dest.write",b0),b0===!1)HU()}function R0(d0){if(y("onerror",d0),f0(),x.removeListener("error",R0),x.listenerCount("error")===0){let b0=x._writableState||x._readableState;if(b0&&!b0.errorEmitted)S(x,d0);else x.emit("error",d0)}}N(x,"error",R0);function s0(){x.removeListener("finish",c0),f0()}x.once("close",s0);function c0(){y("onfinish"),x.removeListener("close",s0),f0()}x.once("finish",c0);function f0(){y("unpipe"),a.unpipe(x)}if(x.emit("pipe",a),x.writableNeedDrain===!0)HU();else if(!E0.flowing)y("pipe resume"),a.resume();return x};function RU(x,b){return function(){let a=x._readableState;if(a.awaitDrainWriters===b)y("pipeOnDrain",1),a.awaitDrainWriters=null;else if(a.multiAwaitDrain)y("pipeOnDrain",a.awaitDrainWriters.size),a.awaitDrainWriters.delete(b);if((!a.awaitDrainWriters||a.awaitDrainWriters.size===0)&&x.listenerCount("data"))x.resume()}}s.prototype.unpipe=function(x){let b=this._readableState,a={hasUnpiped:!1};if(b.pipes.length===0)return this;if(!x){let w0=b.pipes;b.pipes=[],this.pause();for(let A0=0;A00,E0.flowing!==!1)this.resume()}else if(x==="readable"){if(!E0.endEmitted&&!E0.readableListening){if(E0.readableListening=E0.needReadable=!0,E0.flowing=!1,E0.emittedReadable=!1,y("on readable",E0.length,E0.reading),E0.length)K0(this);else if(!E0.reading)G.nextTick(_0,this)}}return a},s.prototype.addListener=s.prototype.on,s.prototype.removeListener=function(x,b){let a=_.prototype.removeListener.call(this,x,b);if(x==="readable")G.nextTick(D0,this);return a},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(x){let b=_.prototype.removeAllListeners.apply(this,arguments);if(x==="readable"||x===void 0)G.nextTick(D0,this);return b};function D0(x){let b=x._readableState;if(b.readableListening=x.listenerCount("readable")>0,b.resumeScheduled&&b[$]===!1)b.flowing=!0;else if(x.listenerCount("data")>0)x.resume();else if(!b.readableListening)b.flowing=null}function _0(x){y("readable nexttick read 0"),x.read(0)}s.prototype.resume=function(){let x=this._readableState;if(!x.flowing)y("resume"),x.flowing=!x.readableListening,CU(this,x);return x[$]=!1,this};function CU(x,b){if(!b.resumeScheduled)b.resumeScheduled=!0,G.nextTick(k0,x,b)}function k0(x,b){if(y("resume",b.reading),!b.reading)x.read(0);if(b.resumeScheduled=!1,x.emit("resume"),z0(x),b.flowing&&!b.reading)x.read(0)}s.prototype.pause=function(){if(y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)y("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[$]=!0,this};function z0(x){let b=x._readableState;y("flow",b.flowing);while(b.flowing&&x.read()!==null);}s.prototype.wrap=function(x){let b=!1;x.on("data",(E0)=>{if(!this.push(E0)&&x.pause)b=!0,x.pause()}),x.on("end",()=>{this.push(null)}),x.on("error",(E0)=>{S(this,E0)}),x.on("close",()=>{this.destroy()}),x.on("destroy",()=>{this.destroy()}),this._read=()=>{if(b&&x.resume)b=!1,x.resume()};let a=q(x);for(let E0=1;E0{w0=F0?u(w0,F0):null,a(),a=V});try{while(!0){let F0=x.destroyed?null:x.read();if(F0!==null)yield F0;else if(w0)throw w0;else if(w0===null)return;else await new C(E0)}}catch(F0){throw w0=u(w0,F0),w0}finally{if((w0||(b===null||b===void 0?void 0:b.destroyOnReturn)!==!1)&&(w0===void 0||x._readableState.autoDestroy))Y0.destroyer(x,null);else x.off("readable",E0),A0()}}z(s.prototype,{readable:{__proto__:null,get(){let x=this._readableState;return!!x&&x.readable!==!1&&!x.destroyed&&!x.errorEmitted&&!x.endEmitted},set(x){if(this._readableState)this._readableState.readable=!!x}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){if(this._readableState)this._readableState.flowing=x}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(x){if(!this._readableState)return;this._readableState.destroyed=x}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),z(x0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[$]!==!1},set(x){this[$]=!!x}}}),s._fromList=S0;function S0(x,b){if(b.length===0)return null;let a;if(b.objectMode)a=b.buffer.shift();else if(!x||x>=b.length){if(b.decoder)a=b.buffer.join("");else if(b.buffer.length===1)a=b.buffer.first();else a=b.buffer.concat(b.length);b.buffer.clear()}else a=b.buffer.consume(x,b.decoder);return a}function AU(x){let b=x._readableState;if(y("endReadable",b.endEmitted),!b.endEmitted)b.ended=!0,G.nextTick(j0,b,x)}function j0(x,b){if(y("endReadableNT",x.endEmitted,x.length),!x.errored&&!x.closeEmitted&&!x.endEmitted&&x.length===0){if(x.endEmitted=!0,b.emit("end"),b.writable&&b.allowHalfOpen===!1)G.nextTick(N0,b);else if(x.autoDestroy){let a=b._writableState;if(!a||a.autoDestroy&&(a.finished||a.writable===!1))b.destroy()}}}function N0(x){if(x.writable&&!x.writableEnded&&!x.destroyed)x.end()}s.from=function(x,b){return E(s,x,b)};var LU;function M0(){if(LU===void 0)LU={};return LU}s.fromWeb=function(x,b){return M0().newStreamReadableFromReadableStream(x,b)},s.toWeb=function(x,b){return M0().newReadableStreamFromStreamReadable(x,b)},s.wrap=function(x,b){var a,E0;return new s({objectMode:(a=(E0=x.readableObjectMode)!==null&&E0!==void 0?E0:x.objectMode)!==null&&a!==void 0?a:!0,...b,destroy(w0,A0){Y0.destroyer(x,w0),A0(w0)}}).wrap(x)}}),zX=u0((T,Y)=>{var G=rU(),{ArrayPrototypeSlice:K,Error:L,FunctionPrototypeSymbolHasInstance:W,ObjectDefineProperty:O,ObjectDefineProperties:z,ObjectSetPrototypeOf:q,StringPrototypeToLowerCase:D,Symbol:C,SymbolHasInstance:F}=o0();Y.exports=A,A.WritableState=X;var{EventEmitter:R}=(VE(),h0(GE)),M=DX().Stream,{Buffer:P}=(FU(),h0(KU)),k=IE(),{addAbortSignal:_}=wE(),{getHighWaterMark:N,getDefaultHighWaterMark:v}=yE(),{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_MULTIPLE_CALLBACK:y,ERR_STREAM_CANNOT_PIPE:l,ERR_STREAM_DESTROYED:Y0,ERR_STREAM_ALREADY_FINISHED:O0,ERR_STREAM_NULL_VALUES:Z0,ERR_STREAM_WRITE_AFTER_END:u,ERR_UNKNOWN_ENCODING:i}=zU().codes,{errorOrDestroy:U}=k;q(A.prototype,M.prototype),q(A,M);function I(){}var Q=C("kOnFinished");function X(f,h,T0){if(typeof T0!=="boolean")T0=h instanceof yU();if(this.objectMode=!!(f&&f.objectMode),T0)this.objectMode=this.objectMode||!!(f&&f.writableObjectMode);this.highWaterMark=f?N(this,f,"writableHighWaterMark",T0):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(f&&f.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=f&&f.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=S.bind(void 0,h),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Z(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!f||f.emitClose!==!1,this.autoDestroy=!f||f.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Q]=[]}function Z(f){f.buffered=[],f.bufferedIndex=0,f.allBuffers=!0,f.allNoop=!0}X.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},O(X.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function A(f){let h=this instanceof yU();if(!h&&!W(A,this))return new A(f);if(this._writableState=new X(f,this,h),f){if(typeof f.write==="function")this._write=f.write;if(typeof f.writev==="function")this._writev=f.writev;if(typeof f.destroy==="function")this._destroy=f.destroy;if(typeof f.final==="function")this._final=f.final;if(typeof f.construct==="function")this._construct=f.construct;if(f.signal)_(f.signal,this)}M.call(this,f),k.construct(this,()=>{let T0=this._writableState;if(!T0.writing)p(this,T0);d(this,T0)})}O(A,F,{__proto__:null,value:function(f){if(W(this,f))return!0;if(this!==A)return!1;return f&&f._writableState instanceof X}}),A.prototype.pipe=function(){U(this,new l)};function $(f,h,T0,r){let e=f._writableState;if(typeof T0==="function")r=T0,T0=e.defaultEncoding;else{if(!T0)T0=e.defaultEncoding;else if(T0!=="buffer"&&!P.isEncoding(T0))throw new i(T0);if(typeof r!=="function")r=I}if(h===null)throw new Z0;else if(!e.objectMode)if(typeof h==="string"){if(e.decodeStrings!==!1)h=P.from(h,T0),T0="buffer"}else if(h instanceof P)T0="buffer";else if(M._isUint8Array(h))h=M._uint8ArrayToBuffer(h),T0="buffer";else throw new B("chunk",["string","Buffer","Uint8Array"],h);let C0;if(e.ending)C0=new u;else if(e.destroyed)C0=new Y0("write");if(C0)return G.nextTick(r,C0),U(f,C0,!0),C0;return e.pendingcb++,J(f,e,h,T0,r)}A.prototype.write=function(f,h,T0){return $(this,f,h,T0)===!0},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){let f=this._writableState;if(f.corked){if(f.corked--,!f.writing)p(this,f)}},A.prototype.setDefaultEncoding=function(f){if(typeof f==="string")f=D(f);if(!P.isEncoding(f))throw new i(f);return this._writableState.defaultEncoding=f,this};function J(f,h,T0,r,e){let C0=h.objectMode?1:T0.length;h.length+=C0;let c=h.lengthT0.bufferedIndex)p(f,T0);if(r)if(T0.afterWriteTickInfo!==null&&T0.afterWriteTickInfo.cb===e)T0.afterWriteTickInfo.count++;else T0.afterWriteTickInfo={count:1,cb:e,stream:f,state:T0},G.nextTick(H,T0.afterWriteTickInfo);else j(f,T0,1,e)}}function H({stream:f,state:h,count:T0,cb:r}){return h.afterWriteTickInfo=null,j(f,h,T0,r)}function j(f,h,T0,r){if(!h.ending&&!f.destroyed&&h.length===0&&h.needDrain)h.needDrain=!1,f.emit("drain");while(T0-- >0)h.pendingcb--,r();if(h.destroyed)w(h);d(f,h)}function w(f){if(f.writing)return;for(let e=f.bufferedIndex;e1&&f._writev){h.pendingcb-=C0-1;let o=h.allNoop?I:(s)=>{for(let X0=c;X0256)T0.splice(0,c),h.bufferedIndex=0;else h.bufferedIndex=c}h.bufferProcessing=!1}A.prototype._write=function(f,h,T0){if(this._writev)this._writev([{chunk:f,encoding:h}],T0);else throw new g("_write()")},A.prototype._writev=null,A.prototype.end=function(f,h,T0){let r=this._writableState;if(typeof f==="function")T0=f,f=null,h=null;else if(typeof h==="function")T0=h,h=null;let e;if(f!==null&&f!==void 0){let C0=$(this,f,h);if(C0 instanceof L)e=C0}if(r.corked)r.corked=1,this.uncork();if(e);else if(!r.errored&&!r.ending)r.ending=!0,d(this,r,!0),r.ended=!0;else if(r.finished)e=new O0("end");else if(r.destroyed)e=new Y0("end");if(typeof T0==="function")if(e||r.finished)G.nextTick(T0,e);else r[Q].push(T0);return this};function n(f){return f.ending&&!f.destroyed&&f.constructed&&f.length===0&&!f.errored&&f.buffered.length===0&&!f.finished&&!f.writing&&!f.errorEmitted&&!f.closeEmitted}function G0(f,h){let T0=!1;function r(e){if(T0){U(f,e!==null&&e!==void 0?e:y());return}if(T0=!0,h.pendingcb--,e){let C0=h[Q].splice(0);for(let c=0;c{if(n(e))I0(r,e);else e.pendingcb--},f,h);else if(n(h))h.pendingcb++,I0(f,h)}}}function I0(f,h){h.pendingcb--,h.finished=!0;let T0=h[Q].splice(0);for(let r=0;r{var G=rU(),K=(FU(),h0(KU)),{isReadable:L,isWritable:W,isIterable:O,isNodeStream:z,isReadableNodeStream:q,isWritableNodeStream:D,isDuplexNodeStream:C,isReadableStream:F,isWritableStream:R}=fU(),M=bU(),{AbortError:P,codes:{ERR_INVALID_ARG_TYPE:k,ERR_INVALID_RETURN_VALUE:_}}=zU(),{destroyer:N}=IE(),v=yU(),B=fE(),g=zX(),{createDeferredPromise:y}=qU(),l=tI(),Y0=globalThis.Blob||K.Blob,O0=typeof Y0<"u"?function(Q){return Q instanceof Y0}:function(Q){return!1},Z0=globalThis.AbortController||AE().AbortController,{FunctionPrototypeCall:u}=o0();class i extends v{constructor(Q){super(Q);if((Q===null||Q===void 0?void 0:Q.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((Q===null||Q===void 0?void 0:Q.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}Y.exports=function Q(X,Z){if(C(X))return X;if(q(X))return I({readable:X});if(D(X))return I({writable:X});if(z(X))return I({writable:!1,readable:!1});if(F(X))return I({readable:B.fromWeb(X)});if(R(X))return I({writable:g.fromWeb(X)});if(typeof X==="function"){let{value:$,write:J,final:E,destroy:V}=U(X);if(O($))return l(i,$,{objectMode:!0,write:J,final:E,destroy:V});let S=$===null||$===void 0?void 0:$.then;if(typeof S==="function"){let H,j=u(S,$,(w)=>{if(w!=null)throw new _("nully","body",w)},(w)=>{N(H,w)});return H=new i({objectMode:!0,readable:!1,write:J,final(w){E(async()=>{try{await j,G.nextTick(w,null)}catch(p){G.nextTick(w,p)}})},destroy:V})}throw new _("Iterable, AsyncIterable or AsyncFunction",Z,$)}if(O0(X))return Q(X.arrayBuffer());if(O(X))return l(i,X,{objectMode:!0,writable:!1});if(F(X===null||X===void 0?void 0:X.readable)&&R(X===null||X===void 0?void 0:X.writable))return i.fromWeb(X);if(typeof(X===null||X===void 0?void 0:X.writable)==="object"||typeof(X===null||X===void 0?void 0:X.readable)==="object"){let $=X!==null&&X!==void 0&&X.readable?q(X===null||X===void 0?void 0:X.readable)?X===null||X===void 0?void 0:X.readable:Q(X.readable):void 0,J=X!==null&&X!==void 0&&X.writable?D(X===null||X===void 0?void 0:X.writable)?X===null||X===void 0?void 0:X.writable:Q(X.writable):void 0;return I({readable:$,writable:J})}let A=X===null||X===void 0?void 0:X.then;if(typeof A==="function"){let $;return u(A,X,(J)=>{if(J!=null)$.push(J);$.push(null)},(J)=>{N($,J)}),$=new i({objectMode:!0,writable:!1,read(){}})}throw new k(Z,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],X)};function U(Q){let{promise:X,resolve:Z}=y(),A=new Z0,$=A.signal;return{value:Q(async function*(){while(!0){let J=X;X=null;let{chunk:E,done:V,cb:S}=await J;if(G.nextTick(S),V)return;if($.aborted)throw new P(void 0,{cause:$.reason});({promise:X,resolve:Z}=y()),yield E}}(),{signal:$}),write(J,E,V){let S=Z;Z=null,S({chunk:J,done:!1,cb:V})},final(J){let E=Z;Z=null,E({done:!0,cb:J})},destroy(J,E){A.abort(),E(J)}}}function I(Q){let X=Q.readable&&typeof Q.readable.read!=="function"?B.wrap(Q.readable):Q.readable,Z=Q.writable,A=!!L(X),$=!!W(Z),J,E,V,S,H;function j(w){let p=S;if(S=null,p)p(w);else if(w)H.destroy(w)}if(H=new i({readableObjectMode:!!(X!==null&&X!==void 0&&X.readableObjectMode),writableObjectMode:!!(Z!==null&&Z!==void 0&&Z.writableObjectMode),readable:A,writable:$}),$)M(Z,(w)=>{if($=!1,w)N(X,w);j(w)}),H._write=function(w,p,n){if(Z.write(w,p))n();else J=n},H._final=function(w){Z.end(),E=w},Z.on("drain",function(){if(J){let w=J;J=null,w()}}),Z.on("finish",function(){if(E){let w=E;E=null,w()}});if(A)M(X,(w)=>{if(A=!1,w)N(X,w);j(w)}),X.on("readable",function(){if(V){let w=V;V=null,w()}}),X.on("end",function(){H.push(null)}),H._read=function(){while(!0){let w=X.read();if(w===null){V=H._read;return}if(!H.push(w))return}};return H._destroy=function(w,p){if(!w&&S!==null)w=new P;if(V=null,J=null,E=null,S===null)p(w);else S=p,N(Z,w),N(X,w)},H}}),yU=u0((T,Y)=>{var{ObjectDefineProperties:G,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:L,ObjectSetPrototypeOf:W}=o0();Y.exports=q;var O=fE(),z=zX();W(q.prototype,O.prototype),W(q,O);{let R=L(z.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:G,Symbol:K}=o0();Y.exports=q;var{ERR_METHOD_NOT_IMPLEMENTED:L}=zU().codes,W=yU(),{getHighWaterMark:O}=yE();G(q.prototype,W.prototype),G(q,W);var z=K("kCallback");function q(F){if(!(this instanceof q))return new q(F);let R=F?O(this,F,"readableHighWaterMark",!0):null;if(R===0)F={...F,highWaterMark:null,readableHighWaterMark:R,writableHighWaterMark:F.writableHighWaterMark||0};if(W.call(this,F),this._readableState.sync=!1,this[z]=null,F){if(typeof F.transform==="function")this._transform=F.transform;if(typeof F.flush==="function")this._flush=F.flush}this.on("prefinish",C)}function D(F){if(typeof this._flush==="function"&&!this.destroyed)this._flush((R,M)=>{if(R){if(F)F(R);else this.destroy(R);return}if(M!=null)this.push(M);if(this.push(null),F)F()});else if(this.push(null),F)F()}function C(){if(this._final!==D)D.call(this)}q.prototype._final=D,q.prototype._transform=function(F,R,M){throw new L("_transform()")},q.prototype._write=function(F,R,M){let P=this._readableState,k=this._writableState,_=P.length;this._transform(F,R,(N,v)=>{if(N){M(N);return}if(v!=null)this.push(v);if(k.ended||_===P.length||P.length{var{ObjectSetPrototypeOf:G}=o0();Y.exports=L;var K=aI();G(L.prototype,K.prototype),G(L,K);function L(W){if(!(this instanceof L))return new L(W);K.call(this,W)}L.prototype._transform=function(W,O,z){z(null,W)}}),SX=u0((T,Y)=>{var G=rU(),{ArrayIsArray:K,Promise:L,SymbolAsyncIterator:W,SymbolDispose:O}=o0(),z=bU(),{once:q}=qU(),D=IE(),C=yU(),{aggregateTwoErrors:F,codes:{ERR_INVALID_ARG_TYPE:R,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:P,ERR_STREAM_DESTROYED:k,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:N}=zU(),{validateFunction:v,validateAbortSignal:B}=LE(),{isIterable:g,isReadable:y,isReadableNodeStream:l,isNodeStream:Y0,isTransformStream:O0,isWebStream:Z0,isReadableStream:u,isReadableFinished:i}=fU(),U=globalThis.AbortController||AE().AbortController,I,Q,X;function Z(w,p,n){let G0=!1;w.on("close",()=>{G0=!0});let t=z(w,{readable:p,writable:n},(d)=>{G0=!d});return{destroy:(d)=>{if(G0)return;G0=!0,D.destroyer(w,d||new k("pipe"))},cleanup:t}}function A(w){return v(w[w.length-1],"streams[stream.length - 1]"),w.pop()}function $(w){if(g(w))return w;else if(l(w))return J(w);throw new R("val",["Readable","Iterable","AsyncIterable"],w)}async function*J(w){if(!Q)Q=fE();yield*Q.prototype[W].call(w)}async function E(w,p,n,{end:G0}){let t,d=null,I0=(g0)=>{if(g0)t=g0;if(d){let f=d;d=null,f()}},m=()=>new L((g0,f)=>{if(t)f(t);else d=()=>{if(t)f(t);else g0()}});p.on("drain",I0);let U0=z(p,{readable:!1},I0);try{if(p.writableNeedDrain)await m();for await(let g0 of w)if(!p.write(g0))await m();if(G0)p.end(),await m();n()}catch(g0){n(t!==g0?F(t,g0):g0)}finally{U0(),p.off("drain",I0)}}async function V(w,p,n,{end:G0}){if(O0(p))p=p.writable;let t=p.getWriter();try{for await(let d of w)await t.ready,t.write(d).catch(()=>{});if(await t.ready,G0)await t.close();n()}catch(d){try{await t.abort(d),n(d)}catch(I0){n(I0)}}}function S(...w){return H(w,q(A(w)))}function H(w,p,n){if(w.length===1&&K(w[0]))w=w[0];if(w.length<2)throw new P("streams");let G0=new U,t=G0.signal,d=n===null||n===void 0?void 0:n.signal,I0=[];B(d,"options.signal");function m(){e(new N)}X=X||qU().addAbortListener;let U0;if(d)U0=X(d,m);let g0,f,h=[],T0=0;function r(s){e(s,--T0===0)}function e(s,X0){var y0;if(s&&(!g0||g0.code==="ERR_STREAM_PREMATURE_CLOSE"))g0=s;if(!g0&&!X0)return;while(h.length)h.shift()(g0);if((y0=U0)===null||y0===void 0||y0[O](),G0.abort(),X0){if(!g0)I0.forEach((L0)=>L0());G.nextTick(p,g0,f)}}let C0;for(let s=0;s0,$0=y0||(n===null||n===void 0?void 0:n.end)!==!1,n0=s===w.length-1;if(Y0(X0)){let V0=function(K0){if(K0&&K0.name!=="AbortError"&&K0.code!=="ERR_STREAM_PREMATURE_CLOSE")r(K0)};var c=V0;if($0){let{destroy:K0,cleanup:r0}=Z(X0,y0,L0);if(h.push(K0),y(X0)&&n0)I0.push(r0)}if(X0.on("error",V0),y(X0)&&n0)I0.push(()=>{X0.removeListener("error",V0)})}if(s===0)if(typeof X0==="function"){if(C0=X0({signal:t}),!g(C0))throw new M("Iterable, AsyncIterable or Stream","source",C0)}else if(g(X0)||l(X0)||O0(X0))C0=X0;else C0=C.from(X0);else if(typeof X0==="function"){if(O0(C0)){var o;C0=$((o=C0)===null||o===void 0?void 0:o.readable)}else C0=$(C0);if(C0=X0(C0,{signal:t}),y0){if(!g(C0,!0))throw new M("AsyncIterable",`transform[${s-1}]`,C0)}else{var x0;if(!I)I=eI();let V0=new I({objectMode:!0}),K0=(x0=C0)===null||x0===void 0?void 0:x0.then;if(typeof K0==="function")T0++,K0.call(C0,(W0)=>{if(f=W0,W0!=null)V0.write(W0);if($0)V0.end();G.nextTick(r)},(W0)=>{V0.destroy(W0),G.nextTick(r,W0)});else if(g(C0,!0))T0++,E(C0,V0,r,{end:$0});else if(u(C0)||O0(C0)){let W0=C0.readable||C0;T0++,E(W0,V0,r,{end:$0})}else throw new M("AsyncIterable or Promise","destination",C0);C0=V0;let{destroy:r0,cleanup:H0}=Z(C0,!1,!0);if(h.push(r0),n0)I0.push(H0)}}else if(Y0(X0)){if(l(C0)){T0+=2;let V0=j(C0,X0,r,{end:$0});if(y(X0)&&n0)I0.push(V0)}else if(O0(C0)||u(C0)){let V0=C0.readable||C0;T0++,E(V0,X0,r,{end:$0})}else if(g(C0))T0++,E(C0,X0,r,{end:$0});else throw new R("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],C0);C0=X0}else if(Z0(X0)){if(l(C0))T0++,V($(C0),X0,r,{end:$0});else if(u(C0)||g(C0))T0++,V(C0,X0,r,{end:$0});else if(O0(C0))T0++,V(C0.readable,X0,r,{end:$0});else throw new R("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],C0);C0=X0}else C0=C.from(X0)}if(t!==null&&t!==void 0&&t.aborted||d!==null&&d!==void 0&&d.aborted)G.nextTick(m);return C0}function j(w,p,n,{end:G0}){let t=!1;if(p.on("close",()=>{if(!t)n(new _)}),w.pipe(p,{end:!1}),G0){let I0=function(){t=!0,p.end()};var d=I0;if(i(w))G.nextTick(I0);else w.once("end",I0)}else n();return z(w,{readable:!0,writable:!1},(I0)=>{let m=w._readableState;if(I0&&I0.code==="ERR_STREAM_PREMATURE_CLOSE"&&m&&m.ended&&!m.errored&&!m.errorEmitted)w.once("end",n).once("error",n);else n(I0)}),z(p,{readable:!1,writable:!0},n)}Y.exports={pipelineImpl:H,pipeline:S}}),iI=u0((T,Y)=>{var{pipeline:G}=SX(),K=yU(),{destroyer:L}=IE(),{isNodeStream:W,isReadable:O,isWritable:z,isWebStream:q,isTransformStream:D,isWritableStream:C,isReadableStream:F}=fU(),{AbortError:R,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:P}}=zU(),k=bU();Y.exports=function(..._){if(_.length===0)throw new P("streams");if(_.length===1)return K.from(_[0]);let N=[..._];if(typeof _[0]==="function")_[0]=K.from(_[0]);if(typeof _[_.length-1]==="function"){let U=_.length-1;_[U]=K.from(_[U])}for(let U=0;U<_.length;++U){if(!W(_[U])&&!q(_[U]))continue;if(U<_.length-1&&!(O(_[U])||F(_[U])||D(_[U])))throw new M(`streams[${U}]`,N[U],"must be readable");if(U>0&&!(z(_[U])||C(_[U])||D(_[U])))throw new M(`streams[${U}]`,N[U],"must be writable")}let v,B,g,y,l;function Y0(U){let I=y;if(y=null,I)I(U);else if(U)l.destroy(U);else if(!i&&!u)l.destroy()}let O0=_[0],Z0=G(_,Y0),u=!!(z(O0)||C(O0)||D(O0)),i=!!(O(Z0)||F(Z0)||D(Z0));if(l=new K({writableObjectMode:!!(O0!==null&&O0!==void 0&&O0.writableObjectMode),readableObjectMode:!!(Z0!==null&&Z0!==void 0&&Z0.readableObjectMode),writable:u,readable:i}),u){if(W(O0))l._write=function(I,Q,X){if(O0.write(I,Q))X();else v=X},l._final=function(I){O0.end(),B=I},O0.on("drain",function(){if(v){let I=v;v=null,I()}});else if(q(O0)){let I=(D(O0)?O0.writable:O0).getWriter();l._write=async function(Q,X,Z){try{await I.ready,I.write(Q).catch(()=>{}),Z()}catch(A){Z(A)}},l._final=async function(Q){try{await I.ready,I.close().catch(()=>{}),B=Q}catch(X){Q(X)}}}let U=D(Z0)?Z0.readable:Z0;k(U,()=>{if(B){let I=B;B=null,I()}})}if(i){if(W(Z0))Z0.on("readable",function(){if(g){let U=g;g=null,U()}}),Z0.on("end",function(){l.push(null)}),l._read=function(){while(!0){let U=Z0.read();if(U===null){g=l._read;return}if(!l.push(U))return}};else if(q(Z0)){let U=(D(Z0)?Z0.readable:Z0).getReader();l._read=async function(){while(!0)try{let{value:I,done:Q}=await U.read();if(!l.push(I))return;if(Q){l.push(null);return}}catch{return}}}}return l._destroy=function(U,I){if(!U&&y!==null)U=new R;if(g=null,v=null,B=null,y===null)I(U);else if(y=I,W(Z0))L(Z0,U)},l}}),UO=u0((T,Y)=>{var G=globalThis.AbortController||AE().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:L,ERR_MISSING_ARGS:W,ERR_OUT_OF_RANGE:O},AbortError:z}=zU(),{validateAbortSignal:q,validateInteger:D,validateObject:C}=LE(),F=o0().Symbol("kWeak"),R=o0().Symbol("kResistStopPropagation"),{finished:M}=bU(),P=iI(),{addAbortSignalNoValidate:k}=wE(),{isWritable:_,isNodeStream:N}=fU(),{deprecate:v}=qU(),{ArrayPrototypePush:B,Boolean:g,MathFloor:y,Number:l,NumberIsNaN:Y0,Promise:O0,PromiseReject:Z0,PromiseResolve:u,PromisePrototypeThen:i,Symbol:U}=o0(),I=U("kEmpty"),Q=U("kEof");function X(d,I0){if(I0!=null)C(I0,"options");if((I0===null||I0===void 0?void 0:I0.signal)!=null)q(I0.signal,"options.signal");if(N(d)&&!_(d))throw new K("stream",d,"must be writable");let m=P(this,d);if(I0!==null&&I0!==void 0&&I0.signal)k(I0.signal,m);return m}function Z(d,I0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);if(I0!=null)C(I0,"options");if((I0===null||I0===void 0?void 0:I0.signal)!=null)q(I0.signal,"options.signal");let m=1;if((I0===null||I0===void 0?void 0:I0.concurrency)!=null)m=y(I0.concurrency);let U0=m-1;if((I0===null||I0===void 0?void 0:I0.highWaterMark)!=null)U0=y(I0.highWaterMark);return D(m,"options.concurrency",1),D(U0,"options.highWaterMark",0),U0+=m,async function*(){let g0=qU().AbortSignalAny([I0===null||I0===void 0?void 0:I0.signal].filter(g)),f=this,h=[],T0={signal:g0},r,e,C0=!1,c=0;function o(){C0=!0,x0()}function x0(){c-=1,s()}function s(){if(e&&!C0&&c=U0||c>=m))await new O0((L0)=>{e=L0})}h.push(Q)}catch(y0){let L0=Z0(y0);i(L0,x0,o),h.push(L0)}finally{if(C0=!0,r)r(),r=null}}X0();try{while(!0){while(h.length>0){let y0=await h[0];if(y0===Q)return;if(g0.aborted)throw new z;if(y0!==I)yield y0;h.shift(),s()}await new O0((y0)=>{r=y0})}}finally{if(C0=!0,e)e(),e=null}}.call(this)}function A(d=void 0){if(d!=null)C(d,"options");if((d===null||d===void 0?void 0:d.signal)!=null)q(d.signal,"options.signal");return async function*(){let I0=0;for await(let U0 of this){var m;if(d!==null&&d!==void 0&&(m=d.signal)!==null&&m!==void 0&&m.aborted)throw new z({cause:d.signal.reason});yield[I0++,U0]}}.call(this)}async function $(d,I0=void 0){for await(let m of S.call(this,d,I0))return!0;return!1}async function J(d,I0=void 0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);return!await $.call(this,async(...m)=>{return!await d(...m)},I0)}async function E(d,I0){for await(let m of S.call(this,d,I0))return m;return}async function V(d,I0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);async function m(U0,g0){return await d(U0,g0),I}for await(let U0 of Z.call(this,m,I0));}function S(d,I0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);async function m(U0,g0){if(await d(U0,g0))return U0;return I}return Z.call(this,m,I0)}class H extends W{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function j(d,I0,m){var U0;if(typeof d!=="function")throw new L("reducer",["Function","AsyncFunction"],d);if(m!=null)C(m,"options");if((m===null||m===void 0?void 0:m.signal)!=null)q(m.signal,"options.signal");let g0=arguments.length>1;if(m!==null&&m!==void 0&&(U0=m.signal)!==null&&U0!==void 0&&U0.aborted){let e=new z(void 0,{cause:m.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(e)),e}let f=new G,h=f.signal;if(m!==null&&m!==void 0&&m.signal){let e={once:!0,[F]:this,[R]:!0};m.signal.addEventListener("abort",()=>f.abort(),e)}let T0=!1;try{for await(let e of this){var r;if(T0=!0,m!==null&&m!==void 0&&(r=m.signal)!==null&&r!==void 0&&r.aborted)throw new z;if(!g0)I0=e,g0=!0;else I0=await d(I0,e,{signal:h})}if(!T0&&!g0)throw new H}finally{f.abort()}return I0}async function w(d){if(d!=null)C(d,"options");if((d===null||d===void 0?void 0:d.signal)!=null)q(d.signal,"options.signal");let I0=[];for await(let U0 of this){var m;if(d!==null&&d!==void 0&&(m=d.signal)!==null&&m!==void 0&&m.aborted)throw new z(void 0,{cause:d.signal.reason});B(I0,U0)}return I0}function p(d,I0){let m=Z.call(this,d,I0);return async function*(){for await(let U0 of m)yield*U0}.call(this)}function n(d){if(d=l(d),Y0(d))return 0;if(d<0)throw new O("number",">= 0",d);return d}function G0(d,I0=void 0){if(I0!=null)C(I0,"options");if((I0===null||I0===void 0?void 0:I0.signal)!=null)q(I0.signal,"options.signal");return d=n(d),async function*(){var m;if(I0!==null&&I0!==void 0&&(m=I0.signal)!==null&&m!==void 0&&m.aborted)throw new z;for await(let g0 of this){var U0;if(I0!==null&&I0!==void 0&&(U0=I0.signal)!==null&&U0!==void 0&&U0.aborted)throw new z;if(d--<=0)yield g0}}.call(this)}function t(d,I0=void 0){if(I0!=null)C(I0,"options");if((I0===null||I0===void 0?void 0:I0.signal)!=null)q(I0.signal,"options.signal");return d=n(d),async function*(){var m;if(I0!==null&&I0!==void 0&&(m=I0.signal)!==null&&m!==void 0&&m.aborted)throw new z;for await(let g0 of this){var U0;if(I0!==null&&I0!==void 0&&(U0=I0.signal)!==null&&U0!==void 0&&U0.aborted)throw new z;if(d-- >0)yield g0;if(d<=0)return}}.call(this)}Y.exports.streamReturningOperators={asIndexedPairs:v(A,"readable.asIndexedPairs will be removed in a future version."),drop:G0,filter:S,flatMap:p,map:Z,take:t,compose:X},Y.exports.promiseReturningOperators={every:J,forEach:V,reduce:j,toArray:w,some:$,find:E}}),UT=u0((T,Y)=>{var{ArrayPrototypePop:G,Promise:K}=o0(),{isIterable:L,isNodeStream:W,isWebStream:O}=fU(),{pipelineImpl:z}=SX(),{finished:q}=bU();ET();function D(...C){return new K((F,R)=>{let M,P,k=C[C.length-1];if(k&&typeof k==="object"&&!W(k)&&!L(k)&&!O(k)){let _=G(C);M=_.signal,P=_.end}z(C,(_,N)=>{if(_)R(_);else F(N)},{signal:M,end:P})})}Y.exports={finished:q,pipeline:D}}),ET=u0((T,Y)=>{var{Buffer:G}=(FU(),h0(KU)),{ObjectDefineProperty:K,ObjectKeys:L,ReflectApply:W}=o0(),{promisify:{custom:O}}=qU(),{streamReturningOperators:z,promiseReturningOperators:q}=UO(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:D}}=zU(),C=iI(),{setDefaultHighWaterMark:F,getDefaultHighWaterMark:R}=yE(),{pipeline:M}=SX(),{destroyer:P}=IE(),k=bU(),_=UT(),N=fU(),v=Y.exports=DX().Stream;v.isDestroyed=N.isDestroyed,v.isDisturbed=N.isDisturbed,v.isErrored=N.isErrored,v.isReadable=N.isReadable,v.isWritable=N.isWritable,v.Readable=fE();for(let g of L(z)){let y=function(...Y0){if(new.target)throw D();return v.Readable.from(W(l,this,Y0))},l=z[g];K(y,"name",{__proto__:null,value:l.name}),K(y,"length",{__proto__:null,value:l.length}),K(v.Readable.prototype,g,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}for(let g of L(q)){let y=function(...Y0){if(new.target)throw D();return W(l,this,Y0)},l=q[g];K(y,"name",{__proto__:null,value:l.name}),K(y,"length",{__proto__:null,value:l.length}),K(v.Readable.prototype,g,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}v.Writable=zX(),v.Duplex=yU(),v.Transform=aI(),v.PassThrough=eI(),v.pipeline=M;var{addAbortSignal:B}=wE();v.addAbortSignal=B,v.finished=k,v.destroy=P,v.compose=C,v.setDefaultHighWaterMark=F,v.getDefaultHighWaterMark=R,K(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),K(M,O,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),K(k,O,{__proto__:null,enumerable:!0,get(){return _.finished}}),v.Stream=v,v._isUint8Array=function(g){return g instanceof Uint8Array},v._uint8ArrayToBuffer=function(g){return G.from(g.buffer,g.byteOffset,g.byteLength)}}),EO=u0((T,Y)=>{var G=MX();{let K=ET(),L=UT(),W=K.Readable.destroy;Y.exports=K.Readable,Y.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,Y.exports._isUint8Array=K._isUint8Array,Y.exports.isDisturbed=K.isDisturbed,Y.exports.isErrored=K.isErrored,Y.exports.isReadable=K.isReadable,Y.exports.Readable=K.Readable,Y.exports.Writable=K.Writable,Y.exports.Duplex=K.Duplex,Y.exports.Transform=K.Transform,Y.exports.PassThrough=K.PassThrough,Y.exports.addAbortSignal=K.addAbortSignal,Y.exports.finished=K.finished,Y.exports.destroy=K.destroy,Y.exports.destroy=W,Y.exports.pipeline=K.pipeline,Y.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return L}}),Y.exports.Stream=K.Stream}Y.exports.default=Y.exports});XT.exports=EO()});var PU={};jU(PU,{webcrypto:()=>_J,rng:()=>hQ,randomUUID:()=>MJ,randomFillSync:()=>RJ,randomFill:()=>HJ,randomBytes:()=>uQ,publicEncrypt:()=>$J,publicDecrypt:()=>FJ,pseudoRandomBytes:()=>pQ,prng:()=>cQ,privateEncrypt:()=>KJ,privateDecrypt:()=>WJ,pbkdf2Sync:()=>mQ,pbkdf2:()=>nQ,listCiphers:()=>IJ,getRandomValues:()=>SJ,getHashes:()=>oQ,getDiffieHellman:()=>ZJ,getCurves:()=>PJ,getCiphers:()=>XJ,default:()=>kJ,createVerify:()=>VJ,createSign:()=>JJ,createHmac:()=>lQ,createHash:()=>CE,createECDH:()=>LJ,createDiffieHellmanGroup:()=>YJ,createDiffieHellman:()=>OJ,createDecipheriv:()=>EJ,createDecipher:()=>iQ,createCredentials:()=>CJ,createCipheriv:()=>aQ,createCipher:()=>rQ,constants:()=>DJ,Verify:()=>AJ,Sign:()=>GJ,Hmac:()=>dQ,Hash:()=>bQ,DiffieHellmanGroup:()=>TJ,DiffieHellman:()=>QJ,Decipheriv:()=>UJ,Decipher:()=>eQ,DEFAULT_ENCODING:()=>zJ,Cipheriv:()=>tQ,Cipher:()=>sQ});function PJ(){return qJ}var XO,IO,IT,TO,YO,ZO=(T,Y,G)=>{G=T!=null?XO(IO(T)):{};let K=Y||!T||!T.__esModule?IT(G,"default",{value:T,enumerable:!0}):G;for(let L of TO(T))if(!YO.call(K,L))IT(K,L,{get:()=>T[L],enumerable:!0});return K},Q0=(T,Y)=>()=>(Y||T((Y={exports:{}}).exports,Y),Y.exports),cE,pE,YT,OO,PX,_X,SU,QO,KE,ZT,JO,GO,VO,AO,OT,LO,$O,KO,FO,WO,HO,RO,CO,DO,zO,FE,hE,QT,SO,JT,GT,MO,WE,kX,vX,qO,VT,jX,PO,AT,_O,LT,$T,kO,vO,jO,NO,BO,xO,gO,wO,yO,fO,cO,pO,hO,uO,NX,KT,bO,FT,dO,lO,oO,nO,cU,dU,WT,vU,HT,uE,mO,_U,sO,rO,tO,RT,xU,HE,CT,aO,DT,eO,zT,iO,UQ,EQ,XQ,BX,IQ,xX,TQ,YQ,ZQ,OQ,QQ,JQ,GQ,VQ,AQ,LQ,$Q,KQ,FQ,WQ,TT,HQ,$E,RQ,ST,MT,CQ,DQ,qT,zQ,SQ,RE,MQ,qQ,PQ,_Q,kQ,vQ,PT,jQ,_T,kT,vT,gX,jT,NQ,NT,BQ,xQ,qX,gQ,wQ,yQ,fQ,p0,cQ,pQ,hQ,uQ,bQ,CE,dQ,lQ,oQ,nQ,mQ,sQ,rQ,tQ,aQ,eQ,iQ,UJ,EJ,XJ,IJ,TJ,YJ,ZJ,OJ,QJ,JJ,GJ,VJ,AJ,LJ,$J,KJ,FJ,WJ,HJ,RJ,CJ,DJ,zJ="buffer",SJ=(T)=>{return crypto.getRandomValues(T)},MJ=()=>{return crypto.randomUUID()},qJ,_J,kJ;var DU=GU(()=>{XO=Object.create,{getPrototypeOf:IO,defineProperty:IT,getOwnPropertyNames:TO}=Object,YO=Object.prototype.hasOwnProperty,cE=Q0((T,Y)=>{Y.exports=(DU(),h0(PU)).randomBytes}),pE=Q0((T,Y)=>{Y.exports=(DU(),h0(PU)).createHash}),YT=Q0((T,Y)=>{Y.exports=(DU(),h0(PU)).createHmac}),OO=Q0((T,Y)=>{Y.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),PX=Q0((T,Y)=>{var G=isFinite,K=Math.pow(2,30)-1;Y.exports=function(L,W){if(typeof L!=="number")throw TypeError("Iterations not a number");if(L<0||!G(L))throw TypeError("Bad iterations");if(typeof W!=="number")throw TypeError("Key length not a number");if(W<0||W>K||W!==W)throw TypeError("Bad key length")}}),_X=Q0((T,Y)=>{var G;if(globalThis.process&&globalThis.process.browser)G="utf-8";else if(globalThis.process&&globalThis.process.version)K=parseInt(process.version.split(".")[0].slice(1),10),G=K>=6?"utf-8":"binary";else G="utf-8";var K;Y.exports=G}),SU=Q0((T,Y)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var G=(FU(),h0(KU)),K=G.Buffer;function L(O,z){for(var q in O)z[q]=O[q]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)Y.exports=G;else L(G,T),T.Buffer=W;function W(O,z,q){return K(O,z,q)}W.prototype=Object.create(K.prototype),L(K,W),W.from=function(O,z,q){if(typeof O==="number")throw TypeError("Argument must not be a number");return K(O,z,q)},W.alloc=function(O,z,q){if(typeof O!=="number")throw TypeError("Argument must be a number");var D=K(O);if(z!==void 0)if(typeof q==="string")D.fill(z,q);else D.fill(z);else D.fill(0);return D},W.allocUnsafe=function(O){if(typeof O!=="number")throw TypeError("Argument must be a number");return K(O)},W.allocUnsafeSlow=function(O){if(typeof O!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(O)}}),QO=Q0((T,Y)=>{var G={}.toString;Y.exports=Array.isArray||function(K){return G.call(K)=="[object Array]"}}),KE=Q0((T,Y)=>{Y.exports=TypeError}),ZT=Q0((T,Y)=>{Y.exports=Object}),JO=Q0((T,Y)=>{Y.exports=Error}),GO=Q0((T,Y)=>{Y.exports=EvalError}),VO=Q0((T,Y)=>{Y.exports=RangeError}),AO=Q0((T,Y)=>{Y.exports=ReferenceError}),OT=Q0((T,Y)=>{Y.exports=SyntaxError}),LO=Q0((T,Y)=>{Y.exports=URIError}),$O=Q0((T,Y)=>{Y.exports=Math.abs}),KO=Q0((T,Y)=>{Y.exports=Math.floor}),FO=Q0((T,Y)=>{Y.exports=Math.max}),WO=Q0((T,Y)=>{Y.exports=Math.min}),HO=Q0((T,Y)=>{Y.exports=Math.pow}),RO=Q0((T,Y)=>{Y.exports=Math.round}),CO=Q0((T,Y)=>{Y.exports=Number.isNaN||function(G){return G!==G}}),DO=Q0((T,Y)=>{var G=CO();Y.exports=function(K){if(G(K)||K===0)return K;return K<0?-1:1}}),zO=Q0((T,Y)=>{Y.exports=Object.getOwnPropertyDescriptor}),FE=Q0((T,Y)=>{var G=zO();if(G)try{G([],"length")}catch(K){G=null}Y.exports=G}),hE=Q0((T,Y)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(K){G=!1}Y.exports=G}),QT=Q0((T,Y)=>{Y.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var G={},K=Symbol("test"),L=Object(K);if(typeof K==="string")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(L)!=="[object Symbol]")return!1;var W=42;G[K]=W;for(var O in G)return!1;if(typeof Object.keys==="function"&&Object.keys(G).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(G).length!==0)return!1;var z=Object.getOwnPropertySymbols(G);if(z.length!==1||z[0]!==K)return!1;if(!Object.prototype.propertyIsEnumerable.call(G,K))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var q=Object.getOwnPropertyDescriptor(G,K);if(q.value!==W||q.enumerable!==!0)return!1}return!0}}),SO=Q0((T,Y)=>{var G=typeof Symbol<"u"&&Symbol,K=QT();Y.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return K()}}),JT=Q0((T,Y)=>{Y.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),GT=Q0((T,Y)=>{var G=ZT();Y.exports=G.getPrototypeOf||null}),MO=Q0((T,Y)=>{var G="Function.prototype.bind called on incompatible ",K=Object.prototype.toString,L=Math.max,W="[object Function]",O=function(D,C){var F=[];for(var R=0;R{var G=MO();Y.exports=Function.prototype.bind||G}),kX=Q0((T,Y)=>{Y.exports=Function.prototype.call}),vX=Q0((T,Y)=>{Y.exports=Function.prototype.apply}),qO=Q0((T,Y)=>{Y.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),VT=Q0((T,Y)=>{var G=WE(),K=vX(),L=kX(),W=qO();Y.exports=W||G.call(L,K)}),jX=Q0((T,Y)=>{var G=WE(),K=KE(),L=kX(),W=VT();Y.exports=function(O){if(O.length<1||typeof O[0]!=="function")throw new K("a function is required");return W(G,L,O)}}),PO=Q0((T,Y)=>{var G=jX(),K=FE(),L;try{L=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var W=!!L&&K&&K(Object.prototype,"__proto__"),O=Object,z=O.getPrototypeOf;Y.exports=W&&typeof W.get==="function"?G([W.get]):typeof z==="function"?function(q){return z(q==null?q:O(q))}:!1}),AT=Q0((T,Y)=>{var G=JT(),K=GT(),L=PO();Y.exports=G?function(W){return G(W)}:K?function(W){if(!W||typeof W!=="object"&&typeof W!=="function")throw TypeError("getProto: not an object");return K(W)}:L?function(W){return L(W)}:null}),_O=Q0((T,Y)=>{var G=Function.prototype.call,K=Object.prototype.hasOwnProperty,L=WE();Y.exports=L.call(G,K)}),LT=Q0((T,Y)=>{var G,K=ZT(),L=JO(),W=GO(),O=VO(),z=AO(),q=OT(),D=KE(),C=LO(),F=$O(),R=KO(),M=FO(),P=WO(),k=HO(),_=RO(),N=DO(),v=Function,B=function(I0){try{return v('"use strict"; return ('+I0+").constructor;")()}catch(m){}},g=FE(),y=hE(),l=function(){throw new D},Y0=g?function(){try{return arguments.callee,l}catch(I0){try{return g(arguments,"callee").get}catch(m){return l}}}():l,O0=SO()(),Z0=AT(),u=GT(),i=JT(),U=vX(),I=kX(),Q={},X=typeof Uint8Array>"u"||!Z0?G:Z0(Uint8Array),Z={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":O0&&Z0?Z0([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":L,"%eval%":eval,"%EvalError%":W,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":O0&&Z0?Z0(Z0([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!O0||!Z0?G:Z0(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":K,"%Object.getOwnPropertyDescriptor%":g,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":O,"%ReferenceError%":z,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!O0||!Z0?G:Z0(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":O0&&Z0?Z0(""[Symbol.iterator]()):G,"%Symbol%":O0?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":Y0,"%TypedArray%":X,"%TypeError%":D,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":C,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":I,"%Function.prototype.apply%":U,"%Object.defineProperty%":y,"%Object.getPrototypeOf%":u,"%Math.abs%":F,"%Math.floor%":R,"%Math.max%":M,"%Math.min%":P,"%Math.pow%":k,"%Math.round%":_,"%Math.sign%":N,"%Reflect.getPrototypeOf%":i};if(Z0)try{null.error}catch(I0){A=Z0(Z0(I0)),Z["%Error.prototype%"]=A}var A,$=function I0(m){var U0;if(m==="%AsyncFunction%")U0=B("async function () {}");else if(m==="%GeneratorFunction%")U0=B("function* () {}");else if(m==="%AsyncGeneratorFunction%")U0=B("async function* () {}");else if(m==="%AsyncGenerator%"){var g0=I0("%AsyncGeneratorFunction%");if(g0)U0=g0.prototype}else if(m==="%AsyncIteratorPrototype%"){var f=I0("%AsyncGenerator%");if(f&&Z0)U0=Z0(f.prototype)}return Z[m]=U0,U0},J={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},E=WE(),V=_O(),S=E.call(I,Array.prototype.concat),H=E.call(U,Array.prototype.splice),j=E.call(I,String.prototype.replace),w=E.call(I,String.prototype.slice),p=E.call(I,RegExp.prototype.exec),n=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,G0=/\\(\\)?/g,t=function(I0){var m=w(I0,0,1),U0=w(I0,-1);if(m==="%"&&U0!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(U0==="%"&&m!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var g0=[];return j(I0,n,function(f,h,T0,r){g0[g0.length]=T0?j(r,G0,"$1"):h||f}),g0},d=function(I0,m){var U0=I0,g0;if(V(J,U0))g0=J[U0],U0="%"+g0[0]+"%";if(V(Z,U0)){var f=Z[U0];if(f===Q)f=$(U0);if(typeof f>"u"&&!m)throw new D("intrinsic "+I0+" exists, but is not available. Please file an issue!");return{alias:g0,name:U0,value:f}}throw new q("intrinsic "+I0+" does not exist!")};Y.exports=function(I0,m){if(typeof I0!=="string"||I0.length===0)throw new D("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof m!=="boolean")throw new D('"allowMissing" argument must be a boolean');if(p(/^%?[^%]*%?$/,I0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var U0=t(I0),g0=U0.length>0?U0[0]:"",f=d("%"+g0+"%",m),h=f.name,T0=f.value,r=!1,e=f.alias;if(e)g0=e[0],H(U0,S([0,1],e));for(var C0=1,c=!0;C0=U0.length){var X0=g(T0,o);if(c=!!X0,c&&"get"in X0&&!("originalValue"in X0.get))T0=X0.get;else T0=T0[o]}else c=V(T0,o),T0=T0[o];if(c&&!r)Z[h]=T0}}return T0}}),$T=Q0((T,Y)=>{var G=LT(),K=jX(),L=K([G("%String.prototype.indexOf%")]);Y.exports=function(W,O){var z=G(W,!!O);if(typeof z==="function"&&L(W,".prototype.")>-1)return K([z]);return z}}),kO=Q0((T,Y)=>{var G=Function.prototype.toString,K=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,L,W;if(typeof K==="function"&&typeof Object.defineProperty==="function")try{L=Object.defineProperty({},"length",{get:function(){throw W}}),W={},K(function(){throw 42},null,L)}catch(g){if(g!==W)K=null}else K=null;var O=/^\s*class\b/,z=function(g){try{var y=G.call(g);return O.test(y)}catch(l){return!1}},q=function(g){try{if(z(g))return!1;return G.call(g),!0}catch(y){return!1}},D=Object.prototype.toString,C="[object Object]",F="[object Function]",R="[object GeneratorFunction]",M="[object HTMLAllCollection]",P="[object HTML document.all class]",k="[object HTMLCollection]",_=typeof Symbol==="function"&&!!Symbol.toStringTag,N=!(0 in[,]),v=function(){return!1};if(typeof document==="object"){if(B=document.all,D.call(B)===D.call(document.all))v=function(g){if((N||!g)&&(typeof g>"u"||typeof g==="object"))try{var y=D.call(g);return(y===M||y===P||y===k||y===C)&&g("")==null}catch(l){}return!1}}var B;Y.exports=K?function(g){if(v(g))return!0;if(!g)return!1;if(typeof g!=="function"&&typeof g!=="object")return!1;try{K(g,null,L)}catch(y){if(y!==W)return!1}return!z(g)&&q(g)}:function(g){if(v(g))return!0;if(!g)return!1;if(typeof g!=="function"&&typeof g!=="object")return!1;if(_)return q(g);if(z(g))return!1;var y=D.call(g);if(y!==F&&y!==R&&!/^\[object HTML/.test(y))return!1;return q(g)}}),vO=Q0((T,Y)=>{var G=kO(),K=Object.prototype.toString,L=Object.prototype.hasOwnProperty,W=function(D,C,F){for(var R=0,M=D.length;R=3)R=F;if(q(D))W(D,C,R);else if(typeof D==="string")O(D,C,R);else z(D,C,R)}}),jO=Q0((T,Y)=>{Y.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),NO=Q0((T,Y)=>{var G=jO(),K=typeof globalThis>"u"?globalThis:globalThis;Y.exports=function(){var L=[];for(var W=0;W{var G=hE(),K=OT(),L=KE(),W=FE();Y.exports=function(O,z,q){if(!O||typeof O!=="object"&&typeof O!=="function")throw new L("`obj` must be an object or a function`");if(typeof z!=="string"&&typeof z!=="symbol")throw new L("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new L("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new L("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new L("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new L("`loose`, if provided, must be a boolean");var D=arguments.length>3?arguments[3]:null,C=arguments.length>4?arguments[4]:null,F=arguments.length>5?arguments[5]:null,R=arguments.length>6?arguments[6]:!1,M=!!W&&W(O,z);if(G)G(O,z,{configurable:F===null&&M?M.configurable:!F,enumerable:D===null&&M?M.enumerable:!D,value:q,writable:C===null&&M?M.writable:!C});else if(R||!D&&!C&&!F)O[z]=q;else throw new K("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),xO=Q0((T,Y)=>{var G=hE(),K=function(){return!!G};K.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(L){return!0}},Y.exports=K}),gO=Q0((T,Y)=>{var G=LT(),K=BO(),L=xO()(),W=FE(),O=KE(),z=G("%Math.floor%");Y.exports=function(q,D){if(typeof q!=="function")throw new O("`fn` is not a function");if(typeof D!=="number"||D<0||D>4294967295||z(D)!==D)throw new O("`length` must be a positive 32-bit integer");var C=arguments.length>2&&!!arguments[2],F=!0,R=!0;if("length"in q&&W){var M=W(q,"length");if(M&&!M.configurable)F=!1;if(M&&!M.writable)R=!1}if(F||R||!C)if(L)K(q,"length",D,!0,!0);else K(q,"length",D);return q}}),wO=Q0((T,Y)=>{var G=WE(),K=vX(),L=VT();Y.exports=function(){return L(G,K,arguments)}}),yO=Q0((T,Y)=>{var G=gO(),K=hE(),L=jX(),W=wO();if(Y.exports=function(O){var z=L(arguments),q=O.length-(arguments.length-1);return G(z,1+(q>0?q:0),!0)},K)K(Y.exports,"apply",{value:W});else Y.exports.apply=W}),fO=Q0((T,Y)=>{var G=QT();Y.exports=function(){return G()&&!!Symbol.toStringTag}}),cO=Q0((T,Y)=>{var G=vO(),K=NO(),L=yO(),W=$T(),O=FE(),z=AT(),q=W("Object.prototype.toString"),D=fO()(),C=typeof globalThis>"u"?globalThis:globalThis,F=K(),R=W("String.prototype.slice"),M=W("Array.prototype.indexOf",!0)||function(N,v){for(var B=0;B-1)return v;if(v!=="Object")return!1;return _(N)}if(!O)return null;return k(N)}}),pO=Q0((T,Y)=>{var G=cO();Y.exports=function(K){return!!G(K)}}),hO=Q0((T,Y)=>{var G=KE(),K=$T(),L=K("TypedArray.prototype.buffer",!0),W=pO();Y.exports=L||function(O){if(!W(O))throw new G("Not a Typed Array");return O.buffer}}),uO=Q0((T,Y)=>{var G=SU().Buffer,K=QO(),L=hO(),W=ArrayBuffer.isView||function(D){try{return L(D),!0}catch(C){return!1}},O=typeof Uint8Array<"u",z=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",q=z&&(G.prototype instanceof Uint8Array||G.TYPED_ARRAY_SUPPORT);Y.exports=function(D,C){if(G.isBuffer(D)){if(D.constructor&&!("isBuffer"in D))return G.from(D);return D}if(typeof D==="string")return G.from(D,C);if(z&&W(D)){if(D.byteLength===0)return G.alloc(0);if(q){var F=G.from(D.buffer,D.byteOffset,D.byteLength);if(F.byteLength===D.byteLength)return F}var R=D instanceof Uint8Array?D:new Uint8Array(D.buffer,D.byteOffset,D.byteLength),M=G.from(R);if(M.length===D.byteLength)return M}if(O&&D instanceof Uint8Array)return G.from(D);var P=K(D);if(P)for(var k=0;k255||~~_!==_)throw RangeError("Array items must be numbers in the range 0-255.")}if(P||G.isBuffer(D)&&D.constructor&&typeof D.constructor.isBuffer==="function"&&D.constructor.isBuffer(D))return G.from(D);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}}),NX=Q0((T,Y)=>{var G=SU().Buffer,K=uO(),L=typeof Uint8Array<"u",W=L&&typeof ArrayBuffer<"u",O=W&&ArrayBuffer.isView;Y.exports=function(z,q,D){if(typeof z==="string"||G.isBuffer(z)||L&&z instanceof Uint8Array||O&&O(z))return K(z,q);throw TypeError(D+" must be a string, a Buffer, a Uint8Array, or a DataView")}}),KT=Q0((T,Y)=>{var G={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,rmd160:20,ripemd160:20},K={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"},L=YT(),W=SU().Buffer,O=PX(),z=_X(),q=NX();function D(C,F,R,M,P){O(R,M),C=q(C,z,"Password"),F=q(F,z,"Salt");var k=(P||"sha1").toLowerCase(),_=K[k]||k,N=G[_];if(typeof N!=="number"||!N)throw TypeError("Digest algorithm not supported: "+P);var v=W.allocUnsafe(M),B=W.allocUnsafe(F.length+4);F.copy(B,0,0,F.length);var g=0,y=N,l=Math.ceil(M/y);for(var Y0=1;Y0<=l;Y0++){B.writeUInt32BE(Y0,F.length);var O0=L(_,C).update(B).digest(),Z0=O0;for(var u=1;u{var G=SU().Buffer,K=PX(),L=_X(),W=KT(),O=NX(),z,q=globalThis.crypto&&globalThis.crypto.subtle,D={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},C=[],F;function R(){if(F)return F;if(globalThis.process&&globalThis.process.nextTick)F=globalThis.process.nextTick;else if(globalThis.queueMicrotask)F=globalThis.queueMicrotask;else if(globalThis.setImmediate)F=globalThis.setImmediate;else F=globalThis.setTimeout;return F}function M(_,N,v,B,g){return q.importKey("raw",_,{name:"PBKDF2"},!1,["deriveBits"]).then(function(y){return q.deriveBits({name:"PBKDF2",salt:N,iterations:v,hash:{name:g}},y,B<<3)}).then(function(y){return G.from(y)})}function P(_){if(globalThis.process&&!globalThis.process.browser)return Promise.resolve(!1);if(!q||!q.importKey||!q.deriveBits)return Promise.resolve(!1);if(C[_]!==void 0)return C[_];z=z||G.alloc(8);var N=M(z,z,10,128,_).then(function(){return!0},function(){return!1});return C[_]=N,N}function k(_,N){_.then(function(v){R()(function(){N(null,v)})},function(v){R()(function(){N(v)})})}Y.exports=function(_,N,v,B,g,y){if(typeof g==="function")y=g,g=void 0;if(K(v,B),_=O(_,L,"Password"),N=O(N,L,"Salt"),typeof y!=="function")throw Error("No callback provided to pbkdf2");g=g||"sha1";var l=D[g.toLowerCase()];if(!l||typeof globalThis.Promise!=="function"){R()(function(){var Y0;try{Y0=W(_,N,v,B,g)}catch(O0){y(O0);return}y(null,Y0)});return}k(P(l).then(function(Y0){if(Y0)return M(_,N,v,B,l);return W(_,N,v,B,g)}),y)}}),FT=Q0((T)=>{var Y=(DU(),h0(PU)),G=PX(),K=_X(),L=NX();function W(z,q,D,C,F,R){if(G(D,C),z=L(z,K,"Password"),q=L(q,K,"Salt"),typeof F==="function")R=F,F="sha1";if(typeof R!=="function")throw Error("No callback provided to pbkdf2");return Y.pbkdf2(z,q,D,C,F,R)}function O(z,q,D,C,F){return G(D,C),z=L(z,K,"Password"),q=L(q,K,"Salt"),F=F||"sha1",Y.pbkdf2Sync(z,q,D,C,F)}if(!Y.pbkdf2Sync||Y.pbkdf2Sync.toString().indexOf("keylen, digest")===-1)T.pbkdf2Sync=KT(),T.pbkdf2=bO();else T.pbkdf2Sync=O,T.pbkdf2=W}),dO=Q0((T)=>{var Y=(DU(),h0(PU));T.createCipher=T.Cipher=Y.createCipher,T.createCipheriv=T.Cipheriv=Y.createCipheriv,T.createDecipher=T.Decipher=Y.createDecipher,T.createDecipheriv=T.Decipheriv=Y.createDecipheriv,T.listCiphers=T.getCiphers=Y.getCiphers}),lO=Q0((T)=>{var Y=(DU(),h0(PU));T.DiffieHellmanGroup=Y.DiffieHellmanGroup,T.createDiffieHellmanGroup=Y.createDiffieHellmanGroup,T.getDiffieHellman=Y.getDiffieHellman,T.createDiffieHellman=Y.createDiffieHellman,T.DiffieHellman=Y.DiffieHellman}),oO=Q0((T)=>{var Y=(DU(),h0(PU));T.createSign=Y.createSign,T.Sign=Y.Sign,T.createVerify=Y.createVerify,T.Verify=Y.Verify}),nO=Q0((T,Y)=>{Y.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),cU=Q0((T,Y)=>{(function(G,K){function L(U,I){if(!U)throw Error(I||"Assertion failed")}function W(U,I){U.super_=I;var Q=function(){};Q.prototype=I.prototype,U.prototype=new Q,U.prototype.constructor=U}function O(U,I,Q){if(O.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(I==="le"||I==="be")Q=I,I=10;this._init(U||0,I||10,Q||"be")}}if(typeof G==="object")G.exports=O;else K.BN=O;O.BN=O,O.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}O.isBN=function(U){if(U instanceof O)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===O.wordSize&&Array.isArray(U.words)},O.max=function(U,I){if(U.cmp(I)>0)return U;return I},O.min=function(U,I){if(U.cmp(I)<0)return U;return I},O.prototype._init=function(U,I,Q){if(typeof U==="number")return this._initNumber(U,I,Q);if(typeof U==="object")return this._initArray(U,I,Q);if(I==="hex")I=16;L(I===(I|0)&&I>=2&&I<=36),U=U.toString().replace(/\s+/g,"");var X=0;if(U[0]==="-")X++,this.negative=1;if(X=0;X-=3)if(A=U[X]|U[X-1]<<8|U[X-2]<<16,this.words[Z]|=A<<$&67108863,this.words[Z+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,Z++}else if(Q==="le"){for(X=0,Z=0;X>>26-$&67108863,$+=24,$>=26)$-=26,Z++}return this.strip()};function q(U,I){var Q=U.charCodeAt(I);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function D(U,I,Q){var X=q(U,Q);if(Q-1>=I)X|=q(U,Q-1)<<4;return X}O.prototype._parseHex=function(U,I,Q){this.length=Math.ceil((U.length-I)/6),this.words=Array(this.length);for(var X=0;X=I;X-=2)if($=D(U,I,X)<=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8;else{var J=U.length-I;for(X=J%2===0?I+1:I;X=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8}this.strip()};function C(U,I,Q,X){var Z=0,A=Math.min(U.length,Q);for(var $=I;$=49)Z+=J-49+10;else if(J>=17)Z+=J-17+10;else Z+=J}return Z}O.prototype._parseBase=function(U,I,Q){this.words=[0],this.length=1;for(var X=0,Z=1;Z<=67108863;Z*=I)X++;X--,Z=Z/I|0;var A=U.length-Q,$=A%X,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},O.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},O.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(O.prototype.toString=function(U,I){U=U||10,I=I|0||1;var Q;if(U===16||U==="hex"){Q="";var X=0,Z=0;for(var A=0;A>>24-X&16777215,X+=2,X>=26)X-=26,A--;if(Z!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(Z!==0)Q=Z.toString(16)+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},O.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},O.prototype.toJSON=function(){return this.toString(16)},O.prototype.toBuffer=function(U,I){return L(typeof z<"u"),this.toArrayLike(z,U,I)},O.prototype.toArray=function(U,I){return this.toArrayLike(Array,U,I)},O.prototype.toArrayLike=function(U,I,Q){var X=this.byteLength(),Z=Q||Math.max(1,X);L(X<=Z,"byte array longer than desired length"),L(Z>0,"Requested array length <= 0"),this.strip();var A=I==="le",$=new U(Z),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,I>>>=13;if(I>=64)Q+=7,I>>>=7;if(I>=8)Q+=4,I>>>=4;if(I>=2)Q+=2,I>>>=2;return Q+I};O.prototype._zeroBits=function(U){if(U===0)return 26;var I=U,Q=0;if((I&8191)===0)Q+=13,I>>>=13;if((I&127)===0)Q+=7,I>>>=7;if((I&15)===0)Q+=4,I>>>=4;if((I&3)===0)Q+=2,I>>>=2;if((I&1)===0)Q++;return Q},O.prototype.bitLength=function(){var U=this.words[this.length-1],I=this._countBits(U);return(this.length-1)*26+I};function P(U){var I=Array(U.bitLength());for(var Q=0;Q>>Z}return I}O.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var I=0;IU.length)return this.clone().ior(U);return U.clone().ior(this)},O.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},O.prototype.iuand=function(U){var I;if(this.length>U.length)I=U;else I=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},O.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},O.prototype.iuxor=function(U){var I,Q;if(this.length>U.length)I=this,Q=U;else I=U,Q=this;for(var X=0;XU.length)return this.clone().ixor(U);return U.clone().ixor(this)},O.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},O.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var I=Math.ceil(U/26)|0,Q=U%26;if(this._expand(I),Q>0)I--;for(var X=0;X0)this.words[X]=~this.words[X]&67108863>>26-Q;return this.strip()},O.prototype.notn=function(U){return this.clone().inotn(U)},O.prototype.setn=function(U,I){L(typeof U==="number"&&U>=0);var Q=U/26|0,X=U%26;if(this._expand(Q+1),I)this.words[Q]=this.words[Q]|1<U.length)Q=this,X=U;else Q=U,X=this;var Z=0;for(var A=0;A>>26;for(;Z!==0&&A>>26;if(this.length=Q.length,Z!==0)this.words[this.length]=Z,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},O.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var I=this.iadd(U);return U.negative=1,I._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var X,Z;if(Q>0)X=this,Z=U;else X=U,Z=this;var A=0;for(var $=0;$>26,this.words[$]=I&67108863;for(;A!==0&&$>26,this.words[$]=I&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,I.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;Z=U.words[p]|0,A=I.words[w]|0,$=Z*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,I,Q){var X=U.words,Z=I.words,A=Q.words,$=0,J,E,V,S=X[0]|0,H=S&8191,j=S>>>13,w=X[1]|0,p=w&8191,n=w>>>13,G0=X[2]|0,t=G0&8191,d=G0>>>13,I0=X[3]|0,m=I0&8191,U0=I0>>>13,g0=X[4]|0,f=g0&8191,h=g0>>>13,T0=X[5]|0,r=T0&8191,e=T0>>>13,C0=X[6]|0,c=C0&8191,o=C0>>>13,x0=X[7]|0,s=x0&8191,X0=x0>>>13,y0=X[8]|0,L0=y0&8191,$0=y0>>>13,n0=X[9]|0,V0=n0&8191,K0=n0>>>13,r0=Z[0]|0,H0=r0&8191,W0=r0>>>13,RU=Z[1]|0,D0=RU&8191,_0=RU>>>13,CU=Z[2]|0,k0=CU&8191,z0=CU>>>13,WU=Z[3]|0,v0=WU&8191,S0=WU>>>13,AU=Z[4]|0,j0=AU&8191,N0=AU>>>13,LU=Z[5]|0,M0=LU&8191,x=LU>>>13,b=Z[6]|0,a=b&8191,E0=b>>>13,w0=Z[7]|0,A0=w0&8191,F0=w0>>>13,m0=Z[8]|0,q0=m0&8191,B0=m0>>>13,HU=Z[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^I.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,D0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,D0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,D0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,D0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,D0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,D0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,D0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,D0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,D0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,D0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var t0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(t0>>>26)|0,t0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,D0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,D0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(X0,H0)|0,V=Math.imul(X0,W0),J=J+Math.imul(c,D0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,D0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,D0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(X0,D0)|0,V=V+Math.imul(X0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,D0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,D0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(X0,k0)|0,V=V+Math.imul(X0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,D0),E=Math.imul(V0,_0),E=E+Math.imul(K0,D0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(X0,v0)|0,V=V+Math.imul(X0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(X0,j0)|0,V=V+Math.imul(X0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(X0,M0)|0,V=V+Math.imul(X0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(X0,a)|0,V=V+Math.imul(X0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(X0,A0)|0,V=V+Math.imul(X0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(X0,q0)|0,V=V+Math.imul(X0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(X0,P0)|0,V=V+Math.imul(X0,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var JU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=t0,A[6]=a0,A[7]=e0,A[8]=i0,A[9]=UU,A[10]=EU,A[11]=XU,A[12]=IU,A[13]=TU,A[14]=YU,A[15]=ZU,A[16]=OU,A[17]=QU,A[18]=JU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,I,Q){Q.negative=I.negative^U.negative,Q.length=U.length+I.length;var X=0,Z=0;for(var A=0;A>>26)|0,Z+=$>>>26,$&=67108863}Q.words[A]=J,X=$,$=Z}if(X!==0)Q.words[A]=X;else Q.length--;return Q.strip()}function v(U,I,Q){var X=new B;return X.mulp(U,I,Q)}O.prototype.mulTo=function(U,I){var Q,X=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,I);else if(X<63)Q=k(this,U,I);else if(X<1024)Q=N(this,U,I);else Q=v(this,U,I);return Q};function B(U,I){this.x=U,this.y=I}B.prototype.makeRBT=function(U){var I=Array(U),Q=O.prototype._countBits(U)-1;for(var X=0;X>=1;return X},B.prototype.permute=function(U,I,Q,X,Z,A){for(var $=0;$>>1)Z++;return 1<>>13,Q[2*A+1]=Z&8191,Z=Z>>>13;for(A=2*I;A>=26,I+=X/67108864|0,I+=Z>>>26,this.words[Q]=Z&67108863}if(I!==0)this.words[Q]=I,this.length++;return this.length=U===0?1:this.length,this},O.prototype.muln=function(U){return this.clone().imuln(U)},O.prototype.sqr=function(){return this.mul(this)},O.prototype.isqr=function(){return this.imul(this.clone())},O.prototype.pow=function(U){var I=P(U);if(I.length===0)return new O(1);var Q=this;for(var X=0;X=0);var I=U%26,Q=(U-I)/26,X=67108863>>>26-I<<26-I,Z;if(I!==0){var A=0;for(Z=0;Z>>26-I}if(A)this.words[Z]=A,this.length++}if(Q!==0){for(Z=this.length-1;Z>=0;Z--)this.words[Z+Q]=this.words[Z];for(Z=0;Z=0);var X;if(I)X=(I-I%26)/26;else X=0;var Z=U%26,A=Math.min((U-Z)/26,this.length),$=67108863^67108863>>>Z<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=X);E--){var S=this.words[E]|0;this.words[E]=V<<26-Z|S>>>Z,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},O.prototype.ishrn=function(U,I,Q){return L(this.negative===0),this.iushrn(U,I,Q)},O.prototype.shln=function(U){return this.clone().ishln(U)},O.prototype.ushln=function(U){return this.clone().iushln(U)},O.prototype.shrn=function(U){return this.clone().ishrn(U)},O.prototype.ushrn=function(U){return this.clone().iushrn(U)},O.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var I=U%26,Q=(U-I)/26,X=1<=0);var I=U%26,Q=(U-I)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(I!==0)Q++;if(this.length=Math.min(Q,this.length),I!==0){var X=67108863^67108863>>>I<=67108864;I++)if(this.words[I]-=67108864,I===this.length-1)this.words[I+1]=1;else this.words[I+1]++;return this.length=Math.max(this.length,I+1),this},O.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var I=0;I>26)-(J/67108864|0),this.words[Z+Q]=A&67108863}for(;Z>26,this.words[Z+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(Z=0;Z>26,this.words[Z]=A&67108863;return this.negative=1,this.strip()},O.prototype._wordDiv=function(U,I){var Q=this.length-U.length,X=this.clone(),Z=U,A=Z.words[Z.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)Z=Z.ushln(Q),X.iushln(Q),A=Z.words[Z.length-1]|0;var J=X.length-Z.length,E;if(I!=="mod"){E=new O(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(X.words[Z.length+H]|0)*67108864+(X.words[Z.length+H-1]|0);j=Math.min(j/A|0,67108863),X._ishlnsubmul(Z,j,H);while(X.negative!==0)if(j--,X.negative=0,X._ishlnsubmul(Z,1,H),!X.isZero())X.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(X.strip(),I!=="div"&&Q!==0)X.iushrn(Q);return{div:E||null,mod:X}},O.prototype.divmod=function(U,I,Q){if(L(!U.isZero()),this.isZero())return{div:new O(0),mod:new O(0)};var X,Z,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,I),I!=="mod")X=A.div.neg();if(I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.iadd(U)}return{div:X,mod:Z}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),I),I!=="mod")X=A.div.neg();return{div:X,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),I),I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.isub(U)}return{div:A.div,mod:Z}}if(U.length>this.length||this.cmp(U)<0)return{div:new O(0),mod:this};if(U.length===1){if(I==="div")return{div:this.divn(U.words[0]),mod:null};if(I==="mod")return{div:null,mod:new O(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new O(this.modn(U.words[0]))}}return this._wordDiv(U,I)},O.prototype.div=function(U){return this.divmod(U,"div",!1).div},O.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},O.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},O.prototype.divRound=function(U){var I=this.divmod(U);if(I.mod.isZero())return I.div;var Q=I.div.negative!==0?I.mod.isub(U):I.mod,X=U.ushrn(1),Z=U.andln(1),A=Q.cmp(X);if(A<0||Z===1&&A===0)return I.div;return I.div.negative!==0?I.div.isubn(1):I.div.iaddn(1)},O.prototype.modn=function(U){L(U<=67108863);var I=67108864%U,Q=0;for(var X=this.length-1;X>=0;X--)Q=(I*Q+(this.words[X]|0))%U;return Q},O.prototype.idivn=function(U){L(U<=67108863);var I=0;for(var Q=this.length-1;Q>=0;Q--){var X=(this.words[Q]|0)+I*67108864;this.words[Q]=X/U|0,I=X%U}return this.strip()},O.prototype.divn=function(U){return this.clone().idivn(U)},O.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=new O(0),$=new O(1),J=0;while(I.isEven()&&Q.isEven())I.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=I.clone();while(!I.isZero()){for(var S=0,H=1;(I.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){I.iushrn(S);while(S-- >0){if(X.isOdd()||Z.isOdd())X.iadd(E),Z.isub(V);X.iushrn(1),Z.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(A),Z.isub($);else Q.isub(I),A.isub(X),$.isub(Z)}return{a:A,b:$,gcd:Q.iushln(J)}},O.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=Q.clone();while(I.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(I.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){I.iushrn($);while($-- >0){if(X.isOdd())X.iadd(A);X.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(Z.isOdd())Z.iadd(A);Z.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(Z);else Q.isub(I),Z.isub(X)}var S;if(I.cmpn(1)===0)S=X;else S=Z;if(S.cmpn(0)<0)S.iadd(U);return S},O.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var I=this.clone(),Q=U.clone();I.negative=0,Q.negative=0;for(var X=0;I.isEven()&&Q.isEven();X++)I.iushrn(1),Q.iushrn(1);do{while(I.isEven())I.iushrn(1);while(Q.isEven())Q.iushrn(1);var Z=I.cmp(Q);if(Z<0){var A=I;I=Q,Q=A}else if(Z===0||Q.cmpn(1)===0)break;I.isub(Q)}while(!0);return Q.iushln(X)},O.prototype.invm=function(U){return this.egcd(U).a.umod(U)},O.prototype.isEven=function(){return(this.words[0]&1)===0},O.prototype.isOdd=function(){return(this.words[0]&1)===1},O.prototype.andln=function(U){return this.words[0]&U},O.prototype.bincn=function(U){L(typeof U==="number");var I=U%26,Q=(U-I)/26,X=1<>>26,$&=67108863,this.words[A]=$}if(Z!==0)this.words[A]=Z,this.length++;return this},O.prototype.isZero=function(){return this.length===1&&this.words[0]===0},O.prototype.cmpn=function(U){var I=U<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(I)U=-U;L(U<=67108863,"Number is too big");var X=this.words[0]|0;Q=X===U?0:XU.length)return 1;if(this.length=0;Q--){var X=this.words[Q]|0,Z=U.words[Q]|0;if(X===Z)continue;if(XZ)I=1;break}return I},O.prototype.gtn=function(U){return this.cmpn(U)===1},O.prototype.gt=function(U){return this.cmp(U)===1},O.prototype.gten=function(U){return this.cmpn(U)>=0},O.prototype.gte=function(U){return this.cmp(U)>=0},O.prototype.ltn=function(U){return this.cmpn(U)===-1},O.prototype.lt=function(U){return this.cmp(U)===-1},O.prototype.lten=function(U){return this.cmpn(U)<=0},O.prototype.lte=function(U){return this.cmp(U)<=0},O.prototype.eqn=function(U){return this.cmpn(U)===0},O.prototype.eq=function(U){return this.cmp(U)===0},O.red=function(U){return new u(U)},O.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},O.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},O.prototype._forceRed=function(U){return this.red=U,this},O.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},O.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},O.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},O.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},O.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},O.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},O.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},O.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},O.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},O.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},O.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},O.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},O.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},O.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,I){this.name=U,this.p=new O(I,16),this.n=this.p.bitLength(),this.k=new O(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new O(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var I=U,Q;do this.split(I,this.tmp),I=this.imulK(I),I=I.iadd(this.tmp),Q=I.bitLength();while(Q>this.n);var X=Q0)I.isub(this.p);else if(I.strip!==void 0)I.strip();else I._strip();return I},y.prototype.split=function(U,I){U.iushrn(this.n,0,I)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,I){var Q=4194303,X=Math.min(U.length,9);for(var Z=0;Z>>22,A=$}if(A>>>=22,U.words[Z-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var I=0;for(var Q=0;Q>>=26,U.words[Q]=Z,I=X}if(I!==0)U.words[U.length++]=I;return U},O._prime=function(U){if(g[U])return g[U];var I;if(U==="k256")I=new l;else if(U==="p224")I=new Y0;else if(U==="p192")I=new O0;else if(U==="p25519")I=new Z0;else throw Error("Unknown prime "+U);return g[U]=I,I};function u(U){if(typeof U==="string"){var I=O._prime(U);this.m=I.p,this.prime=I}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,I){L((U.negative|I.negative)===0,"red works only with positives"),L(U.red&&U.red===I.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,I){this._verify2(U,I);var Q=U.add(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,I){this._verify2(U,I);var Q=U.iadd(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,I){this._verify2(U,I);var Q=U.sub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,I){this._verify2(U,I);var Q=U.isub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,I){return this._verify1(U),this.imod(U.ushln(I))},u.prototype.imul=function(U,I){return this._verify2(U,I),this.imod(U.imul(I))},u.prototype.mul=function(U,I){return this._verify2(U,I),this.imod(U.mul(I))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var I=this.m.andln(3);if(L(I%2===1),I===3){var Q=this.m.add(new O(1)).iushrn(2);return this.pow(U,Q)}var X=this.m.subn(1),Z=0;while(!X.isZero()&&X.andln(1)===0)Z++,X.iushrn(1);L(!X.isZero());var A=new O(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new O(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,X),S=this.pow(U,X.addn(1).iushrn(1)),H=this.pow(U,X),j=Z;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;Z--){var V=I.words[Z];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==X[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(Z!==0||S!==0))continue;A=this.mul(A,X[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var I=U.umod(this.m);return I===U?I.clone():I},u.prototype.convertFrom=function(U){var I=U.clone();return I.red=null,I},O.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new O(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var I=this.imod(U.mul(this.rinv));return I.red=null,I},i.prototype.imul=function(U,I){if(U.isZero()||I.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,I){if(U.isZero()||I.isZero())return new O(0)._forceRed(this);var Q=U.mul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var I=this.imod(U._invmp(this.m).mul(this.r2));return I._forceRed(this)}})(typeof Y>"u"||Y,T)}),dU=Q0((T,Y)=>{Y.exports=G;function G(K,L){if(!K)throw Error(L||"Assertion failed")}G.equal=function(K,L,W){if(K!=L)throw Error(W||"Assertion failed: "+K+" != "+L)}}),WT=Q0((T)=>{var Y=T;function G(W,O){if(Array.isArray(W))return W.slice();if(!W)return[];var z=[];if(typeof W!=="string"){for(var q=0;q>8,F=D&255;if(C)z.push(C,F);else z.push(F)}return z}Y.toArray=G;function K(W){if(W.length===1)return"0"+W;else return W}Y.zero2=K;function L(W){var O="";for(var z=0;z{var Y=T,G=cU(),K=dU(),L=WT();Y.assert=K,Y.toArray=L.toArray,Y.zero2=L.zero2,Y.toHex=L.toHex,Y.encode=L.encode;function W(C,F,R){var M=Array(Math.max(C.bitLength(),R)+1),P;for(P=0;P(k>>1)-1)N=(k>>1)-v;else N=v;_.isubn(N)}else N=0;M[P]=N,_.iushrn(1)}return M}Y.getNAF=W;function O(C,F){var R=[[],[]];C=C.clone(),F=F.clone();var M=0,P=0,k;while(C.cmpn(-M)>0||F.cmpn(-P)>0){var _=C.andln(3)+M&3,N=F.andln(3)+P&3;if(_===3)_=-1;if(N===3)N=-1;var v;if((_&1)===0)v=0;else if(k=C.andln(7)+M&7,(k===3||k===5)&&N===2)v=-_;else v=_;R[0].push(v);var B;if((N&1)===0)B=0;else if(k=F.andln(7)+P&7,(k===3||k===5)&&_===2)B=-N;else B=N;if(R[1].push(B),2*M===v+1)M=1-M;if(2*P===B+1)P=1-P;C.iushrn(1),F.iushrn(1)}return R}Y.getJSF=O;function z(C,F,R){var M="_"+F;C.prototype[F]=function(){return this[M]!==void 0?this[M]:this[M]=R.call(this)}}Y.cachedProperty=z;function q(C){return typeof C==="string"?Y.toArray(C,"hex"):C}Y.parseBytes=q;function D(C){return new G(C,"hex","le")}Y.intFromLE=D}),HT=Q0((T,Y)=>{var G;Y.exports=function(W){if(!G)G=new K(null);return G.generate(W)};function K(W){this.rand=W}if(Y.exports.Rand=K,K.prototype.generate=function(W){return this._rand(W)},K.prototype._rand=function(W){if(this.rand.getBytes)return this.rand.getBytes(W);var O=new Uint8Array(W);for(var z=0;z{var G=cU(),K=vU(),L=K.getNAF,W=K.getJSF,O=K.assert;function z(D,C){this.type=D,this.p=new G(C.p,16),this.red=C.prime?G.red(C.prime):G.mont(this.p),this.zero=new G(0).toRed(this.red),this.one=new G(1).toRed(this.red),this.two=new G(2).toRed(this.red),this.n=C.n&&new G(C.n,16),this.g=C.g&&this.pointFromJSON(C.g,C.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var F=this.n&&this.p.div(this.n);if(!F||F.cmpn(100)>0)this.redN=null;else this._maxwellTrick=!0,this.redN=this.n.toRed(this.red)}Y.exports=z,z.prototype.point=function(){throw Error("Not implemented")},z.prototype.validate=function(){throw Error("Not implemented")},z.prototype._fixedNafMul=function(D,C){O(D.precomputed);var F=D._getDoubles(),R=L(C,1,this._bitLength),M=(1<=k;N--)_=(_<<1)+R[N];P.push(_)}var v=this.jpoint(null,null,null),B=this.jpoint(null,null,null);for(var g=M;g>0;g--){for(k=0;k=0;_--){for(var N=0;_>=0&&P[_]===0;_--)N++;if(_>=0)N++;if(k=k.dblp(N),_<0)break;var v=P[_];if(O(v!==0),D.type==="affine")if(v>0)k=k.mixedAdd(M[v-1>>1]);else k=k.mixedAdd(M[-v-1>>1].neg());else if(v>0)k=k.add(M[v-1>>1]);else k=k.add(M[-v-1>>1].neg())}return D.type==="affine"?k.toP():k},z.prototype._wnafMulAdd=function(D,C,F,R,M){var P=this._wnafT1,k=this._wnafT2,_=this._wnafT3,N=0,v,B,g;for(v=0;v=1;v-=2){var l=v-1,Y0=v;if(P[l]!==1||P[Y0]!==1){_[l]=L(F[l],P[l],this._bitLength),_[Y0]=L(F[Y0],P[Y0],this._bitLength),N=Math.max(_[l].length,N),N=Math.max(_[Y0].length,N);continue}var O0=[C[l],null,null,C[Y0]];if(C[l].y.cmp(C[Y0].y)===0)O0[1]=C[l].add(C[Y0]),O0[2]=C[l].toJ().mixedAdd(C[Y0].neg());else if(C[l].y.cmp(C[Y0].y.redNeg())===0)O0[1]=C[l].toJ().mixedAdd(C[Y0]),O0[2]=C[l].add(C[Y0].neg());else O0[1]=C[l].toJ().mixedAdd(C[Y0]),O0[2]=C[l].toJ().mixedAdd(C[Y0].neg());var Z0=[-3,-1,-5,-7,0,7,5,1,3],u=W(F[l],F[Y0]);N=Math.max(u[0].length,N),_[l]=Array(N),_[Y0]=Array(N);for(B=0;B=0;v--){var X=0;while(v>=0){var Z=!0;for(B=0;B=0)X++;if(I=I.dblp(X),v<0)break;for(B=0;B0)g=k[B][A-1>>1];else if(A<0)g=k[B][-A-1>>1].neg();if(g.type==="affine")I=I.mixedAdd(g);else I=I.add(g)}}for(v=0;v=Math.ceil((D.bitLength()+1)/C.step)},q.prototype._getDoubles=function(D,C){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var F=[this],R=this;for(var M=0;M{if(typeof Object.create==="function")Y.exports=function(G,K){if(K)G.super_=K,G.prototype=Object.create(K.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0}})};else Y.exports=function(G,K){if(K){G.super_=K;var L=function(){};L.prototype=K.prototype,G.prototype=new L,G.prototype.constructor=G}}}),_U=Q0((T,Y)=>{try{if(G=(xI(),h0(BI)),typeof G.inherits!=="function")throw"";Y.exports=G.inherits}catch(K){Y.exports=mO()}var G}),sO=Q0((T,Y)=>{var G=vU(),K=cU(),L=_U(),W=uE(),O=G.assert;function z(C){W.call(this,"short",C),this.a=new K(C.a,16).toRed(this.red),this.b=new K(C.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(C),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}L(z,W),Y.exports=z,z.prototype._getEndomorphism=function(C){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var F,R;if(C.beta)F=new K(C.beta,16).toRed(this.red);else{var M=this._getEndoRoots(this.p);F=M[0].cmp(M[1])<0?M[0]:M[1],F=F.toRed(this.red)}if(C.lambda)R=new K(C.lambda,16);else{var P=this._getEndoRoots(this.n);if(this.g.mul(P[0]).x.cmp(this.g.x.redMul(F))===0)R=P[0];else R=P[1],O(this.g.mul(R).x.cmp(this.g.x.redMul(F))===0)}var k;if(C.basis)k=C.basis.map(function(_){return{a:new K(_.a,16),b:new K(_.b,16)}});else k=this._getEndoBasis(R);return{beta:F,lambda:R,basis:k}},z.prototype._getEndoRoots=function(C){var F=C===this.p?this.red:K.mont(C),R=new K(2).toRed(F).redInvm(),M=R.redNeg(),P=new K(3).toRed(F).redNeg().redSqrt().redMul(R),k=M.redAdd(P).fromRed(),_=M.redSub(P).fromRed();return[k,_]},z.prototype._getEndoBasis=function(C){var F=this.n.ushrn(Math.floor(this.n.bitLength()/2)),R=C,M=this.n.clone(),P=new K(1),k=new K(0),_=new K(0),N=new K(1),v,B,g,y,l,Y0,O0,Z0=0,u,i;while(R.cmpn(0)!==0){var U=M.div(R);u=M.sub(U.mul(R)),i=_.sub(U.mul(P));var I=N.sub(U.mul(k));if(!g&&u.cmp(F)<0)v=O0.neg(),B=P,g=u.neg(),y=i;else if(g&&++Z0===2)break;O0=u,M=R,R=u,_=P,P=i,N=k,k=I}l=u.neg(),Y0=i;var Q=g.sqr().add(y.sqr()),X=l.sqr().add(Y0.sqr());if(X.cmp(Q)>=0)l=v,Y0=B;if(g.negative)g=g.neg(),y=y.neg();if(l.negative)l=l.neg(),Y0=Y0.neg();return[{a:g,b:y},{a:l,b:Y0}]},z.prototype._endoSplit=function(C){var F=this.endo.basis,R=F[0],M=F[1],P=M.b.mul(C).divRound(this.n),k=R.b.neg().mul(C).divRound(this.n),_=P.mul(R.a),N=k.mul(M.a),v=P.mul(R.b),B=k.mul(M.b),g=C.sub(_).sub(N),y=v.add(B).neg();return{k1:g,k2:y}},z.prototype.pointFromX=function(C,F){if(C=new K(C,16),!C.red)C=C.toRed(this.red);var R=C.redSqr().redMul(C).redIAdd(C.redMul(this.a)).redIAdd(this.b),M=R.redSqrt();if(M.redSqr().redSub(R).cmp(this.zero)!==0)throw Error("invalid point");var P=M.fromRed().isOdd();if(F&&!P||!F&&P)M=M.redNeg();return this.point(C,M)},z.prototype.validate=function(C){if(C.inf)return!0;var{x:F,y:R}=C,M=this.a.redMul(F),P=F.redSqr().redMul(F).redIAdd(M).redIAdd(this.b);return R.redSqr().redISub(P).cmpn(0)===0},z.prototype._endoWnafMulAdd=function(C,F,R){var M=this._endoWnafT1,P=this._endoWnafT2;for(var k=0;k";return""},q.prototype.isInfinity=function(){return this.inf},q.prototype.add=function(C){if(this.inf)return C;if(C.inf)return this;if(this.eq(C))return this.dbl();if(this.neg().eq(C))return this.curve.point(null,null);if(this.x.cmp(C.x)===0)return this.curve.point(null,null);var F=this.y.redSub(C.y);if(F.cmpn(0)!==0)F=F.redMul(this.x.redSub(C.x).redInvm());var R=F.redSqr().redISub(this.x).redISub(C.x),M=F.redMul(this.x.redSub(R)).redISub(this.y);return this.curve.point(R,M)},q.prototype.dbl=function(){if(this.inf)return this;var C=this.y.redAdd(this.y);if(C.cmpn(0)===0)return this.curve.point(null,null);var F=this.curve.a,R=this.x.redSqr(),M=C.redInvm(),P=R.redAdd(R).redIAdd(R).redIAdd(F).redMul(M),k=P.redSqr().redISub(this.x.redAdd(this.x)),_=P.redMul(this.x.redSub(k)).redISub(this.y);return this.curve.point(k,_)},q.prototype.getX=function(){return this.x.fromRed()},q.prototype.getY=function(){return this.y.fromRed()},q.prototype.mul=function(C){if(C=new K(C,16),this.isInfinity())return this;else if(this._hasDoubles(C))return this.curve._fixedNafMul(this,C);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[C]);else return this.curve._wnafMul(this,C)},q.prototype.mulAdd=function(C,F,R){var M=[this,F],P=[C,R];if(this.curve.endo)return this.curve._endoWnafMulAdd(M,P);else return this.curve._wnafMulAdd(1,M,P,2)},q.prototype.jmulAdd=function(C,F,R){var M=[this,F],P=[C,R];if(this.curve.endo)return this.curve._endoWnafMulAdd(M,P,!0);else return this.curve._wnafMulAdd(1,M,P,2,!0)},q.prototype.eq=function(C){return this===C||this.inf===C.inf&&(this.inf||this.x.cmp(C.x)===0&&this.y.cmp(C.y)===0)},q.prototype.neg=function(C){if(this.inf)return this;var F=this.curve.point(this.x,this.y.redNeg());if(C&&this.precomputed){var R=this.precomputed,M=function(P){return P.neg()};F.precomputed={naf:R.naf&&{wnd:R.naf.wnd,points:R.naf.points.map(M)},doubles:R.doubles&&{step:R.doubles.step,points:R.doubles.points.map(M)}}}return F},q.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var C=this.curve.jpoint(this.x,this.y,this.curve.one);return C};function D(C,F,R,M){if(W.BasePoint.call(this,C,"jacobian"),F===null&&R===null&&M===null)this.x=this.curve.one,this.y=this.curve.one,this.z=new K(0);else this.x=new K(F,16),this.y=new K(R,16),this.z=new K(M,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one}L(D,W.BasePoint),z.prototype.jpoint=function(C,F,R){return new D(this,C,F,R)},D.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var C=this.z.redInvm(),F=C.redSqr(),R=this.x.redMul(F),M=this.y.redMul(F).redMul(C);return this.curve.point(R,M)},D.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},D.prototype.add=function(C){if(this.isInfinity())return C;if(C.isInfinity())return this;var F=C.z.redSqr(),R=this.z.redSqr(),M=this.x.redMul(F),P=C.x.redMul(R),k=this.y.redMul(F.redMul(C.z)),_=C.y.redMul(R.redMul(this.z)),N=M.redSub(P),v=k.redSub(_);if(N.cmpn(0)===0)if(v.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var B=N.redSqr(),g=B.redMul(N),y=M.redMul(B),l=v.redSqr().redIAdd(g).redISub(y).redISub(y),Y0=v.redMul(y.redISub(l)).redISub(k.redMul(g)),O0=this.z.redMul(C.z).redMul(N);return this.curve.jpoint(l,Y0,O0)},D.prototype.mixedAdd=function(C){if(this.isInfinity())return C.toJ();if(C.isInfinity())return this;var F=this.z.redSqr(),R=this.x,M=C.x.redMul(F),P=this.y,k=C.y.redMul(F).redMul(this.z),_=R.redSub(M),N=P.redSub(k);if(_.cmpn(0)===0)if(N.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var v=_.redSqr(),B=v.redMul(_),g=R.redMul(v),y=N.redSqr().redIAdd(B).redISub(g).redISub(g),l=N.redMul(g.redISub(y)).redISub(P.redMul(B)),Y0=this.z.redMul(_);return this.curve.jpoint(y,l,Y0)},D.prototype.dblp=function(C){if(C===0)return this;if(this.isInfinity())return this;if(!C)return this.dbl();var F;if(this.curve.zeroA||this.curve.threeA){var R=this;for(F=0;F=0)return!1;if(R.redIAdd(P),this.x.cmp(R)===0)return!0}},D.prototype.inspect=function(){if(this.isInfinity())return"";return""},D.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),rO=Q0((T,Y)=>{var G=cU(),K=_U(),L=uE(),W=vU();function O(q){L.call(this,"mont",q),this.a=new G(q.a,16).toRed(this.red),this.b=new G(q.b,16).toRed(this.red),this.i4=new G(4).toRed(this.red).redInvm(),this.two=new G(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}K(O,L),Y.exports=O,O.prototype.validate=function(q){var D=q.normalize().x,C=D.redSqr(),F=C.redMul(D).redAdd(C.redMul(this.a)).redAdd(D),R=F.redSqrt();return R.redSqr().cmp(F)===0};function z(q,D,C){if(L.BasePoint.call(this,q,"projective"),D===null&&C===null)this.x=this.curve.one,this.z=this.curve.zero;else{if(this.x=new G(D,16),this.z=new G(C,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}K(z,L.BasePoint),O.prototype.decodePoint=function(q,D){return this.point(W.toArray(q,D),1)},O.prototype.point=function(q,D){return new z(this,q,D)},O.prototype.pointFromJSON=function(q){return z.fromJSON(this,q)},z.prototype.precompute=function(){},z.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},z.fromJSON=function(q,D){return new z(q,D[0],D[1]||q.one)},z.prototype.inspect=function(){if(this.isInfinity())return"";return""},z.prototype.isInfinity=function(){return this.z.cmpn(0)===0},z.prototype.dbl=function(){var q=this.x.redAdd(this.z),D=q.redSqr(),C=this.x.redSub(this.z),F=C.redSqr(),R=D.redSub(F),M=D.redMul(F),P=R.redMul(F.redAdd(this.curve.a24.redMul(R)));return this.curve.point(M,P)},z.prototype.add=function(){throw Error("Not supported on Montgomery curve")},z.prototype.diffAdd=function(q,D){var C=this.x.redAdd(this.z),F=this.x.redSub(this.z),R=q.x.redAdd(q.z),M=q.x.redSub(q.z),P=M.redMul(C),k=R.redMul(F),_=D.z.redMul(P.redAdd(k).redSqr()),N=D.x.redMul(P.redISub(k).redSqr());return this.curve.point(_,N)},z.prototype.mul=function(q){var D=q.clone(),C=this,F=this.curve.point(null,null),R=this;for(var M=[];D.cmpn(0)!==0;D.iushrn(1))M.push(D.andln(1));for(var P=M.length-1;P>=0;P--)if(M[P]===0)C=C.diffAdd(F,R),F=F.dbl();else F=C.diffAdd(F,R),C=C.dbl();return F},z.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},z.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},z.prototype.eq=function(q){return this.getX().cmp(q.getX())===0},z.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},z.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),tO=Q0((T,Y)=>{var G=vU(),K=cU(),L=_U(),W=uE(),O=G.assert;function z(D){this.twisted=(D.a|0)!==1,this.mOneA=this.twisted&&(D.a|0)===-1,this.extended=this.mOneA,W.call(this,"edwards",D),this.a=new K(D.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new K(D.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new K(D.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),O(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(D.c|0)===1}L(z,W),Y.exports=z,z.prototype._mulA=function(D){if(this.mOneA)return D.redNeg();else return this.a.redMul(D)},z.prototype._mulC=function(D){if(this.oneC)return D;else return this.c.redMul(D)},z.prototype.jpoint=function(D,C,F,R){return this.point(D,C,F,R)},z.prototype.pointFromX=function(D,C){if(D=new K(D,16),!D.red)D=D.toRed(this.red);var F=D.redSqr(),R=this.c2.redSub(this.a.redMul(F)),M=this.one.redSub(this.c2.redMul(this.d).redMul(F)),P=R.redMul(M.redInvm()),k=P.redSqrt();if(k.redSqr().redSub(P).cmp(this.zero)!==0)throw Error("invalid point");var _=k.fromRed().isOdd();if(C&&!_||!C&&_)k=k.redNeg();return this.point(D,k)},z.prototype.pointFromY=function(D,C){if(D=new K(D,16),!D.red)D=D.toRed(this.red);var F=D.redSqr(),R=F.redSub(this.c2),M=F.redMul(this.d).redMul(this.c2).redSub(this.a),P=R.redMul(M.redInvm());if(P.cmp(this.zero)===0)if(C)throw Error("invalid point");else return this.point(this.zero,D);var k=P.redSqrt();if(k.redSqr().redSub(P).cmp(this.zero)!==0)throw Error("invalid point");if(k.fromRed().isOdd()!==C)k=k.redNeg();return this.point(k,D)},z.prototype.validate=function(D){if(D.isInfinity())return!0;D.normalize();var C=D.x.redSqr(),F=D.y.redSqr(),R=C.redMul(this.a).redAdd(F),M=this.c2.redMul(this.one.redAdd(this.d.redMul(C).redMul(F)));return R.cmp(M)===0};function q(D,C,F,R,M){if(W.BasePoint.call(this,D,"projective"),C===null&&F===null&&R===null)this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0;else{if(this.x=new K(C,16),this.y=new K(F,16),this.z=R?new K(R,16):this.curve.one,this.t=M&&new K(M,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);if(this.t&&!this.t.red)this.t=this.t.toRed(this.curve.red);if(this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t){if(this.t=this.x.redMul(this.y),!this.zOne)this.t=this.t.redMul(this.z.redInvm())}}}L(q,W.BasePoint),z.prototype.pointFromJSON=function(D){return q.fromJSON(this,D)},z.prototype.point=function(D,C,F,R){return new q(this,D,C,F,R)},q.fromJSON=function(D,C){return new q(D,C[0],C[1],C[2])},q.prototype.inspect=function(){if(this.isInfinity())return"";return""},q.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},q.prototype._extDbl=function(){var D=this.x.redSqr(),C=this.y.redSqr(),F=this.z.redSqr();F=F.redIAdd(F);var R=this.curve._mulA(D),M=this.x.redAdd(this.y).redSqr().redISub(D).redISub(C),P=R.redAdd(C),k=P.redSub(F),_=R.redSub(C),N=M.redMul(k),v=P.redMul(_),B=M.redMul(_),g=k.redMul(P);return this.curve.point(N,v,g,B)},q.prototype._projDbl=function(){var D=this.x.redAdd(this.y).redSqr(),C=this.x.redSqr(),F=this.y.redSqr(),R,M,P,k,_,N;if(this.curve.twisted){k=this.curve._mulA(C);var v=k.redAdd(F);if(this.zOne)R=D.redSub(C).redSub(F).redMul(v.redSub(this.curve.two)),M=v.redMul(k.redSub(F)),P=v.redSqr().redSub(v).redSub(v);else _=this.z.redSqr(),N=v.redSub(_).redISub(_),R=D.redSub(C).redISub(F).redMul(N),M=v.redMul(k.redSub(F)),P=v.redMul(N)}else k=C.redAdd(F),_=this.curve._mulC(this.z).redSqr(),N=k.redSub(_).redSub(_),R=this.curve._mulC(D.redISub(k)).redMul(N),M=this.curve._mulC(k).redMul(C.redISub(F)),P=k.redMul(N);return this.curve.point(R,M,P)},q.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()},q.prototype._extAdd=function(D){var C=this.y.redSub(this.x).redMul(D.y.redSub(D.x)),F=this.y.redAdd(this.x).redMul(D.y.redAdd(D.x)),R=this.t.redMul(this.curve.dd).redMul(D.t),M=this.z.redMul(D.z.redAdd(D.z)),P=F.redSub(C),k=M.redSub(R),_=M.redAdd(R),N=F.redAdd(C),v=P.redMul(k),B=_.redMul(N),g=P.redMul(N),y=k.redMul(_);return this.curve.point(v,B,y,g)},q.prototype._projAdd=function(D){var C=this.z.redMul(D.z),F=C.redSqr(),R=this.x.redMul(D.x),M=this.y.redMul(D.y),P=this.curve.d.redMul(R).redMul(M),k=F.redSub(P),_=F.redAdd(P),N=this.x.redAdd(this.y).redMul(D.x.redAdd(D.y)).redISub(R).redISub(M),v=C.redMul(k).redMul(N),B,g;if(this.curve.twisted)B=C.redMul(_).redMul(M.redSub(this.curve._mulA(R))),g=k.redMul(_);else B=C.redMul(_).redMul(M.redSub(R)),g=this.curve._mulC(k).redMul(_);return this.curve.point(v,B,g)},q.prototype.add=function(D){if(this.isInfinity())return D;if(D.isInfinity())return this;if(this.curve.extended)return this._extAdd(D);else return this._projAdd(D)},q.prototype.mul=function(D){if(this._hasDoubles(D))return this.curve._fixedNafMul(this,D);else return this.curve._wnafMul(this,D)},q.prototype.mulAdd=function(D,C,F){return this.curve._wnafMulAdd(1,[this,C],[D,F],2,!1)},q.prototype.jmulAdd=function(D,C,F){return this.curve._wnafMulAdd(1,[this,C],[D,F],2,!0)},q.prototype.normalize=function(){if(this.zOne)return this;var D=this.z.redInvm();if(this.x=this.x.redMul(D),this.y=this.y.redMul(D),this.t)this.t=this.t.redMul(D);return this.z=this.curve.one,this.zOne=!0,this},q.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},q.prototype.getX=function(){return this.normalize(),this.x.fromRed()},q.prototype.getY=function(){return this.normalize(),this.y.fromRed()},q.prototype.eq=function(D){return this===D||this.getX().cmp(D.getX())===0&&this.getY().cmp(D.getY())===0},q.prototype.eqXToP=function(D){var C=D.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(C)===0)return!0;var F=D.clone(),R=this.curve.redN.redMul(this.z);for(;;){if(F.iadd(this.curve.n),F.cmp(this.curve.p)>=0)return!1;if(C.redIAdd(R),this.x.cmp(C)===0)return!0}},q.prototype.toP=q.prototype.normalize,q.prototype.mixedAdd=q.prototype.add}),RT=Q0((T)=>{var Y=T;Y.base=uE(),Y.short=sO(),Y.mont=rO(),Y.edwards=tO()}),xU=Q0((T)=>{var Y=dU(),G=_U();T.inherits=G;function K(I,Q){if((I.charCodeAt(Q)&64512)!==55296)return!1;if(Q<0||Q+1>=I.length)return!1;return(I.charCodeAt(Q+1)&64512)===56320}function L(I,Q){if(Array.isArray(I))return I.slice();if(!I)return[];var X=[];if(typeof I==="string"){if(!Q){var Z=0;for(var A=0;A>6|192,X[Z++]=$&63|128;else if(K(I,A))$=65536+(($&1023)<<10)+(I.charCodeAt(++A)&1023),X[Z++]=$>>18|240,X[Z++]=$>>12&63|128,X[Z++]=$>>6&63|128,X[Z++]=$&63|128;else X[Z++]=$>>12|224,X[Z++]=$>>6&63|128,X[Z++]=$&63|128}}else if(Q==="hex"){if(I=I.replace(/[^a-z0-9]+/ig,""),I.length%2!==0)I="0"+I;for(A=0;A>>24|I>>>8&65280|I<<8&16711680|(I&255)<<24;return Q>>>0}T.htonl=O;function z(I,Q){var X="";for(var Z=0;Z>>0}return $}T.join32=C;function F(I,Q){var X=Array(I.length*4);for(var Z=0,A=0;Z>>24,X[A+1]=$>>>16&255,X[A+2]=$>>>8&255,X[A+3]=$&255;else X[A+3]=$>>>24,X[A+2]=$>>>16&255,X[A+1]=$>>>8&255,X[A]=$&255}return X}T.split32=F;function R(I,Q){return I>>>Q|I<<32-Q}T.rotr32=R;function M(I,Q){return I<>>32-Q}T.rotl32=M;function P(I,Q){return I+Q>>>0}T.sum32=P;function k(I,Q,X){return I+Q+X>>>0}T.sum32_3=k;function _(I,Q,X,Z){return I+Q+X+Z>>>0}T.sum32_4=_;function N(I,Q,X,Z,A){return I+Q+X+Z+A>>>0}T.sum32_5=N;function v(I,Q,X,Z){var A=I[Q],$=I[Q+1],J=Z+$>>>0,E=(J>>0,I[Q+1]=J}T.sum64=v;function B(I,Q,X,Z){var A=Q+Z>>>0,$=(A>>0}T.sum64_hi=B;function g(I,Q,X,Z){var A=Q+Z;return A>>>0}T.sum64_lo=g;function y(I,Q,X,Z,A,$,J,E){var V=0,S=Q;S=S+Z>>>0,V+=S>>0,V+=S<$?1:0,S=S+E>>>0,V+=S>>0}T.sum64_4_hi=y;function l(I,Q,X,Z,A,$,J,E){var V=Q+Z+$+E;return V>>>0}T.sum64_4_lo=l;function Y0(I,Q,X,Z,A,$,J,E,V,S){var H=0,j=Q;j=j+Z>>>0,H+=j>>0,H+=j<$?1:0,j=j+E>>>0,H+=j>>0,H+=j>>0}T.sum64_5_hi=Y0;function O0(I,Q,X,Z,A,$,J,E,V,S){var H=Q+Z+$+E+S;return H>>>0}T.sum64_5_lo=O0;function Z0(I,Q,X){var Z=Q<<32-X|I>>>X;return Z>>>0}T.rotr64_hi=Z0;function u(I,Q,X){var Z=I<<32-X|Q>>>X;return Z>>>0}T.rotr64_lo=u;function i(I,Q,X){return I>>>X}T.shr64_hi=i;function U(I,Q,X){var Z=I<<32-X|Q>>>X;return Z>>>0}T.shr64_lo=U}),HE=Q0((T)=>{var Y=xU(),G=dU();function K(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}T.BlockHash=K,K.prototype.update=function(L,W){if(L=Y.toArray(L,W),!this.pending)this.pending=L;else this.pending=this.pending.concat(L);if(this.pendingTotal+=L.length,this.pending.length>=this._delta8){L=this.pending;var O=L.length%this._delta8;if(this.pending=L.slice(L.length-O,L.length),this.pending.length===0)this.pending=null;L=Y.join32(L,0,L.length-O,this.endian);for(var z=0;z>>24&255,z[q++]=L>>>16&255,z[q++]=L>>>8&255,z[q++]=L&255}else{z[q++]=L&255,z[q++]=L>>>8&255,z[q++]=L>>>16&255,z[q++]=L>>>24&255,z[q++]=0,z[q++]=0,z[q++]=0,z[q++]=0;for(D=8;D{var Y=xU(),G=Y.rotr32;function K(F,R,M,P){if(F===0)return L(R,M,P);if(F===1||F===3)return O(R,M,P);if(F===2)return W(R,M,P)}T.ft_1=K;function L(F,R,M){return F&R^~F&M}T.ch32=L;function W(F,R,M){return F&R^F&M^R&M}T.maj32=W;function O(F,R,M){return F^R^M}T.p32=O;function z(F){return G(F,2)^G(F,13)^G(F,22)}T.s0_256=z;function q(F){return G(F,6)^G(F,11)^G(F,25)}T.s1_256=q;function D(F){return G(F,7)^G(F,18)^F>>>3}T.g0_256=D;function C(F){return G(F,17)^G(F,19)^F>>>10}T.g1_256=C}),aO=Q0((T,Y)=>{var G=xU(),K=HE(),L=CT(),W=G.rotl32,O=G.sum32,z=G.sum32_5,q=L.ft_1,D=K.BlockHash,C=[1518500249,1859775393,2400959708,3395469782];function F(){if(!(this instanceof F))return new F;D.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(F,D),Y.exports=F,F.blockSize=512,F.outSize=160,F.hmacStrength=80,F.padLength=64,F.prototype._update=function(R,M){var P=this.W;for(var k=0;k<16;k++)P[k]=R[M+k];for(;k{var G=xU(),K=HE(),L=CT(),W=dU(),O=G.sum32,z=G.sum32_4,q=G.sum32_5,D=L.ch32,C=L.maj32,F=L.s0_256,R=L.s1_256,M=L.g0_256,P=L.g1_256,k=K.BlockHash,_=[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];function N(){if(!(this instanceof N))return new N;k.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=_,this.W=Array(64)}G.inherits(N,k),Y.exports=N,N.blockSize=512,N.outSize=256,N.hmacStrength=192,N.padLength=64,N.prototype._update=function(v,B){var g=this.W;for(var y=0;y<16;y++)g[y]=v[B+y];for(;y{var G=xU(),K=DT();function L(){if(!(this instanceof L))return new L;K.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(L,K),Y.exports=L,L.blockSize=512,L.outSize=224,L.hmacStrength=192,L.padLength=64,L.prototype._digest=function(W){if(W==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),zT=Q0((T,Y)=>{var G=xU(),K=HE(),L=dU(),W=G.rotr64_hi,O=G.rotr64_lo,z=G.shr64_hi,q=G.shr64_lo,D=G.sum64,C=G.sum64_hi,F=G.sum64_lo,R=G.sum64_4_hi,M=G.sum64_4_lo,P=G.sum64_5_hi,k=G.sum64_5_lo,_=K.BlockHash,N=[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];function v(){if(!(this instanceof v))return new v;_.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=N,this.W=Array(160)}G.inherits(v,_),Y.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(X,Z){var A=this.W;for(var $=0;$<32;$++)A[$]=X[Z+$];for(;${var G=xU(),K=zT();function L(){if(!(this instanceof L))return new L;K.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(L,K),Y.exports=L,L.blockSize=1024,L.outSize=384,L.hmacStrength=192,L.padLength=128,L.prototype._digest=function(W){if(W==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),UQ=Q0((T)=>{T.sha1=aO(),T.sha224=eO(),T.sha256=DT(),T.sha384=iO(),T.sha512=zT()}),EQ=Q0((T)=>{var Y=xU(),G=HE(),K=Y.rotl32,L=Y.sum32,W=Y.sum32_3,O=Y.sum32_4,z=G.BlockHash;function q(){if(!(this instanceof q))return new q;z.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Y.inherits(q,z),T.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(_,N){var v=this.h[0],B=this.h[1],g=this.h[2],y=this.h[3],l=this.h[4],Y0=v,O0=B,Z0=g,u=y,i=l;for(var U=0;U<80;U++){var I=L(K(O(v,D(U,B,g,y),_[R[U]+N],C(U)),P[U]),l);v=l,l=y,y=K(g,10),g=B,B=I,I=L(K(O(Y0,D(79-U,O0,Z0,u),_[M[U]+N],F(U)),k[U]),i),Y0=i,i=u,u=K(Z0,10),Z0=O0,O0=I}I=W(this.h[1],g,u),this.h[1]=W(this.h[2],y,i),this.h[2]=W(this.h[3],l,Y0),this.h[3]=W(this.h[4],v,O0),this.h[4]=W(this.h[0],B,Z0),this.h[0]=I},q.prototype._digest=function(_){if(_==="hex")return Y.toHex32(this.h,"little");else return Y.split32(this.h,"little")};function D(_,N,v,B){if(_<=15)return N^v^B;else if(_<=31)return N&v|~N&B;else if(_<=47)return(N|~v)^B;else if(_<=63)return N&B|v&~B;else return N^(v|~B)}function C(_){if(_<=15)return 0;else if(_<=31)return 1518500249;else if(_<=47)return 1859775393;else if(_<=63)return 2400959708;else return 2840853838}function F(_){if(_<=15)return 1352829926;else if(_<=31)return 1548603684;else if(_<=47)return 1836072691;else if(_<=63)return 2053994217;else return 0}var R=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],M=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],k=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),XQ=Q0((T,Y)=>{var G=xU(),K=dU();function L(W,O,z){if(!(this instanceof L))return new L(W,O,z);this.Hash=W,this.blockSize=W.blockSize/8,this.outSize=W.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(O,z))}Y.exports=L,L.prototype._init=function(W){if(W.length>this.blockSize)W=new this.Hash().update(W).digest();K(W.length<=this.blockSize);for(var O=W.length;O{var Y=T;Y.utils=xU(),Y.common=HE(),Y.sha=UQ(),Y.ripemd=EQ(),Y.hmac=XQ(),Y.sha1=Y.sha.sha1,Y.sha256=Y.sha.sha256,Y.sha224=Y.sha.sha224,Y.sha384=Y.sha.sha384,Y.sha512=Y.sha.sha512,Y.ripemd160=Y.ripemd.ripemd160}),IQ=Q0((T,Y)=>{Y.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}}),xX=Q0((T)=>{var Y=T,G=BX(),K=RT(),L=vU(),W=L.assert;function O(D){if(D.type==="short")this.curve=new K.short(D);else if(D.type==="edwards")this.curve=new K.edwards(D);else this.curve=new K.mont(D);this.g=this.curve.g,this.n=this.curve.n,this.hash=D.hash,W(this.g.validate(),"Invalid curve"),W(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}Y.PresetCurve=O;function z(D,C){Object.defineProperty(Y,D,{configurable:!0,enumerable:!0,get:function(){var F=new O(C);return Object.defineProperty(Y,D,{configurable:!0,enumerable:!0,value:F}),F}})}z("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:G.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),z("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:G.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),z("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:G.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),z("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:G.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),z("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:G.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),z("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:G.sha256,gRed:!1,g:["9"]}),z("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:G.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var q;try{q=IQ()}catch(D){q=void 0}z("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:G.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",q]})}),TQ=Q0((T,Y)=>{var G=BX(),K=WT(),L=dU();function W(O){if(!(this instanceof W))return new W(O);this.hash=O.hash,this.predResist=!!O.predResist,this.outLen=this.hash.outSize,this.minEntropy=O.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var z=K.toArray(O.entropy,O.entropyEnc||"hex"),q=K.toArray(O.nonce,O.nonceEnc||"hex"),D=K.toArray(O.pers,O.persEnc||"hex");L(z.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(z,q,D)}Y.exports=W,W.prototype._init=function(O,z,q){var D=O.concat(z).concat(q);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var C=0;C=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(O.concat(q||[])),this._reseed=1},W.prototype.generate=function(O,z,q,D){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");if(typeof z!=="string")D=q,q=z,z=null;if(q)q=K.toArray(q,D||"hex"),this._update(q);var C=[];while(C.length{var G=cU(),K=vU(),L=K.assert;function W(O,z){if(this.ec=O,this.priv=null,this.pub=null,z.priv)this._importPrivate(z.priv,z.privEnc);if(z.pub)this._importPublic(z.pub,z.pubEnc)}Y.exports=W,W.fromPublic=function(O,z,q){if(z instanceof W)return z;return new W(O,{pub:z,pubEnc:q})},W.fromPrivate=function(O,z,q){if(z instanceof W)return z;return new W(O,{priv:z,privEnc:q})},W.prototype.validate=function(){var O=this.getPublic();if(O.isInfinity())return{result:!1,reason:"Invalid public key"};if(!O.validate())return{result:!1,reason:"Public key is not a point"};if(!O.mul(this.ec.curve.n).isInfinity())return{result:!1,reason:"Public key * N != O"};return{result:!0,reason:null}},W.prototype.getPublic=function(O,z){if(typeof O==="string")z=O,O=null;if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!z)return this.pub;return this.pub.encode(z,O)},W.prototype.getPrivate=function(O){if(O==="hex")return this.priv.toString(16,2);else return this.priv},W.prototype._importPrivate=function(O,z){this.priv=new G(O,z||16),this.priv=this.priv.umod(this.ec.curve.n)},W.prototype._importPublic=function(O,z){if(O.x||O.y){if(this.ec.curve.type==="mont")L(O.x,"Need x coordinate");else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")L(O.x&&O.y,"Need both x and y coordinate");this.pub=this.ec.curve.point(O.x,O.y);return}this.pub=this.ec.curve.decodePoint(O,z)},W.prototype.derive=function(O){if(!O.validate())L(O.validate(),"public point not validated");return O.mul(this.priv).getX()},W.prototype.sign=function(O,z,q){return this.ec.sign(O,this,z,q)},W.prototype.verify=function(O,z,q){return this.ec.verify(O,z,this,void 0,q)},W.prototype.inspect=function(){return""}}),ZQ=Q0((T,Y)=>{var G=cU(),K=vU(),L=K.assert;function W(C,F){if(C instanceof W)return C;if(this._importDER(C,F))return;if(L(C.r&&C.s,"Signature without r or s"),this.r=new G(C.r,16),this.s=new G(C.s,16),C.recoveryParam===void 0)this.recoveryParam=null;else this.recoveryParam=C.recoveryParam}Y.exports=W;function O(){this.place=0}function z(C,F){var R=C[F.place++];if(!(R&128))return R;var M=R&15;if(M===0||M>4)return!1;if(C[F.place]===0)return!1;var P=0;for(var k=0,_=F.place;k>>=0;if(P<=127)return!1;return F.place=_,P}function q(C){var F=0,R=C.length-1;while(!C[F]&&!(C[F+1]&128)&&F>>3);C.push(R|128);while(--R)C.push(F>>>(R<<3)&255);C.push(F)}W.prototype.toDER=function(C){var F=this.r.toArray(),R=this.s.toArray();if(F[0]&128)F=[0].concat(F);if(R[0]&128)R=[0].concat(R);F=q(F),R=q(R);while(!R[0]&&!(R[1]&128))R=R.slice(1);var M=[2];D(M,F.length),M=M.concat(F),M.push(2),D(M,R.length);var P=M.concat(R),k=[48];return D(k,P.length),k=k.concat(P),K.encode(k,C)}}),OQ=Q0((T,Y)=>{var G=cU(),K=TQ(),L=vU(),W=xX(),O=HT(),z=L.assert,q=YQ(),D=ZQ();function C(F){if(!(this instanceof C))return new C(F);if(typeof F==="string")z(Object.prototype.hasOwnProperty.call(W,F),"Unknown curve "+F),F=W[F];if(F instanceof W.PresetCurve)F={curve:F};this.curve=F.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=F.curve.g,this.g.precompute(F.curve.n.bitLength()+1),this.hash=F.hash||F.curve.hash}Y.exports=C,C.prototype.keyPair=function(F){return new q(this,F)},C.prototype.keyFromPrivate=function(F,R){return q.fromPrivate(this,F,R)},C.prototype.keyFromPublic=function(F,R){return q.fromPublic(this,F,R)},C.prototype.genKeyPair=function(F){if(!F)F={};var R=new K({hash:this.hash,pers:F.pers,persEnc:F.persEnc||"utf8",entropy:F.entropy||O(this.hash.hmacStrength),entropyEnc:F.entropy&&F.entropyEnc||"utf8",nonce:this.n.toArray()}),M=this.n.byteLength(),P=this.n.sub(new G(2));for(;;){var k=new G(R.generate(M));if(k.cmp(P)>0)continue;return k.iaddn(1),this.keyFromPrivate(k)}},C.prototype._truncateToN=function(F,R,M){var P;if(G.isBN(F)||typeof F==="number")F=new G(F,16),P=F.byteLength();else if(typeof F==="object")P=F.length,F=new G(F,16);else{var k=F.toString();P=k.length+1>>>1,F=new G(k,16)}if(typeof M!=="number")M=P*8;var _=M-this.n.bitLength();if(_>0)F=F.ushrn(_);if(!R&&F.cmp(this.n)>=0)return F.sub(this.n);else return F},C.prototype.sign=function(F,R,M,P){if(typeof M==="object")P=M,M=null;if(!P)P={};if(typeof F!=="string"&&typeof F!=="number"&&!G.isBN(F)){z(typeof F==="object"&&F&&typeof F.length==="number","Expected message to be an array-like, a hex string, or a BN instance"),z(F.length>>>0===F.length);for(var k=0;k=0)continue;var Y0=this.g.mul(l);if(Y0.isInfinity())continue;var O0=Y0.getX(),Z0=O0.umod(this.n);if(Z0.cmpn(0)===0)continue;var u=l.invm(this.n).mul(Z0.mul(R.getPrivate()).iadd(F));if(u=u.umod(this.n),u.cmpn(0)===0)continue;var i=(Y0.getY().isOdd()?1:0)|(O0.cmp(Z0)!==0?2:0);if(P.canonical&&u.cmp(this.nh)>0)u=this.n.sub(u),i^=1;return new D({r:Z0,s:u,recoveryParam:i})}},C.prototype.verify=function(F,R,M,P,k){if(!k)k={};F=this._truncateToN(F,!1,k.msgBitLength),M=this.keyFromPublic(M,P),R=new D(R,"hex");var{r:_,s:N}=R;if(_.cmpn(1)<0||_.cmp(this.n)>=0)return!1;if(N.cmpn(1)<0||N.cmp(this.n)>=0)return!1;var v=N.invm(this.n),B=v.mul(F).umod(this.n),g=v.mul(_).umod(this.n),y;if(!this.curve._maxwellTrick){if(y=this.g.mulAdd(B,M.getPublic(),g),y.isInfinity())return!1;return y.getX().umod(this.n).cmp(_)===0}if(y=this.g.jmulAdd(B,M.getPublic(),g),y.isInfinity())return!1;return y.eqXToP(_)},C.prototype.recoverPubKey=function(F,R,M,P){z((3&M)===M,"The recovery param is more than two bits"),R=new D(R,P);var k=this.n,_=new G(F),N=R.r,v=R.s,B=M&1,g=M>>1;if(N.cmp(this.curve.p.umod(this.curve.n))>=0&&g)throw Error("Unable to find sencond key candinate");if(g)N=this.curve.pointFromX(N.add(this.curve.n),B);else N=this.curve.pointFromX(N,B);var y=R.r.invm(k),l=k.sub(_).mul(y).umod(k),Y0=v.mul(y).umod(k);return this.g.mulAdd(l,N,Y0)},C.prototype.getKeyRecoveryParam=function(F,R,M,P){if(R=new D(R,P),R.recoveryParam!==null)return R.recoveryParam;for(var k=0;k<4;k++){var _;try{_=this.recoverPubKey(F,R,k)}catch(N){continue}if(_.eq(M))return k}throw Error("Unable to find valid recovery factor")}}),QQ=Q0((T,Y)=>{var G=vU(),K=G.assert,L=G.parseBytes,W=G.cachedProperty;function O(z,q){if(this.eddsa=z,this._secret=L(q.secret),z.isPoint(q.pub))this._pub=q.pub;else this._pubBytes=L(q.pub)}O.fromPublic=function(z,q){if(q instanceof O)return q;return new O(z,{pub:q})},O.fromSecret=function(z,q){if(q instanceof O)return q;return new O(z,{secret:q})},O.prototype.secret=function(){return this._secret},W(O,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),W(O,"pub",function(){if(this._pubBytes)return this.eddsa.decodePoint(this._pubBytes);return this.eddsa.g.mul(this.priv())}),W(O,"privBytes",function(){var z=this.eddsa,q=this.hash(),D=z.encodingLength-1,C=q.slice(0,z.encodingLength);return C[0]&=248,C[D]&=127,C[D]|=64,C}),W(O,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),W(O,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),W(O,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),O.prototype.sign=function(z){return K(this._secret,"KeyPair can only verify"),this.eddsa.sign(z,this)},O.prototype.verify=function(z,q){return this.eddsa.verify(z,q,this)},O.prototype.getSecret=function(z){return K(this._secret,"KeyPair is public only"),G.encode(this.secret(),z)},O.prototype.getPublic=function(z){return G.encode(this.pubBytes(),z)},Y.exports=O}),JQ=Q0((T,Y)=>{var G=cU(),K=vU(),L=K.assert,W=K.cachedProperty,O=K.parseBytes;function z(q,D){if(this.eddsa=q,typeof D!=="object")D=O(D);if(Array.isArray(D))L(D.length===q.encodingLength*2,"Signature has invalid size"),D={R:D.slice(0,q.encodingLength),S:D.slice(q.encodingLength)};if(L(D.R&&D.S,"Signature without R or S"),q.isPoint(D.R))this._R=D.R;if(D.S instanceof G)this._S=D.S;this._Rencoded=Array.isArray(D.R)?D.R:D.Rencoded,this._Sencoded=Array.isArray(D.S)?D.S:D.Sencoded}W(z,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),W(z,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),W(z,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),W(z,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),z.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},z.prototype.toHex=function(){return K.encode(this.toBytes(),"hex").toUpperCase()},Y.exports=z}),GQ=Q0((T,Y)=>{var G=BX(),K=xX(),L=vU(),W=L.assert,O=L.parseBytes,z=QQ(),q=JQ();function D(C){if(W(C==="ed25519","only tested with ed25519 so far"),!(this instanceof D))return new D(C);C=K[C].curve,this.curve=C,this.g=C.g,this.g.precompute(C.n.bitLength()+1),this.pointClass=C.point().constructor,this.encodingLength=Math.ceil(C.n.bitLength()/8),this.hash=G.sha512}Y.exports=D,D.prototype.sign=function(C,F){C=O(C);var R=this.keyFromSecret(F),M=this.hashInt(R.messagePrefix(),C),P=this.g.mul(M),k=this.encodePoint(P),_=this.hashInt(k,R.pubBytes(),C).mul(R.priv()),N=M.add(_).umod(this.curve.n);return this.makeSignature({R:P,S:N,Rencoded:k})},D.prototype.verify=function(C,F,R){if(C=O(C),F=this.makeSignature(F),F.S().gte(F.eddsa.curve.n)||F.S().isNeg())return!1;var M=this.keyFromPublic(R),P=this.hashInt(F.Rencoded(),M.pubBytes(),C),k=this.g.mul(F.S()),_=F.R().add(M.pub().mul(P));return _.eq(k)},D.prototype.hashInt=function(){var C=this.hash();for(var F=0;F{var Y=T;Y.version=nO().version,Y.utils=vU(),Y.rand=HT(),Y.curve=RT(),Y.curves=xX(),Y.ec=OQ(),Y.eddsa=GQ()}),AQ=Q0((T,Y)=>{(function(G,K){function L(U,I){if(!U)throw Error(I||"Assertion failed")}function W(U,I){U.super_=I;var Q=function(){};Q.prototype=I.prototype,U.prototype=new Q,U.prototype.constructor=U}function O(U,I,Q){if(O.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(I==="le"||I==="be")Q=I,I=10;this._init(U||0,I||10,Q||"be")}}if(typeof G==="object")G.exports=O;else K.BN=O;O.BN=O,O.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}O.isBN=function(U){if(U instanceof O)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===O.wordSize&&Array.isArray(U.words)},O.max=function(U,I){if(U.cmp(I)>0)return U;return I},O.min=function(U,I){if(U.cmp(I)<0)return U;return I},O.prototype._init=function(U,I,Q){if(typeof U==="number")return this._initNumber(U,I,Q);if(typeof U==="object")return this._initArray(U,I,Q);if(I==="hex")I=16;L(I===(I|0)&&I>=2&&I<=36),U=U.toString().replace(/\s+/g,"");var X=0;if(U[0]==="-")X++,this.negative=1;if(X=0;X-=3)if(A=U[X]|U[X-1]<<8|U[X-2]<<16,this.words[Z]|=A<<$&67108863,this.words[Z+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,Z++}else if(Q==="le"){for(X=0,Z=0;X>>26-$&67108863,$+=24,$>=26)$-=26,Z++}return this.strip()};function q(U,I){var Q=U.charCodeAt(I);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function D(U,I,Q){var X=q(U,Q);if(Q-1>=I)X|=q(U,Q-1)<<4;return X}O.prototype._parseHex=function(U,I,Q){this.length=Math.ceil((U.length-I)/6),this.words=Array(this.length);for(var X=0;X=I;X-=2)if($=D(U,I,X)<=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8;else{var J=U.length-I;for(X=J%2===0?I+1:I;X=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8}this.strip()};function C(U,I,Q,X){var Z=0,A=Math.min(U.length,Q);for(var $=I;$=49)Z+=J-49+10;else if(J>=17)Z+=J-17+10;else Z+=J}return Z}O.prototype._parseBase=function(U,I,Q){this.words=[0],this.length=1;for(var X=0,Z=1;Z<=67108863;Z*=I)X++;X--,Z=Z/I|0;var A=U.length-Q,$=A%X,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},O.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},O.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(O.prototype.toString=function(U,I){U=U||10,I=I|0||1;var Q;if(U===16||U==="hex"){Q="";var X=0,Z=0;for(var A=0;A>>24-X&16777215,X+=2,X>=26)X-=26,A--;if(Z!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(Z!==0)Q=Z.toString(16)+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},O.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},O.prototype.toJSON=function(){return this.toString(16)},O.prototype.toBuffer=function(U,I){return L(typeof z<"u"),this.toArrayLike(z,U,I)},O.prototype.toArray=function(U,I){return this.toArrayLike(Array,U,I)},O.prototype.toArrayLike=function(U,I,Q){var X=this.byteLength(),Z=Q||Math.max(1,X);L(X<=Z,"byte array longer than desired length"),L(Z>0,"Requested array length <= 0"),this.strip();var A=I==="le",$=new U(Z),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,I>>>=13;if(I>=64)Q+=7,I>>>=7;if(I>=8)Q+=4,I>>>=4;if(I>=2)Q+=2,I>>>=2;return Q+I};O.prototype._zeroBits=function(U){if(U===0)return 26;var I=U,Q=0;if((I&8191)===0)Q+=13,I>>>=13;if((I&127)===0)Q+=7,I>>>=7;if((I&15)===0)Q+=4,I>>>=4;if((I&3)===0)Q+=2,I>>>=2;if((I&1)===0)Q++;return Q},O.prototype.bitLength=function(){var U=this.words[this.length-1],I=this._countBits(U);return(this.length-1)*26+I};function P(U){var I=Array(U.bitLength());for(var Q=0;Q>>Z}return I}O.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var I=0;IU.length)return this.clone().ior(U);return U.clone().ior(this)},O.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},O.prototype.iuand=function(U){var I;if(this.length>U.length)I=U;else I=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},O.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},O.prototype.iuxor=function(U){var I,Q;if(this.length>U.length)I=this,Q=U;else I=U,Q=this;for(var X=0;XU.length)return this.clone().ixor(U);return U.clone().ixor(this)},O.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},O.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var I=Math.ceil(U/26)|0,Q=U%26;if(this._expand(I),Q>0)I--;for(var X=0;X0)this.words[X]=~this.words[X]&67108863>>26-Q;return this.strip()},O.prototype.notn=function(U){return this.clone().inotn(U)},O.prototype.setn=function(U,I){L(typeof U==="number"&&U>=0);var Q=U/26|0,X=U%26;if(this._expand(Q+1),I)this.words[Q]=this.words[Q]|1<U.length)Q=this,X=U;else Q=U,X=this;var Z=0;for(var A=0;A>>26;for(;Z!==0&&A>>26;if(this.length=Q.length,Z!==0)this.words[this.length]=Z,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},O.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var I=this.iadd(U);return U.negative=1,I._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var X,Z;if(Q>0)X=this,Z=U;else X=U,Z=this;var A=0;for(var $=0;$>26,this.words[$]=I&67108863;for(;A!==0&&$>26,this.words[$]=I&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,I.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;Z=U.words[p]|0,A=I.words[w]|0,$=Z*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,I,Q){var X=U.words,Z=I.words,A=Q.words,$=0,J,E,V,S=X[0]|0,H=S&8191,j=S>>>13,w=X[1]|0,p=w&8191,n=w>>>13,G0=X[2]|0,t=G0&8191,d=G0>>>13,I0=X[3]|0,m=I0&8191,U0=I0>>>13,g0=X[4]|0,f=g0&8191,h=g0>>>13,T0=X[5]|0,r=T0&8191,e=T0>>>13,C0=X[6]|0,c=C0&8191,o=C0>>>13,x0=X[7]|0,s=x0&8191,X0=x0>>>13,y0=X[8]|0,L0=y0&8191,$0=y0>>>13,n0=X[9]|0,V0=n0&8191,K0=n0>>>13,r0=Z[0]|0,H0=r0&8191,W0=r0>>>13,RU=Z[1]|0,D0=RU&8191,_0=RU>>>13,CU=Z[2]|0,k0=CU&8191,z0=CU>>>13,WU=Z[3]|0,v0=WU&8191,S0=WU>>>13,AU=Z[4]|0,j0=AU&8191,N0=AU>>>13,LU=Z[5]|0,M0=LU&8191,x=LU>>>13,b=Z[6]|0,a=b&8191,E0=b>>>13,w0=Z[7]|0,A0=w0&8191,F0=w0>>>13,m0=Z[8]|0,q0=m0&8191,B0=m0>>>13,HU=Z[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^I.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,D0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,D0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,D0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,D0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,D0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,D0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,D0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,D0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,D0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,D0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var t0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(t0>>>26)|0,t0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,D0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,D0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(X0,H0)|0,V=Math.imul(X0,W0),J=J+Math.imul(c,D0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,D0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,D0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(X0,D0)|0,V=V+Math.imul(X0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,D0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,D0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(X0,k0)|0,V=V+Math.imul(X0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,D0),E=Math.imul(V0,_0),E=E+Math.imul(K0,D0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(X0,v0)|0,V=V+Math.imul(X0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(X0,j0)|0,V=V+Math.imul(X0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(X0,M0)|0,V=V+Math.imul(X0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(X0,a)|0,V=V+Math.imul(X0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(X0,A0)|0,V=V+Math.imul(X0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(X0,q0)|0,V=V+Math.imul(X0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(X0,P0)|0,V=V+Math.imul(X0,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var JU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=t0,A[6]=a0,A[7]=e0,A[8]=i0,A[9]=UU,A[10]=EU,A[11]=XU,A[12]=IU,A[13]=TU,A[14]=YU,A[15]=ZU,A[16]=OU,A[17]=QU,A[18]=JU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,I,Q){Q.negative=I.negative^U.negative,Q.length=U.length+I.length;var X=0,Z=0;for(var A=0;A>>26)|0,Z+=$>>>26,$&=67108863}Q.words[A]=J,X=$,$=Z}if(X!==0)Q.words[A]=X;else Q.length--;return Q.strip()}function v(U,I,Q){var X=new B;return X.mulp(U,I,Q)}O.prototype.mulTo=function(U,I){var Q,X=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,I);else if(X<63)Q=k(this,U,I);else if(X<1024)Q=N(this,U,I);else Q=v(this,U,I);return Q};function B(U,I){this.x=U,this.y=I}B.prototype.makeRBT=function(U){var I=Array(U),Q=O.prototype._countBits(U)-1;for(var X=0;X>=1;return X},B.prototype.permute=function(U,I,Q,X,Z,A){for(var $=0;$>>1)Z++;return 1<>>13,Q[2*A+1]=Z&8191,Z=Z>>>13;for(A=2*I;A>=26,I+=X/67108864|0,I+=Z>>>26,this.words[Q]=Z&67108863}if(I!==0)this.words[Q]=I,this.length++;return this.length=U===0?1:this.length,this},O.prototype.muln=function(U){return this.clone().imuln(U)},O.prototype.sqr=function(){return this.mul(this)},O.prototype.isqr=function(){return this.imul(this.clone())},O.prototype.pow=function(U){var I=P(U);if(I.length===0)return new O(1);var Q=this;for(var X=0;X=0);var I=U%26,Q=(U-I)/26,X=67108863>>>26-I<<26-I,Z;if(I!==0){var A=0;for(Z=0;Z>>26-I}if(A)this.words[Z]=A,this.length++}if(Q!==0){for(Z=this.length-1;Z>=0;Z--)this.words[Z+Q]=this.words[Z];for(Z=0;Z=0);var X;if(I)X=(I-I%26)/26;else X=0;var Z=U%26,A=Math.min((U-Z)/26,this.length),$=67108863^67108863>>>Z<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=X);E--){var S=this.words[E]|0;this.words[E]=V<<26-Z|S>>>Z,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},O.prototype.ishrn=function(U,I,Q){return L(this.negative===0),this.iushrn(U,I,Q)},O.prototype.shln=function(U){return this.clone().ishln(U)},O.prototype.ushln=function(U){return this.clone().iushln(U)},O.prototype.shrn=function(U){return this.clone().ishrn(U)},O.prototype.ushrn=function(U){return this.clone().iushrn(U)},O.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var I=U%26,Q=(U-I)/26,X=1<=0);var I=U%26,Q=(U-I)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(I!==0)Q++;if(this.length=Math.min(Q,this.length),I!==0){var X=67108863^67108863>>>I<=67108864;I++)if(this.words[I]-=67108864,I===this.length-1)this.words[I+1]=1;else this.words[I+1]++;return this.length=Math.max(this.length,I+1),this},O.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var I=0;I>26)-(J/67108864|0),this.words[Z+Q]=A&67108863}for(;Z>26,this.words[Z+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(Z=0;Z>26,this.words[Z]=A&67108863;return this.negative=1,this.strip()},O.prototype._wordDiv=function(U,I){var Q=this.length-U.length,X=this.clone(),Z=U,A=Z.words[Z.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)Z=Z.ushln(Q),X.iushln(Q),A=Z.words[Z.length-1]|0;var J=X.length-Z.length,E;if(I!=="mod"){E=new O(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(X.words[Z.length+H]|0)*67108864+(X.words[Z.length+H-1]|0);j=Math.min(j/A|0,67108863),X._ishlnsubmul(Z,j,H);while(X.negative!==0)if(j--,X.negative=0,X._ishlnsubmul(Z,1,H),!X.isZero())X.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(X.strip(),I!=="div"&&Q!==0)X.iushrn(Q);return{div:E||null,mod:X}},O.prototype.divmod=function(U,I,Q){if(L(!U.isZero()),this.isZero())return{div:new O(0),mod:new O(0)};var X,Z,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,I),I!=="mod")X=A.div.neg();if(I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.iadd(U)}return{div:X,mod:Z}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),I),I!=="mod")X=A.div.neg();return{div:X,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),I),I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.isub(U)}return{div:A.div,mod:Z}}if(U.length>this.length||this.cmp(U)<0)return{div:new O(0),mod:this};if(U.length===1){if(I==="div")return{div:this.divn(U.words[0]),mod:null};if(I==="mod")return{div:null,mod:new O(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new O(this.modn(U.words[0]))}}return this._wordDiv(U,I)},O.prototype.div=function(U){return this.divmod(U,"div",!1).div},O.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},O.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},O.prototype.divRound=function(U){var I=this.divmod(U);if(I.mod.isZero())return I.div;var Q=I.div.negative!==0?I.mod.isub(U):I.mod,X=U.ushrn(1),Z=U.andln(1),A=Q.cmp(X);if(A<0||Z===1&&A===0)return I.div;return I.div.negative!==0?I.div.isubn(1):I.div.iaddn(1)},O.prototype.modn=function(U){L(U<=67108863);var I=67108864%U,Q=0;for(var X=this.length-1;X>=0;X--)Q=(I*Q+(this.words[X]|0))%U;return Q},O.prototype.idivn=function(U){L(U<=67108863);var I=0;for(var Q=this.length-1;Q>=0;Q--){var X=(this.words[Q]|0)+I*67108864;this.words[Q]=X/U|0,I=X%U}return this.strip()},O.prototype.divn=function(U){return this.clone().idivn(U)},O.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=new O(0),$=new O(1),J=0;while(I.isEven()&&Q.isEven())I.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=I.clone();while(!I.isZero()){for(var S=0,H=1;(I.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){I.iushrn(S);while(S-- >0){if(X.isOdd()||Z.isOdd())X.iadd(E),Z.isub(V);X.iushrn(1),Z.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(A),Z.isub($);else Q.isub(I),A.isub(X),$.isub(Z)}return{a:A,b:$,gcd:Q.iushln(J)}},O.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=Q.clone();while(I.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(I.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){I.iushrn($);while($-- >0){if(X.isOdd())X.iadd(A);X.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(Z.isOdd())Z.iadd(A);Z.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(Z);else Q.isub(I),Z.isub(X)}var S;if(I.cmpn(1)===0)S=X;else S=Z;if(S.cmpn(0)<0)S.iadd(U);return S},O.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var I=this.clone(),Q=U.clone();I.negative=0,Q.negative=0;for(var X=0;I.isEven()&&Q.isEven();X++)I.iushrn(1),Q.iushrn(1);do{while(I.isEven())I.iushrn(1);while(Q.isEven())Q.iushrn(1);var Z=I.cmp(Q);if(Z<0){var A=I;I=Q,Q=A}else if(Z===0||Q.cmpn(1)===0)break;I.isub(Q)}while(!0);return Q.iushln(X)},O.prototype.invm=function(U){return this.egcd(U).a.umod(U)},O.prototype.isEven=function(){return(this.words[0]&1)===0},O.prototype.isOdd=function(){return(this.words[0]&1)===1},O.prototype.andln=function(U){return this.words[0]&U},O.prototype.bincn=function(U){L(typeof U==="number");var I=U%26,Q=(U-I)/26,X=1<>>26,$&=67108863,this.words[A]=$}if(Z!==0)this.words[A]=Z,this.length++;return this},O.prototype.isZero=function(){return this.length===1&&this.words[0]===0},O.prototype.cmpn=function(U){var I=U<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(I)U=-U;L(U<=67108863,"Number is too big");var X=this.words[0]|0;Q=X===U?0:XU.length)return 1;if(this.length=0;Q--){var X=this.words[Q]|0,Z=U.words[Q]|0;if(X===Z)continue;if(XZ)I=1;break}return I},O.prototype.gtn=function(U){return this.cmpn(U)===1},O.prototype.gt=function(U){return this.cmp(U)===1},O.prototype.gten=function(U){return this.cmpn(U)>=0},O.prototype.gte=function(U){return this.cmp(U)>=0},O.prototype.ltn=function(U){return this.cmpn(U)===-1},O.prototype.lt=function(U){return this.cmp(U)===-1},O.prototype.lten=function(U){return this.cmpn(U)<=0},O.prototype.lte=function(U){return this.cmp(U)<=0},O.prototype.eqn=function(U){return this.cmpn(U)===0},O.prototype.eq=function(U){return this.cmp(U)===0},O.red=function(U){return new u(U)},O.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},O.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},O.prototype._forceRed=function(U){return this.red=U,this},O.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},O.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},O.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},O.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},O.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},O.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},O.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},O.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},O.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},O.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},O.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},O.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},O.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},O.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,I){this.name=U,this.p=new O(I,16),this.n=this.p.bitLength(),this.k=new O(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new O(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var I=U,Q;do this.split(I,this.tmp),I=this.imulK(I),I=I.iadd(this.tmp),Q=I.bitLength();while(Q>this.n);var X=Q0)I.isub(this.p);else if(I.strip!==void 0)I.strip();else I._strip();return I},y.prototype.split=function(U,I){U.iushrn(this.n,0,I)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,I){var Q=4194303,X=Math.min(U.length,9);for(var Z=0;Z>>22,A=$}if(A>>>=22,U.words[Z-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var I=0;for(var Q=0;Q>>=26,U.words[Q]=Z,I=X}if(I!==0)U.words[U.length++]=I;return U},O._prime=function(U){if(g[U])return g[U];var I;if(U==="k256")I=new l;else if(U==="p224")I=new Y0;else if(U==="p192")I=new O0;else if(U==="p25519")I=new Z0;else throw Error("Unknown prime "+U);return g[U]=I,I};function u(U){if(typeof U==="string"){var I=O._prime(U);this.m=I.p,this.prime=I}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,I){L((U.negative|I.negative)===0,"red works only with positives"),L(U.red&&U.red===I.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,I){this._verify2(U,I);var Q=U.add(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,I){this._verify2(U,I);var Q=U.iadd(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,I){this._verify2(U,I);var Q=U.sub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,I){this._verify2(U,I);var Q=U.isub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,I){return this._verify1(U),this.imod(U.ushln(I))},u.prototype.imul=function(U,I){return this._verify2(U,I),this.imod(U.imul(I))},u.prototype.mul=function(U,I){return this._verify2(U,I),this.imod(U.mul(I))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var I=this.m.andln(3);if(L(I%2===1),I===3){var Q=this.m.add(new O(1)).iushrn(2);return this.pow(U,Q)}var X=this.m.subn(1),Z=0;while(!X.isZero()&&X.andln(1)===0)Z++,X.iushrn(1);L(!X.isZero());var A=new O(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new O(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,X),S=this.pow(U,X.addn(1).iushrn(1)),H=this.pow(U,X),j=Z;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;Z--){var V=I.words[Z];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==X[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(Z!==0||S!==0))continue;A=this.mul(A,X[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var I=U.umod(this.m);return I===U?I.clone():I},u.prototype.convertFrom=function(U){var I=U.clone();return I.red=null,I},O.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new O(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var I=this.imod(U.mul(this.rinv));return I.red=null,I},i.prototype.imul=function(U,I){if(U.isZero()||I.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,I){if(U.isZero()||I.isZero())return new O(0)._forceRed(this);var Q=U.mul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var I=this.imod(U._invmp(this.m).mul(this.r2));return I._forceRed(this)}})(typeof Y>"u"||Y,T)}),LQ=Q0((T,Y)=>{var G=VQ(),K=AQ();Y.exports=function(z){return new W(z)};var L={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};L.p224=L.secp224r1,L.p256=L.secp256r1=L.prime256v1,L.p192=L.secp192r1=L.prime192v1,L.p384=L.secp384r1,L.p521=L.secp521r1;function W(z){if(this.curveType=L[z],!this.curveType)this.curveType={name:z};this.curve=new G.ec(this.curveType.name),this.keys=void 0}W.prototype.generateKeys=function(z,q){return this.keys=this.curve.genKeyPair(),this.getPublicKey(z,q)},W.prototype.computeSecret=function(z,q,D){if(q=q||"utf8",!Buffer.isBuffer(z))z=new Buffer(z,q);var C=this.curve.keyFromPublic(z).getPublic(),F=C.mul(this.keys.getPrivate()).getX();return O(F,D,this.curveType.byteLength)},W.prototype.getPublicKey=function(z,q){var D=this.keys.getPublic(q==="compressed",!0);if(q==="hybrid")if(D[D.length-1]%2)D[0]=7;else D[0]=6;return O(D,z)},W.prototype.getPrivateKey=function(z){return O(this.keys.getPrivate(),z)},W.prototype.setPublicKey=function(z,q){if(q=q||"utf8",!Buffer.isBuffer(z))z=new Buffer(z,q);return this.keys._importPublic(z),this},W.prototype.setPrivateKey=function(z,q){if(q=q||"utf8",!Buffer.isBuffer(z))z=new Buffer(z,q);var D=new K(z);return D=D.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(D),this};function O(z,q,D){if(!Array.isArray(z))z=z.toArray();var C=new Buffer(z);if(D&&C.length{var G=(DU(),h0(PU)).createECDH;Y.exports=G||LQ()}),KQ=Q0((T,Y)=>{(function(G,K){function L(U,I){if(!U)throw Error(I||"Assertion failed")}function W(U,I){U.super_=I;var Q=function(){};Q.prototype=I.prototype,U.prototype=new Q,U.prototype.constructor=U}function O(U,I,Q){if(O.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(I==="le"||I==="be")Q=I,I=10;this._init(U||0,I||10,Q||"be")}}if(typeof G==="object")G.exports=O;else K.BN=O;O.BN=O,O.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}O.isBN=function(U){if(U instanceof O)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===O.wordSize&&Array.isArray(U.words)},O.max=function(U,I){if(U.cmp(I)>0)return U;return I},O.min=function(U,I){if(U.cmp(I)<0)return U;return I},O.prototype._init=function(U,I,Q){if(typeof U==="number")return this._initNumber(U,I,Q);if(typeof U==="object")return this._initArray(U,I,Q);if(I==="hex")I=16;L(I===(I|0)&&I>=2&&I<=36),U=U.toString().replace(/\s+/g,"");var X=0;if(U[0]==="-")X++,this.negative=1;if(X=0;X-=3)if(A=U[X]|U[X-1]<<8|U[X-2]<<16,this.words[Z]|=A<<$&67108863,this.words[Z+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,Z++}else if(Q==="le"){for(X=0,Z=0;X>>26-$&67108863,$+=24,$>=26)$-=26,Z++}return this.strip()};function q(U,I){var Q=U.charCodeAt(I);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function D(U,I,Q){var X=q(U,Q);if(Q-1>=I)X|=q(U,Q-1)<<4;return X}O.prototype._parseHex=function(U,I,Q){this.length=Math.ceil((U.length-I)/6),this.words=Array(this.length);for(var X=0;X=I;X-=2)if($=D(U,I,X)<=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8;else{var J=U.length-I;for(X=J%2===0?I+1:I;X=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8}this.strip()};function C(U,I,Q,X){var Z=0,A=Math.min(U.length,Q);for(var $=I;$=49)Z+=J-49+10;else if(J>=17)Z+=J-17+10;else Z+=J}return Z}O.prototype._parseBase=function(U,I,Q){this.words=[0],this.length=1;for(var X=0,Z=1;Z<=67108863;Z*=I)X++;X--,Z=Z/I|0;var A=U.length-Q,$=A%X,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},O.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},O.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(O.prototype.toString=function(U,I){U=U||10,I=I|0||1;var Q;if(U===16||U==="hex"){Q="";var X=0,Z=0;for(var A=0;A>>24-X&16777215,X+=2,X>=26)X-=26,A--;if(Z!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(Z!==0)Q=Z.toString(16)+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},O.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},O.prototype.toJSON=function(){return this.toString(16)},O.prototype.toBuffer=function(U,I){return L(typeof z<"u"),this.toArrayLike(z,U,I)},O.prototype.toArray=function(U,I){return this.toArrayLike(Array,U,I)},O.prototype.toArrayLike=function(U,I,Q){var X=this.byteLength(),Z=Q||Math.max(1,X);L(X<=Z,"byte array longer than desired length"),L(Z>0,"Requested array length <= 0"),this.strip();var A=I==="le",$=new U(Z),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,I>>>=13;if(I>=64)Q+=7,I>>>=7;if(I>=8)Q+=4,I>>>=4;if(I>=2)Q+=2,I>>>=2;return Q+I};O.prototype._zeroBits=function(U){if(U===0)return 26;var I=U,Q=0;if((I&8191)===0)Q+=13,I>>>=13;if((I&127)===0)Q+=7,I>>>=7;if((I&15)===0)Q+=4,I>>>=4;if((I&3)===0)Q+=2,I>>>=2;if((I&1)===0)Q++;return Q},O.prototype.bitLength=function(){var U=this.words[this.length-1],I=this._countBits(U);return(this.length-1)*26+I};function P(U){var I=Array(U.bitLength());for(var Q=0;Q>>Z}return I}O.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var I=0;IU.length)return this.clone().ior(U);return U.clone().ior(this)},O.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},O.prototype.iuand=function(U){var I;if(this.length>U.length)I=U;else I=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},O.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},O.prototype.iuxor=function(U){var I,Q;if(this.length>U.length)I=this,Q=U;else I=U,Q=this;for(var X=0;XU.length)return this.clone().ixor(U);return U.clone().ixor(this)},O.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},O.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var I=Math.ceil(U/26)|0,Q=U%26;if(this._expand(I),Q>0)I--;for(var X=0;X0)this.words[X]=~this.words[X]&67108863>>26-Q;return this.strip()},O.prototype.notn=function(U){return this.clone().inotn(U)},O.prototype.setn=function(U,I){L(typeof U==="number"&&U>=0);var Q=U/26|0,X=U%26;if(this._expand(Q+1),I)this.words[Q]=this.words[Q]|1<U.length)Q=this,X=U;else Q=U,X=this;var Z=0;for(var A=0;A>>26;for(;Z!==0&&A>>26;if(this.length=Q.length,Z!==0)this.words[this.length]=Z,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},O.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var I=this.iadd(U);return U.negative=1,I._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var X,Z;if(Q>0)X=this,Z=U;else X=U,Z=this;var A=0;for(var $=0;$>26,this.words[$]=I&67108863;for(;A!==0&&$>26,this.words[$]=I&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,I.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;Z=U.words[p]|0,A=I.words[w]|0,$=Z*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,I,Q){var X=U.words,Z=I.words,A=Q.words,$=0,J,E,V,S=X[0]|0,H=S&8191,j=S>>>13,w=X[1]|0,p=w&8191,n=w>>>13,G0=X[2]|0,t=G0&8191,d=G0>>>13,I0=X[3]|0,m=I0&8191,U0=I0>>>13,g0=X[4]|0,f=g0&8191,h=g0>>>13,T0=X[5]|0,r=T0&8191,e=T0>>>13,C0=X[6]|0,c=C0&8191,o=C0>>>13,x0=X[7]|0,s=x0&8191,X0=x0>>>13,y0=X[8]|0,L0=y0&8191,$0=y0>>>13,n0=X[9]|0,V0=n0&8191,K0=n0>>>13,r0=Z[0]|0,H0=r0&8191,W0=r0>>>13,RU=Z[1]|0,D0=RU&8191,_0=RU>>>13,CU=Z[2]|0,k0=CU&8191,z0=CU>>>13,WU=Z[3]|0,v0=WU&8191,S0=WU>>>13,AU=Z[4]|0,j0=AU&8191,N0=AU>>>13,LU=Z[5]|0,M0=LU&8191,x=LU>>>13,b=Z[6]|0,a=b&8191,E0=b>>>13,w0=Z[7]|0,A0=w0&8191,F0=w0>>>13,m0=Z[8]|0,q0=m0&8191,B0=m0>>>13,HU=Z[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^I.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,D0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,D0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,D0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,D0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,D0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,D0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,D0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,D0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,D0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,D0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var t0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(t0>>>26)|0,t0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,D0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,D0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(X0,H0)|0,V=Math.imul(X0,W0),J=J+Math.imul(c,D0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,D0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,D0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(X0,D0)|0,V=V+Math.imul(X0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,D0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,D0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(X0,k0)|0,V=V+Math.imul(X0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,D0),E=Math.imul(V0,_0),E=E+Math.imul(K0,D0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(X0,v0)|0,V=V+Math.imul(X0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(X0,j0)|0,V=V+Math.imul(X0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(X0,M0)|0,V=V+Math.imul(X0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(X0,a)|0,V=V+Math.imul(X0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(X0,A0)|0,V=V+Math.imul(X0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(X0,q0)|0,V=V+Math.imul(X0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(X0,P0)|0,V=V+Math.imul(X0,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var JU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=t0,A[6]=a0,A[7]=e0,A[8]=i0,A[9]=UU,A[10]=EU,A[11]=XU,A[12]=IU,A[13]=TU,A[14]=YU,A[15]=ZU,A[16]=OU,A[17]=QU,A[18]=JU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,I,Q){Q.negative=I.negative^U.negative,Q.length=U.length+I.length;var X=0,Z=0;for(var A=0;A>>26)|0,Z+=$>>>26,$&=67108863}Q.words[A]=J,X=$,$=Z}if(X!==0)Q.words[A]=X;else Q.length--;return Q.strip()}function v(U,I,Q){var X=new B;return X.mulp(U,I,Q)}O.prototype.mulTo=function(U,I){var Q,X=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,I);else if(X<63)Q=k(this,U,I);else if(X<1024)Q=N(this,U,I);else Q=v(this,U,I);return Q};function B(U,I){this.x=U,this.y=I}B.prototype.makeRBT=function(U){var I=Array(U),Q=O.prototype._countBits(U)-1;for(var X=0;X>=1;return X},B.prototype.permute=function(U,I,Q,X,Z,A){for(var $=0;$>>1)Z++;return 1<>>13,Q[2*A+1]=Z&8191,Z=Z>>>13;for(A=2*I;A>=26,I+=X/67108864|0,I+=Z>>>26,this.words[Q]=Z&67108863}if(I!==0)this.words[Q]=I,this.length++;return this.length=U===0?1:this.length,this},O.prototype.muln=function(U){return this.clone().imuln(U)},O.prototype.sqr=function(){return this.mul(this)},O.prototype.isqr=function(){return this.imul(this.clone())},O.prototype.pow=function(U){var I=P(U);if(I.length===0)return new O(1);var Q=this;for(var X=0;X=0);var I=U%26,Q=(U-I)/26,X=67108863>>>26-I<<26-I,Z;if(I!==0){var A=0;for(Z=0;Z>>26-I}if(A)this.words[Z]=A,this.length++}if(Q!==0){for(Z=this.length-1;Z>=0;Z--)this.words[Z+Q]=this.words[Z];for(Z=0;Z=0);var X;if(I)X=(I-I%26)/26;else X=0;var Z=U%26,A=Math.min((U-Z)/26,this.length),$=67108863^67108863>>>Z<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=X);E--){var S=this.words[E]|0;this.words[E]=V<<26-Z|S>>>Z,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},O.prototype.ishrn=function(U,I,Q){return L(this.negative===0),this.iushrn(U,I,Q)},O.prototype.shln=function(U){return this.clone().ishln(U)},O.prototype.ushln=function(U){return this.clone().iushln(U)},O.prototype.shrn=function(U){return this.clone().ishrn(U)},O.prototype.ushrn=function(U){return this.clone().iushrn(U)},O.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var I=U%26,Q=(U-I)/26,X=1<=0);var I=U%26,Q=(U-I)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(I!==0)Q++;if(this.length=Math.min(Q,this.length),I!==0){var X=67108863^67108863>>>I<=67108864;I++)if(this.words[I]-=67108864,I===this.length-1)this.words[I+1]=1;else this.words[I+1]++;return this.length=Math.max(this.length,I+1),this},O.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var I=0;I>26)-(J/67108864|0),this.words[Z+Q]=A&67108863}for(;Z>26,this.words[Z+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(Z=0;Z>26,this.words[Z]=A&67108863;return this.negative=1,this.strip()},O.prototype._wordDiv=function(U,I){var Q=this.length-U.length,X=this.clone(),Z=U,A=Z.words[Z.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)Z=Z.ushln(Q),X.iushln(Q),A=Z.words[Z.length-1]|0;var J=X.length-Z.length,E;if(I!=="mod"){E=new O(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(X.words[Z.length+H]|0)*67108864+(X.words[Z.length+H-1]|0);j=Math.min(j/A|0,67108863),X._ishlnsubmul(Z,j,H);while(X.negative!==0)if(j--,X.negative=0,X._ishlnsubmul(Z,1,H),!X.isZero())X.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(X.strip(),I!=="div"&&Q!==0)X.iushrn(Q);return{div:E||null,mod:X}},O.prototype.divmod=function(U,I,Q){if(L(!U.isZero()),this.isZero())return{div:new O(0),mod:new O(0)};var X,Z,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,I),I!=="mod")X=A.div.neg();if(I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.iadd(U)}return{div:X,mod:Z}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),I),I!=="mod")X=A.div.neg();return{div:X,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),I),I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.isub(U)}return{div:A.div,mod:Z}}if(U.length>this.length||this.cmp(U)<0)return{div:new O(0),mod:this};if(U.length===1){if(I==="div")return{div:this.divn(U.words[0]),mod:null};if(I==="mod")return{div:null,mod:new O(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new O(this.modn(U.words[0]))}}return this._wordDiv(U,I)},O.prototype.div=function(U){return this.divmod(U,"div",!1).div},O.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},O.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},O.prototype.divRound=function(U){var I=this.divmod(U);if(I.mod.isZero())return I.div;var Q=I.div.negative!==0?I.mod.isub(U):I.mod,X=U.ushrn(1),Z=U.andln(1),A=Q.cmp(X);if(A<0||Z===1&&A===0)return I.div;return I.div.negative!==0?I.div.isubn(1):I.div.iaddn(1)},O.prototype.modn=function(U){L(U<=67108863);var I=67108864%U,Q=0;for(var X=this.length-1;X>=0;X--)Q=(I*Q+(this.words[X]|0))%U;return Q},O.prototype.idivn=function(U){L(U<=67108863);var I=0;for(var Q=this.length-1;Q>=0;Q--){var X=(this.words[Q]|0)+I*67108864;this.words[Q]=X/U|0,I=X%U}return this.strip()},O.prototype.divn=function(U){return this.clone().idivn(U)},O.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=new O(0),$=new O(1),J=0;while(I.isEven()&&Q.isEven())I.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=I.clone();while(!I.isZero()){for(var S=0,H=1;(I.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){I.iushrn(S);while(S-- >0){if(X.isOdd()||Z.isOdd())X.iadd(E),Z.isub(V);X.iushrn(1),Z.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(A),Z.isub($);else Q.isub(I),A.isub(X),$.isub(Z)}return{a:A,b:$,gcd:Q.iushln(J)}},O.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=Q.clone();while(I.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(I.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){I.iushrn($);while($-- >0){if(X.isOdd())X.iadd(A);X.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(Z.isOdd())Z.iadd(A);Z.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(Z);else Q.isub(I),Z.isub(X)}var S;if(I.cmpn(1)===0)S=X;else S=Z;if(S.cmpn(0)<0)S.iadd(U);return S},O.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var I=this.clone(),Q=U.clone();I.negative=0,Q.negative=0;for(var X=0;I.isEven()&&Q.isEven();X++)I.iushrn(1),Q.iushrn(1);do{while(I.isEven())I.iushrn(1);while(Q.isEven())Q.iushrn(1);var Z=I.cmp(Q);if(Z<0){var A=I;I=Q,Q=A}else if(Z===0||Q.cmpn(1)===0)break;I.isub(Q)}while(!0);return Q.iushln(X)},O.prototype.invm=function(U){return this.egcd(U).a.umod(U)},O.prototype.isEven=function(){return(this.words[0]&1)===0},O.prototype.isOdd=function(){return(this.words[0]&1)===1},O.prototype.andln=function(U){return this.words[0]&U},O.prototype.bincn=function(U){L(typeof U==="number");var I=U%26,Q=(U-I)/26,X=1<>>26,$&=67108863,this.words[A]=$}if(Z!==0)this.words[A]=Z,this.length++;return this},O.prototype.isZero=function(){return this.length===1&&this.words[0]===0},O.prototype.cmpn=function(U){var I=U<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(I)U=-U;L(U<=67108863,"Number is too big");var X=this.words[0]|0;Q=X===U?0:XU.length)return 1;if(this.length=0;Q--){var X=this.words[Q]|0,Z=U.words[Q]|0;if(X===Z)continue;if(XZ)I=1;break}return I},O.prototype.gtn=function(U){return this.cmpn(U)===1},O.prototype.gt=function(U){return this.cmp(U)===1},O.prototype.gten=function(U){return this.cmpn(U)>=0},O.prototype.gte=function(U){return this.cmp(U)>=0},O.prototype.ltn=function(U){return this.cmpn(U)===-1},O.prototype.lt=function(U){return this.cmp(U)===-1},O.prototype.lten=function(U){return this.cmpn(U)<=0},O.prototype.lte=function(U){return this.cmp(U)<=0},O.prototype.eqn=function(U){return this.cmpn(U)===0},O.prototype.eq=function(U){return this.cmp(U)===0},O.red=function(U){return new u(U)},O.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},O.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},O.prototype._forceRed=function(U){return this.red=U,this},O.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},O.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},O.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},O.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},O.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},O.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},O.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},O.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},O.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},O.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},O.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},O.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},O.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},O.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,I){this.name=U,this.p=new O(I,16),this.n=this.p.bitLength(),this.k=new O(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new O(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var I=U,Q;do this.split(I,this.tmp),I=this.imulK(I),I=I.iadd(this.tmp),Q=I.bitLength();while(Q>this.n);var X=Q0)I.isub(this.p);else if(I.strip!==void 0)I.strip();else I._strip();return I},y.prototype.split=function(U,I){U.iushrn(this.n,0,I)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,I){var Q=4194303,X=Math.min(U.length,9);for(var Z=0;Z>>22,A=$}if(A>>>=22,U.words[Z-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var I=0;for(var Q=0;Q>>=26,U.words[Q]=Z,I=X}if(I!==0)U.words[U.length++]=I;return U},O._prime=function(U){if(g[U])return g[U];var I;if(U==="k256")I=new l;else if(U==="p224")I=new Y0;else if(U==="p192")I=new O0;else if(U==="p25519")I=new Z0;else throw Error("Unknown prime "+U);return g[U]=I,I};function u(U){if(typeof U==="string"){var I=O._prime(U);this.m=I.p,this.prime=I}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,I){L((U.negative|I.negative)===0,"red works only with positives"),L(U.red&&U.red===I.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,I){this._verify2(U,I);var Q=U.add(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,I){this._verify2(U,I);var Q=U.iadd(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,I){this._verify2(U,I);var Q=U.sub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,I){this._verify2(U,I);var Q=U.isub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,I){return this._verify1(U),this.imod(U.ushln(I))},u.prototype.imul=function(U,I){return this._verify2(U,I),this.imod(U.imul(I))},u.prototype.mul=function(U,I){return this._verify2(U,I),this.imod(U.mul(I))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var I=this.m.andln(3);if(L(I%2===1),I===3){var Q=this.m.add(new O(1)).iushrn(2);return this.pow(U,Q)}var X=this.m.subn(1),Z=0;while(!X.isZero()&&X.andln(1)===0)Z++,X.iushrn(1);L(!X.isZero());var A=new O(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new O(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,X),S=this.pow(U,X.addn(1).iushrn(1)),H=this.pow(U,X),j=Z;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;Z--){var V=I.words[Z];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==X[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(Z!==0||S!==0))continue;A=this.mul(A,X[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var I=U.umod(this.m);return I===U?I.clone():I},u.prototype.convertFrom=function(U){var I=U.clone();return I.red=null,I},O.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new O(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var I=this.imod(U.mul(this.rinv));return I.red=null,I},i.prototype.imul=function(U,I){if(U.isZero()||I.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,I){if(U.isZero()||I.isZero())return new O(0)._forceRed(this);var Q=U.mul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var I=this.imod(U._invmp(this.m).mul(this.r2));return I._forceRed(this)}})(typeof Y>"u"||Y,T)}),FQ=Q0((T)=>{var Y=RE(),G=_U(),K=T;K.define=function(W,O){return new L(W,O)};function L(W,O){this.name=W,this.body=O,this.decoders={},this.encoders={}}L.prototype._createNamed=function(W){var O;try{O=(()=>{throw new Error("Cannot require module "+"vm");})().runInThisContext("(function "+this.name+`(entity) { +`).map(function(C){return" "+C}).join(` +`)}else z=I.stylize("[Circular]","special");if(UE(Z)){if(W&&L.match(/^\d+$/))return z;if(Z=JSON.stringify(""+L),Z.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))Z=Z.slice(1,-1),Z=I.stylize(Z,"name");else Z=Z.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Z=I.stylize(Z,"string")}return Z+": "+z}function NO(I,Y,G){var K=0,L=I.reduce(function(W,Z){if(K++,Z.indexOf(` +`)>=0)K++;return W+Z.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(L>60)return G[0]+(Y===""?"":Y+` + `)+" "+I.join(`, + `)+" "+G[1];return G[0]+Y+" "+I.join(", ")+" "+G[1]}function MX(I){return Array.isArray(I)}function FT(I){return typeof I==="boolean"}function gE(I){return I===null}function xO(I){return I==null}function qX(I){return typeof I==="number"}function wE(I){return typeof I==="string"}function gO(I){return typeof I==="symbol"}function UE(I){return I===void 0}function jE(I){return EE(I)&&WT(I)==="[object RegExp]"}function EE(I){return typeof I==="object"&&I!==null}function $T(I){return EE(I)&&WT(I)==="[object Date]"}function NE(I){return EE(I)&&(WT(I)==="[object Error]"||I instanceof Error)}function BE(I){return typeof I==="function"}function wO(I){return I===null||typeof I==="boolean"||typeof I==="number"||typeof I==="string"||typeof I==="symbol"||typeof I>"u"}function yO(I){return I instanceof Buffer}function WT(I){return Object.prototype.toString.call(I)}function AT(I){return I<10?"0"+I.toString(10):I.toString(10)}function cO(){var I=new Date,Y=[AT(I.getHours()),AT(I.getMinutes()),AT(I.getSeconds())].join(":");return[I.getDate(),fO[I.getMonth()],Y].join(" ")}function PX(...I){console.log("%s - %s",cO(),KT.apply(null,I))}function _X(I,Y){if(Y)I.super_=Y,I.prototype=Object.create(Y.prototype,{constructor:{value:I,enumerable:!1,writable:!0,configurable:!0}})}function HT(I,Y){if(!Y||!EE(Y))return I;var G=Object.keys(Y),K=G.length;while(K--)I[G[K]]=Y[G[K]];return I}function kX(I,Y){return Object.prototype.hasOwnProperty.call(I,Y)}function RT(I,Y){if(!I){var G=Error("Promise was rejected with a falsy value");G.reason=I,I=G}return Y(I)}function jX(I){if(typeof I!=="function")throw TypeError('The "original" argument must be of type Function');function Y(...G){var K=G.pop();if(typeof K!=="function")throw TypeError("The last argument must be of type Function");var L=this,W=function(...Z){return K.apply(L,...Z)};I.apply(this,G).then(function(Z){process.nextTick(W.bind(null,null,Z))},function(Z){process.nextTick(RT.bind(null,Z,W))})}return Object.setPrototypeOf(Y,Object.getPrototypeOf(I)),Object.defineProperties(Y,Object.getOwnPropertyDescriptors(I)),Y}var SO,qO,nU,BO=()=>{},fO,vX,NX,BX,pO;var gX=VU(()=>{SO=/%[sdj%]/g;qO=((I={},Y={},G)=>((G=typeof process<"u"&&!1)&&(G=G.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),Y=new RegExp("^"+G+"$","i"),(K)=>{if(K=K.toUpperCase(),!I[K])if(Y.test(K))I[K]=function(...L){console.error("%s: %s",K,pid,KT.apply(null,...L))};else I[K]=function(){};return I[K]}))(),nU=((I)=>(I.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},I.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},I.custom=Symbol.for("nodejs.util.inspect.custom"),I))(function(I,Y,...G){var K={seen:[],stylize:_O};if(G.length>=1)K.depth=G[0];if(G.length>=2)K.colors=G[1];if(FT(Y))K.showHidden=Y;else if(Y)HT(K,Y);if(UE(K.showHidden))K.showHidden=!1;if(UE(K.depth))K.depth=2;if(UE(K.colors))K.colors=!1;if(K.colors)K.stylize=PO;return xE(K,I,K.depth)});fO=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];vX=((I)=>(I.custom=Symbol.for("nodejs.util.promisify.custom"),I))(function(I){if(typeof I!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&I[kCustomPromisifiedSymbol]){var Y=I[kCustomPromisifiedSymbol];if(typeof Y!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(Y,kCustomPromisifiedSymbol,{value:Y,enumerable:!1,writable:!1,configurable:!0}),Y}function Y(...G){var K,L,W=new Promise(function(Z,z){K=Z,L=z});G.push(function(Z,z){if(Z)L(Z);else K(z)});try{I.apply(this,G)}catch(Z){L(Z)}return W}if(Object.setPrototypeOf(Y,Object.getPrototypeOf(I)),kCustomPromisifiedSymbol)Object.defineProperty(Y,kCustomPromisifiedSymbol,{value:Y,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(Y,Object.getOwnPropertyDescriptors(I))});({TextEncoder:NX,TextDecoder:BX}=globalThis),pO={TextEncoder:NX,TextDecoder:BX,promisify:vX,log:PX,inherits:_X,_extend:HT,callbackifyOnRejected:RT,callbackify:jX}});var GE={};jU(GE,{setMaxListeners:()=>oX,once:()=>dX,listenerCount:()=>nX,init:()=>uU,getMaxListeners:()=>sX,getEventListeners:()=>lX,default:()=>sO,captureRejectionSymbol:()=>pX,addAbortListener:()=>rX,EventEmitter:()=>uU});function hX(I,Y){var{_events:G}=I;if(Y[0]??=Error("Unhandled error."),!G)throw Y[0];var K=G[cX];if(K)for(var L of yX.call(K))L.apply(I,Y);var W=G.error;if(!W)throw Y[0];for(var L of yX.call(W))L.apply(I,Y);return!0}function bO(I,Y,G,K){Y.then(void 0,function(L){queueMicrotask(()=>dO(I,L,G,K))})}function dO(I,Y,G,K){if(typeof I[wX]==="function")I[wX](Y,G,...K);else try{I[mU]=!1,I.emit("error",Y)}finally{I[mU]=!0}}function uX(I,Y,G){G.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${G.length} ${String(Y)} listeners added to [${I.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=I,K.type=Y,K.count=G.length,console.warn(K)}function bX(I,Y,...G){this.removeListener(I,Y),Y.apply(this,G)}function dX(I,Y,G){var K=G?.signal;if(mX(K,"options.signal"),K?.aborted)throw new DT(void 0,{cause:K?.reason});let{resolve:L,reject:W,promise:Z}=$newPromiseCapability(Promise),z=(D)=>{if(I.removeListener(Y,q),K!=null)yE(K,"abort",C);W(D)},q=(...D)=>{if(typeof I.removeListener==="function")I.removeListener("error",z);if(K!=null)yE(K,"abort",C);L(D)};if(fX(I,Y,q,{once:!0}),Y!=="error"&&typeof I.once==="function")I.once("error",z);function C(){yE(I,Y,q),yE(I,"error",z),W(new DT(void 0,{cause:K?.reason}))}if(K!=null)fX(K,"abort",C,{once:!0});return Z}function lX(I,Y){return I.listeners(Y)}function oX(I,...Y){zT(I,"setMaxListeners",0);var G;if(Y&&(G=Y.length))for(let K=0;KK||(G!=null||K!=null)&&Number.isNaN(I))throw nO(Y,`${G!=null?`>= ${G}`:""}${G!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,I)}function JE(I){if(typeof I!=="function")throw TypeError("The listener must be a function")}function mO(I,Y){if(typeof I!=="boolean")throw TE(Y,"boolean",I)}function sX(I){return I?._maxListeners??sU}function rX(I,Y){if(I===void 0)throw TE("signal","AbortSignal",I);if(mX(I,"signal"),typeof Y!=="function")throw TE("listener","function",Y);let G;if(I.aborted)queueMicrotask(()=>Y());else I.addEventListener("abort",Y,{__proto__:null,once:!0}),G=()=>{I.removeEventListener("abort",Y)};return{__proto__:null,[Symbol.dispose](){G?.()}}}var CT,mU,cX,hO,uO,wX,pX,yX,sU=10,uU=function(I){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[mU]=I?.captureRejections?Boolean(I?.captureRejections):l0[mU])this.emit=oO},l0,lO=function(I,...Y){if(I==="error")return hX(this,Y);var{_events:G}=this;if(G===void 0)return!1;var K=G[I];if(K===void 0)return!1;let L=K.length>1?K.slice():K;for(let W=0,{length:Z}=L;W1?K.slice():K;for(let W=0,{length:Z}=L;W{CT=Symbol.for,mU=Symbol("kCapture"),cX=CT("events.errorMonitor"),hO=Symbol("events.maxEventTargetListeners"),uO=Symbol("events.maxEventTargetListenersWarned"),wX=CT("nodejs.rejection"),pX=CT("nodejs.rejection"),yX=Array.prototype.slice,l0=uU.prototype={};l0._events=void 0;l0._eventsCount=0;l0._maxListeners=void 0;l0.setMaxListeners=function(I){return zT(I,"setMaxListeners",0),this._maxListeners=I,this};l0.constructor=uU;l0.getMaxListeners=function(){return this?._maxListeners??sU};l0.emit=lO;l0.addListener=function(I,Y){JE(Y);var G=this._events;if(!G)G=this._events={__proto__:null},this._eventsCount=0;else if(G.newListener)this.emit("newListener",I,Y.listener??Y);var K=G[I];if(!K)G[I]=[Y],this._eventsCount++;else{K.push(Y);var L=this._maxListeners??sU;if(L>0&&K.length>L&&!K.warned)uX(this,I,K)}return this};l0.on=l0.addListener;l0.prependListener=function(I,Y){JE(Y);var G=this._events;if(!G)G=this._events={__proto__:null},this._eventsCount=0;else if(G.newListener)this.emit("newListener",I,Y.listener??Y);var K=G[I];if(!K)G[I]=[Y],this._eventsCount++;else{K.unshift(Y);var L=this._maxListeners??sU;if(L>0&&K.length>L&&!K.warned)uX(this,I,K)}return this};l0.once=function(I,Y){JE(Y);let G=bX.bind(this,I,Y);return G.listener=Y,this.addListener(I,G),this};l0.prependOnceListener=function(I,Y){JE(Y);let G=bX.bind(this,I,Y);return G.listener=Y,this.prependListener(I,G),this};l0.removeListener=function(I,Y){JE(Y);var{_events:G}=this;if(!G)return this;var K=G[I];if(!K)return this;var L=K.length;let W=-1;for(let Z=L-1;Z>=0;Z--)if(K[Z]===Y||K[Z].listener===Y){W=Z;break}if(W<0)return this;if(W===0)K.shift();else K.splice(W,1);if(K.length===0)delete G[I],this._eventsCount--;return this};l0.off=l0.removeListener;l0.removeAllListeners=function(I){var{_events:Y}=this;if(I&&Y){if(Y[I])delete Y[I],this._eventsCount--}else this._events={__proto__:null};return this};l0.listeners=function(I){var{_events:Y}=this;if(!Y)return[];var G=Y[I];if(!G)return[];return G.map((K)=>K.listener??K)};l0.rawListeners=function(I){var{_events:Y}=this;if(!Y)return[];var G=Y[I];if(!G)return[];return G.slice()};l0.listenerCount=function(I){var{_events:Y}=this;if(!Y)return 0;return Y[I]?.length??0};l0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};l0[mU]=!1;DT=class DT extends Error{constructor(I="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw TE("options","Object",Y);super(I,Y);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(uU,{captureRejections:{get(){return l0[mU]},set(I){mO(I,"EventEmitter.captureRejections"),l0[mU]=I},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return sU},set:(I)=>{zT(I,"defaultMaxListeners",0),sU=I}},kMaxEventTargetListeners:{value:hO,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:uO,enumerable:!1,configurable:!1,writable:!1}});Object.assign(uU,{once:dX,getEventListeners:lX,getMaxListeners:sX,setMaxListeners:oX,EventEmitter:uU,usingDomains:!1,captureRejectionSymbol:pX,errorMonitor:cX,addAbortListener:rX,init:uU,listenerCount:nX});sO=uU});var PT=gY((HV,XI)=>{var u0=(I,Y)=>()=>(Y||I((Y={exports:{}}).exports,Y),Y.exports),o0=u0((I,Y)=>{class G extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let L="";for(let W=0;W{Y.exports={format(G,...K){return G.replace(/%([sdifj])/g,function(...[L,W]){let Z=K.shift();if(W==="f")return Z.toFixed(6);else if(W==="j")return JSON.stringify(Z);else if(W==="s"&&typeof Z==="object")return`${Z.constructor!==Object?Z.constructor.name:""} {}`.trim();else return Z.toString()})},inspect(G){switch(typeof G){case"string":if(G.includes("'")){if(!G.includes('"'))return`"${G}"`;else if(!G.includes("`")&&!G.includes("${"))return`\`${G}\``}return`'${G}'`;case"number":if(isNaN(G))return"NaN";else if(Object.is(G,-0))return String(G);return G;case"bigint":return`${String(G)}n`;case"boolean":case"undefined":return String(G);case"object":return"{}"}}}}),zU=u0((I,Y)=>{var{format:G,inspect:K}=tX(),{AggregateError:L}=o0(),W=globalThis.AggregateError||L,Z=Symbol("kIsNodeError"),z=["string","function","number","object","Function","Object","boolean","bigint","symbol"],q=/^([A-Z][a-z0-9]*)+$/,C={};function D(N,v){if(!N)throw new C.ERR_INTERNAL_ASSERTION(v)}function F(N){let v="",B=N.length,g=N[0]==="-"?1:0;for(;B>=g+4;B-=3)v=`_${N.slice(B-3,B)}${v}`;return`${N.slice(0,B)}${v}`}function R(N,v,B){if(typeof v==="function")return D(v.length<=B.length,`Code: ${N}; The provided arguments length (${B.length}) does not match the required ones (${v.length}).`),v(...B);let g=(v.match(/%[dfijoOs]/g)||[]).length;if(D(g===B.length,`Code: ${N}; The provided arguments length (${B.length}) does not match the required ones (${g}).`),B.length===0)return v;return G(v,...B)}function M(N,v,B){if(!B)B=Error;class g extends B{constructor(...y){super(R(N,v,y))}toString(){return`${this.name} [${N}]: ${this.message}`}}Object.defineProperties(g.prototype,{name:{value:B.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${N}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),g.prototype.code=N,g.prototype[Z]=!0,C[N]=g}function P(N){let v="__node_internal_"+N.name;return Object.defineProperty(N,"name",{value:v}),N}function k(N,v){if(N&&v&&N!==v){if(Array.isArray(v.errors))return v.errors.push(N),v;let B=new W([v,N],v.message);return B.code=v.code,B}return N||v}class _ extends Error{constructor(N="The operation was aborted",v=void 0){if(v!==void 0&&typeof v!=="object")throw new C.ERR_INVALID_ARG_TYPE("options","Object",v);super(N,v);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(N,v,B)=>{if(D(typeof N==="string","'name' must be a string"),!Array.isArray(v))v=[v];let g="The ";if(N.endsWith(" argument"))g+=`${N} `;else g+=`"${N}" ${N.includes(".")?"property":"argument"} `;g+="must be ";let y=[],l=[],Y0=[];for(let O0 of v)if(D(typeof O0==="string","All expected entries have to be of type string"),z.includes(O0))y.push(O0.toLowerCase());else if(q.test(O0))l.push(O0);else D(O0!=="object",'The value "object" should be written as "Object"'),Y0.push(O0);if(l.length>0){let O0=y.indexOf("object");if(O0!==-1)y.splice(y,O0,1),l.push("Object")}if(y.length>0){switch(y.length){case 1:g+=`of type ${y[0]}`;break;case 2:g+=`one of type ${y[0]} or ${y[1]}`;break;default:{let O0=y.pop();g+=`one of type ${y.join(", ")}, or ${O0}`}}if(l.length>0||Y0.length>0)g+=" or "}if(l.length>0){switch(l.length){case 1:g+=`an instance of ${l[0]}`;break;case 2:g+=`an instance of ${l[0]} or ${l[1]}`;break;default:{let O0=l.pop();g+=`an instance of ${l.join(", ")}, or ${O0}`}}if(Y0.length>0)g+=" or "}switch(Y0.length){case 0:break;case 1:if(Y0[0].toLowerCase()!==Y0[0])g+="an ";g+=`${Y0[0]}`;break;case 2:g+=`one of ${Y0[0]} or ${Y0[1]}`;break;default:{let O0=Y0.pop();g+=`one of ${Y0.join(", ")}, or ${O0}`}}if(B==null)g+=`. Received ${B}`;else if(typeof B==="function"&&B.name)g+=`. Received function ${B.name}`;else if(typeof B==="object"){var Z0;if((Z0=B.constructor)!==null&&Z0!==void 0&&Z0.name)g+=`. Received an instance of ${B.constructor.name}`;else{let O0=K(B,{depth:-1});g+=`. Received ${O0}`}}else{let O0=K(B,{colors:!1});if(O0.length>25)O0=`${O0.slice(0,25)}...`;g+=`. Received type ${typeof B} (${O0})`}return g},TypeError),M("ERR_INVALID_ARG_VALUE",(N,v,B="is invalid")=>{let g=K(v);if(g.length>128)g=g.slice(0,128)+"...";return`The ${N.includes(".")?"property":"argument"} '${N}' ${B}. Received ${g}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(N,v,B)=>{var g;let y=B!==null&&B!==void 0&&(g=B.constructor)!==null&&g!==void 0&&g.name?`instance of ${B.constructor.name}`:`type ${typeof B}`;return`Expected ${N} to be returned from the "${v}" function but got ${y}.`},TypeError),M("ERR_MISSING_ARGS",(...N)=>{D(N.length>0,"At least one arg needs to be specified");let v,B=N.length;switch(N=(Array.isArray(N)?N:[N]).map((g)=>`"${g}"`).join(" or "),B){case 1:v+=`The ${N[0]} argument`;break;case 2:v+=`The ${N[0]} and ${N[1]} arguments`;break;default:{let g=N.pop();v+=`The ${N.join(", ")}, and ${g} arguments`}break}return`${v} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(N,v,B)=>{D(v,'Missing "range" argument');let g;if(Number.isInteger(B)&&Math.abs(B)>4294967296)g=F(String(B));else if(typeof B==="bigint"){g=String(B);let y=BigInt(2)**BigInt(32);if(B>y||B<-y)g=F(g);g+="n"}else g=K(B);return`The value of "${N}" is out of range. It must be ${v}. Received ${g}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Y.exports={AbortError:_,aggregateTwoErrors:P(k),hideStackFrames:P,codes:C}}),rO=u0((I,Y)=>{Object.defineProperty(I,"__esModule",{value:!0});var G=new WeakMap,K=new WeakMap;function L(u){let i=G.get(u);return console.assert(i!=null,"'this' is expected an Event object, but got",u),i}function W(u){if(u.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",u.passiveListener);return}if(!u.event.cancelable)return;if(u.canceled=!0,typeof u.event.preventDefault==="function")u.event.preventDefault()}function Z(u,i){G.set(this,{eventTarget:u,event:i,eventPhase:2,currentTarget:u,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:i.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let U=Object.keys(i);for(let X=0;X0){let u=Array(arguments.length);for(let i=0;i{Object.defineProperty(I,"__esModule",{value:!0});var G=rO();class K extends G.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let D=Z.get(this);if(typeof D!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return D}}G.defineEventAttribute(K.prototype,"abort");function L(){let D=Object.create(K.prototype);return G.EventTarget.call(D),Z.set(D,!1),D}function W(D){if(Z.get(D)!==!1)return;Z.set(D,!0),D.dispatchEvent({type:"abort"})}var Z=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class z{constructor(){q.set(this,L())}get signal(){return C(this)}abort(){W(C(this))}}var q=new WeakMap;function C(D){let F=q.get(D);if(F==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${D===null?"null":typeof D}`);return F}if(Object.defineProperties(z.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(z.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});I.AbortController=z,I.AbortSignal=K,I.default=z,Y.exports=z,Y.exports.AbortController=Y.exports.default=z,Y.exports.AbortSignal=K}),qU=u0((I,Y)=>{var G=(FU(),h0(KU)),{format:K,inspect:L}=tX(),{codes:{ERR_INVALID_ARG_TYPE:W}}=zU(),{kResistStopPropagation:Z,AggregateError:z,SymbolDispose:q}=o0(),C=globalThis.AbortSignal||AE().AbortSignal,D=globalThis.AbortController||AE().AbortController,F=Object.getPrototypeOf(async function(){}).constructor,R=globalThis.Blob||G.Blob,M=typeof R<"u"?function(_){return _ instanceof R}:function(_){return!1},P=(_,N)=>{if(_!==void 0&&(_===null||typeof _!=="object"||!("aborted"in _)))throw new W(N,"AbortSignal",_)},k=(_,N)=>{if(typeof _!=="function")throw new W(N,"Function",_)};Y.exports={AggregateError:z,kEmptyObject:Object.freeze({}),once(_){let N=!1;return function(...v){if(N)return;N=!0,_.apply(this,v)}},createDeferredPromise:function(){let _,N;return{promise:new Promise((v,B)=>{_=v,N=B}),resolve:_,reject:N}},promisify(_){return new Promise((N,v)=>{_((B,...g)=>{if(B)return v(B);return N(...g)})})},debuglog(){return function(){}},format:K,inspect:L,types:{isAsyncFunction(_){return _ instanceof F},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:M,deprecate(_,N){return _},addAbortListener:(VE(),h0(GE)).addAbortListener||function(_,N){if(_===void 0)throw new W("signal","AbortSignal",_);P(_,"signal"),k(N,"listener");let v;if(_.aborted)queueMicrotask(()=>N());else _.addEventListener("abort",N,{__proto__:null,once:!0,[Z]:!0}),v=()=>{_.removeEventListener("abort",N)};return{__proto__:null,[q](){var B;(B=v)===null||B===void 0||B()}}},AbortSignalAny:C.any||function(_){if(_.length===1)return _[0];let N=new D,v=()=>N.abort();return _.forEach((B)=>{P(B,"signals"),B.addEventListener("abort",v,{once:!0})}),N.signal.addEventListener("abort",()=>{_.forEach((B)=>B.removeEventListener("abort",v))},{once:!0}),N.signal}},Y.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),LE=u0((I,Y)=>{var{ArrayIsArray:G,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:L,ArrayPrototypeMap:W,NumberIsInteger:Z,NumberIsNaN:z,NumberMAX_SAFE_INTEGER:q,NumberMIN_SAFE_INTEGER:C,NumberParseInt:D,ObjectPrototypeHasOwnProperty:F,RegExpPrototypeExec:R,String:M,StringPrototypeToUpperCase:P,StringPrototypeTrim:k}=o0(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:N,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:B,ERR_OUT_OF_RANGE:g,ERR_UNKNOWN_SIGNAL:y}}=zU(),{normalizeEncoding:l}=qU(),{isAsyncFunction:Y0,isArrayBufferView:Z0}=qU().types,O0={};function u(c){return c===(c|0)}function i(c){return c===c>>>0}var U=/^[0-7]+$/,X="must be a 32-bit unsigned integer or an octal string";function Q(c,o,x0){if(typeof c>"u")c=x0;if(typeof c==="string"){if(R(U,c)===null)throw new B(o,c,X);c=D(c,8)}return A(c,o),c}var T=_((c,o,x0=C,s=q)=>{if(typeof c!=="number")throw new v(o,"number",c);if(!Z(c))throw new g(o,"an integer",c);if(cs)throw new g(o,`>= ${x0} && <= ${s}`,c)}),O=_((c,o,x0=-2147483648,s=2147483647)=>{if(typeof c!=="number")throw new v(o,"number",c);if(!Z(c))throw new g(o,"an integer",c);if(cs)throw new g(o,`>= ${x0} && <= ${s}`,c)}),A=_((c,o,x0=!1)=>{if(typeof c!=="number")throw new v(o,"number",c);if(!Z(c))throw new g(o,"an integer",c);let s=x0?1:0,T0=4294967295;if(cT0)throw new g(o,`>= ${s} && <= ${T0}`,c)});function $(c,o){if(typeof c!=="string")throw new v(o,"string",c)}function J(c,o,x0=void 0,s){if(typeof c!=="number")throw new v(o,"number",c);if(x0!=null&&cs||(x0!=null||s!=null)&&z(c))throw new g(o,`${x0!=null?`>= ${x0}`:""}${x0!=null&&s!=null?" && ":""}${s!=null?`<= ${s}`:""}`,c)}var E=_((c,o,x0)=>{if(!K(x0,c)){let s="must be one of: "+L(W(x0,(T0)=>typeof T0==="string"?`'${T0}'`:M(T0)),", ");throw new B(o,c,s)}});function V(c,o){if(typeof c!=="boolean")throw new v(o,"boolean",c)}function S(c,o,x0){return c==null||!F(c,o)?x0:c[o]}var H=_((c,o,x0=null)=>{let s=S(x0,"allowArray",!1),T0=S(x0,"allowFunction",!1);if(!S(x0,"nullable",!1)&&c===null||!s&&G(c)||typeof c!=="object"&&(!T0||typeof c!=="function"))throw new v(o,"Object",c)}),j=_((c,o)=>{if(c!=null&&typeof c!=="object"&&typeof c!=="function")throw new v(o,"a dictionary",c)}),w=_((c,o,x0=0)=>{if(!G(c))throw new v(o,"Array",c);if(c.length{if(!Z0(c))throw new v(o,["Buffer","TypedArray","DataView"],c)});function X0(c,o){let x0=l(o),s=c.length;if(x0==="hex"&&s%2!==0)throw new B("encoding",o,`is invalid for data of length ${s}`)}function m(c,o="Port",x0=!0){if(typeof c!=="number"&&typeof c!=="string"||typeof c==="string"&&k(c).length===0||+c!==+c>>>0||c>65535||c===0&&!x0)throw new N(o,c,x0);return c|0}var U0=_((c,o)=>{if(c!==void 0&&(c===null||typeof c!=="object"||!("aborted"in c)))throw new v(o,"AbortSignal",c)}),g0=_((c,o)=>{if(typeof c!=="function")throw new v(o,"Function",c)}),f=_((c,o)=>{if(typeof c!=="function"||Y0(c))throw new v(o,"Function",c)}),h=_((c,o)=>{if(c!==void 0)throw new v(o,"undefined",c)});function I0(c,o,x0){if(!K(x0,c))throw new v(o,`('${L(x0,"|")}')`,c)}var r=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function e(c,o){if(typeof c>"u"||!R(r,c))throw new B(o,c,'must be an array or string of format "; rel=preload; as=style"')}function D0(c){if(typeof c==="string")return e(c,"hints"),c;else if(G(c)){let o=c.length,x0="";if(o===0)return x0;for(let s=0;s; rel=preload; as=style"')}Y.exports={isInt32:u,isUint32:i,parseFileMode:Q,validateArray:w,validateStringArray:p,validateBooleanArray:n,validateAbortSignalArray:G0,validateBoolean:V,validateBuffer:d,validateDictionary:j,validateEncoding:X0,validateFunction:g0,validateInt32:O,validateInteger:T,validateNumber:J,validateObject:H,validateOneOf:E,validatePlainFunction:f,validatePort:m,validateSignalName:t,validateString:$,validateUint32:A,validateUndefined:h,validateUnion:I0,validateAbortSignal:U0,validateLinkHeaderValue:D0}}),rU=u0((I,Y)=>{Y.exports=globalThis.process}),fU=u0((I,Y)=>{var{SymbolAsyncIterator:G,SymbolIterator:K,SymbolFor:L}=o0(),W=L("nodejs.stream.destroyed"),Z=L("nodejs.stream.errored"),z=L("nodejs.stream.readable"),q=L("nodejs.stream.writable"),C=L("nodejs.stream.disturbed"),D=L("nodejs.webstream.isClosedPromise"),F=L("nodejs.webstream.controllerErrorFunction");function R(S,H=!1){var j;return!!(S&&typeof S.pipe==="function"&&typeof S.on==="function"&&(!H||typeof S.pause==="function"&&typeof S.resume==="function")&&(!S._writableState||((j=S._readableState)===null||j===void 0?void 0:j.readable)!==!1)&&(!S._writableState||S._readableState))}function M(S){var H;return!!(S&&typeof S.write==="function"&&typeof S.on==="function"&&(!S._readableState||((H=S._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function P(S){return!!(S&&typeof S.pipe==="function"&&S._readableState&&typeof S.on==="function"&&typeof S.write==="function")}function k(S){return S&&(S._readableState||S._writableState||typeof S.write==="function"&&typeof S.on==="function"||typeof S.pipe==="function"&&typeof S.on==="function")}function _(S){return!!(S&&!k(S)&&typeof S.pipeThrough==="function"&&typeof S.getReader==="function"&&typeof S.cancel==="function")}function N(S){return!!(S&&!k(S)&&typeof S.getWriter==="function"&&typeof S.abort==="function")}function v(S){return!!(S&&!k(S)&&typeof S.readable==="object"&&typeof S.writable==="object")}function B(S){return _(S)||N(S)||v(S)}function g(S,H){if(S==null)return!1;if(H===!0)return typeof S[G]==="function";if(H===!1)return typeof S[K]==="function";return typeof S[G]==="function"||typeof S[K]==="function"}function y(S){if(!k(S))return null;let{_writableState:H,_readableState:j}=S,w=H||j;return!!(S.destroyed||S[W]||w!==null&&w!==void 0&&w.destroyed)}function l(S){if(!M(S))return null;if(S.writableEnded===!0)return!0;let H=S._writableState;if(H!==null&&H!==void 0&&H.errored)return!1;if(typeof(H===null||H===void 0?void 0:H.ended)!=="boolean")return null;return H.ended}function Y0(S,H){if(!M(S))return null;if(S.writableFinished===!0)return!0;let j=S._writableState;if(j!==null&&j!==void 0&&j.errored)return!1;if(typeof(j===null||j===void 0?void 0:j.finished)!=="boolean")return null;return!!(j.finished||H===!1&&j.ended===!0&&j.length===0)}function Z0(S){if(!R(S))return null;if(S.readableEnded===!0)return!0;let H=S._readableState;if(!H||H.errored)return!1;if(typeof(H===null||H===void 0?void 0:H.ended)!=="boolean")return null;return H.ended}function O0(S,H){if(!R(S))return null;let j=S._readableState;if(j!==null&&j!==void 0&&j.errored)return!1;if(typeof(j===null||j===void 0?void 0:j.endEmitted)!=="boolean")return null;return!!(j.endEmitted||H===!1&&j.ended===!0&&j.length===0)}function u(S){if(S&&S[z]!=null)return S[z];if(typeof(S===null||S===void 0?void 0:S.readable)!=="boolean")return null;if(y(S))return!1;return R(S)&&S.readable&&!O0(S)}function i(S){if(S&&S[q]!=null)return S[q];if(typeof(S===null||S===void 0?void 0:S.writable)!=="boolean")return null;if(y(S))return!1;return M(S)&&S.writable&&!l(S)}function U(S,H){if(!k(S))return null;if(y(S))return!0;if((H===null||H===void 0?void 0:H.readable)!==!1&&u(S))return!1;if((H===null||H===void 0?void 0:H.writable)!==!1&&i(S))return!1;return!0}function X(S){var H,j;if(!k(S))return null;if(S.writableErrored)return S.writableErrored;return(H=(j=S._writableState)===null||j===void 0?void 0:j.errored)!==null&&H!==void 0?H:null}function Q(S){var H,j;if(!k(S))return null;if(S.readableErrored)return S.readableErrored;return(H=(j=S._readableState)===null||j===void 0?void 0:j.errored)!==null&&H!==void 0?H:null}function T(S){if(!k(S))return null;if(typeof S.closed==="boolean")return S.closed;let{_writableState:H,_readableState:j}=S;if(typeof(H===null||H===void 0?void 0:H.closed)==="boolean"||typeof(j===null||j===void 0?void 0:j.closed)==="boolean")return(H===null||H===void 0?void 0:H.closed)||(j===null||j===void 0?void 0:j.closed);if(typeof S._closed==="boolean"&&O(S))return S._closed;return null}function O(S){return typeof S._closed==="boolean"&&typeof S._defaultKeepAlive==="boolean"&&typeof S._removedConnection==="boolean"&&typeof S._removedContLen==="boolean"}function A(S){return typeof S._sent100==="boolean"&&O(S)}function $(S){var H;return typeof S._consuming==="boolean"&&typeof S._dumped==="boolean"&&((H=S.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function J(S){if(!k(S))return null;let{_writableState:H,_readableState:j}=S,w=H||j;return!w&&A(S)||!!(w&&w.autoDestroy&&w.emitClose&&w.closed===!1)}function E(S){var H;return!!(S&&((H=S[C])!==null&&H!==void 0?H:S.readableDidRead||S.readableAborted))}function V(S){var H,j,w,p,n,G0,t,d,X0,m;return!!(S&&((H=(j=(w=(p=(n=(G0=S[Z])!==null&&G0!==void 0?G0:S.readableErrored)!==null&&n!==void 0?n:S.writableErrored)!==null&&p!==void 0?p:(t=S._readableState)===null||t===void 0?void 0:t.errorEmitted)!==null&&w!==void 0?w:(d=S._writableState)===null||d===void 0?void 0:d.errorEmitted)!==null&&j!==void 0?j:(X0=S._readableState)===null||X0===void 0?void 0:X0.errored)!==null&&H!==void 0?H:(m=S._writableState)===null||m===void 0?void 0:m.errored))}Y.exports={isDestroyed:y,kIsDestroyed:W,isDisturbed:E,kIsDisturbed:C,isErrored:V,kIsErrored:Z,isReadable:u,kIsReadable:z,kIsClosedPromise:D,kControllerErrorFunction:F,kIsWritable:q,isClosed:T,isDuplexNodeStream:P,isFinished:U,isIterable:g,isReadableNodeStream:R,isReadableStream:_,isReadableEnded:Z0,isReadableFinished:O0,isReadableErrored:Q,isNodeStream:k,isWebStream:B,isWritable:i,isWritableNodeStream:M,isWritableStream:N,isWritableEnded:l,isWritableFinished:Y0,isWritableErrored:X,isServerRequest:$,isServerResponse:A,willEmitClose:J,isTransformStream:v}}),bU=u0((I,Y)=>{var G=rU(),{AbortError:K,codes:L}=zU(),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_PREMATURE_CLOSE:Z}=L,{kEmptyObject:z,once:q}=qU(),{validateAbortSignal:C,validateFunction:D,validateObject:F,validateBoolean:R}=LE(),{Promise:M,PromisePrototypeThen:P,SymbolDispose:k}=o0(),{isClosed:_,isReadable:N,isReadableNodeStream:v,isReadableStream:B,isReadableFinished:g,isReadableErrored:y,isWritable:l,isWritableNodeStream:Y0,isWritableStream:Z0,isWritableFinished:O0,isWritableErrored:u,isNodeStream:i,willEmitClose:U,kIsClosedPromise:X}=fU(),Q;function T(E){return E.setHeader&&typeof E.abort==="function"}var O=()=>{};function A(E,V,S){var H,j;if(arguments.length===2)S=V,V=z;else if(V==null)V=z;else F(V,"options");if(D(S,"callback"),C(V.signal,"options.signal"),S=q(S),B(E)||Z0(E))return $(E,V,S);if(!i(E))throw new W("stream",["ReadableStream","WritableStream","Stream"],E);let w=(H=V.readable)!==null&&H!==void 0?H:v(E),p=(j=V.writable)!==null&&j!==void 0?j:Y0(E),n=E._writableState,G0=E._readableState,t=()=>{if(!E.writable)m()},d=U(E)&&v(E)===w&&Y0(E)===p,X0=O0(E,!1),m=()=>{if(X0=!0,E.destroyed)d=!1;if(d&&(!E.readable||w))return;if(!w||U0)S.call(E)},U0=g(E,!1),g0=()=>{if(U0=!0,E.destroyed)d=!1;if(d&&(!E.writable||p))return;if(!p||X0)S.call(E)},f=(c)=>{S.call(E,c)},h=_(E),I0=()=>{h=!0;let c=u(E)||y(E);if(c&&typeof c!=="boolean")return S.call(E,c);if(w&&!U0&&v(E,!0)){if(!g(E,!1))return S.call(E,new Z)}if(p&&!X0){if(!O0(E,!1))return S.call(E,new Z)}S.call(E)},r=()=>{h=!0;let c=u(E)||y(E);if(c&&typeof c!=="boolean")return S.call(E,c);S.call(E)},e=()=>{E.req.on("finish",m)};if(T(E)){if(E.on("complete",m),!d)E.on("abort",I0);if(E.req)e();else E.on("request",e)}else if(p&&!n)E.on("end",t),E.on("close",t);if(!d&&typeof E.aborted==="boolean")E.on("aborted",I0);if(E.on("end",g0),E.on("finish",m),V.error!==!1)E.on("error",f);if(E.on("close",I0),h)G.nextTick(I0);else if(n!==null&&n!==void 0&&n.errorEmitted||G0!==null&&G0!==void 0&&G0.errorEmitted){if(!d)G.nextTick(r)}else if(!w&&(!d||N(E))&&(X0||l(E)===!1))G.nextTick(r);else if(!p&&(!d||l(E))&&(U0||N(E)===!1))G.nextTick(r);else if(G0&&E.req&&E.aborted)G.nextTick(r);let D0=()=>{if(S=O,E.removeListener("aborted",I0),E.removeListener("complete",m),E.removeListener("abort",I0),E.removeListener("request",e),E.req)E.req.removeListener("finish",m);E.removeListener("end",t),E.removeListener("close",t),E.removeListener("finish",m),E.removeListener("end",g0),E.removeListener("error",f),E.removeListener("close",I0)};if(V.signal&&!h){let c=()=>{let o=S;D0(),o.call(E,new K(void 0,{cause:V.signal.reason}))};if(V.signal.aborted)G.nextTick(c);else{Q=Q||qU().addAbortListener;let o=Q(V.signal,c),x0=S;S=q((...s)=>{o[k](),x0.apply(E,s)})}}return D0}function $(E,V,S){let H=!1,j=O;if(V.signal)if(j=()=>{H=!0,S.call(E,new K(void 0,{cause:V.signal.reason}))},V.signal.aborted)G.nextTick(j);else{Q=Q||qU().addAbortListener;let p=Q(V.signal,j),n=S;S=q((...G0)=>{p[k](),n.apply(E,G0)})}let w=(...p)=>{if(!H)G.nextTick(()=>S.apply(E,p))};return P(E[X].promise,w,w),O}function J(E,V){var S;let H=!1;if(V===null)V=z;if((S=V)!==null&&S!==void 0&&S.cleanup)R(V.cleanup,"cleanup"),H=V.cleanup;return new M((j,w)=>{let p=A(E,V,(n)=>{if(H)p();if(n)w(n);else j()})})}Y.exports=A,Y.exports.finished=J}),XE=u0((I,Y)=>{var G=rU(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:L},AbortError:W}=zU(),{Symbol:Z}=o0(),{kIsDestroyed:z,isDestroyed:q,isFinished:C,isServerRequest:D}=fU(),F=Z("kDestroy"),R=Z("kConstruct");function M(U,X,Q){if(U){if(U.stack,X&&!X.errored)X.errored=U;if(Q&&!Q.errored)Q.errored=U}}function P(U,X){let Q=this._readableState,T=this._writableState,O=T||Q;if(T!==null&&T!==void 0&&T.destroyed||Q!==null&&Q!==void 0&&Q.destroyed){if(typeof X==="function")X();return this}if(M(U,T,Q),T)T.destroyed=!0;if(Q)Q.destroyed=!0;if(!O.constructed)this.once(F,function(A){k(this,K(A,U),X)});else k(this,U,X);return this}function k(U,X,Q){let T=!1;function O(A){if(T)return;T=!0;let{_readableState:$,_writableState:J}=U;if(M(A,J,$),J)J.closed=!0;if($)$.closed=!0;if(typeof Q==="function")Q(A);if(A)G.nextTick(_,U,A);else G.nextTick(N,U)}try{U._destroy(X||null,O)}catch(A){O(A)}}function _(U,X){v(U,X),N(U)}function N(U){let{_readableState:X,_writableState:Q}=U;if(Q)Q.closeEmitted=!0;if(X)X.closeEmitted=!0;if(Q!==null&&Q!==void 0&&Q.emitClose||X!==null&&X!==void 0&&X.emitClose)U.emit("close")}function v(U,X){let{_readableState:Q,_writableState:T}=U;if(T!==null&&T!==void 0&&T.errorEmitted||Q!==null&&Q!==void 0&&Q.errorEmitted)return;if(T)T.errorEmitted=!0;if(Q)Q.errorEmitted=!0;U.emit("error",X)}function B(){let U=this._readableState,X=this._writableState;if(U)U.constructed=!0,U.closed=!1,U.closeEmitted=!1,U.destroyed=!1,U.errored=null,U.errorEmitted=!1,U.reading=!1,U.ended=U.readable===!1,U.endEmitted=U.readable===!1;if(X)X.constructed=!0,X.destroyed=!1,X.closed=!1,X.closeEmitted=!1,X.errored=null,X.errorEmitted=!1,X.finalCalled=!1,X.prefinished=!1,X.ended=X.writable===!1,X.ending=X.writable===!1,X.finished=X.writable===!1}function g(U,X,Q){let{_readableState:T,_writableState:O}=U;if(O!==null&&O!==void 0&&O.destroyed||T!==null&&T!==void 0&&T.destroyed)return this;if(T!==null&&T!==void 0&&T.autoDestroy||O!==null&&O!==void 0&&O.autoDestroy)U.destroy(X);else if(X){if(X.stack,O&&!O.errored)O.errored=X;if(T&&!T.errored)T.errored=X;if(Q)G.nextTick(v,U,X);else v(U,X)}}function y(U,X){if(typeof U._construct!=="function")return;let{_readableState:Q,_writableState:T}=U;if(Q)Q.constructed=!1;if(T)T.constructed=!1;if(U.once(R,X),U.listenerCount(R)>1)return;G.nextTick(l,U)}function l(U){let X=!1;function Q(T){if(X){g(U,T!==null&&T!==void 0?T:new L);return}X=!0;let{_readableState:O,_writableState:A}=U,$=A||O;if(O)O.constructed=!0;if(A)A.constructed=!0;if($.destroyed)U.emit(F,T);else if(T)g(U,T,!0);else G.nextTick(Y0,U)}try{U._construct((T)=>{G.nextTick(Q,T)})}catch(T){G.nextTick(Q,T)}}function Y0(U){U.emit(R)}function Z0(U){return(U===null||U===void 0?void 0:U.setHeader)&&typeof U.abort==="function"}function O0(U){U.emit("close")}function u(U,X){U.emit("error",X),G.nextTick(O0,U)}function i(U,X){if(!U||q(U))return;if(!X&&!C(U))X=new W;if(D(U))U.socket=null,U.destroy(X);else if(Z0(U))U.abort();else if(Z0(U.req))U.req.abort();else if(typeof U.destroy==="function")U.destroy(X);else if(typeof U.close==="function")U.close();else if(X)G.nextTick(u,U,X);else G.nextTick(O0,U);if(!U.destroyed)U[z]=!0}Y.exports={construct:y,destroyer:i,destroy:P,undestroy:B,errorOrDestroy:g}}),ST=u0((I,Y)=>{var{ArrayIsArray:G,ObjectSetPrototypeOf:K}=o0(),{EventEmitter:L}=(VE(),h0(GE));function W(z){L.call(this,z)}K(W.prototype,L.prototype),K(W,L),W.prototype.pipe=function(z,q){let C=this;function D(N){if(z.writable&&z.write(N)===!1&&C.pause)C.pause()}C.on("data",D);function F(){if(C.readable&&C.resume)C.resume()}if(z.on("drain",F),!z._isStdio&&(!q||q.end!==!1))C.on("end",M),C.on("close",P);let R=!1;function M(){if(R)return;R=!0,z.end()}function P(){if(R)return;if(R=!0,typeof z.destroy==="function")z.destroy()}function k(N){if(_(),L.listenerCount(this,"error")===0)this.emit("error",N)}Z(C,"error",k),Z(z,"error",k);function _(){C.removeListener("data",D),z.removeListener("drain",F),C.removeListener("end",M),C.removeListener("close",P),C.removeListener("error",k),z.removeListener("error",k),C.removeListener("end",_),C.removeListener("close",_),z.removeListener("close",_)}return C.on("end",_),C.on("close",_),z.on("close",_),z.emit("pipe",C),z};function Z(z,q,C){if(typeof z.prependListener==="function")return z.prependListener(q,C);if(!z._events||!z._events[q])z.on(q,C);else if(G(z._events[q]))z._events[q].unshift(C);else z._events[q]=[C,z._events[q]]}Y.exports={Stream:W,prependListener:Z}}),fE=u0((I,Y)=>{var{SymbolDispose:G}=o0(),{AbortError:K,codes:L}=zU(),{isNodeStream:W,isWebStream:Z,kControllerErrorFunction:z}=fU(),q=bU(),{ERR_INVALID_ARG_TYPE:C}=L,D,F=(R,M)=>{if(typeof R!=="object"||!("aborted"in R))throw new C(M,"AbortSignal",R)};Y.exports.addAbortSignal=function(R,M){if(F(R,"signal"),!W(M)&&!Z(M))throw new C("stream",["ReadableStream","WritableStream","Stream"],M);return Y.exports.addAbortSignalNoValidate(R,M)},Y.exports.addAbortSignalNoValidate=function(R,M){if(typeof R!=="object"||!("aborted"in R))return M;let P=W(M)?()=>{M.destroy(new K(void 0,{cause:R.reason}))}:()=>{M[z](new K(void 0,{cause:R.reason}))};if(R.aborted)P();else{D=D||qU().addAbortListener;let k=D(R,P);q(M,k[G])}return M}}),tO=u0((I,Y)=>{var{StringPrototypeSlice:G,SymbolIterator:K,TypedArrayPrototypeSet:L,Uint8Array:W}=o0(),{Buffer:Z}=(FU(),h0(KU)),{inspect:z}=qU();Y.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(q){let C={data:q,next:null};if(this.length>0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}unshift(q){let C={data:q,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}shift(){if(this.length===0)return;let q=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,q}clear(){this.head=this.tail=null,this.length=0}join(q){if(this.length===0)return"";let C=this.head,D=""+C.data;while((C=C.next)!==null)D+=q+C.data;return D}concat(q){if(this.length===0)return Z.alloc(0);let C=Z.allocUnsafe(q>>>0),D=this.head,F=0;while(D)L(C,D.data,F),F+=D.data.length,D=D.next;return C}consume(q,C){let D=this.head.data;if(qR.length)C+=R,q-=R.length;else{if(q===R.length)if(C+=R,++F,D.next)this.head=D.next;else this.head=this.tail=null;else C+=G(R,0,q),this.head=D,D.data=G(R,q);break}++F}while((D=D.next)!==null);return this.length-=F,C}_getBuffer(q){let C=Z.allocUnsafe(q),D=q,F=this.head,R=0;do{let M=F.data;if(q>M.length)L(C,M,D-q),q-=M.length;else{if(q===M.length)if(L(C,M,D-q),++R,F.next)this.head=F.next;else this.head=this.tail=null;else L(C,new W(M.buffer,M.byteOffset,q),D-q),this.head=F,F.data=M.slice(q);break}++R}while((F=F.next)!==null);return this.length-=R,C}[Symbol.for("nodejs.util.inspect.custom")](q,C){return z(this,{...C,depth:0,customInspect:!1})}}}),cE=u0((I,Y)=>{var{MathFloor:G,NumberIsInteger:K}=o0(),{validateInteger:L}=LE(),{ERR_INVALID_ARG_VALUE:W}=zU().codes,Z=16384,z=16;function q(R,M,P){return R.highWaterMark!=null?R.highWaterMark:M?R[P]:null}function C(R){return R?z:Z}function D(R,M){if(L(M,"value",0),R)z=M;else Z=M}function F(R,M,P,k){let _=q(M,k,P);if(_!=null){if(!K(_)||_<0){let N=k?`options.${P}`:"options.highWaterMark";throw new W(N,_)}return G(_)}return C(R.objectMode)}Y.exports={getHighWaterMark:F,getDefaultHighWaterMark:C,setDefaultHighWaterMark:D}}),aO=u0((I,Y)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var G=(FU(),h0(KU)),K=G.Buffer;function L(Z,z){for(var q in Z)z[q]=Z[q]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)Y.exports=G;else L(G,I),I.Buffer=W;function W(Z,z,q){return K(Z,z,q)}W.prototype=Object.create(K.prototype),L(K,W),W.from=function(Z,z,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return K(Z,z,q)},W.alloc=function(Z,z,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var C=K(Z);if(z!==void 0)if(typeof q==="string")C.fill(z,q);else C.fill(z);else C.fill(0);return C},W.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return K(Z)},W.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),eO=u0((I)=>{var Y=aO().Buffer,G=Y.isEncoding||function(v){switch(v=""+v,v&&v.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(v){if(!v)return"utf8";var B;while(!0)switch(v){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return v;default:if(B)return;v=(""+v).toLowerCase(),B=!0}}function L(v){var B=K(v);if(typeof B!=="string"&&(Y.isEncoding===G||!G(v)))throw Error("Unknown encoding: "+v);return B||v}I.StringDecoder=W;function W(v){this.encoding=L(v);var B;switch(this.encoding){case"utf16le":this.text=R,this.end=M,B=4;break;case"utf8":this.fillLast=C,B=4;break;case"base64":this.text=P,this.end=k,B=3;break;default:this.write=_,this.end=N;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Y.allocUnsafe(B)}W.prototype.write=function(v){if(v.length===0)return"";var B,g;if(this.lastNeed){if(B=this.fillLast(v),B===void 0)return"";g=this.lastNeed,this.lastNeed=0}else g=0;if(g>5===6)return 2;else if(v>>4===14)return 3;else if(v>>3===30)return 4;return v>>6===2?-1:-2}function z(v,B,g){var y=B.length-1;if(y=0){if(l>0)v.lastNeed=l-1;return l}if(--y=0){if(l>0)v.lastNeed=l-2;return l}if(--y=0){if(l>0)if(l===2)l=0;else v.lastNeed=l-3;return l}return 0}function q(v,B,g){if((B[0]&192)!==128)return v.lastNeed=0,"�";if(v.lastNeed>1&&B.length>1){if((B[1]&192)!==128)return v.lastNeed=1,"�";if(v.lastNeed>2&&B.length>2){if((B[2]&192)!==128)return v.lastNeed=2,"�"}}}function C(v){var B=this.lastTotal-this.lastNeed,g=q(this,v,B);if(g!==void 0)return g;if(this.lastNeed<=v.length)return v.copy(this.lastChar,B,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,B,0,v.length),this.lastNeed-=v.length}function D(v,B){var g=z(this,v,B);if(!this.lastNeed)return v.toString("utf8",B);this.lastTotal=g;var y=v.length-(g-this.lastNeed);return v.copy(this.lastChar,0,y),v.toString("utf8",B,y)}function F(v){var B=v&&v.length?this.write(v):"";if(this.lastNeed)return B+"�";return B}function R(v,B){if((v.length-B)%2===0){var g=v.toString("utf16le",B);if(g){var y=g.charCodeAt(g.length-1);if(y>=55296&&y<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1],g.slice(0,-1)}return g}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",B,v.length-1)}function M(v){var B=v&&v.length?this.write(v):"";if(this.lastNeed){var g=this.lastTotal-this.lastNeed;return B+this.lastChar.toString("utf16le",0,g)}return B}function P(v,B){var g=(v.length-B)%3;if(g===0)return v.toString("base64",B);if(this.lastNeed=3-g,this.lastTotal=3,g===1)this.lastChar[0]=v[v.length-1];else this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1];return v.toString("base64",B,v.length-g)}function k(v){var B=v&&v.length?this.write(v):"";if(this.lastNeed)return B+this.lastChar.toString("base64",0,3-this.lastNeed);return B}function _(v){return v.toString(this.encoding)}function N(v){return v&&v.length?this.write(v):""}}),aX=u0((I,Y)=>{var G=rU(),{PromisePrototypeThen:K,SymbolAsyncIterator:L,SymbolIterator:W}=o0(),{Buffer:Z}=(FU(),h0(KU)),{ERR_INVALID_ARG_TYPE:z,ERR_STREAM_NULL_VALUES:q}=zU().codes;function C(D,F,R){let M;if(typeof F==="string"||F instanceof Z)return new D({objectMode:!0,...R,read(){this.push(F),this.push(null)}});let P;if(F&&F[L])P=!0,M=F[L]();else if(F&&F[W])P=!1,M=F[W]();else throw new z("iterable",["Iterable"],F);let k=new D({objectMode:!0,highWaterMark:1,...R}),_=!1;k._read=function(){if(!_)_=!0,v()},k._destroy=function(B,g){K(N(B),()=>G.nextTick(g,B),(y)=>G.nextTick(g,y||B))};async function N(B){let g=B!==void 0&&B!==null,y=typeof M.throw==="function";if(g&&y){let{value:l,done:Y0}=await M.throw(B);if(await l,Y0)return}if(typeof M.return==="function"){let{value:l}=await M.return();await l}}async function v(){for(;;){try{let{value:B,done:g}=P?await M.next():M.next();if(g)k.push(null);else{let y=B&&typeof B.then==="function"?await B:B;if(y===null)throw _=!1,new q;else if(k.push(y))continue;else _=!1}}catch(B){k.destroy(B)}break}}return k}Y.exports=C}),pE=u0((I,Y)=>{var G=rU(),{ArrayPrototypeIndexOf:K,NumberIsInteger:L,NumberIsNaN:W,NumberParseInt:Z,ObjectDefineProperties:z,ObjectKeys:q,ObjectSetPrototypeOf:C,Promise:D,SafeSet:F,SymbolAsyncDispose:R,SymbolAsyncIterator:M,Symbol:P}=o0();Y.exports=s,s.ReadableState=x0;var{EventEmitter:k}=(VE(),h0(GE)),{Stream:_,prependListener:N}=ST(),{Buffer:v}=(FU(),h0(KU)),{addAbortSignal:B}=fE(),g=bU(),y=qU().debuglog("stream",(x)=>{y=x}),l=tO(),Y0=XE(),{getHighWaterMark:Z0,getDefaultHighWaterMark:O0}=cE(),{aggregateTwoErrors:u,codes:{ERR_INVALID_ARG_TYPE:i,ERR_METHOD_NOT_IMPLEMENTED:U,ERR_OUT_OF_RANGE:X,ERR_STREAM_PUSH_AFTER_EOF:Q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:T},AbortError:O}=zU(),{validateObject:A}=LE(),$=P("kPaused"),{StringDecoder:J}=eO(),E=aX();C(s.prototype,_.prototype),C(s,_);var V=()=>{},{errorOrDestroy:S}=Y0,H=1,j=2,w=4,p=8,n=16,G0=32,t=64,d=128,X0=256,m=512,U0=1024,g0=2048,f=4096,h=8192,I0=16384,r=32768,e=65536,D0=131072,c=262144;function o(x){return{enumerable:!1,get(){return(this.state&x)!==0},set(b){if(b)this.state|=x;else this.state&=~x}}}z(x0.prototype,{objectMode:o(H),ended:o(j),endEmitted:o(w),reading:o(p),constructed:o(n),sync:o(G0),needReadable:o(t),emittedReadable:o(d),readableListening:o(X0),resumeScheduled:o(m),errorEmitted:o(U0),emitClose:o(g0),autoDestroy:o(f),destroyed:o(h),closed:o(I0),closeEmitted:o(r),multiAwaitDrain:o(e),readingMore:o(D0),dataEmitted:o(c)});function x0(x,b,a){if(typeof a!=="boolean")a=b instanceof yU();if(this.state=g0|f|n|G0,x&&x.objectMode)this.state|=H;if(a&&x&&x.readableObjectMode)this.state|=H;if(this.highWaterMark=x?Z0(this,x,"readableHighWaterMark",a):O0(!1),this.buffer=new l,this.length=0,this.pipes=[],this.flowing=null,this[$]=null,x&&x.emitClose===!1)this.state&=~g0;if(x&&x.autoDestroy===!1)this.state&=~f;if(this.errored=null,this.defaultEncoding=x&&x.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,x&&x.encoding)this.decoder=new J(x.encoding),this.encoding=x.encoding}function s(x){if(!(this instanceof s))return new s(x);let b=this instanceof yU();if(this._readableState=new x0(x,this,b),x){if(typeof x.read==="function")this._read=x.read;if(typeof x.destroy==="function")this._destroy=x.destroy;if(typeof x.construct==="function")this._construct=x.construct;if(x.signal&&!b)B(x.signal,this)}_.call(this,x),Y0.construct(this,()=>{if(this._readableState.needReadable)H0(this,this._readableState)})}s.prototype.destroy=Y0.destroy,s.prototype._undestroy=Y0.undestroy,s.prototype._destroy=function(x,b){b(x)},s.prototype[k.captureRejectionSymbol]=function(x){this.destroy(x)},s.prototype[R]=function(){let x;if(!this.destroyed)x=this.readableEnded?null:new O,this.destroy(x);return new D((b,a)=>g(this,(E0)=>E0&&E0!==x?a(E0):b(null)))},s.prototype.push=function(x,b){return T0(this,x,b,!1)},s.prototype.unshift=function(x,b){return T0(this,x,b,!0)};function T0(x,b,a,E0){y("readableAddChunk",b);let w0=x._readableState,A0;if((w0.state&H)===0){if(typeof b==="string"){if(a=a||w0.defaultEncoding,w0.encoding!==a)if(E0&&w0.encoding)b=v.from(b,a).toString(w0.encoding);else b=v.from(b,a),a=""}else if(b instanceof v)a="";else if(_._isUint8Array(b))b=_._uint8ArrayToBuffer(b),a="";else if(b!=null)A0=new i("chunk",["string","Buffer","Uint8Array"],b)}if(A0)S(x,A0);else if(b===null)w0.state&=~p,V0(x,w0);else if((w0.state&H)!==0||b&&b.length>0)if(E0)if((w0.state&w)!==0)S(x,new T);else if(w0.destroyed||w0.errored)return!1;else y0(x,w0,b,!0);else if(w0.ended)S(x,new Q);else if(w0.destroyed||w0.errored)return!1;else if(w0.state&=~p,w0.decoder&&!a)if(b=w0.decoder.write(b),w0.objectMode||b.length!==0)y0(x,w0,b,!1);else H0(x,w0);else y0(x,w0,b,!1);else if(!E0)w0.state&=~p,H0(x,w0);return!w0.ended&&(w0.length0){if((b.state&e)!==0)b.awaitDrainWriters.clear();else b.awaitDrainWriters=null;b.dataEmitted=!0,x.emit("data",a)}else{if(b.length+=b.objectMode?1:a.length,E0)b.buffer.unshift(a);else b.buffer.push(a);if((b.state&t)!==0)K0(x)}H0(x,b)}s.prototype.isPaused=function(){let x=this._readableState;return x[$]===!0||x.flowing===!1},s.prototype.setEncoding=function(x){let b=new J(x);this._readableState.decoder=b,this._readableState.encoding=this._readableState.decoder.encoding;let a=this._readableState.buffer,E0="";for(let w0 of a)E0+=b.write(w0);if(a.clear(),E0!=="")a.push(E0);return this._readableState.length=E0.length,this};var L0=1073741824;function $0(x){if(x>L0)throw new X("size","<= 1GiB",x);else x--,x|=x>>>1,x|=x>>>2,x|=x>>>4,x|=x>>>8,x|=x>>>16,x++;return x}function n0(x,b){if(x<=0||b.length===0&&b.ended)return 0;if((b.state&H)!==0)return 1;if(W(x)){if(b.flowing&&b.length)return b.buffer.first().length;return b.length}if(x<=b.length)return x;return b.ended?b.length:0}s.prototype.read=function(x){if(y("read",x),x===void 0)x=NaN;else if(!L(x))x=Z(x,10);let b=this._readableState,a=x;if(x>b.highWaterMark)b.highWaterMark=$0(x);if(x!==0)b.state&=~d;if(x===0&&b.needReadable&&((b.highWaterMark!==0?b.length>=b.highWaterMark:b.length>0)||b.ended)){if(y("read: emitReadable",b.length,b.ended),b.length===0&&b.ended)AU(this);else K0(this);return null}if(x=n0(x,b),x===0&&b.ended){if(b.length===0)AU(this);return null}let E0=(b.state&t)!==0;if(y("need readable",E0),b.length===0||b.length-x0)w0=S0(x,b);else w0=null;if(w0===null)b.needReadable=b.length<=b.highWaterMark,x=0;else if(b.length-=x,b.multiAwaitDrain)b.awaitDrainWriters.clear();else b.awaitDrainWriters=null;if(b.length===0){if(!b.ended)b.needReadable=!0;if(a!==x&&b.ended)AU(this)}if(w0!==null&&!b.errorEmitted&&!b.closeEmitted)b.dataEmitted=!0,this.emit("data",w0);return w0};function V0(x,b){if(y("onEofChunk"),b.ended)return;if(b.decoder){let a=b.decoder.end();if(a&&a.length)b.buffer.push(a),b.length+=b.objectMode?1:a.length}if(b.ended=!0,b.sync)K0(x);else b.needReadable=!1,b.emittedReadable=!0,t0(x)}function K0(x){let b=x._readableState;if(y("emitReadable",b.needReadable,b.emittedReadable),b.needReadable=!1,!b.emittedReadable)y("emitReadable",b.flowing),b.emittedReadable=!0,G.nextTick(t0,x)}function t0(x){let b=x._readableState;if(y("emitReadable_",b.destroyed,b.length,b.ended),!b.destroyed&&!b.errored&&(b.length||b.ended))x.emit("readable"),b.emittedReadable=!1;b.needReadable=!b.flowing&&!b.ended&&b.length<=b.highWaterMark,z0(x)}function H0(x,b){if(!b.readingMore&&b.constructed)b.readingMore=!0,G.nextTick(W0,x,b)}function W0(x,b){while(!b.reading&&!b.ended&&(b.length1&&E0.pipes.includes(x))y("false write response, pause",E0.awaitDrainWriters.size),E0.awaitDrainWriters.add(x);a.pause()}if(!m0)m0=RU(a,x),x.on("drain",m0)}a.on("data",P0);function P0(d0){y("ondata");let b0=x.write(d0);if(y("dest.write",b0),b0===!1)HU()}function R0(d0){if(y("onerror",d0),f0(),x.removeListener("error",R0),x.listenerCount("error")===0){let b0=x._writableState||x._readableState;if(b0&&!b0.errorEmitted)S(x,d0);else x.emit("error",d0)}}N(x,"error",R0);function s0(){x.removeListener("finish",c0),f0()}x.once("close",s0);function c0(){y("onfinish"),x.removeListener("close",s0),f0()}x.once("finish",c0);function f0(){y("unpipe"),a.unpipe(x)}if(x.emit("pipe",a),x.writableNeedDrain===!0)HU();else if(!E0.flowing)y("pipe resume"),a.resume();return x};function RU(x,b){return function(){let a=x._readableState;if(a.awaitDrainWriters===b)y("pipeOnDrain",1),a.awaitDrainWriters=null;else if(a.multiAwaitDrain)y("pipeOnDrain",a.awaitDrainWriters.size),a.awaitDrainWriters.delete(b);if((!a.awaitDrainWriters||a.awaitDrainWriters.size===0)&&x.listenerCount("data"))x.resume()}}s.prototype.unpipe=function(x){let b=this._readableState,a={hasUnpiped:!1};if(b.pipes.length===0)return this;if(!x){let w0=b.pipes;b.pipes=[],this.pause();for(let A0=0;A00,E0.flowing!==!1)this.resume()}else if(x==="readable"){if(!E0.endEmitted&&!E0.readableListening){if(E0.readableListening=E0.needReadable=!0,E0.flowing=!1,E0.emittedReadable=!1,y("on readable",E0.length,E0.reading),E0.length)K0(this);else if(!E0.reading)G.nextTick(_0,this)}}return a},s.prototype.addListener=s.prototype.on,s.prototype.removeListener=function(x,b){let a=_.prototype.removeListener.call(this,x,b);if(x==="readable")G.nextTick(C0,this);return a},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(x){let b=_.prototype.removeAllListeners.apply(this,arguments);if(x==="readable"||x===void 0)G.nextTick(C0,this);return b};function C0(x){let b=x._readableState;if(b.readableListening=x.listenerCount("readable")>0,b.resumeScheduled&&b[$]===!1)b.flowing=!0;else if(x.listenerCount("data")>0)x.resume();else if(!b.readableListening)b.flowing=null}function _0(x){y("readable nexttick read 0"),x.read(0)}s.prototype.resume=function(){let x=this._readableState;if(!x.flowing)y("resume"),x.flowing=!x.readableListening,DU(this,x);return x[$]=!1,this};function DU(x,b){if(!b.resumeScheduled)b.resumeScheduled=!0,G.nextTick(k0,x,b)}function k0(x,b){if(y("resume",b.reading),!b.reading)x.read(0);if(b.resumeScheduled=!1,x.emit("resume"),z0(x),b.flowing&&!b.reading)x.read(0)}s.prototype.pause=function(){if(y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)y("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[$]=!0,this};function z0(x){let b=x._readableState;y("flow",b.flowing);while(b.flowing&&x.read()!==null);}s.prototype.wrap=function(x){let b=!1;x.on("data",(E0)=>{if(!this.push(E0)&&x.pause)b=!0,x.pause()}),x.on("end",()=>{this.push(null)}),x.on("error",(E0)=>{S(this,E0)}),x.on("close",()=>{this.destroy()}),x.on("destroy",()=>{this.destroy()}),this._read=()=>{if(b&&x.resume)b=!1,x.resume()};let a=q(x);for(let E0=1;E0{w0=F0?u(w0,F0):null,a(),a=V});try{while(!0){let F0=x.destroyed?null:x.read();if(F0!==null)yield F0;else if(w0)throw w0;else if(w0===null)return;else await new D(E0)}}catch(F0){throw w0=u(w0,F0),w0}finally{if((w0||(b===null||b===void 0?void 0:b.destroyOnReturn)!==!1)&&(w0===void 0||x._readableState.autoDestroy))Y0.destroyer(x,null);else x.off("readable",E0),A0()}}z(s.prototype,{readable:{__proto__:null,get(){let x=this._readableState;return!!x&&x.readable!==!1&&!x.destroyed&&!x.errorEmitted&&!x.endEmitted},set(x){if(this._readableState)this._readableState.readable=!!x}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){if(this._readableState)this._readableState.flowing=x}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(x){if(!this._readableState)return;this._readableState.destroyed=x}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),z(x0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[$]!==!1},set(x){this[$]=!!x}}}),s._fromList=S0;function S0(x,b){if(b.length===0)return null;let a;if(b.objectMode)a=b.buffer.shift();else if(!x||x>=b.length){if(b.decoder)a=b.buffer.join("");else if(b.buffer.length===1)a=b.buffer.first();else a=b.buffer.concat(b.length);b.buffer.clear()}else a=b.buffer.consume(x,b.decoder);return a}function AU(x){let b=x._readableState;if(y("endReadable",b.endEmitted),!b.endEmitted)b.ended=!0,G.nextTick(j0,b,x)}function j0(x,b){if(y("endReadableNT",x.endEmitted,x.length),!x.errored&&!x.closeEmitted&&!x.endEmitted&&x.length===0){if(x.endEmitted=!0,b.emit("end"),b.writable&&b.allowHalfOpen===!1)G.nextTick(N0,b);else if(x.autoDestroy){let a=b._writableState;if(!a||a.autoDestroy&&(a.finished||a.writable===!1))b.destroy()}}}function N0(x){if(x.writable&&!x.writableEnded&&!x.destroyed)x.end()}s.from=function(x,b){return E(s,x,b)};var LU;function M0(){if(LU===void 0)LU={};return LU}s.fromWeb=function(x,b){return M0().newStreamReadableFromReadableStream(x,b)},s.toWeb=function(x,b){return M0().newReadableStreamFromStreamReadable(x,b)},s.wrap=function(x,b){var a,E0;return new s({objectMode:(a=(E0=x.readableObjectMode)!==null&&E0!==void 0?E0:x.objectMode)!==null&&a!==void 0?a:!0,...b,destroy(w0,A0){Y0.destroyer(x,w0),A0(w0)}}).wrap(x)}}),MT=u0((I,Y)=>{var G=rU(),{ArrayPrototypeSlice:K,Error:L,FunctionPrototypeSymbolHasInstance:W,ObjectDefineProperty:Z,ObjectDefineProperties:z,ObjectSetPrototypeOf:q,StringPrototypeToLowerCase:C,Symbol:D,SymbolHasInstance:F}=o0();Y.exports=A,A.WritableState=T;var{EventEmitter:R}=(VE(),h0(GE)),M=ST().Stream,{Buffer:P}=(FU(),h0(KU)),k=XE(),{addAbortSignal:_}=fE(),{getHighWaterMark:N,getDefaultHighWaterMark:v}=cE(),{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_MULTIPLE_CALLBACK:y,ERR_STREAM_CANNOT_PIPE:l,ERR_STREAM_DESTROYED:Y0,ERR_STREAM_ALREADY_FINISHED:Z0,ERR_STREAM_NULL_VALUES:O0,ERR_STREAM_WRITE_AFTER_END:u,ERR_UNKNOWN_ENCODING:i}=zU().codes,{errorOrDestroy:U}=k;q(A.prototype,M.prototype),q(A,M);function X(){}var Q=D("kOnFinished");function T(f,h,I0){if(typeof I0!=="boolean")I0=h instanceof yU();if(this.objectMode=!!(f&&f.objectMode),I0)this.objectMode=this.objectMode||!!(f&&f.writableObjectMode);this.highWaterMark=f?N(this,f,"writableHighWaterMark",I0):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(f&&f.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=f&&f.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=S.bind(void 0,h),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,O(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!f||f.emitClose!==!1,this.autoDestroy=!f||f.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Q]=[]}function O(f){f.buffered=[],f.bufferedIndex=0,f.allBuffers=!0,f.allNoop=!0}T.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},Z(T.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function A(f){let h=this instanceof yU();if(!h&&!W(A,this))return new A(f);if(this._writableState=new T(f,this,h),f){if(typeof f.write==="function")this._write=f.write;if(typeof f.writev==="function")this._writev=f.writev;if(typeof f.destroy==="function")this._destroy=f.destroy;if(typeof f.final==="function")this._final=f.final;if(typeof f.construct==="function")this._construct=f.construct;if(f.signal)_(f.signal,this)}M.call(this,f),k.construct(this,()=>{let I0=this._writableState;if(!I0.writing)p(this,I0);d(this,I0)})}Z(A,F,{__proto__:null,value:function(f){if(W(this,f))return!0;if(this!==A)return!1;return f&&f._writableState instanceof T}}),A.prototype.pipe=function(){U(this,new l)};function $(f,h,I0,r){let e=f._writableState;if(typeof I0==="function")r=I0,I0=e.defaultEncoding;else{if(!I0)I0=e.defaultEncoding;else if(I0!=="buffer"&&!P.isEncoding(I0))throw new i(I0);if(typeof r!=="function")r=X}if(h===null)throw new O0;else if(!e.objectMode)if(typeof h==="string"){if(e.decodeStrings!==!1)h=P.from(h,I0),I0="buffer"}else if(h instanceof P)I0="buffer";else if(M._isUint8Array(h))h=M._uint8ArrayToBuffer(h),I0="buffer";else throw new B("chunk",["string","Buffer","Uint8Array"],h);let D0;if(e.ending)D0=new u;else if(e.destroyed)D0=new Y0("write");if(D0)return G.nextTick(r,D0),U(f,D0,!0),D0;return e.pendingcb++,J(f,e,h,I0,r)}A.prototype.write=function(f,h,I0){return $(this,f,h,I0)===!0},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){let f=this._writableState;if(f.corked){if(f.corked--,!f.writing)p(this,f)}},A.prototype.setDefaultEncoding=function(f){if(typeof f==="string")f=C(f);if(!P.isEncoding(f))throw new i(f);return this._writableState.defaultEncoding=f,this};function J(f,h,I0,r,e){let D0=h.objectMode?1:I0.length;h.length+=D0;let c=h.lengthI0.bufferedIndex)p(f,I0);if(r)if(I0.afterWriteTickInfo!==null&&I0.afterWriteTickInfo.cb===e)I0.afterWriteTickInfo.count++;else I0.afterWriteTickInfo={count:1,cb:e,stream:f,state:I0},G.nextTick(H,I0.afterWriteTickInfo);else j(f,I0,1,e)}}function H({stream:f,state:h,count:I0,cb:r}){return h.afterWriteTickInfo=null,j(f,h,I0,r)}function j(f,h,I0,r){if(!h.ending&&!f.destroyed&&h.length===0&&h.needDrain)h.needDrain=!1,f.emit("drain");while(I0-- >0)h.pendingcb--,r();if(h.destroyed)w(h);d(f,h)}function w(f){if(f.writing)return;for(let e=f.bufferedIndex;e1&&f._writev){h.pendingcb-=D0-1;let o=h.allNoop?X:(s)=>{for(let T0=c;T0256)I0.splice(0,c),h.bufferedIndex=0;else h.bufferedIndex=c}h.bufferProcessing=!1}A.prototype._write=function(f,h,I0){if(this._writev)this._writev([{chunk:f,encoding:h}],I0);else throw new g("_write()")},A.prototype._writev=null,A.prototype.end=function(f,h,I0){let r=this._writableState;if(typeof f==="function")I0=f,f=null,h=null;else if(typeof h==="function")I0=h,h=null;let e;if(f!==null&&f!==void 0){let D0=$(this,f,h);if(D0 instanceof L)e=D0}if(r.corked)r.corked=1,this.uncork();if(e);else if(!r.errored&&!r.ending)r.ending=!0,d(this,r,!0),r.ended=!0;else if(r.finished)e=new Z0("end");else if(r.destroyed)e=new Y0("end");if(typeof I0==="function")if(e||r.finished)G.nextTick(I0,e);else r[Q].push(I0);return this};function n(f){return f.ending&&!f.destroyed&&f.constructed&&f.length===0&&!f.errored&&f.buffered.length===0&&!f.finished&&!f.writing&&!f.errorEmitted&&!f.closeEmitted}function G0(f,h){let I0=!1;function r(e){if(I0){U(f,e!==null&&e!==void 0?e:y());return}if(I0=!0,h.pendingcb--,e){let D0=h[Q].splice(0);for(let c=0;c{if(n(e))X0(r,e);else e.pendingcb--},f,h);else if(n(h))h.pendingcb++,X0(f,h)}}}function X0(f,h){h.pendingcb--,h.finished=!0;let I0=h[Q].splice(0);for(let r=0;r{var G=rU(),K=(FU(),h0(KU)),{isReadable:L,isWritable:W,isIterable:Z,isNodeStream:z,isReadableNodeStream:q,isWritableNodeStream:C,isDuplexNodeStream:D,isReadableStream:F,isWritableStream:R}=fU(),M=bU(),{AbortError:P,codes:{ERR_INVALID_ARG_TYPE:k,ERR_INVALID_RETURN_VALUE:_}}=zU(),{destroyer:N}=XE(),v=yU(),B=pE(),g=MT(),{createDeferredPromise:y}=qU(),l=aX(),Y0=globalThis.Blob||K.Blob,Z0=typeof Y0<"u"?function(Q){return Q instanceof Y0}:function(Q){return!1},O0=globalThis.AbortController||AE().AbortController,{FunctionPrototypeCall:u}=o0();class i extends v{constructor(Q){super(Q);if((Q===null||Q===void 0?void 0:Q.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((Q===null||Q===void 0?void 0:Q.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}Y.exports=function Q(T,O){if(D(T))return T;if(q(T))return X({readable:T});if(C(T))return X({writable:T});if(z(T))return X({writable:!1,readable:!1});if(F(T))return X({readable:B.fromWeb(T)});if(R(T))return X({writable:g.fromWeb(T)});if(typeof T==="function"){let{value:$,write:J,final:E,destroy:V}=U(T);if(Z($))return l(i,$,{objectMode:!0,write:J,final:E,destroy:V});let S=$===null||$===void 0?void 0:$.then;if(typeof S==="function"){let H,j=u(S,$,(w)=>{if(w!=null)throw new _("nully","body",w)},(w)=>{N(H,w)});return H=new i({objectMode:!0,readable:!1,write:J,final(w){E(async()=>{try{await j,G.nextTick(w,null)}catch(p){G.nextTick(w,p)}})},destroy:V})}throw new _("Iterable, AsyncIterable or AsyncFunction",O,$)}if(Z0(T))return Q(T.arrayBuffer());if(Z(T))return l(i,T,{objectMode:!0,writable:!1});if(F(T===null||T===void 0?void 0:T.readable)&&R(T===null||T===void 0?void 0:T.writable))return i.fromWeb(T);if(typeof(T===null||T===void 0?void 0:T.writable)==="object"||typeof(T===null||T===void 0?void 0:T.readable)==="object"){let $=T!==null&&T!==void 0&&T.readable?q(T===null||T===void 0?void 0:T.readable)?T===null||T===void 0?void 0:T.readable:Q(T.readable):void 0,J=T!==null&&T!==void 0&&T.writable?C(T===null||T===void 0?void 0:T.writable)?T===null||T===void 0?void 0:T.writable:Q(T.writable):void 0;return X({readable:$,writable:J})}let A=T===null||T===void 0?void 0:T.then;if(typeof A==="function"){let $;return u(A,T,(J)=>{if(J!=null)$.push(J);$.push(null)},(J)=>{N($,J)}),$=new i({objectMode:!0,writable:!1,read(){}})}throw new k(O,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],T)};function U(Q){let{promise:T,resolve:O}=y(),A=new O0,$=A.signal;return{value:Q(async function*(){while(!0){let J=T;T=null;let{chunk:E,done:V,cb:S}=await J;if(G.nextTick(S),V)return;if($.aborted)throw new P(void 0,{cause:$.reason});({promise:T,resolve:O}=y()),yield E}}(),{signal:$}),write(J,E,V){let S=O;O=null,S({chunk:J,done:!1,cb:V})},final(J){let E=O;O=null,E({done:!0,cb:J})},destroy(J,E){A.abort(),E(J)}}}function X(Q){let T=Q.readable&&typeof Q.readable.read!=="function"?B.wrap(Q.readable):Q.readable,O=Q.writable,A=!!L(T),$=!!W(O),J,E,V,S,H;function j(w){let p=S;if(S=null,p)p(w);else if(w)H.destroy(w)}if(H=new i({readableObjectMode:!!(T!==null&&T!==void 0&&T.readableObjectMode),writableObjectMode:!!(O!==null&&O!==void 0&&O.writableObjectMode),readable:A,writable:$}),$)M(O,(w)=>{if($=!1,w)N(T,w);j(w)}),H._write=function(w,p,n){if(O.write(w,p))n();else J=n},H._final=function(w){O.end(),E=w},O.on("drain",function(){if(J){let w=J;J=null,w()}}),O.on("finish",function(){if(E){let w=E;E=null,w()}});if(A)M(T,(w)=>{if(A=!1,w)N(T,w);j(w)}),T.on("readable",function(){if(V){let w=V;V=null,w()}}),T.on("end",function(){H.push(null)}),H._read=function(){while(!0){let w=T.read();if(w===null){V=H._read;return}if(!H.push(w))return}};return H._destroy=function(w,p){if(!w&&S!==null)w=new P;if(V=null,J=null,E=null,S===null)p(w);else S=p,N(O,w),N(T,w)},H}}),yU=u0((I,Y)=>{var{ObjectDefineProperties:G,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:L,ObjectSetPrototypeOf:W}=o0();Y.exports=q;var Z=pE(),z=MT();W(q.prototype,Z.prototype),W(q,Z);{let R=L(z.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:G,Symbol:K}=o0();Y.exports=q;var{ERR_METHOD_NOT_IMPLEMENTED:L}=zU().codes,W=yU(),{getHighWaterMark:Z}=cE();G(q.prototype,W.prototype),G(q,W);var z=K("kCallback");function q(F){if(!(this instanceof q))return new q(F);let R=F?Z(this,F,"readableHighWaterMark",!0):null;if(R===0)F={...F,highWaterMark:null,readableHighWaterMark:R,writableHighWaterMark:F.writableHighWaterMark||0};if(W.call(this,F),this._readableState.sync=!1,this[z]=null,F){if(typeof F.transform==="function")this._transform=F.transform;if(typeof F.flush==="function")this._flush=F.flush}this.on("prefinish",D)}function C(F){if(typeof this._flush==="function"&&!this.destroyed)this._flush((R,M)=>{if(R){if(F)F(R);else this.destroy(R);return}if(M!=null)this.push(M);if(this.push(null),F)F()});else if(this.push(null),F)F()}function D(){if(this._final!==C)C.call(this)}q.prototype._final=C,q.prototype._transform=function(F,R,M){throw new L("_transform()")},q.prototype._write=function(F,R,M){let P=this._readableState,k=this._writableState,_=P.length;this._transform(F,R,(N,v)=>{if(N){M(N);return}if(v!=null)this.push(v);if(k.ended||_===P.length||P.length{var{ObjectSetPrototypeOf:G}=o0();Y.exports=L;var K=eX();G(L.prototype,K.prototype),G(L,K);function L(W){if(!(this instanceof L))return new L(W);K.call(this,W)}L.prototype._transform=function(W,Z,z){z(null,W)}}),qT=u0((I,Y)=>{var G=rU(),{ArrayIsArray:K,Promise:L,SymbolAsyncIterator:W,SymbolDispose:Z}=o0(),z=bU(),{once:q}=qU(),C=XE(),D=yU(),{aggregateTwoErrors:F,codes:{ERR_INVALID_ARG_TYPE:R,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:P,ERR_STREAM_DESTROYED:k,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:N}=zU(),{validateFunction:v,validateAbortSignal:B}=LE(),{isIterable:g,isReadable:y,isReadableNodeStream:l,isNodeStream:Y0,isTransformStream:Z0,isWebStream:O0,isReadableStream:u,isReadableFinished:i}=fU(),U=globalThis.AbortController||AE().AbortController,X,Q,T;function O(w,p,n){let G0=!1;w.on("close",()=>{G0=!0});let t=z(w,{readable:p,writable:n},(d)=>{G0=!d});return{destroy:(d)=>{if(G0)return;G0=!0,C.destroyer(w,d||new k("pipe"))},cleanup:t}}function A(w){return v(w[w.length-1],"streams[stream.length - 1]"),w.pop()}function $(w){if(g(w))return w;else if(l(w))return J(w);throw new R("val",["Readable","Iterable","AsyncIterable"],w)}async function*J(w){if(!Q)Q=pE();yield*Q.prototype[W].call(w)}async function E(w,p,n,{end:G0}){let t,d=null,X0=(g0)=>{if(g0)t=g0;if(d){let f=d;d=null,f()}},m=()=>new L((g0,f)=>{if(t)f(t);else d=()=>{if(t)f(t);else g0()}});p.on("drain",X0);let U0=z(p,{readable:!1},X0);try{if(p.writableNeedDrain)await m();for await(let g0 of w)if(!p.write(g0))await m();if(G0)p.end(),await m();n()}catch(g0){n(t!==g0?F(t,g0):g0)}finally{U0(),p.off("drain",X0)}}async function V(w,p,n,{end:G0}){if(Z0(p))p=p.writable;let t=p.getWriter();try{for await(let d of w)await t.ready,t.write(d).catch(()=>{});if(await t.ready,G0)await t.close();n()}catch(d){try{await t.abort(d),n(d)}catch(X0){n(X0)}}}function S(...w){return H(w,q(A(w)))}function H(w,p,n){if(w.length===1&&K(w[0]))w=w[0];if(w.length<2)throw new P("streams");let G0=new U,t=G0.signal,d=n===null||n===void 0?void 0:n.signal,X0=[];B(d,"options.signal");function m(){e(new N)}T=T||qU().addAbortListener;let U0;if(d)U0=T(d,m);let g0,f,h=[],I0=0;function r(s){e(s,--I0===0)}function e(s,T0){var y0;if(s&&(!g0||g0.code==="ERR_STREAM_PREMATURE_CLOSE"))g0=s;if(!g0&&!T0)return;while(h.length)h.shift()(g0);if((y0=U0)===null||y0===void 0||y0[Z](),G0.abort(),T0){if(!g0)X0.forEach((L0)=>L0());G.nextTick(p,g0,f)}}let D0;for(let s=0;s0,$0=y0||(n===null||n===void 0?void 0:n.end)!==!1,n0=s===w.length-1;if(Y0(T0)){let V0=function(K0){if(K0&&K0.name!=="AbortError"&&K0.code!=="ERR_STREAM_PREMATURE_CLOSE")r(K0)};var c=V0;if($0){let{destroy:K0,cleanup:t0}=O(T0,y0,L0);if(h.push(K0),y(T0)&&n0)X0.push(t0)}if(T0.on("error",V0),y(T0)&&n0)X0.push(()=>{T0.removeListener("error",V0)})}if(s===0)if(typeof T0==="function"){if(D0=T0({signal:t}),!g(D0))throw new M("Iterable, AsyncIterable or Stream","source",D0)}else if(g(T0)||l(T0)||Z0(T0))D0=T0;else D0=D.from(T0);else if(typeof T0==="function"){if(Z0(D0)){var o;D0=$((o=D0)===null||o===void 0?void 0:o.readable)}else D0=$(D0);if(D0=T0(D0,{signal:t}),y0){if(!g(D0,!0))throw new M("AsyncIterable",`transform[${s-1}]`,D0)}else{var x0;if(!X)X=iX();let V0=new X({objectMode:!0}),K0=(x0=D0)===null||x0===void 0?void 0:x0.then;if(typeof K0==="function")I0++,K0.call(D0,(W0)=>{if(f=W0,W0!=null)V0.write(W0);if($0)V0.end();G.nextTick(r)},(W0)=>{V0.destroy(W0),G.nextTick(r,W0)});else if(g(D0,!0))I0++,E(D0,V0,r,{end:$0});else if(u(D0)||Z0(D0)){let W0=D0.readable||D0;I0++,E(W0,V0,r,{end:$0})}else throw new M("AsyncIterable or Promise","destination",D0);D0=V0;let{destroy:t0,cleanup:H0}=O(D0,!1,!0);if(h.push(t0),n0)X0.push(H0)}}else if(Y0(T0)){if(l(D0)){I0+=2;let V0=j(D0,T0,r,{end:$0});if(y(T0)&&n0)X0.push(V0)}else if(Z0(D0)||u(D0)){let V0=D0.readable||D0;I0++,E(V0,T0,r,{end:$0})}else if(g(D0))I0++,E(D0,T0,r,{end:$0});else throw new R("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],D0);D0=T0}else if(O0(T0)){if(l(D0))I0++,V($(D0),T0,r,{end:$0});else if(u(D0)||g(D0))I0++,V(D0,T0,r,{end:$0});else if(Z0(D0))I0++,V(D0.readable,T0,r,{end:$0});else throw new R("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],D0);D0=T0}else D0=D.from(T0)}if(t!==null&&t!==void 0&&t.aborted||d!==null&&d!==void 0&&d.aborted)G.nextTick(m);return D0}function j(w,p,n,{end:G0}){let t=!1;if(p.on("close",()=>{if(!t)n(new _)}),w.pipe(p,{end:!1}),G0){let X0=function(){t=!0,p.end()};var d=X0;if(i(w))G.nextTick(X0);else w.once("end",X0)}else n();return z(w,{readable:!0,writable:!1},(X0)=>{let m=w._readableState;if(X0&&X0.code==="ERR_STREAM_PREMATURE_CLOSE"&&m&&m.ended&&!m.errored&&!m.errorEmitted)w.once("end",n).once("error",n);else n(X0)}),z(p,{readable:!1,writable:!0},n)}Y.exports={pipelineImpl:H,pipeline:S}}),UI=u0((I,Y)=>{var{pipeline:G}=qT(),K=yU(),{destroyer:L}=XE(),{isNodeStream:W,isReadable:Z,isWritable:z,isWebStream:q,isTransformStream:C,isWritableStream:D,isReadableStream:F}=fU(),{AbortError:R,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:P}}=zU(),k=bU();Y.exports=function(..._){if(_.length===0)throw new P("streams");if(_.length===1)return K.from(_[0]);let N=[..._];if(typeof _[0]==="function")_[0]=K.from(_[0]);if(typeof _[_.length-1]==="function"){let U=_.length-1;_[U]=K.from(_[U])}for(let U=0;U<_.length;++U){if(!W(_[U])&&!q(_[U]))continue;if(U<_.length-1&&!(Z(_[U])||F(_[U])||C(_[U])))throw new M(`streams[${U}]`,N[U],"must be readable");if(U>0&&!(z(_[U])||D(_[U])||C(_[U])))throw new M(`streams[${U}]`,N[U],"must be writable")}let v,B,g,y,l;function Y0(U){let X=y;if(y=null,X)X(U);else if(U)l.destroy(U);else if(!i&&!u)l.destroy()}let Z0=_[0],O0=G(_,Y0),u=!!(z(Z0)||D(Z0)||C(Z0)),i=!!(Z(O0)||F(O0)||C(O0));if(l=new K({writableObjectMode:!!(Z0!==null&&Z0!==void 0&&Z0.writableObjectMode),readableObjectMode:!!(O0!==null&&O0!==void 0&&O0.readableObjectMode),writable:u,readable:i}),u){if(W(Z0))l._write=function(X,Q,T){if(Z0.write(X,Q))T();else v=T},l._final=function(X){Z0.end(),B=X},Z0.on("drain",function(){if(v){let X=v;v=null,X()}});else if(q(Z0)){let X=(C(Z0)?Z0.writable:Z0).getWriter();l._write=async function(Q,T,O){try{await X.ready,X.write(Q).catch(()=>{}),O()}catch(A){O(A)}},l._final=async function(Q){try{await X.ready,X.close().catch(()=>{}),B=Q}catch(T){Q(T)}}}let U=C(O0)?O0.readable:O0;k(U,()=>{if(B){let X=B;B=null,X()}})}if(i){if(W(O0))O0.on("readable",function(){if(g){let U=g;g=null,U()}}),O0.on("end",function(){l.push(null)}),l._read=function(){while(!0){let U=O0.read();if(U===null){g=l._read;return}if(!l.push(U))return}};else if(q(O0)){let U=(C(O0)?O0.readable:O0).getReader();l._read=async function(){while(!0)try{let{value:X,done:Q}=await U.read();if(!l.push(X))return;if(Q){l.push(null);return}}catch{return}}}}return l._destroy=function(U,X){if(!U&&y!==null)U=new R;if(g=null,v=null,B=null,y===null)X(U);else if(y=X,W(O0))L(O0,U)},l}}),UZ=u0((I,Y)=>{var G=globalThis.AbortController||AE().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:L,ERR_MISSING_ARGS:W,ERR_OUT_OF_RANGE:Z},AbortError:z}=zU(),{validateAbortSignal:q,validateInteger:C,validateObject:D}=LE(),F=o0().Symbol("kWeak"),R=o0().Symbol("kResistStopPropagation"),{finished:M}=bU(),P=UI(),{addAbortSignalNoValidate:k}=fE(),{isWritable:_,isNodeStream:N}=fU(),{deprecate:v}=qU(),{ArrayPrototypePush:B,Boolean:g,MathFloor:y,Number:l,NumberIsNaN:Y0,Promise:Z0,PromiseReject:O0,PromiseResolve:u,PromisePrototypeThen:i,Symbol:U}=o0(),X=U("kEmpty"),Q=U("kEof");function T(d,X0){if(X0!=null)D(X0,"options");if((X0===null||X0===void 0?void 0:X0.signal)!=null)q(X0.signal,"options.signal");if(N(d)&&!_(d))throw new K("stream",d,"must be writable");let m=P(this,d);if(X0!==null&&X0!==void 0&&X0.signal)k(X0.signal,m);return m}function O(d,X0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);if(X0!=null)D(X0,"options");if((X0===null||X0===void 0?void 0:X0.signal)!=null)q(X0.signal,"options.signal");let m=1;if((X0===null||X0===void 0?void 0:X0.concurrency)!=null)m=y(X0.concurrency);let U0=m-1;if((X0===null||X0===void 0?void 0:X0.highWaterMark)!=null)U0=y(X0.highWaterMark);return C(m,"options.concurrency",1),C(U0,"options.highWaterMark",0),U0+=m,async function*(){let g0=qU().AbortSignalAny([X0===null||X0===void 0?void 0:X0.signal].filter(g)),f=this,h=[],I0={signal:g0},r,e,D0=!1,c=0;function o(){D0=!0,x0()}function x0(){c-=1,s()}function s(){if(e&&!D0&&c=U0||c>=m))await new Z0((L0)=>{e=L0})}h.push(Q)}catch(y0){let L0=O0(y0);i(L0,x0,o),h.push(L0)}finally{if(D0=!0,r)r(),r=null}}T0();try{while(!0){while(h.length>0){let y0=await h[0];if(y0===Q)return;if(g0.aborted)throw new z;if(y0!==X)yield y0;h.shift(),s()}await new Z0((y0)=>{r=y0})}}finally{if(D0=!0,e)e(),e=null}}.call(this)}function A(d=void 0){if(d!=null)D(d,"options");if((d===null||d===void 0?void 0:d.signal)!=null)q(d.signal,"options.signal");return async function*(){let X0=0;for await(let U0 of this){var m;if(d!==null&&d!==void 0&&(m=d.signal)!==null&&m!==void 0&&m.aborted)throw new z({cause:d.signal.reason});yield[X0++,U0]}}.call(this)}async function $(d,X0=void 0){for await(let m of S.call(this,d,X0))return!0;return!1}async function J(d,X0=void 0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);return!await $.call(this,async(...m)=>{return!await d(...m)},X0)}async function E(d,X0){for await(let m of S.call(this,d,X0))return m;return}async function V(d,X0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);async function m(U0,g0){return await d(U0,g0),X}for await(let U0 of O.call(this,m,X0));}function S(d,X0){if(typeof d!=="function")throw new L("fn",["Function","AsyncFunction"],d);async function m(U0,g0){if(await d(U0,g0))return U0;return X}return O.call(this,m,X0)}class H extends W{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function j(d,X0,m){var U0;if(typeof d!=="function")throw new L("reducer",["Function","AsyncFunction"],d);if(m!=null)D(m,"options");if((m===null||m===void 0?void 0:m.signal)!=null)q(m.signal,"options.signal");let g0=arguments.length>1;if(m!==null&&m!==void 0&&(U0=m.signal)!==null&&U0!==void 0&&U0.aborted){let e=new z(void 0,{cause:m.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(e)),e}let f=new G,h=f.signal;if(m!==null&&m!==void 0&&m.signal){let e={once:!0,[F]:this,[R]:!0};m.signal.addEventListener("abort",()=>f.abort(),e)}let I0=!1;try{for await(let e of this){var r;if(I0=!0,m!==null&&m!==void 0&&(r=m.signal)!==null&&r!==void 0&&r.aborted)throw new z;if(!g0)X0=e,g0=!0;else X0=await d(X0,e,{signal:h})}if(!I0&&!g0)throw new H}finally{f.abort()}return X0}async function w(d){if(d!=null)D(d,"options");if((d===null||d===void 0?void 0:d.signal)!=null)q(d.signal,"options.signal");let X0=[];for await(let U0 of this){var m;if(d!==null&&d!==void 0&&(m=d.signal)!==null&&m!==void 0&&m.aborted)throw new z(void 0,{cause:d.signal.reason});B(X0,U0)}return X0}function p(d,X0){let m=O.call(this,d,X0);return async function*(){for await(let U0 of m)yield*U0}.call(this)}function n(d){if(d=l(d),Y0(d))return 0;if(d<0)throw new Z("number",">= 0",d);return d}function G0(d,X0=void 0){if(X0!=null)D(X0,"options");if((X0===null||X0===void 0?void 0:X0.signal)!=null)q(X0.signal,"options.signal");return d=n(d),async function*(){var m;if(X0!==null&&X0!==void 0&&(m=X0.signal)!==null&&m!==void 0&&m.aborted)throw new z;for await(let g0 of this){var U0;if(X0!==null&&X0!==void 0&&(U0=X0.signal)!==null&&U0!==void 0&&U0.aborted)throw new z;if(d--<=0)yield g0}}.call(this)}function t(d,X0=void 0){if(X0!=null)D(X0,"options");if((X0===null||X0===void 0?void 0:X0.signal)!=null)q(X0.signal,"options.signal");return d=n(d),async function*(){var m;if(X0!==null&&X0!==void 0&&(m=X0.signal)!==null&&m!==void 0&&m.aborted)throw new z;for await(let g0 of this){var U0;if(X0!==null&&X0!==void 0&&(U0=X0.signal)!==null&&U0!==void 0&&U0.aborted)throw new z;if(d-- >0)yield g0;if(d<=0)return}}.call(this)}Y.exports.streamReturningOperators={asIndexedPairs:v(A,"readable.asIndexedPairs will be removed in a future version."),drop:G0,filter:S,flatMap:p,map:O,take:t,compose:T},Y.exports.promiseReturningOperators={every:J,forEach:V,reduce:j,toArray:w,some:$,find:E}}),EI=u0((I,Y)=>{var{ArrayPrototypePop:G,Promise:K}=o0(),{isIterable:L,isNodeStream:W,isWebStream:Z}=fU(),{pipelineImpl:z}=qT(),{finished:q}=bU();TI();function C(...D){return new K((F,R)=>{let M,P,k=D[D.length-1];if(k&&typeof k==="object"&&!W(k)&&!L(k)&&!Z(k)){let _=G(D);M=_.signal,P=_.end}z(D,(_,N)=>{if(_)R(_);else F(N)},{signal:M,end:P})})}Y.exports={finished:q,pipeline:C}}),TI=u0((I,Y)=>{var{Buffer:G}=(FU(),h0(KU)),{ObjectDefineProperty:K,ObjectKeys:L,ReflectApply:W}=o0(),{promisify:{custom:Z}}=qU(),{streamReturningOperators:z,promiseReturningOperators:q}=UZ(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:C}}=zU(),D=UI(),{setDefaultHighWaterMark:F,getDefaultHighWaterMark:R}=cE(),{pipeline:M}=qT(),{destroyer:P}=XE(),k=bU(),_=EI(),N=fU(),v=Y.exports=ST().Stream;v.isDestroyed=N.isDestroyed,v.isDisturbed=N.isDisturbed,v.isErrored=N.isErrored,v.isReadable=N.isReadable,v.isWritable=N.isWritable,v.Readable=pE();for(let g of L(z)){let y=function(...Y0){if(new.target)throw C();return v.Readable.from(W(l,this,Y0))},l=z[g];K(y,"name",{__proto__:null,value:l.name}),K(y,"length",{__proto__:null,value:l.length}),K(v.Readable.prototype,g,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}for(let g of L(q)){let y=function(...Y0){if(new.target)throw C();return W(l,this,Y0)},l=q[g];K(y,"name",{__proto__:null,value:l.name}),K(y,"length",{__proto__:null,value:l.length}),K(v.Readable.prototype,g,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}v.Writable=MT(),v.Duplex=yU(),v.Transform=eX(),v.PassThrough=iX(),v.pipeline=M;var{addAbortSignal:B}=fE();v.addAbortSignal=B,v.finished=k,v.destroy=P,v.compose=D,v.setDefaultHighWaterMark=F,v.getDefaultHighWaterMark=R,K(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),K(M,Z,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),K(k,Z,{__proto__:null,enumerable:!0,get(){return _.finished}}),v.Stream=v,v._isUint8Array=function(g){return g instanceof Uint8Array},v._uint8ArrayToBuffer=function(g){return G.from(g.buffer,g.byteOffset,g.byteLength)}}),EZ=u0((I,Y)=>{var G=PT();{let K=TI(),L=EI(),W=K.Readable.destroy;Y.exports=K.Readable,Y.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,Y.exports._isUint8Array=K._isUint8Array,Y.exports.isDisturbed=K.isDisturbed,Y.exports.isErrored=K.isErrored,Y.exports.isReadable=K.isReadable,Y.exports.Readable=K.Readable,Y.exports.Writable=K.Writable,Y.exports.Duplex=K.Duplex,Y.exports.Transform=K.Transform,Y.exports.PassThrough=K.PassThrough,Y.exports.addAbortSignal=K.addAbortSignal,Y.exports.finished=K.finished,Y.exports.destroy=K.destroy,Y.exports.destroy=W,Y.exports.pipeline=K.pipeline,Y.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return L}}),Y.exports.Stream=K.Stream}Y.exports.default=Y.exports});XI.exports=EZ()});var PU={};jU(PU,{webcrypto:()=>_J,rng:()=>hQ,randomUUID:()=>MJ,randomFillSync:()=>RJ,randomFill:()=>HJ,randomBytes:()=>uQ,publicEncrypt:()=>$J,publicDecrypt:()=>FJ,pseudoRandomBytes:()=>pQ,prng:()=>cQ,privateEncrypt:()=>KJ,privateDecrypt:()=>WJ,pbkdf2Sync:()=>mQ,pbkdf2:()=>nQ,listCiphers:()=>XJ,getRandomValues:()=>SJ,getHashes:()=>oQ,getDiffieHellman:()=>OJ,getCurves:()=>PJ,getCiphers:()=>TJ,default:()=>kJ,createVerify:()=>VJ,createSign:()=>JJ,createHmac:()=>lQ,createHash:()=>DE,createECDH:()=>LJ,createDiffieHellmanGroup:()=>YJ,createDiffieHellman:()=>ZJ,createDecipheriv:()=>EJ,createDecipher:()=>iQ,createCredentials:()=>DJ,createCipheriv:()=>aQ,createCipher:()=>rQ,constants:()=>CJ,Verify:()=>AJ,Sign:()=>GJ,Hmac:()=>dQ,Hash:()=>bQ,DiffieHellmanGroup:()=>IJ,DiffieHellman:()=>QJ,Decipheriv:()=>UJ,Decipher:()=>eQ,DEFAULT_ENCODING:()=>zJ,Cipheriv:()=>tQ,Cipher:()=>sQ});function PJ(){return qJ}var TZ,XZ,II,IZ,YZ,OZ=(I,Y,G)=>{G=I!=null?TZ(XZ(I)):{};let K=Y||!I||!I.__esModule?II(G,"default",{value:I,enumerable:!0}):G;for(let L of IZ(I))if(!YZ.call(K,L))II(K,L,{get:()=>I[L],enumerable:!0});return K},Q0=(I,Y)=>()=>(Y||I((Y={exports:{}}).exports,Y),Y.exports),hE,uE,OI,ZZ,kT,vT,SU,QZ,KE,ZI,JZ,GZ,VZ,AZ,QI,LZ,$Z,KZ,FZ,WZ,HZ,RZ,DZ,CZ,zZ,FE,bE,JI,SZ,GI,VI,MZ,WE,jT,NT,qZ,AI,BT,PZ,LI,_Z,$I,KI,kZ,vZ,jZ,NZ,BZ,xZ,gZ,wZ,yZ,fZ,cZ,pZ,hZ,uZ,xT,FI,bZ,WI,dZ,lZ,oZ,nZ,cU,dU,HI,vU,RI,dE,mZ,_U,sZ,rZ,tZ,DI,xU,HE,CI,aZ,zI,eZ,SI,iZ,UQ,EQ,TQ,gT,XQ,wT,IQ,YQ,OQ,ZQ,QQ,JQ,GQ,VQ,AQ,LQ,$Q,KQ,FQ,WQ,YI,HQ,$E,RQ,MI,qI,DQ,CQ,PI,zQ,SQ,RE,MQ,qQ,PQ,_Q,kQ,vQ,_I,jQ,kI,vI,jI,yT,NI,NQ,BI,BQ,xQ,_T,gQ,wQ,yQ,fQ,p0,cQ,pQ,hQ,uQ,bQ,DE,dQ,lQ,oQ,nQ,mQ,sQ,rQ,tQ,aQ,eQ,iQ,UJ,EJ,TJ,XJ,IJ,YJ,OJ,ZJ,QJ,JJ,GJ,VJ,AJ,LJ,$J,KJ,FJ,WJ,HJ,RJ,DJ,CJ,zJ="buffer",SJ=(I)=>{return crypto.getRandomValues(I)},MJ=()=>{return crypto.randomUUID()},qJ,_J,kJ;var CU=VU(()=>{TZ=Object.create,{getPrototypeOf:XZ,defineProperty:II,getOwnPropertyNames:IZ}=Object,YZ=Object.prototype.hasOwnProperty,hE=Q0((I,Y)=>{Y.exports=(CU(),h0(PU)).randomBytes}),uE=Q0((I,Y)=>{Y.exports=(CU(),h0(PU)).createHash}),OI=Q0((I,Y)=>{Y.exports=(CU(),h0(PU)).createHmac}),ZZ=Q0((I,Y)=>{Y.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),kT=Q0((I,Y)=>{var G=isFinite,K=Math.pow(2,30)-1;Y.exports=function(L,W){if(typeof L!=="number")throw TypeError("Iterations not a number");if(L<0||!G(L))throw TypeError("Bad iterations");if(typeof W!=="number")throw TypeError("Key length not a number");if(W<0||W>K||W!==W)throw TypeError("Bad key length")}}),vT=Q0((I,Y)=>{var G;if(globalThis.process&&globalThis.process.browser)G="utf-8";else if(globalThis.process&&globalThis.process.version)K=parseInt(process.version.split(".")[0].slice(1),10),G=K>=6?"utf-8":"binary";else G="utf-8";var K;Y.exports=G}),SU=Q0((I,Y)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var G=(FU(),h0(KU)),K=G.Buffer;function L(Z,z){for(var q in Z)z[q]=Z[q]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)Y.exports=G;else L(G,I),I.Buffer=W;function W(Z,z,q){return K(Z,z,q)}W.prototype=Object.create(K.prototype),L(K,W),W.from=function(Z,z,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return K(Z,z,q)},W.alloc=function(Z,z,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var C=K(Z);if(z!==void 0)if(typeof q==="string")C.fill(z,q);else C.fill(z);else C.fill(0);return C},W.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return K(Z)},W.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),QZ=Q0((I,Y)=>{var G={}.toString;Y.exports=Array.isArray||function(K){return G.call(K)=="[object Array]"}}),KE=Q0((I,Y)=>{Y.exports=TypeError}),ZI=Q0((I,Y)=>{Y.exports=Object}),JZ=Q0((I,Y)=>{Y.exports=Error}),GZ=Q0((I,Y)=>{Y.exports=EvalError}),VZ=Q0((I,Y)=>{Y.exports=RangeError}),AZ=Q0((I,Y)=>{Y.exports=ReferenceError}),QI=Q0((I,Y)=>{Y.exports=SyntaxError}),LZ=Q0((I,Y)=>{Y.exports=URIError}),$Z=Q0((I,Y)=>{Y.exports=Math.abs}),KZ=Q0((I,Y)=>{Y.exports=Math.floor}),FZ=Q0((I,Y)=>{Y.exports=Math.max}),WZ=Q0((I,Y)=>{Y.exports=Math.min}),HZ=Q0((I,Y)=>{Y.exports=Math.pow}),RZ=Q0((I,Y)=>{Y.exports=Math.round}),DZ=Q0((I,Y)=>{Y.exports=Number.isNaN||function(G){return G!==G}}),CZ=Q0((I,Y)=>{var G=DZ();Y.exports=function(K){if(G(K)||K===0)return K;return K<0?-1:1}}),zZ=Q0((I,Y)=>{Y.exports=Object.getOwnPropertyDescriptor}),FE=Q0((I,Y)=>{var G=zZ();if(G)try{G([],"length")}catch(K){G=null}Y.exports=G}),bE=Q0((I,Y)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(K){G=!1}Y.exports=G}),JI=Q0((I,Y)=>{Y.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var G={},K=Symbol("test"),L=Object(K);if(typeof K==="string")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(L)!=="[object Symbol]")return!1;var W=42;G[K]=W;for(var Z in G)return!1;if(typeof Object.keys==="function"&&Object.keys(G).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(G).length!==0)return!1;var z=Object.getOwnPropertySymbols(G);if(z.length!==1||z[0]!==K)return!1;if(!Object.prototype.propertyIsEnumerable.call(G,K))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var q=Object.getOwnPropertyDescriptor(G,K);if(q.value!==W||q.enumerable!==!0)return!1}return!0}}),SZ=Q0((I,Y)=>{var G=typeof Symbol<"u"&&Symbol,K=JI();Y.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return K()}}),GI=Q0((I,Y)=>{Y.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),VI=Q0((I,Y)=>{var G=ZI();Y.exports=G.getPrototypeOf||null}),MZ=Q0((I,Y)=>{var G="Function.prototype.bind called on incompatible ",K=Object.prototype.toString,L=Math.max,W="[object Function]",Z=function(C,D){var F=[];for(var R=0;R{var G=MZ();Y.exports=Function.prototype.bind||G}),jT=Q0((I,Y)=>{Y.exports=Function.prototype.call}),NT=Q0((I,Y)=>{Y.exports=Function.prototype.apply}),qZ=Q0((I,Y)=>{Y.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),AI=Q0((I,Y)=>{var G=WE(),K=NT(),L=jT(),W=qZ();Y.exports=W||G.call(L,K)}),BT=Q0((I,Y)=>{var G=WE(),K=KE(),L=jT(),W=AI();Y.exports=function(Z){if(Z.length<1||typeof Z[0]!=="function")throw new K("a function is required");return W(G,L,Z)}}),PZ=Q0((I,Y)=>{var G=BT(),K=FE(),L;try{L=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var W=!!L&&K&&K(Object.prototype,"__proto__"),Z=Object,z=Z.getPrototypeOf;Y.exports=W&&typeof W.get==="function"?G([W.get]):typeof z==="function"?function(q){return z(q==null?q:Z(q))}:!1}),LI=Q0((I,Y)=>{var G=GI(),K=VI(),L=PZ();Y.exports=G?function(W){return G(W)}:K?function(W){if(!W||typeof W!=="object"&&typeof W!=="function")throw TypeError("getProto: not an object");return K(W)}:L?function(W){return L(W)}:null}),_Z=Q0((I,Y)=>{var G=Function.prototype.call,K=Object.prototype.hasOwnProperty,L=WE();Y.exports=L.call(G,K)}),$I=Q0((I,Y)=>{var G,K=ZI(),L=JZ(),W=GZ(),Z=VZ(),z=AZ(),q=QI(),C=KE(),D=LZ(),F=$Z(),R=KZ(),M=FZ(),P=WZ(),k=HZ(),_=RZ(),N=CZ(),v=Function,B=function(X0){try{return v('"use strict"; return ('+X0+").constructor;")()}catch(m){}},g=FE(),y=bE(),l=function(){throw new C},Y0=g?function(){try{return arguments.callee,l}catch(X0){try{return g(arguments,"callee").get}catch(m){return l}}}():l,Z0=SZ()(),O0=LI(),u=VI(),i=GI(),U=NT(),X=jT(),Q={},T=typeof Uint8Array>"u"||!O0?G:O0(Uint8Array),O={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":Z0&&O0?O0([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":L,"%eval%":eval,"%EvalError%":W,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Z0&&O0?O0(O0([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Z0||!O0?G:O0(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":K,"%Object.getOwnPropertyDescriptor%":g,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":z,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Z0||!O0?G:O0(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Z0&&O0?O0(""[Symbol.iterator]()):G,"%Symbol%":Z0?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":Y0,"%TypedArray%":T,"%TypeError%":C,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":D,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":X,"%Function.prototype.apply%":U,"%Object.defineProperty%":y,"%Object.getPrototypeOf%":u,"%Math.abs%":F,"%Math.floor%":R,"%Math.max%":M,"%Math.min%":P,"%Math.pow%":k,"%Math.round%":_,"%Math.sign%":N,"%Reflect.getPrototypeOf%":i};if(O0)try{null.error}catch(X0){A=O0(O0(X0)),O["%Error.prototype%"]=A}var A,$=function X0(m){var U0;if(m==="%AsyncFunction%")U0=B("async function () {}");else if(m==="%GeneratorFunction%")U0=B("function* () {}");else if(m==="%AsyncGeneratorFunction%")U0=B("async function* () {}");else if(m==="%AsyncGenerator%"){var g0=X0("%AsyncGeneratorFunction%");if(g0)U0=g0.prototype}else if(m==="%AsyncIteratorPrototype%"){var f=X0("%AsyncGenerator%");if(f&&O0)U0=O0(f.prototype)}return O[m]=U0,U0},J={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},E=WE(),V=_Z(),S=E.call(X,Array.prototype.concat),H=E.call(U,Array.prototype.splice),j=E.call(X,String.prototype.replace),w=E.call(X,String.prototype.slice),p=E.call(X,RegExp.prototype.exec),n=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,G0=/\\(\\)?/g,t=function(X0){var m=w(X0,0,1),U0=w(X0,-1);if(m==="%"&&U0!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(U0==="%"&&m!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var g0=[];return j(X0,n,function(f,h,I0,r){g0[g0.length]=I0?j(r,G0,"$1"):h||f}),g0},d=function(X0,m){var U0=X0,g0;if(V(J,U0))g0=J[U0],U0="%"+g0[0]+"%";if(V(O,U0)){var f=O[U0];if(f===Q)f=$(U0);if(typeof f>"u"&&!m)throw new C("intrinsic "+X0+" exists, but is not available. Please file an issue!");return{alias:g0,name:U0,value:f}}throw new q("intrinsic "+X0+" does not exist!")};Y.exports=function(X0,m){if(typeof X0!=="string"||X0.length===0)throw new C("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof m!=="boolean")throw new C('"allowMissing" argument must be a boolean');if(p(/^%?[^%]*%?$/,X0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var U0=t(X0),g0=U0.length>0?U0[0]:"",f=d("%"+g0+"%",m),h=f.name,I0=f.value,r=!1,e=f.alias;if(e)g0=e[0],H(U0,S([0,1],e));for(var D0=1,c=!0;D0=U0.length){var T0=g(I0,o);if(c=!!T0,c&&"get"in T0&&!("originalValue"in T0.get))I0=T0.get;else I0=I0[o]}else c=V(I0,o),I0=I0[o];if(c&&!r)O[h]=I0}}return I0}}),KI=Q0((I,Y)=>{var G=$I(),K=BT(),L=K([G("%String.prototype.indexOf%")]);Y.exports=function(W,Z){var z=G(W,!!Z);if(typeof z==="function"&&L(W,".prototype.")>-1)return K([z]);return z}}),kZ=Q0((I,Y)=>{var G=Function.prototype.toString,K=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,L,W;if(typeof K==="function"&&typeof Object.defineProperty==="function")try{L=Object.defineProperty({},"length",{get:function(){throw W}}),W={},K(function(){throw 42},null,L)}catch(g){if(g!==W)K=null}else K=null;var Z=/^\s*class\b/,z=function(g){try{var y=G.call(g);return Z.test(y)}catch(l){return!1}},q=function(g){try{if(z(g))return!1;return G.call(g),!0}catch(y){return!1}},C=Object.prototype.toString,D="[object Object]",F="[object Function]",R="[object GeneratorFunction]",M="[object HTMLAllCollection]",P="[object HTML document.all class]",k="[object HTMLCollection]",_=typeof Symbol==="function"&&!!Symbol.toStringTag,N=!(0 in[,]),v=function(){return!1};if(typeof document==="object"){if(B=document.all,C.call(B)===C.call(document.all))v=function(g){if((N||!g)&&(typeof g>"u"||typeof g==="object"))try{var y=C.call(g);return(y===M||y===P||y===k||y===D)&&g("")==null}catch(l){}return!1}}var B;Y.exports=K?function(g){if(v(g))return!0;if(!g)return!1;if(typeof g!=="function"&&typeof g!=="object")return!1;try{K(g,null,L)}catch(y){if(y!==W)return!1}return!z(g)&&q(g)}:function(g){if(v(g))return!0;if(!g)return!1;if(typeof g!=="function"&&typeof g!=="object")return!1;if(_)return q(g);if(z(g))return!1;var y=C.call(g);if(y!==F&&y!==R&&!/^\[object HTML/.test(y))return!1;return q(g)}}),vZ=Q0((I,Y)=>{var G=kZ(),K=Object.prototype.toString,L=Object.prototype.hasOwnProperty,W=function(C,D,F){for(var R=0,M=C.length;R=3)R=F;if(q(C))W(C,D,R);else if(typeof C==="string")Z(C,D,R);else z(C,D,R)}}),jZ=Q0((I,Y)=>{Y.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),NZ=Q0((I,Y)=>{var G=jZ(),K=typeof globalThis>"u"?globalThis:globalThis;Y.exports=function(){var L=[];for(var W=0;W{var G=bE(),K=QI(),L=KE(),W=FE();Y.exports=function(Z,z,q){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw new L("`obj` must be an object or a function`");if(typeof z!=="string"&&typeof z!=="symbol")throw new L("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new L("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new L("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new L("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new L("`loose`, if provided, must be a boolean");var C=arguments.length>3?arguments[3]:null,D=arguments.length>4?arguments[4]:null,F=arguments.length>5?arguments[5]:null,R=arguments.length>6?arguments[6]:!1,M=!!W&&W(Z,z);if(G)G(Z,z,{configurable:F===null&&M?M.configurable:!F,enumerable:C===null&&M?M.enumerable:!C,value:q,writable:D===null&&M?M.writable:!D});else if(R||!C&&!D&&!F)Z[z]=q;else throw new K("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),xZ=Q0((I,Y)=>{var G=bE(),K=function(){return!!G};K.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(L){return!0}},Y.exports=K}),gZ=Q0((I,Y)=>{var G=$I(),K=BZ(),L=xZ()(),W=FE(),Z=KE(),z=G("%Math.floor%");Y.exports=function(q,C){if(typeof q!=="function")throw new Z("`fn` is not a function");if(typeof C!=="number"||C<0||C>4294967295||z(C)!==C)throw new Z("`length` must be a positive 32-bit integer");var D=arguments.length>2&&!!arguments[2],F=!0,R=!0;if("length"in q&&W){var M=W(q,"length");if(M&&!M.configurable)F=!1;if(M&&!M.writable)R=!1}if(F||R||!D)if(L)K(q,"length",C,!0,!0);else K(q,"length",C);return q}}),wZ=Q0((I,Y)=>{var G=WE(),K=NT(),L=AI();Y.exports=function(){return L(G,K,arguments)}}),yZ=Q0((I,Y)=>{var G=gZ(),K=bE(),L=BT(),W=wZ();if(Y.exports=function(Z){var z=L(arguments),q=Z.length-(arguments.length-1);return G(z,1+(q>0?q:0),!0)},K)K(Y.exports,"apply",{value:W});else Y.exports.apply=W}),fZ=Q0((I,Y)=>{var G=JI();Y.exports=function(){return G()&&!!Symbol.toStringTag}}),cZ=Q0((I,Y)=>{var G=vZ(),K=NZ(),L=yZ(),W=KI(),Z=FE(),z=LI(),q=W("Object.prototype.toString"),C=fZ()(),D=typeof globalThis>"u"?globalThis:globalThis,F=K(),R=W("String.prototype.slice"),M=W("Array.prototype.indexOf",!0)||function(N,v){for(var B=0;B-1)return v;if(v!=="Object")return!1;return _(N)}if(!Z)return null;return k(N)}}),pZ=Q0((I,Y)=>{var G=cZ();Y.exports=function(K){return!!G(K)}}),hZ=Q0((I,Y)=>{var G=KE(),K=KI(),L=K("TypedArray.prototype.buffer",!0),W=pZ();Y.exports=L||function(Z){if(!W(Z))throw new G("Not a Typed Array");return Z.buffer}}),uZ=Q0((I,Y)=>{var G=SU().Buffer,K=QZ(),L=hZ(),W=ArrayBuffer.isView||function(C){try{return L(C),!0}catch(D){return!1}},Z=typeof Uint8Array<"u",z=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",q=z&&(G.prototype instanceof Uint8Array||G.TYPED_ARRAY_SUPPORT);Y.exports=function(C,D){if(G.isBuffer(C)){if(C.constructor&&!("isBuffer"in C))return G.from(C);return C}if(typeof C==="string")return G.from(C,D);if(z&&W(C)){if(C.byteLength===0)return G.alloc(0);if(q){var F=G.from(C.buffer,C.byteOffset,C.byteLength);if(F.byteLength===C.byteLength)return F}var R=C instanceof Uint8Array?C:new Uint8Array(C.buffer,C.byteOffset,C.byteLength),M=G.from(R);if(M.length===C.byteLength)return M}if(Z&&C instanceof Uint8Array)return G.from(C);var P=K(C);if(P)for(var k=0;k255||~~_!==_)throw RangeError("Array items must be numbers in the range 0-255.")}if(P||G.isBuffer(C)&&C.constructor&&typeof C.constructor.isBuffer==="function"&&C.constructor.isBuffer(C))return G.from(C);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}}),xT=Q0((I,Y)=>{var G=SU().Buffer,K=uZ(),L=typeof Uint8Array<"u",W=L&&typeof ArrayBuffer<"u",Z=W&&ArrayBuffer.isView;Y.exports=function(z,q,C){if(typeof z==="string"||G.isBuffer(z)||L&&z instanceof Uint8Array||Z&&Z(z))return K(z,q);throw TypeError(C+" must be a string, a Buffer, a Uint8Array, or a DataView")}}),FI=Q0((I,Y)=>{var G={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,rmd160:20,ripemd160:20},K={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"},L=OI(),W=SU().Buffer,Z=kT(),z=vT(),q=xT();function C(D,F,R,M,P){Z(R,M),D=q(D,z,"Password"),F=q(F,z,"Salt");var k=(P||"sha1").toLowerCase(),_=K[k]||k,N=G[_];if(typeof N!=="number"||!N)throw TypeError("Digest algorithm not supported: "+P);var v=W.allocUnsafe(M),B=W.allocUnsafe(F.length+4);F.copy(B,0,0,F.length);var g=0,y=N,l=Math.ceil(M/y);for(var Y0=1;Y0<=l;Y0++){B.writeUInt32BE(Y0,F.length);var Z0=L(_,D).update(B).digest(),O0=Z0;for(var u=1;u{var G=SU().Buffer,K=kT(),L=vT(),W=FI(),Z=xT(),z,q=globalThis.crypto&&globalThis.crypto.subtle,C={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},D=[],F;function R(){if(F)return F;if(globalThis.process&&globalThis.process.nextTick)F=globalThis.process.nextTick;else if(globalThis.queueMicrotask)F=globalThis.queueMicrotask;else if(globalThis.setImmediate)F=globalThis.setImmediate;else F=globalThis.setTimeout;return F}function M(_,N,v,B,g){return q.importKey("raw",_,{name:"PBKDF2"},!1,["deriveBits"]).then(function(y){return q.deriveBits({name:"PBKDF2",salt:N,iterations:v,hash:{name:g}},y,B<<3)}).then(function(y){return G.from(y)})}function P(_){if(globalThis.process&&!globalThis.process.browser)return Promise.resolve(!1);if(!q||!q.importKey||!q.deriveBits)return Promise.resolve(!1);if(D[_]!==void 0)return D[_];z=z||G.alloc(8);var N=M(z,z,10,128,_).then(function(){return!0},function(){return!1});return D[_]=N,N}function k(_,N){_.then(function(v){R()(function(){N(null,v)})},function(v){R()(function(){N(v)})})}Y.exports=function(_,N,v,B,g,y){if(typeof g==="function")y=g,g=void 0;if(K(v,B),_=Z(_,L,"Password"),N=Z(N,L,"Salt"),typeof y!=="function")throw Error("No callback provided to pbkdf2");g=g||"sha1";var l=C[g.toLowerCase()];if(!l||typeof globalThis.Promise!=="function"){R()(function(){var Y0;try{Y0=W(_,N,v,B,g)}catch(Z0){y(Z0);return}y(null,Y0)});return}k(P(l).then(function(Y0){if(Y0)return M(_,N,v,B,l);return W(_,N,v,B,g)}),y)}}),WI=Q0((I)=>{var Y=(CU(),h0(PU)),G=kT(),K=vT(),L=xT();function W(z,q,C,D,F,R){if(G(C,D),z=L(z,K,"Password"),q=L(q,K,"Salt"),typeof F==="function")R=F,F="sha1";if(typeof R!=="function")throw Error("No callback provided to pbkdf2");return Y.pbkdf2(z,q,C,D,F,R)}function Z(z,q,C,D,F){return G(C,D),z=L(z,K,"Password"),q=L(q,K,"Salt"),F=F||"sha1",Y.pbkdf2Sync(z,q,C,D,F)}if(!Y.pbkdf2Sync||Y.pbkdf2Sync.toString().indexOf("keylen, digest")===-1)I.pbkdf2Sync=FI(),I.pbkdf2=bZ();else I.pbkdf2Sync=Z,I.pbkdf2=W}),dZ=Q0((I)=>{var Y=(CU(),h0(PU));I.createCipher=I.Cipher=Y.createCipher,I.createCipheriv=I.Cipheriv=Y.createCipheriv,I.createDecipher=I.Decipher=Y.createDecipher,I.createDecipheriv=I.Decipheriv=Y.createDecipheriv,I.listCiphers=I.getCiphers=Y.getCiphers}),lZ=Q0((I)=>{var Y=(CU(),h0(PU));I.DiffieHellmanGroup=Y.DiffieHellmanGroup,I.createDiffieHellmanGroup=Y.createDiffieHellmanGroup,I.getDiffieHellman=Y.getDiffieHellman,I.createDiffieHellman=Y.createDiffieHellman,I.DiffieHellman=Y.DiffieHellman}),oZ=Q0((I)=>{var Y=(CU(),h0(PU));I.createSign=Y.createSign,I.Sign=Y.Sign,I.createVerify=Y.createVerify,I.Verify=Y.Verify}),nZ=Q0((I,Y)=>{Y.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),cU=Q0((I,Y)=>{(function(G,K){function L(U,X){if(!U)throw Error(X||"Assertion failed")}function W(U,X){U.super_=X;var Q=function(){};Q.prototype=X.prototype,U.prototype=new Q,U.prototype.constructor=U}function Z(U,X,Q){if(Z.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(X==="le"||X==="be")Q=X,X=10;this._init(U||0,X||10,Q||"be")}}if(typeof G==="object")G.exports=Z;else K.BN=Z;Z.BN=Z,Z.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}Z.isBN=function(U){if(U instanceof Z)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===Z.wordSize&&Array.isArray(U.words)},Z.max=function(U,X){if(U.cmp(X)>0)return U;return X},Z.min=function(U,X){if(U.cmp(X)<0)return U;return X},Z.prototype._init=function(U,X,Q){if(typeof U==="number")return this._initNumber(U,X,Q);if(typeof U==="object")return this._initArray(U,X,Q);if(X==="hex")X=16;L(X===(X|0)&&X>=2&&X<=36),U=U.toString().replace(/\s+/g,"");var T=0;if(U[0]==="-")T++,this.negative=1;if(T=0;T-=3)if(A=U[T]|U[T-1]<<8|U[T-2]<<16,this.words[O]|=A<<$&67108863,this.words[O+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,O++}else if(Q==="le"){for(T=0,O=0;T>>26-$&67108863,$+=24,$>=26)$-=26,O++}return this.strip()};function q(U,X){var Q=U.charCodeAt(X);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function C(U,X,Q){var T=q(U,Q);if(Q-1>=X)T|=q(U,Q-1)<<4;return T}Z.prototype._parseHex=function(U,X,Q){this.length=Math.ceil((U.length-X)/6),this.words=Array(this.length);for(var T=0;T=X;T-=2)if($=C(U,X,T)<=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8;else{var J=U.length-X;for(T=J%2===0?X+1:X;T=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8}this.strip()};function D(U,X,Q,T){var O=0,A=Math.min(U.length,Q);for(var $=X;$=49)O+=J-49+10;else if(J>=17)O+=J-17+10;else O+=J}return O}Z.prototype._parseBase=function(U,X,Q){this.words=[0],this.length=1;for(var T=0,O=1;O<=67108863;O*=X)T++;T--,O=O/X|0;var A=U.length-Q,$=A%T,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},Z.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},Z.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(Z.prototype.toString=function(U,X){U=U||10,X=X|0||1;var Q;if(U===16||U==="hex"){Q="";var T=0,O=0;for(var A=0;A>>24-T&16777215,T+=2,T>=26)T-=26,A--;if(O!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(O!==0)Q=O.toString(16)+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},Z.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},Z.prototype.toJSON=function(){return this.toString(16)},Z.prototype.toBuffer=function(U,X){return L(typeof z<"u"),this.toArrayLike(z,U,X)},Z.prototype.toArray=function(U,X){return this.toArrayLike(Array,U,X)},Z.prototype.toArrayLike=function(U,X,Q){var T=this.byteLength(),O=Q||Math.max(1,T);L(T<=O,"byte array longer than desired length"),L(O>0,"Requested array length <= 0"),this.strip();var A=X==="le",$=new U(O),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,X>>>=13;if(X>=64)Q+=7,X>>>=7;if(X>=8)Q+=4,X>>>=4;if(X>=2)Q+=2,X>>>=2;return Q+X};Z.prototype._zeroBits=function(U){if(U===0)return 26;var X=U,Q=0;if((X&8191)===0)Q+=13,X>>>=13;if((X&127)===0)Q+=7,X>>>=7;if((X&15)===0)Q+=4,X>>>=4;if((X&3)===0)Q+=2,X>>>=2;if((X&1)===0)Q++;return Q},Z.prototype.bitLength=function(){var U=this.words[this.length-1],X=this._countBits(U);return(this.length-1)*26+X};function P(U){var X=Array(U.bitLength());for(var Q=0;Q>>O}return X}Z.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var X=0;XU.length)return this.clone().ior(U);return U.clone().ior(this)},Z.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},Z.prototype.iuand=function(U){var X;if(this.length>U.length)X=U;else X=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},Z.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},Z.prototype.iuxor=function(U){var X,Q;if(this.length>U.length)X=this,Q=U;else X=U,Q=this;for(var T=0;TU.length)return this.clone().ixor(U);return U.clone().ixor(this)},Z.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},Z.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var X=Math.ceil(U/26)|0,Q=U%26;if(this._expand(X),Q>0)X--;for(var T=0;T0)this.words[T]=~this.words[T]&67108863>>26-Q;return this.strip()},Z.prototype.notn=function(U){return this.clone().inotn(U)},Z.prototype.setn=function(U,X){L(typeof U==="number"&&U>=0);var Q=U/26|0,T=U%26;if(this._expand(Q+1),X)this.words[Q]=this.words[Q]|1<U.length)Q=this,T=U;else Q=U,T=this;var O=0;for(var A=0;A>>26;for(;O!==0&&A>>26;if(this.length=Q.length,O!==0)this.words[this.length]=O,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},Z.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var X=this.iadd(U);return U.negative=1,X._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var T,O;if(Q>0)T=this,O=U;else T=U,O=this;var A=0;for(var $=0;$>26,this.words[$]=X&67108863;for(;A!==0&&$>26,this.words[$]=X&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,X.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;O=U.words[p]|0,A=X.words[w]|0,$=O*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,X,Q){var T=U.words,O=X.words,A=Q.words,$=0,J,E,V,S=T[0]|0,H=S&8191,j=S>>>13,w=T[1]|0,p=w&8191,n=w>>>13,G0=T[2]|0,t=G0&8191,d=G0>>>13,X0=T[3]|0,m=X0&8191,U0=X0>>>13,g0=T[4]|0,f=g0&8191,h=g0>>>13,I0=T[5]|0,r=I0&8191,e=I0>>>13,D0=T[6]|0,c=D0&8191,o=D0>>>13,x0=T[7]|0,s=x0&8191,T0=x0>>>13,y0=T[8]|0,L0=y0&8191,$0=y0>>>13,n0=T[9]|0,V0=n0&8191,K0=n0>>>13,t0=O[0]|0,H0=t0&8191,W0=t0>>>13,RU=O[1]|0,C0=RU&8191,_0=RU>>>13,DU=O[2]|0,k0=DU&8191,z0=DU>>>13,WU=O[3]|0,v0=WU&8191,S0=WU>>>13,AU=O[4]|0,j0=AU&8191,N0=AU>>>13,LU=O[5]|0,M0=LU&8191,x=LU>>>13,b=O[6]|0,a=b&8191,E0=b>>>13,w0=O[7]|0,A0=w0&8191,F0=w0>>>13,m0=O[8]|0,q0=m0&8191,B0=m0>>>13,HU=O[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^X.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,C0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,C0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,C0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,C0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,C0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,C0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,C0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,C0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,C0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,C0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,C0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,C0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(T0,H0)|0,V=Math.imul(T0,W0),J=J+Math.imul(c,C0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,C0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,C0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(T0,C0)|0,V=V+Math.imul(T0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,C0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,C0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(T0,k0)|0,V=V+Math.imul(T0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,C0),E=Math.imul(V0,_0),E=E+Math.imul(K0,C0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(T0,v0)|0,V=V+Math.imul(T0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(T0,j0)|0,V=V+Math.imul(T0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(T0,M0)|0,V=V+Math.imul(T0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(T0,a)|0,V=V+Math.imul(T0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(T0,A0)|0,V=V+Math.imul(T0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(T0,q0)|0,V=V+Math.imul(T0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(T0,P0)|0,V=V+Math.imul(T0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var JU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var GU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(GU>>>26)|0,GU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=a0,A[6]=e0,A[7]=i0,A[8]=UU,A[9]=EU,A[10]=TU,A[11]=XU,A[12]=IU,A[13]=YU,A[14]=OU,A[15]=ZU,A[16]=QU,A[17]=JU,A[18]=GU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,X,Q){Q.negative=X.negative^U.negative,Q.length=U.length+X.length;var T=0,O=0;for(var A=0;A>>26)|0,O+=$>>>26,$&=67108863}Q.words[A]=J,T=$,$=O}if(T!==0)Q.words[A]=T;else Q.length--;return Q.strip()}function v(U,X,Q){var T=new B;return T.mulp(U,X,Q)}Z.prototype.mulTo=function(U,X){var Q,T=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,X);else if(T<63)Q=k(this,U,X);else if(T<1024)Q=N(this,U,X);else Q=v(this,U,X);return Q};function B(U,X){this.x=U,this.y=X}B.prototype.makeRBT=function(U){var X=Array(U),Q=Z.prototype._countBits(U)-1;for(var T=0;T>=1;return T},B.prototype.permute=function(U,X,Q,T,O,A){for(var $=0;$>>1)O++;return 1<>>13,Q[2*A+1]=O&8191,O=O>>>13;for(A=2*X;A>=26,X+=T/67108864|0,X+=O>>>26,this.words[Q]=O&67108863}if(X!==0)this.words[Q]=X,this.length++;return this.length=U===0?1:this.length,this},Z.prototype.muln=function(U){return this.clone().imuln(U)},Z.prototype.sqr=function(){return this.mul(this)},Z.prototype.isqr=function(){return this.imul(this.clone())},Z.prototype.pow=function(U){var X=P(U);if(X.length===0)return new Z(1);var Q=this;for(var T=0;T=0);var X=U%26,Q=(U-X)/26,T=67108863>>>26-X<<26-X,O;if(X!==0){var A=0;for(O=0;O>>26-X}if(A)this.words[O]=A,this.length++}if(Q!==0){for(O=this.length-1;O>=0;O--)this.words[O+Q]=this.words[O];for(O=0;O=0);var T;if(X)T=(X-X%26)/26;else T=0;var O=U%26,A=Math.min((U-O)/26,this.length),$=67108863^67108863>>>O<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=T);E--){var S=this.words[E]|0;this.words[E]=V<<26-O|S>>>O,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},Z.prototype.ishrn=function(U,X,Q){return L(this.negative===0),this.iushrn(U,X,Q)},Z.prototype.shln=function(U){return this.clone().ishln(U)},Z.prototype.ushln=function(U){return this.clone().iushln(U)},Z.prototype.shrn=function(U){return this.clone().ishrn(U)},Z.prototype.ushrn=function(U){return this.clone().iushrn(U)},Z.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var X=U%26,Q=(U-X)/26,T=1<=0);var X=U%26,Q=(U-X)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(X!==0)Q++;if(this.length=Math.min(Q,this.length),X!==0){var T=67108863^67108863>>>X<=67108864;X++)if(this.words[X]-=67108864,X===this.length-1)this.words[X+1]=1;else this.words[X+1]++;return this.length=Math.max(this.length,X+1),this},Z.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var X=0;X>26)-(J/67108864|0),this.words[O+Q]=A&67108863}for(;O>26,this.words[O+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(O=0;O>26,this.words[O]=A&67108863;return this.negative=1,this.strip()},Z.prototype._wordDiv=function(U,X){var Q=this.length-U.length,T=this.clone(),O=U,A=O.words[O.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)O=O.ushln(Q),T.iushln(Q),A=O.words[O.length-1]|0;var J=T.length-O.length,E;if(X!=="mod"){E=new Z(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(T.words[O.length+H]|0)*67108864+(T.words[O.length+H-1]|0);j=Math.min(j/A|0,67108863),T._ishlnsubmul(O,j,H);while(T.negative!==0)if(j--,T.negative=0,T._ishlnsubmul(O,1,H),!T.isZero())T.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(T.strip(),X!=="div"&&Q!==0)T.iushrn(Q);return{div:E||null,mod:T}},Z.prototype.divmod=function(U,X,Q){if(L(!U.isZero()),this.isZero())return{div:new Z(0),mod:new Z(0)};var T,O,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,X),X!=="mod")T=A.div.neg();if(X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.iadd(U)}return{div:T,mod:O}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),X),X!=="mod")T=A.div.neg();return{div:T,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),X),X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.isub(U)}return{div:A.div,mod:O}}if(U.length>this.length||this.cmp(U)<0)return{div:new Z(0),mod:this};if(U.length===1){if(X==="div")return{div:this.divn(U.words[0]),mod:null};if(X==="mod")return{div:null,mod:new Z(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new Z(this.modn(U.words[0]))}}return this._wordDiv(U,X)},Z.prototype.div=function(U){return this.divmod(U,"div",!1).div},Z.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},Z.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},Z.prototype.divRound=function(U){var X=this.divmod(U);if(X.mod.isZero())return X.div;var Q=X.div.negative!==0?X.mod.isub(U):X.mod,T=U.ushrn(1),O=U.andln(1),A=Q.cmp(T);if(A<0||O===1&&A===0)return X.div;return X.div.negative!==0?X.div.isubn(1):X.div.iaddn(1)},Z.prototype.modn=function(U){L(U<=67108863);var X=67108864%U,Q=0;for(var T=this.length-1;T>=0;T--)Q=(X*Q+(this.words[T]|0))%U;return Q},Z.prototype.idivn=function(U){L(U<=67108863);var X=0;for(var Q=this.length-1;Q>=0;Q--){var T=(this.words[Q]|0)+X*67108864;this.words[Q]=T/U|0,X=T%U}return this.strip()},Z.prototype.divn=function(U){return this.clone().idivn(U)},Z.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=new Z(0),$=new Z(1),J=0;while(X.isEven()&&Q.isEven())X.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=X.clone();while(!X.isZero()){for(var S=0,H=1;(X.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){X.iushrn(S);while(S-- >0){if(T.isOdd()||O.isOdd())T.iadd(E),O.isub(V);T.iushrn(1),O.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(A),O.isub($);else Q.isub(X),A.isub(T),$.isub(O)}return{a:A,b:$,gcd:Q.iushln(J)}},Z.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=Q.clone();while(X.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(X.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){X.iushrn($);while($-- >0){if(T.isOdd())T.iadd(A);T.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(O.isOdd())O.iadd(A);O.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(O);else Q.isub(X),O.isub(T)}var S;if(X.cmpn(1)===0)S=T;else S=O;if(S.cmpn(0)<0)S.iadd(U);return S},Z.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var X=this.clone(),Q=U.clone();X.negative=0,Q.negative=0;for(var T=0;X.isEven()&&Q.isEven();T++)X.iushrn(1),Q.iushrn(1);do{while(X.isEven())X.iushrn(1);while(Q.isEven())Q.iushrn(1);var O=X.cmp(Q);if(O<0){var A=X;X=Q,Q=A}else if(O===0||Q.cmpn(1)===0)break;X.isub(Q)}while(!0);return Q.iushln(T)},Z.prototype.invm=function(U){return this.egcd(U).a.umod(U)},Z.prototype.isEven=function(){return(this.words[0]&1)===0},Z.prototype.isOdd=function(){return(this.words[0]&1)===1},Z.prototype.andln=function(U){return this.words[0]&U},Z.prototype.bincn=function(U){L(typeof U==="number");var X=U%26,Q=(U-X)/26,T=1<>>26,$&=67108863,this.words[A]=$}if(O!==0)this.words[A]=O,this.length++;return this},Z.prototype.isZero=function(){return this.length===1&&this.words[0]===0},Z.prototype.cmpn=function(U){var X=U<0;if(this.negative!==0&&!X)return-1;if(this.negative===0&&X)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(X)U=-U;L(U<=67108863,"Number is too big");var T=this.words[0]|0;Q=T===U?0:TU.length)return 1;if(this.length=0;Q--){var T=this.words[Q]|0,O=U.words[Q]|0;if(T===O)continue;if(TO)X=1;break}return X},Z.prototype.gtn=function(U){return this.cmpn(U)===1},Z.prototype.gt=function(U){return this.cmp(U)===1},Z.prototype.gten=function(U){return this.cmpn(U)>=0},Z.prototype.gte=function(U){return this.cmp(U)>=0},Z.prototype.ltn=function(U){return this.cmpn(U)===-1},Z.prototype.lt=function(U){return this.cmp(U)===-1},Z.prototype.lten=function(U){return this.cmpn(U)<=0},Z.prototype.lte=function(U){return this.cmp(U)<=0},Z.prototype.eqn=function(U){return this.cmpn(U)===0},Z.prototype.eq=function(U){return this.cmp(U)===0},Z.red=function(U){return new u(U)},Z.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},Z.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},Z.prototype._forceRed=function(U){return this.red=U,this},Z.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},Z.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},Z.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},Z.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},Z.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},Z.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},Z.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},Z.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},Z.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},Z.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},Z.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},Z.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},Z.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},Z.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,X){this.name=U,this.p=new Z(X,16),this.n=this.p.bitLength(),this.k=new Z(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new Z(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var X=U,Q;do this.split(X,this.tmp),X=this.imulK(X),X=X.iadd(this.tmp),Q=X.bitLength();while(Q>this.n);var T=Q0)X.isub(this.p);else if(X.strip!==void 0)X.strip();else X._strip();return X},y.prototype.split=function(U,X){U.iushrn(this.n,0,X)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,X){var Q=4194303,T=Math.min(U.length,9);for(var O=0;O>>22,A=$}if(A>>>=22,U.words[O-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var X=0;for(var Q=0;Q>>=26,U.words[Q]=O,X=T}if(X!==0)U.words[U.length++]=X;return U},Z._prime=function(U){if(g[U])return g[U];var X;if(U==="k256")X=new l;else if(U==="p224")X=new Y0;else if(U==="p192")X=new Z0;else if(U==="p25519")X=new O0;else throw Error("Unknown prime "+U);return g[U]=X,X};function u(U){if(typeof U==="string"){var X=Z._prime(U);this.m=X.p,this.prime=X}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,X){L((U.negative|X.negative)===0,"red works only with positives"),L(U.red&&U.red===X.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,X){this._verify2(U,X);var Q=U.add(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,X){this._verify2(U,X);var Q=U.iadd(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,X){this._verify2(U,X);var Q=U.sub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,X){this._verify2(U,X);var Q=U.isub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,X){return this._verify1(U),this.imod(U.ushln(X))},u.prototype.imul=function(U,X){return this._verify2(U,X),this.imod(U.imul(X))},u.prototype.mul=function(U,X){return this._verify2(U,X),this.imod(U.mul(X))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var X=this.m.andln(3);if(L(X%2===1),X===3){var Q=this.m.add(new Z(1)).iushrn(2);return this.pow(U,Q)}var T=this.m.subn(1),O=0;while(!T.isZero()&&T.andln(1)===0)O++,T.iushrn(1);L(!T.isZero());var A=new Z(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new Z(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,T),S=this.pow(U,T.addn(1).iushrn(1)),H=this.pow(U,T),j=O;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;O--){var V=X.words[O];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==T[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(O!==0||S!==0))continue;A=this.mul(A,T[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var X=U.umod(this.m);return X===U?X.clone():X},u.prototype.convertFrom=function(U){var X=U.clone();return X.red=null,X},Z.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new Z(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var X=this.imod(U.mul(this.rinv));return X.red=null,X},i.prototype.imul=function(U,X){if(U.isZero()||X.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,X){if(U.isZero()||X.isZero())return new Z(0)._forceRed(this);var Q=U.mul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var X=this.imod(U._invmp(this.m).mul(this.r2));return X._forceRed(this)}})(typeof Y>"u"||Y,I)}),dU=Q0((I,Y)=>{Y.exports=G;function G(K,L){if(!K)throw Error(L||"Assertion failed")}G.equal=function(K,L,W){if(K!=L)throw Error(W||"Assertion failed: "+K+" != "+L)}}),HI=Q0((I)=>{var Y=I;function G(W,Z){if(Array.isArray(W))return W.slice();if(!W)return[];var z=[];if(typeof W!=="string"){for(var q=0;q>8,F=C&255;if(D)z.push(D,F);else z.push(F)}return z}Y.toArray=G;function K(W){if(W.length===1)return"0"+W;else return W}Y.zero2=K;function L(W){var Z="";for(var z=0;z{var Y=I,G=cU(),K=dU(),L=HI();Y.assert=K,Y.toArray=L.toArray,Y.zero2=L.zero2,Y.toHex=L.toHex,Y.encode=L.encode;function W(D,F,R){var M=Array(Math.max(D.bitLength(),R)+1),P;for(P=0;P(k>>1)-1)N=(k>>1)-v;else N=v;_.isubn(N)}else N=0;M[P]=N,_.iushrn(1)}return M}Y.getNAF=W;function Z(D,F){var R=[[],[]];D=D.clone(),F=F.clone();var M=0,P=0,k;while(D.cmpn(-M)>0||F.cmpn(-P)>0){var _=D.andln(3)+M&3,N=F.andln(3)+P&3;if(_===3)_=-1;if(N===3)N=-1;var v;if((_&1)===0)v=0;else if(k=D.andln(7)+M&7,(k===3||k===5)&&N===2)v=-_;else v=_;R[0].push(v);var B;if((N&1)===0)B=0;else if(k=F.andln(7)+P&7,(k===3||k===5)&&_===2)B=-N;else B=N;if(R[1].push(B),2*M===v+1)M=1-M;if(2*P===B+1)P=1-P;D.iushrn(1),F.iushrn(1)}return R}Y.getJSF=Z;function z(D,F,R){var M="_"+F;D.prototype[F]=function(){return this[M]!==void 0?this[M]:this[M]=R.call(this)}}Y.cachedProperty=z;function q(D){return typeof D==="string"?Y.toArray(D,"hex"):D}Y.parseBytes=q;function C(D){return new G(D,"hex","le")}Y.intFromLE=C}),RI=Q0((I,Y)=>{var G;Y.exports=function(W){if(!G)G=new K(null);return G.generate(W)};function K(W){this.rand=W}if(Y.exports.Rand=K,K.prototype.generate=function(W){return this._rand(W)},K.prototype._rand=function(W){if(this.rand.getBytes)return this.rand.getBytes(W);var Z=new Uint8Array(W);for(var z=0;z{var G=cU(),K=vU(),L=K.getNAF,W=K.getJSF,Z=K.assert;function z(C,D){this.type=C,this.p=new G(D.p,16),this.red=D.prime?G.red(D.prime):G.mont(this.p),this.zero=new G(0).toRed(this.red),this.one=new G(1).toRed(this.red),this.two=new G(2).toRed(this.red),this.n=D.n&&new G(D.n,16),this.g=D.g&&this.pointFromJSON(D.g,D.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var F=this.n&&this.p.div(this.n);if(!F||F.cmpn(100)>0)this.redN=null;else this._maxwellTrick=!0,this.redN=this.n.toRed(this.red)}Y.exports=z,z.prototype.point=function(){throw Error("Not implemented")},z.prototype.validate=function(){throw Error("Not implemented")},z.prototype._fixedNafMul=function(C,D){Z(C.precomputed);var F=C._getDoubles(),R=L(D,1,this._bitLength),M=(1<=k;N--)_=(_<<1)+R[N];P.push(_)}var v=this.jpoint(null,null,null),B=this.jpoint(null,null,null);for(var g=M;g>0;g--){for(k=0;k=0;_--){for(var N=0;_>=0&&P[_]===0;_--)N++;if(_>=0)N++;if(k=k.dblp(N),_<0)break;var v=P[_];if(Z(v!==0),C.type==="affine")if(v>0)k=k.mixedAdd(M[v-1>>1]);else k=k.mixedAdd(M[-v-1>>1].neg());else if(v>0)k=k.add(M[v-1>>1]);else k=k.add(M[-v-1>>1].neg())}return C.type==="affine"?k.toP():k},z.prototype._wnafMulAdd=function(C,D,F,R,M){var P=this._wnafT1,k=this._wnafT2,_=this._wnafT3,N=0,v,B,g;for(v=0;v=1;v-=2){var l=v-1,Y0=v;if(P[l]!==1||P[Y0]!==1){_[l]=L(F[l],P[l],this._bitLength),_[Y0]=L(F[Y0],P[Y0],this._bitLength),N=Math.max(_[l].length,N),N=Math.max(_[Y0].length,N);continue}var Z0=[D[l],null,null,D[Y0]];if(D[l].y.cmp(D[Y0].y)===0)Z0[1]=D[l].add(D[Y0]),Z0[2]=D[l].toJ().mixedAdd(D[Y0].neg());else if(D[l].y.cmp(D[Y0].y.redNeg())===0)Z0[1]=D[l].toJ().mixedAdd(D[Y0]),Z0[2]=D[l].add(D[Y0].neg());else Z0[1]=D[l].toJ().mixedAdd(D[Y0]),Z0[2]=D[l].toJ().mixedAdd(D[Y0].neg());var O0=[-3,-1,-5,-7,0,7,5,1,3],u=W(F[l],F[Y0]);N=Math.max(u[0].length,N),_[l]=Array(N),_[Y0]=Array(N);for(B=0;B=0;v--){var T=0;while(v>=0){var O=!0;for(B=0;B=0)T++;if(X=X.dblp(T),v<0)break;for(B=0;B0)g=k[B][A-1>>1];else if(A<0)g=k[B][-A-1>>1].neg();if(g.type==="affine")X=X.mixedAdd(g);else X=X.add(g)}}for(v=0;v=Math.ceil((C.bitLength()+1)/D.step)},q.prototype._getDoubles=function(C,D){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var F=[this],R=this;for(var M=0;M{if(typeof Object.create==="function")Y.exports=function(G,K){if(K)G.super_=K,G.prototype=Object.create(K.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0}})};else Y.exports=function(G,K){if(K){G.super_=K;var L=function(){};L.prototype=K.prototype,G.prototype=new L,G.prototype.constructor=G}}}),_U=Q0((I,Y)=>{try{if(G=(gX(),h0(xX)),typeof G.inherits!=="function")throw"";Y.exports=G.inherits}catch(K){Y.exports=mZ()}var G}),sZ=Q0((I,Y)=>{var G=vU(),K=cU(),L=_U(),W=dE(),Z=G.assert;function z(D){W.call(this,"short",D),this.a=new K(D.a,16).toRed(this.red),this.b=new K(D.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(D),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}L(z,W),Y.exports=z,z.prototype._getEndomorphism=function(D){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var F,R;if(D.beta)F=new K(D.beta,16).toRed(this.red);else{var M=this._getEndoRoots(this.p);F=M[0].cmp(M[1])<0?M[0]:M[1],F=F.toRed(this.red)}if(D.lambda)R=new K(D.lambda,16);else{var P=this._getEndoRoots(this.n);if(this.g.mul(P[0]).x.cmp(this.g.x.redMul(F))===0)R=P[0];else R=P[1],Z(this.g.mul(R).x.cmp(this.g.x.redMul(F))===0)}var k;if(D.basis)k=D.basis.map(function(_){return{a:new K(_.a,16),b:new K(_.b,16)}});else k=this._getEndoBasis(R);return{beta:F,lambda:R,basis:k}},z.prototype._getEndoRoots=function(D){var F=D===this.p?this.red:K.mont(D),R=new K(2).toRed(F).redInvm(),M=R.redNeg(),P=new K(3).toRed(F).redNeg().redSqrt().redMul(R),k=M.redAdd(P).fromRed(),_=M.redSub(P).fromRed();return[k,_]},z.prototype._getEndoBasis=function(D){var F=this.n.ushrn(Math.floor(this.n.bitLength()/2)),R=D,M=this.n.clone(),P=new K(1),k=new K(0),_=new K(0),N=new K(1),v,B,g,y,l,Y0,Z0,O0=0,u,i;while(R.cmpn(0)!==0){var U=M.div(R);u=M.sub(U.mul(R)),i=_.sub(U.mul(P));var X=N.sub(U.mul(k));if(!g&&u.cmp(F)<0)v=Z0.neg(),B=P,g=u.neg(),y=i;else if(g&&++O0===2)break;Z0=u,M=R,R=u,_=P,P=i,N=k,k=X}l=u.neg(),Y0=i;var Q=g.sqr().add(y.sqr()),T=l.sqr().add(Y0.sqr());if(T.cmp(Q)>=0)l=v,Y0=B;if(g.negative)g=g.neg(),y=y.neg();if(l.negative)l=l.neg(),Y0=Y0.neg();return[{a:g,b:y},{a:l,b:Y0}]},z.prototype._endoSplit=function(D){var F=this.endo.basis,R=F[0],M=F[1],P=M.b.mul(D).divRound(this.n),k=R.b.neg().mul(D).divRound(this.n),_=P.mul(R.a),N=k.mul(M.a),v=P.mul(R.b),B=k.mul(M.b),g=D.sub(_).sub(N),y=v.add(B).neg();return{k1:g,k2:y}},z.prototype.pointFromX=function(D,F){if(D=new K(D,16),!D.red)D=D.toRed(this.red);var R=D.redSqr().redMul(D).redIAdd(D.redMul(this.a)).redIAdd(this.b),M=R.redSqrt();if(M.redSqr().redSub(R).cmp(this.zero)!==0)throw Error("invalid point");var P=M.fromRed().isOdd();if(F&&!P||!F&&P)M=M.redNeg();return this.point(D,M)},z.prototype.validate=function(D){if(D.inf)return!0;var{x:F,y:R}=D,M=this.a.redMul(F),P=F.redSqr().redMul(F).redIAdd(M).redIAdd(this.b);return R.redSqr().redISub(P).cmpn(0)===0},z.prototype._endoWnafMulAdd=function(D,F,R){var M=this._endoWnafT1,P=this._endoWnafT2;for(var k=0;k";return""},q.prototype.isInfinity=function(){return this.inf},q.prototype.add=function(D){if(this.inf)return D;if(D.inf)return this;if(this.eq(D))return this.dbl();if(this.neg().eq(D))return this.curve.point(null,null);if(this.x.cmp(D.x)===0)return this.curve.point(null,null);var F=this.y.redSub(D.y);if(F.cmpn(0)!==0)F=F.redMul(this.x.redSub(D.x).redInvm());var R=F.redSqr().redISub(this.x).redISub(D.x),M=F.redMul(this.x.redSub(R)).redISub(this.y);return this.curve.point(R,M)},q.prototype.dbl=function(){if(this.inf)return this;var D=this.y.redAdd(this.y);if(D.cmpn(0)===0)return this.curve.point(null,null);var F=this.curve.a,R=this.x.redSqr(),M=D.redInvm(),P=R.redAdd(R).redIAdd(R).redIAdd(F).redMul(M),k=P.redSqr().redISub(this.x.redAdd(this.x)),_=P.redMul(this.x.redSub(k)).redISub(this.y);return this.curve.point(k,_)},q.prototype.getX=function(){return this.x.fromRed()},q.prototype.getY=function(){return this.y.fromRed()},q.prototype.mul=function(D){if(D=new K(D,16),this.isInfinity())return this;else if(this._hasDoubles(D))return this.curve._fixedNafMul(this,D);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[D]);else return this.curve._wnafMul(this,D)},q.prototype.mulAdd=function(D,F,R){var M=[this,F],P=[D,R];if(this.curve.endo)return this.curve._endoWnafMulAdd(M,P);else return this.curve._wnafMulAdd(1,M,P,2)},q.prototype.jmulAdd=function(D,F,R){var M=[this,F],P=[D,R];if(this.curve.endo)return this.curve._endoWnafMulAdd(M,P,!0);else return this.curve._wnafMulAdd(1,M,P,2,!0)},q.prototype.eq=function(D){return this===D||this.inf===D.inf&&(this.inf||this.x.cmp(D.x)===0&&this.y.cmp(D.y)===0)},q.prototype.neg=function(D){if(this.inf)return this;var F=this.curve.point(this.x,this.y.redNeg());if(D&&this.precomputed){var R=this.precomputed,M=function(P){return P.neg()};F.precomputed={naf:R.naf&&{wnd:R.naf.wnd,points:R.naf.points.map(M)},doubles:R.doubles&&{step:R.doubles.step,points:R.doubles.points.map(M)}}}return F},q.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var D=this.curve.jpoint(this.x,this.y,this.curve.one);return D};function C(D,F,R,M){if(W.BasePoint.call(this,D,"jacobian"),F===null&&R===null&&M===null)this.x=this.curve.one,this.y=this.curve.one,this.z=new K(0);else this.x=new K(F,16),this.y=new K(R,16),this.z=new K(M,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one}L(C,W.BasePoint),z.prototype.jpoint=function(D,F,R){return new C(this,D,F,R)},C.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var D=this.z.redInvm(),F=D.redSqr(),R=this.x.redMul(F),M=this.y.redMul(F).redMul(D);return this.curve.point(R,M)},C.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},C.prototype.add=function(D){if(this.isInfinity())return D;if(D.isInfinity())return this;var F=D.z.redSqr(),R=this.z.redSqr(),M=this.x.redMul(F),P=D.x.redMul(R),k=this.y.redMul(F.redMul(D.z)),_=D.y.redMul(R.redMul(this.z)),N=M.redSub(P),v=k.redSub(_);if(N.cmpn(0)===0)if(v.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var B=N.redSqr(),g=B.redMul(N),y=M.redMul(B),l=v.redSqr().redIAdd(g).redISub(y).redISub(y),Y0=v.redMul(y.redISub(l)).redISub(k.redMul(g)),Z0=this.z.redMul(D.z).redMul(N);return this.curve.jpoint(l,Y0,Z0)},C.prototype.mixedAdd=function(D){if(this.isInfinity())return D.toJ();if(D.isInfinity())return this;var F=this.z.redSqr(),R=this.x,M=D.x.redMul(F),P=this.y,k=D.y.redMul(F).redMul(this.z),_=R.redSub(M),N=P.redSub(k);if(_.cmpn(0)===0)if(N.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();var v=_.redSqr(),B=v.redMul(_),g=R.redMul(v),y=N.redSqr().redIAdd(B).redISub(g).redISub(g),l=N.redMul(g.redISub(y)).redISub(P.redMul(B)),Y0=this.z.redMul(_);return this.curve.jpoint(y,l,Y0)},C.prototype.dblp=function(D){if(D===0)return this;if(this.isInfinity())return this;if(!D)return this.dbl();var F;if(this.curve.zeroA||this.curve.threeA){var R=this;for(F=0;F=0)return!1;if(R.redIAdd(P),this.x.cmp(R)===0)return!0}},C.prototype.inspect=function(){if(this.isInfinity())return"";return""},C.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),rZ=Q0((I,Y)=>{var G=cU(),K=_U(),L=dE(),W=vU();function Z(q){L.call(this,"mont",q),this.a=new G(q.a,16).toRed(this.red),this.b=new G(q.b,16).toRed(this.red),this.i4=new G(4).toRed(this.red).redInvm(),this.two=new G(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}K(Z,L),Y.exports=Z,Z.prototype.validate=function(q){var C=q.normalize().x,D=C.redSqr(),F=D.redMul(C).redAdd(D.redMul(this.a)).redAdd(C),R=F.redSqrt();return R.redSqr().cmp(F)===0};function z(q,C,D){if(L.BasePoint.call(this,q,"projective"),C===null&&D===null)this.x=this.curve.one,this.z=this.curve.zero;else{if(this.x=new G(C,16),this.z=new G(D,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}K(z,L.BasePoint),Z.prototype.decodePoint=function(q,C){return this.point(W.toArray(q,C),1)},Z.prototype.point=function(q,C){return new z(this,q,C)},Z.prototype.pointFromJSON=function(q){return z.fromJSON(this,q)},z.prototype.precompute=function(){},z.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},z.fromJSON=function(q,C){return new z(q,C[0],C[1]||q.one)},z.prototype.inspect=function(){if(this.isInfinity())return"";return""},z.prototype.isInfinity=function(){return this.z.cmpn(0)===0},z.prototype.dbl=function(){var q=this.x.redAdd(this.z),C=q.redSqr(),D=this.x.redSub(this.z),F=D.redSqr(),R=C.redSub(F),M=C.redMul(F),P=R.redMul(F.redAdd(this.curve.a24.redMul(R)));return this.curve.point(M,P)},z.prototype.add=function(){throw Error("Not supported on Montgomery curve")},z.prototype.diffAdd=function(q,C){var D=this.x.redAdd(this.z),F=this.x.redSub(this.z),R=q.x.redAdd(q.z),M=q.x.redSub(q.z),P=M.redMul(D),k=R.redMul(F),_=C.z.redMul(P.redAdd(k).redSqr()),N=C.x.redMul(P.redISub(k).redSqr());return this.curve.point(_,N)},z.prototype.mul=function(q){var C=q.clone(),D=this,F=this.curve.point(null,null),R=this;for(var M=[];C.cmpn(0)!==0;C.iushrn(1))M.push(C.andln(1));for(var P=M.length-1;P>=0;P--)if(M[P]===0)D=D.diffAdd(F,R),F=F.dbl();else F=D.diffAdd(F,R),D=D.dbl();return F},z.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},z.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},z.prototype.eq=function(q){return this.getX().cmp(q.getX())===0},z.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},z.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),tZ=Q0((I,Y)=>{var G=vU(),K=cU(),L=_U(),W=dE(),Z=G.assert;function z(C){this.twisted=(C.a|0)!==1,this.mOneA=this.twisted&&(C.a|0)===-1,this.extended=this.mOneA,W.call(this,"edwards",C),this.a=new K(C.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new K(C.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new K(C.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Z(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(C.c|0)===1}L(z,W),Y.exports=z,z.prototype._mulA=function(C){if(this.mOneA)return C.redNeg();else return this.a.redMul(C)},z.prototype._mulC=function(C){if(this.oneC)return C;else return this.c.redMul(C)},z.prototype.jpoint=function(C,D,F,R){return this.point(C,D,F,R)},z.prototype.pointFromX=function(C,D){if(C=new K(C,16),!C.red)C=C.toRed(this.red);var F=C.redSqr(),R=this.c2.redSub(this.a.redMul(F)),M=this.one.redSub(this.c2.redMul(this.d).redMul(F)),P=R.redMul(M.redInvm()),k=P.redSqrt();if(k.redSqr().redSub(P).cmp(this.zero)!==0)throw Error("invalid point");var _=k.fromRed().isOdd();if(D&&!_||!D&&_)k=k.redNeg();return this.point(C,k)},z.prototype.pointFromY=function(C,D){if(C=new K(C,16),!C.red)C=C.toRed(this.red);var F=C.redSqr(),R=F.redSub(this.c2),M=F.redMul(this.d).redMul(this.c2).redSub(this.a),P=R.redMul(M.redInvm());if(P.cmp(this.zero)===0)if(D)throw Error("invalid point");else return this.point(this.zero,C);var k=P.redSqrt();if(k.redSqr().redSub(P).cmp(this.zero)!==0)throw Error("invalid point");if(k.fromRed().isOdd()!==D)k=k.redNeg();return this.point(k,C)},z.prototype.validate=function(C){if(C.isInfinity())return!0;C.normalize();var D=C.x.redSqr(),F=C.y.redSqr(),R=D.redMul(this.a).redAdd(F),M=this.c2.redMul(this.one.redAdd(this.d.redMul(D).redMul(F)));return R.cmp(M)===0};function q(C,D,F,R,M){if(W.BasePoint.call(this,C,"projective"),D===null&&F===null&&R===null)this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0;else{if(this.x=new K(D,16),this.y=new K(F,16),this.z=R?new K(R,16):this.curve.one,this.t=M&&new K(M,16),!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);if(this.t&&!this.t.red)this.t=this.t.toRed(this.curve.red);if(this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t){if(this.t=this.x.redMul(this.y),!this.zOne)this.t=this.t.redMul(this.z.redInvm())}}}L(q,W.BasePoint),z.prototype.pointFromJSON=function(C){return q.fromJSON(this,C)},z.prototype.point=function(C,D,F,R){return new q(this,C,D,F,R)},q.fromJSON=function(C,D){return new q(C,D[0],D[1],D[2])},q.prototype.inspect=function(){if(this.isInfinity())return"";return""},q.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},q.prototype._extDbl=function(){var C=this.x.redSqr(),D=this.y.redSqr(),F=this.z.redSqr();F=F.redIAdd(F);var R=this.curve._mulA(C),M=this.x.redAdd(this.y).redSqr().redISub(C).redISub(D),P=R.redAdd(D),k=P.redSub(F),_=R.redSub(D),N=M.redMul(k),v=P.redMul(_),B=M.redMul(_),g=k.redMul(P);return this.curve.point(N,v,g,B)},q.prototype._projDbl=function(){var C=this.x.redAdd(this.y).redSqr(),D=this.x.redSqr(),F=this.y.redSqr(),R,M,P,k,_,N;if(this.curve.twisted){k=this.curve._mulA(D);var v=k.redAdd(F);if(this.zOne)R=C.redSub(D).redSub(F).redMul(v.redSub(this.curve.two)),M=v.redMul(k.redSub(F)),P=v.redSqr().redSub(v).redSub(v);else _=this.z.redSqr(),N=v.redSub(_).redISub(_),R=C.redSub(D).redISub(F).redMul(N),M=v.redMul(k.redSub(F)),P=v.redMul(N)}else k=D.redAdd(F),_=this.curve._mulC(this.z).redSqr(),N=k.redSub(_).redSub(_),R=this.curve._mulC(C.redISub(k)).redMul(N),M=this.curve._mulC(k).redMul(D.redISub(F)),P=k.redMul(N);return this.curve.point(R,M,P)},q.prototype.dbl=function(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()},q.prototype._extAdd=function(C){var D=this.y.redSub(this.x).redMul(C.y.redSub(C.x)),F=this.y.redAdd(this.x).redMul(C.y.redAdd(C.x)),R=this.t.redMul(this.curve.dd).redMul(C.t),M=this.z.redMul(C.z.redAdd(C.z)),P=F.redSub(D),k=M.redSub(R),_=M.redAdd(R),N=F.redAdd(D),v=P.redMul(k),B=_.redMul(N),g=P.redMul(N),y=k.redMul(_);return this.curve.point(v,B,y,g)},q.prototype._projAdd=function(C){var D=this.z.redMul(C.z),F=D.redSqr(),R=this.x.redMul(C.x),M=this.y.redMul(C.y),P=this.curve.d.redMul(R).redMul(M),k=F.redSub(P),_=F.redAdd(P),N=this.x.redAdd(this.y).redMul(C.x.redAdd(C.y)).redISub(R).redISub(M),v=D.redMul(k).redMul(N),B,g;if(this.curve.twisted)B=D.redMul(_).redMul(M.redSub(this.curve._mulA(R))),g=k.redMul(_);else B=D.redMul(_).redMul(M.redSub(R)),g=this.curve._mulC(k).redMul(_);return this.curve.point(v,B,g)},q.prototype.add=function(C){if(this.isInfinity())return C;if(C.isInfinity())return this;if(this.curve.extended)return this._extAdd(C);else return this._projAdd(C)},q.prototype.mul=function(C){if(this._hasDoubles(C))return this.curve._fixedNafMul(this,C);else return this.curve._wnafMul(this,C)},q.prototype.mulAdd=function(C,D,F){return this.curve._wnafMulAdd(1,[this,D],[C,F],2,!1)},q.prototype.jmulAdd=function(C,D,F){return this.curve._wnafMulAdd(1,[this,D],[C,F],2,!0)},q.prototype.normalize=function(){if(this.zOne)return this;var C=this.z.redInvm();if(this.x=this.x.redMul(C),this.y=this.y.redMul(C),this.t)this.t=this.t.redMul(C);return this.z=this.curve.one,this.zOne=!0,this},q.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},q.prototype.getX=function(){return this.normalize(),this.x.fromRed()},q.prototype.getY=function(){return this.normalize(),this.y.fromRed()},q.prototype.eq=function(C){return this===C||this.getX().cmp(C.getX())===0&&this.getY().cmp(C.getY())===0},q.prototype.eqXToP=function(C){var D=C.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(D)===0)return!0;var F=C.clone(),R=this.curve.redN.redMul(this.z);for(;;){if(F.iadd(this.curve.n),F.cmp(this.curve.p)>=0)return!1;if(D.redIAdd(R),this.x.cmp(D)===0)return!0}},q.prototype.toP=q.prototype.normalize,q.prototype.mixedAdd=q.prototype.add}),DI=Q0((I)=>{var Y=I;Y.base=dE(),Y.short=sZ(),Y.mont=rZ(),Y.edwards=tZ()}),xU=Q0((I)=>{var Y=dU(),G=_U();I.inherits=G;function K(X,Q){if((X.charCodeAt(Q)&64512)!==55296)return!1;if(Q<0||Q+1>=X.length)return!1;return(X.charCodeAt(Q+1)&64512)===56320}function L(X,Q){if(Array.isArray(X))return X.slice();if(!X)return[];var T=[];if(typeof X==="string"){if(!Q){var O=0;for(var A=0;A>6|192,T[O++]=$&63|128;else if(K(X,A))$=65536+(($&1023)<<10)+(X.charCodeAt(++A)&1023),T[O++]=$>>18|240,T[O++]=$>>12&63|128,T[O++]=$>>6&63|128,T[O++]=$&63|128;else T[O++]=$>>12|224,T[O++]=$>>6&63|128,T[O++]=$&63|128}}else if(Q==="hex"){if(X=X.replace(/[^a-z0-9]+/ig,""),X.length%2!==0)X="0"+X;for(A=0;A>>24|X>>>8&65280|X<<8&16711680|(X&255)<<24;return Q>>>0}I.htonl=Z;function z(X,Q){var T="";for(var O=0;O>>0}return $}I.join32=D;function F(X,Q){var T=Array(X.length*4);for(var O=0,A=0;O>>24,T[A+1]=$>>>16&255,T[A+2]=$>>>8&255,T[A+3]=$&255;else T[A+3]=$>>>24,T[A+2]=$>>>16&255,T[A+1]=$>>>8&255,T[A]=$&255}return T}I.split32=F;function R(X,Q){return X>>>Q|X<<32-Q}I.rotr32=R;function M(X,Q){return X<>>32-Q}I.rotl32=M;function P(X,Q){return X+Q>>>0}I.sum32=P;function k(X,Q,T){return X+Q+T>>>0}I.sum32_3=k;function _(X,Q,T,O){return X+Q+T+O>>>0}I.sum32_4=_;function N(X,Q,T,O,A){return X+Q+T+O+A>>>0}I.sum32_5=N;function v(X,Q,T,O){var A=X[Q],$=X[Q+1],J=O+$>>>0,E=(J>>0,X[Q+1]=J}I.sum64=v;function B(X,Q,T,O){var A=Q+O>>>0,$=(A>>0}I.sum64_hi=B;function g(X,Q,T,O){var A=Q+O;return A>>>0}I.sum64_lo=g;function y(X,Q,T,O,A,$,J,E){var V=0,S=Q;S=S+O>>>0,V+=S>>0,V+=S<$?1:0,S=S+E>>>0,V+=S>>0}I.sum64_4_hi=y;function l(X,Q,T,O,A,$,J,E){var V=Q+O+$+E;return V>>>0}I.sum64_4_lo=l;function Y0(X,Q,T,O,A,$,J,E,V,S){var H=0,j=Q;j=j+O>>>0,H+=j>>0,H+=j<$?1:0,j=j+E>>>0,H+=j>>0,H+=j>>0}I.sum64_5_hi=Y0;function Z0(X,Q,T,O,A,$,J,E,V,S){var H=Q+O+$+E+S;return H>>>0}I.sum64_5_lo=Z0;function O0(X,Q,T){var O=Q<<32-T|X>>>T;return O>>>0}I.rotr64_hi=O0;function u(X,Q,T){var O=X<<32-T|Q>>>T;return O>>>0}I.rotr64_lo=u;function i(X,Q,T){return X>>>T}I.shr64_hi=i;function U(X,Q,T){var O=X<<32-T|Q>>>T;return O>>>0}I.shr64_lo=U}),HE=Q0((I)=>{var Y=xU(),G=dU();function K(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}I.BlockHash=K,K.prototype.update=function(L,W){if(L=Y.toArray(L,W),!this.pending)this.pending=L;else this.pending=this.pending.concat(L);if(this.pendingTotal+=L.length,this.pending.length>=this._delta8){L=this.pending;var Z=L.length%this._delta8;if(this.pending=L.slice(L.length-Z,L.length),this.pending.length===0)this.pending=null;L=Y.join32(L,0,L.length-Z,this.endian);for(var z=0;z>>24&255,z[q++]=L>>>16&255,z[q++]=L>>>8&255,z[q++]=L&255}else{z[q++]=L&255,z[q++]=L>>>8&255,z[q++]=L>>>16&255,z[q++]=L>>>24&255,z[q++]=0,z[q++]=0,z[q++]=0,z[q++]=0;for(C=8;C{var Y=xU(),G=Y.rotr32;function K(F,R,M,P){if(F===0)return L(R,M,P);if(F===1||F===3)return Z(R,M,P);if(F===2)return W(R,M,P)}I.ft_1=K;function L(F,R,M){return F&R^~F&M}I.ch32=L;function W(F,R,M){return F&R^F&M^R&M}I.maj32=W;function Z(F,R,M){return F^R^M}I.p32=Z;function z(F){return G(F,2)^G(F,13)^G(F,22)}I.s0_256=z;function q(F){return G(F,6)^G(F,11)^G(F,25)}I.s1_256=q;function C(F){return G(F,7)^G(F,18)^F>>>3}I.g0_256=C;function D(F){return G(F,17)^G(F,19)^F>>>10}I.g1_256=D}),aZ=Q0((I,Y)=>{var G=xU(),K=HE(),L=CI(),W=G.rotl32,Z=G.sum32,z=G.sum32_5,q=L.ft_1,C=K.BlockHash,D=[1518500249,1859775393,2400959708,3395469782];function F(){if(!(this instanceof F))return new F;C.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(F,C),Y.exports=F,F.blockSize=512,F.outSize=160,F.hmacStrength=80,F.padLength=64,F.prototype._update=function(R,M){var P=this.W;for(var k=0;k<16;k++)P[k]=R[M+k];for(;k{var G=xU(),K=HE(),L=CI(),W=dU(),Z=G.sum32,z=G.sum32_4,q=G.sum32_5,C=L.ch32,D=L.maj32,F=L.s0_256,R=L.s1_256,M=L.g0_256,P=L.g1_256,k=K.BlockHash,_=[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];function N(){if(!(this instanceof N))return new N;k.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=_,this.W=Array(64)}G.inherits(N,k),Y.exports=N,N.blockSize=512,N.outSize=256,N.hmacStrength=192,N.padLength=64,N.prototype._update=function(v,B){var g=this.W;for(var y=0;y<16;y++)g[y]=v[B+y];for(;y{var G=xU(),K=zI();function L(){if(!(this instanceof L))return new L;K.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(L,K),Y.exports=L,L.blockSize=512,L.outSize=224,L.hmacStrength=192,L.padLength=64,L.prototype._digest=function(W){if(W==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),SI=Q0((I,Y)=>{var G=xU(),K=HE(),L=dU(),W=G.rotr64_hi,Z=G.rotr64_lo,z=G.shr64_hi,q=G.shr64_lo,C=G.sum64,D=G.sum64_hi,F=G.sum64_lo,R=G.sum64_4_hi,M=G.sum64_4_lo,P=G.sum64_5_hi,k=G.sum64_5_lo,_=K.BlockHash,N=[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];function v(){if(!(this instanceof v))return new v;_.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=N,this.W=Array(160)}G.inherits(v,_),Y.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(T,O){var A=this.W;for(var $=0;$<32;$++)A[$]=T[O+$];for(;${var G=xU(),K=SI();function L(){if(!(this instanceof L))return new L;K.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(L,K),Y.exports=L,L.blockSize=1024,L.outSize=384,L.hmacStrength=192,L.padLength=128,L.prototype._digest=function(W){if(W==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),UQ=Q0((I)=>{I.sha1=aZ(),I.sha224=eZ(),I.sha256=zI(),I.sha384=iZ(),I.sha512=SI()}),EQ=Q0((I)=>{var Y=xU(),G=HE(),K=Y.rotl32,L=Y.sum32,W=Y.sum32_3,Z=Y.sum32_4,z=G.BlockHash;function q(){if(!(this instanceof q))return new q;z.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Y.inherits(q,z),I.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(_,N){var v=this.h[0],B=this.h[1],g=this.h[2],y=this.h[3],l=this.h[4],Y0=v,Z0=B,O0=g,u=y,i=l;for(var U=0;U<80;U++){var X=L(K(Z(v,C(U,B,g,y),_[R[U]+N],D(U)),P[U]),l);v=l,l=y,y=K(g,10),g=B,B=X,X=L(K(Z(Y0,C(79-U,Z0,O0,u),_[M[U]+N],F(U)),k[U]),i),Y0=i,i=u,u=K(O0,10),O0=Z0,Z0=X}X=W(this.h[1],g,u),this.h[1]=W(this.h[2],y,i),this.h[2]=W(this.h[3],l,Y0),this.h[3]=W(this.h[4],v,Z0),this.h[4]=W(this.h[0],B,O0),this.h[0]=X},q.prototype._digest=function(_){if(_==="hex")return Y.toHex32(this.h,"little");else return Y.split32(this.h,"little")};function C(_,N,v,B){if(_<=15)return N^v^B;else if(_<=31)return N&v|~N&B;else if(_<=47)return(N|~v)^B;else if(_<=63)return N&B|v&~B;else return N^(v|~B)}function D(_){if(_<=15)return 0;else if(_<=31)return 1518500249;else if(_<=47)return 1859775393;else if(_<=63)return 2400959708;else return 2840853838}function F(_){if(_<=15)return 1352829926;else if(_<=31)return 1548603684;else if(_<=47)return 1836072691;else if(_<=63)return 2053994217;else return 0}var R=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],M=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],k=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),TQ=Q0((I,Y)=>{var G=xU(),K=dU();function L(W,Z,z){if(!(this instanceof L))return new L(W,Z,z);this.Hash=W,this.blockSize=W.blockSize/8,this.outSize=W.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,z))}Y.exports=L,L.prototype._init=function(W){if(W.length>this.blockSize)W=new this.Hash().update(W).digest();K(W.length<=this.blockSize);for(var Z=W.length;Z{var Y=I;Y.utils=xU(),Y.common=HE(),Y.sha=UQ(),Y.ripemd=EQ(),Y.hmac=TQ(),Y.sha1=Y.sha.sha1,Y.sha256=Y.sha.sha256,Y.sha224=Y.sha.sha224,Y.sha384=Y.sha.sha384,Y.sha512=Y.sha.sha512,Y.ripemd160=Y.ripemd.ripemd160}),XQ=Q0((I,Y)=>{Y.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}}),wT=Q0((I)=>{var Y=I,G=gT(),K=DI(),L=vU(),W=L.assert;function Z(C){if(C.type==="short")this.curve=new K.short(C);else if(C.type==="edwards")this.curve=new K.edwards(C);else this.curve=new K.mont(C);this.g=this.curve.g,this.n=this.curve.n,this.hash=C.hash,W(this.g.validate(),"Invalid curve"),W(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}Y.PresetCurve=Z;function z(C,D){Object.defineProperty(Y,C,{configurable:!0,enumerable:!0,get:function(){var F=new Z(D);return Object.defineProperty(Y,C,{configurable:!0,enumerable:!0,value:F}),F}})}z("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:G.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),z("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:G.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),z("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:G.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),z("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:G.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),z("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:G.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),z("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:G.sha256,gRed:!1,g:["9"]}),z("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:G.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var q;try{q=XQ()}catch(C){q=void 0}z("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:G.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",q]})}),IQ=Q0((I,Y)=>{var G=gT(),K=HI(),L=dU();function W(Z){if(!(this instanceof W))return new W(Z);this.hash=Z.hash,this.predResist=!!Z.predResist,this.outLen=this.hash.outSize,this.minEntropy=Z.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var z=K.toArray(Z.entropy,Z.entropyEnc||"hex"),q=K.toArray(Z.nonce,Z.nonceEnc||"hex"),C=K.toArray(Z.pers,Z.persEnc||"hex");L(z.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(z,q,C)}Y.exports=W,W.prototype._init=function(Z,z,q){var C=Z.concat(z).concat(q);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var D=0;D=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(Z.concat(q||[])),this._reseed=1},W.prototype.generate=function(Z,z,q,C){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");if(typeof z!=="string")C=q,q=z,z=null;if(q)q=K.toArray(q,C||"hex"),this._update(q);var D=[];while(D.length{var G=cU(),K=vU(),L=K.assert;function W(Z,z){if(this.ec=Z,this.priv=null,this.pub=null,z.priv)this._importPrivate(z.priv,z.privEnc);if(z.pub)this._importPublic(z.pub,z.pubEnc)}Y.exports=W,W.fromPublic=function(Z,z,q){if(z instanceof W)return z;return new W(Z,{pub:z,pubEnc:q})},W.fromPrivate=function(Z,z,q){if(z instanceof W)return z;return new W(Z,{priv:z,privEnc:q})},W.prototype.validate=function(){var Z=this.getPublic();if(Z.isInfinity())return{result:!1,reason:"Invalid public key"};if(!Z.validate())return{result:!1,reason:"Public key is not a point"};if(!Z.mul(this.ec.curve.n).isInfinity())return{result:!1,reason:"Public key * N != O"};return{result:!0,reason:null}},W.prototype.getPublic=function(Z,z){if(typeof Z==="string")z=Z,Z=null;if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!z)return this.pub;return this.pub.encode(z,Z)},W.prototype.getPrivate=function(Z){if(Z==="hex")return this.priv.toString(16,2);else return this.priv},W.prototype._importPrivate=function(Z,z){this.priv=new G(Z,z||16),this.priv=this.priv.umod(this.ec.curve.n)},W.prototype._importPublic=function(Z,z){if(Z.x||Z.y){if(this.ec.curve.type==="mont")L(Z.x,"Need x coordinate");else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")L(Z.x&&Z.y,"Need both x and y coordinate");this.pub=this.ec.curve.point(Z.x,Z.y);return}this.pub=this.ec.curve.decodePoint(Z,z)},W.prototype.derive=function(Z){if(!Z.validate())L(Z.validate(),"public point not validated");return Z.mul(this.priv).getX()},W.prototype.sign=function(Z,z,q){return this.ec.sign(Z,this,z,q)},W.prototype.verify=function(Z,z,q){return this.ec.verify(Z,z,this,void 0,q)},W.prototype.inspect=function(){return""}}),OQ=Q0((I,Y)=>{var G=cU(),K=vU(),L=K.assert;function W(D,F){if(D instanceof W)return D;if(this._importDER(D,F))return;if(L(D.r&&D.s,"Signature without r or s"),this.r=new G(D.r,16),this.s=new G(D.s,16),D.recoveryParam===void 0)this.recoveryParam=null;else this.recoveryParam=D.recoveryParam}Y.exports=W;function Z(){this.place=0}function z(D,F){var R=D[F.place++];if(!(R&128))return R;var M=R&15;if(M===0||M>4)return!1;if(D[F.place]===0)return!1;var P=0;for(var k=0,_=F.place;k>>=0;if(P<=127)return!1;return F.place=_,P}function q(D){var F=0,R=D.length-1;while(!D[F]&&!(D[F+1]&128)&&F>>3);D.push(R|128);while(--R)D.push(F>>>(R<<3)&255);D.push(F)}W.prototype.toDER=function(D){var F=this.r.toArray(),R=this.s.toArray();if(F[0]&128)F=[0].concat(F);if(R[0]&128)R=[0].concat(R);F=q(F),R=q(R);while(!R[0]&&!(R[1]&128))R=R.slice(1);var M=[2];C(M,F.length),M=M.concat(F),M.push(2),C(M,R.length);var P=M.concat(R),k=[48];return C(k,P.length),k=k.concat(P),K.encode(k,D)}}),ZQ=Q0((I,Y)=>{var G=cU(),K=IQ(),L=vU(),W=wT(),Z=RI(),z=L.assert,q=YQ(),C=OQ();function D(F){if(!(this instanceof D))return new D(F);if(typeof F==="string")z(Object.prototype.hasOwnProperty.call(W,F),"Unknown curve "+F),F=W[F];if(F instanceof W.PresetCurve)F={curve:F};this.curve=F.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=F.curve.g,this.g.precompute(F.curve.n.bitLength()+1),this.hash=F.hash||F.curve.hash}Y.exports=D,D.prototype.keyPair=function(F){return new q(this,F)},D.prototype.keyFromPrivate=function(F,R){return q.fromPrivate(this,F,R)},D.prototype.keyFromPublic=function(F,R){return q.fromPublic(this,F,R)},D.prototype.genKeyPair=function(F){if(!F)F={};var R=new K({hash:this.hash,pers:F.pers,persEnc:F.persEnc||"utf8",entropy:F.entropy||Z(this.hash.hmacStrength),entropyEnc:F.entropy&&F.entropyEnc||"utf8",nonce:this.n.toArray()}),M=this.n.byteLength(),P=this.n.sub(new G(2));for(;;){var k=new G(R.generate(M));if(k.cmp(P)>0)continue;return k.iaddn(1),this.keyFromPrivate(k)}},D.prototype._truncateToN=function(F,R,M){var P;if(G.isBN(F)||typeof F==="number")F=new G(F,16),P=F.byteLength();else if(typeof F==="object")P=F.length,F=new G(F,16);else{var k=F.toString();P=k.length+1>>>1,F=new G(k,16)}if(typeof M!=="number")M=P*8;var _=M-this.n.bitLength();if(_>0)F=F.ushrn(_);if(!R&&F.cmp(this.n)>=0)return F.sub(this.n);else return F},D.prototype.sign=function(F,R,M,P){if(typeof M==="object")P=M,M=null;if(!P)P={};if(typeof F!=="string"&&typeof F!=="number"&&!G.isBN(F)){z(typeof F==="object"&&F&&typeof F.length==="number","Expected message to be an array-like, a hex string, or a BN instance"),z(F.length>>>0===F.length);for(var k=0;k=0)continue;var Y0=this.g.mul(l);if(Y0.isInfinity())continue;var Z0=Y0.getX(),O0=Z0.umod(this.n);if(O0.cmpn(0)===0)continue;var u=l.invm(this.n).mul(O0.mul(R.getPrivate()).iadd(F));if(u=u.umod(this.n),u.cmpn(0)===0)continue;var i=(Y0.getY().isOdd()?1:0)|(Z0.cmp(O0)!==0?2:0);if(P.canonical&&u.cmp(this.nh)>0)u=this.n.sub(u),i^=1;return new C({r:O0,s:u,recoveryParam:i})}},D.prototype.verify=function(F,R,M,P,k){if(!k)k={};F=this._truncateToN(F,!1,k.msgBitLength),M=this.keyFromPublic(M,P),R=new C(R,"hex");var{r:_,s:N}=R;if(_.cmpn(1)<0||_.cmp(this.n)>=0)return!1;if(N.cmpn(1)<0||N.cmp(this.n)>=0)return!1;var v=N.invm(this.n),B=v.mul(F).umod(this.n),g=v.mul(_).umod(this.n),y;if(!this.curve._maxwellTrick){if(y=this.g.mulAdd(B,M.getPublic(),g),y.isInfinity())return!1;return y.getX().umod(this.n).cmp(_)===0}if(y=this.g.jmulAdd(B,M.getPublic(),g),y.isInfinity())return!1;return y.eqXToP(_)},D.prototype.recoverPubKey=function(F,R,M,P){z((3&M)===M,"The recovery param is more than two bits"),R=new C(R,P);var k=this.n,_=new G(F),N=R.r,v=R.s,B=M&1,g=M>>1;if(N.cmp(this.curve.p.umod(this.curve.n))>=0&&g)throw Error("Unable to find sencond key candinate");if(g)N=this.curve.pointFromX(N.add(this.curve.n),B);else N=this.curve.pointFromX(N,B);var y=R.r.invm(k),l=k.sub(_).mul(y).umod(k),Y0=v.mul(y).umod(k);return this.g.mulAdd(l,N,Y0)},D.prototype.getKeyRecoveryParam=function(F,R,M,P){if(R=new C(R,P),R.recoveryParam!==null)return R.recoveryParam;for(var k=0;k<4;k++){var _;try{_=this.recoverPubKey(F,R,k)}catch(N){continue}if(_.eq(M))return k}throw Error("Unable to find valid recovery factor")}}),QQ=Q0((I,Y)=>{var G=vU(),K=G.assert,L=G.parseBytes,W=G.cachedProperty;function Z(z,q){if(this.eddsa=z,this._secret=L(q.secret),z.isPoint(q.pub))this._pub=q.pub;else this._pubBytes=L(q.pub)}Z.fromPublic=function(z,q){if(q instanceof Z)return q;return new Z(z,{pub:q})},Z.fromSecret=function(z,q){if(q instanceof Z)return q;return new Z(z,{secret:q})},Z.prototype.secret=function(){return this._secret},W(Z,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),W(Z,"pub",function(){if(this._pubBytes)return this.eddsa.decodePoint(this._pubBytes);return this.eddsa.g.mul(this.priv())}),W(Z,"privBytes",function(){var z=this.eddsa,q=this.hash(),C=z.encodingLength-1,D=q.slice(0,z.encodingLength);return D[0]&=248,D[C]&=127,D[C]|=64,D}),W(Z,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),W(Z,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),W(Z,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Z.prototype.sign=function(z){return K(this._secret,"KeyPair can only verify"),this.eddsa.sign(z,this)},Z.prototype.verify=function(z,q){return this.eddsa.verify(z,q,this)},Z.prototype.getSecret=function(z){return K(this._secret,"KeyPair is public only"),G.encode(this.secret(),z)},Z.prototype.getPublic=function(z){return G.encode(this.pubBytes(),z)},Y.exports=Z}),JQ=Q0((I,Y)=>{var G=cU(),K=vU(),L=K.assert,W=K.cachedProperty,Z=K.parseBytes;function z(q,C){if(this.eddsa=q,typeof C!=="object")C=Z(C);if(Array.isArray(C))L(C.length===q.encodingLength*2,"Signature has invalid size"),C={R:C.slice(0,q.encodingLength),S:C.slice(q.encodingLength)};if(L(C.R&&C.S,"Signature without R or S"),q.isPoint(C.R))this._R=C.R;if(C.S instanceof G)this._S=C.S;this._Rencoded=Array.isArray(C.R)?C.R:C.Rencoded,this._Sencoded=Array.isArray(C.S)?C.S:C.Sencoded}W(z,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),W(z,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),W(z,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),W(z,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),z.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},z.prototype.toHex=function(){return K.encode(this.toBytes(),"hex").toUpperCase()},Y.exports=z}),GQ=Q0((I,Y)=>{var G=gT(),K=wT(),L=vU(),W=L.assert,Z=L.parseBytes,z=QQ(),q=JQ();function C(D){if(W(D==="ed25519","only tested with ed25519 so far"),!(this instanceof C))return new C(D);D=K[D].curve,this.curve=D,this.g=D.g,this.g.precompute(D.n.bitLength()+1),this.pointClass=D.point().constructor,this.encodingLength=Math.ceil(D.n.bitLength()/8),this.hash=G.sha512}Y.exports=C,C.prototype.sign=function(D,F){D=Z(D);var R=this.keyFromSecret(F),M=this.hashInt(R.messagePrefix(),D),P=this.g.mul(M),k=this.encodePoint(P),_=this.hashInt(k,R.pubBytes(),D).mul(R.priv()),N=M.add(_).umod(this.curve.n);return this.makeSignature({R:P,S:N,Rencoded:k})},C.prototype.verify=function(D,F,R){if(D=Z(D),F=this.makeSignature(F),F.S().gte(F.eddsa.curve.n)||F.S().isNeg())return!1;var M=this.keyFromPublic(R),P=this.hashInt(F.Rencoded(),M.pubBytes(),D),k=this.g.mul(F.S()),_=F.R().add(M.pub().mul(P));return _.eq(k)},C.prototype.hashInt=function(){var D=this.hash();for(var F=0;F{var Y=I;Y.version=nZ().version,Y.utils=vU(),Y.rand=RI(),Y.curve=DI(),Y.curves=wT(),Y.ec=ZQ(),Y.eddsa=GQ()}),AQ=Q0((I,Y)=>{(function(G,K){function L(U,X){if(!U)throw Error(X||"Assertion failed")}function W(U,X){U.super_=X;var Q=function(){};Q.prototype=X.prototype,U.prototype=new Q,U.prototype.constructor=U}function Z(U,X,Q){if(Z.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(X==="le"||X==="be")Q=X,X=10;this._init(U||0,X||10,Q||"be")}}if(typeof G==="object")G.exports=Z;else K.BN=Z;Z.BN=Z,Z.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}Z.isBN=function(U){if(U instanceof Z)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===Z.wordSize&&Array.isArray(U.words)},Z.max=function(U,X){if(U.cmp(X)>0)return U;return X},Z.min=function(U,X){if(U.cmp(X)<0)return U;return X},Z.prototype._init=function(U,X,Q){if(typeof U==="number")return this._initNumber(U,X,Q);if(typeof U==="object")return this._initArray(U,X,Q);if(X==="hex")X=16;L(X===(X|0)&&X>=2&&X<=36),U=U.toString().replace(/\s+/g,"");var T=0;if(U[0]==="-")T++,this.negative=1;if(T=0;T-=3)if(A=U[T]|U[T-1]<<8|U[T-2]<<16,this.words[O]|=A<<$&67108863,this.words[O+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,O++}else if(Q==="le"){for(T=0,O=0;T>>26-$&67108863,$+=24,$>=26)$-=26,O++}return this.strip()};function q(U,X){var Q=U.charCodeAt(X);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function C(U,X,Q){var T=q(U,Q);if(Q-1>=X)T|=q(U,Q-1)<<4;return T}Z.prototype._parseHex=function(U,X,Q){this.length=Math.ceil((U.length-X)/6),this.words=Array(this.length);for(var T=0;T=X;T-=2)if($=C(U,X,T)<=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8;else{var J=U.length-X;for(T=J%2===0?X+1:X;T=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8}this.strip()};function D(U,X,Q,T){var O=0,A=Math.min(U.length,Q);for(var $=X;$=49)O+=J-49+10;else if(J>=17)O+=J-17+10;else O+=J}return O}Z.prototype._parseBase=function(U,X,Q){this.words=[0],this.length=1;for(var T=0,O=1;O<=67108863;O*=X)T++;T--,O=O/X|0;var A=U.length-Q,$=A%T,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},Z.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},Z.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(Z.prototype.toString=function(U,X){U=U||10,X=X|0||1;var Q;if(U===16||U==="hex"){Q="";var T=0,O=0;for(var A=0;A>>24-T&16777215,T+=2,T>=26)T-=26,A--;if(O!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(O!==0)Q=O.toString(16)+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},Z.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},Z.prototype.toJSON=function(){return this.toString(16)},Z.prototype.toBuffer=function(U,X){return L(typeof z<"u"),this.toArrayLike(z,U,X)},Z.prototype.toArray=function(U,X){return this.toArrayLike(Array,U,X)},Z.prototype.toArrayLike=function(U,X,Q){var T=this.byteLength(),O=Q||Math.max(1,T);L(T<=O,"byte array longer than desired length"),L(O>0,"Requested array length <= 0"),this.strip();var A=X==="le",$=new U(O),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,X>>>=13;if(X>=64)Q+=7,X>>>=7;if(X>=8)Q+=4,X>>>=4;if(X>=2)Q+=2,X>>>=2;return Q+X};Z.prototype._zeroBits=function(U){if(U===0)return 26;var X=U,Q=0;if((X&8191)===0)Q+=13,X>>>=13;if((X&127)===0)Q+=7,X>>>=7;if((X&15)===0)Q+=4,X>>>=4;if((X&3)===0)Q+=2,X>>>=2;if((X&1)===0)Q++;return Q},Z.prototype.bitLength=function(){var U=this.words[this.length-1],X=this._countBits(U);return(this.length-1)*26+X};function P(U){var X=Array(U.bitLength());for(var Q=0;Q>>O}return X}Z.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var X=0;XU.length)return this.clone().ior(U);return U.clone().ior(this)},Z.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},Z.prototype.iuand=function(U){var X;if(this.length>U.length)X=U;else X=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},Z.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},Z.prototype.iuxor=function(U){var X,Q;if(this.length>U.length)X=this,Q=U;else X=U,Q=this;for(var T=0;TU.length)return this.clone().ixor(U);return U.clone().ixor(this)},Z.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},Z.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var X=Math.ceil(U/26)|0,Q=U%26;if(this._expand(X),Q>0)X--;for(var T=0;T0)this.words[T]=~this.words[T]&67108863>>26-Q;return this.strip()},Z.prototype.notn=function(U){return this.clone().inotn(U)},Z.prototype.setn=function(U,X){L(typeof U==="number"&&U>=0);var Q=U/26|0,T=U%26;if(this._expand(Q+1),X)this.words[Q]=this.words[Q]|1<U.length)Q=this,T=U;else Q=U,T=this;var O=0;for(var A=0;A>>26;for(;O!==0&&A>>26;if(this.length=Q.length,O!==0)this.words[this.length]=O,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},Z.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var X=this.iadd(U);return U.negative=1,X._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var T,O;if(Q>0)T=this,O=U;else T=U,O=this;var A=0;for(var $=0;$>26,this.words[$]=X&67108863;for(;A!==0&&$>26,this.words[$]=X&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,X.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;O=U.words[p]|0,A=X.words[w]|0,$=O*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,X,Q){var T=U.words,O=X.words,A=Q.words,$=0,J,E,V,S=T[0]|0,H=S&8191,j=S>>>13,w=T[1]|0,p=w&8191,n=w>>>13,G0=T[2]|0,t=G0&8191,d=G0>>>13,X0=T[3]|0,m=X0&8191,U0=X0>>>13,g0=T[4]|0,f=g0&8191,h=g0>>>13,I0=T[5]|0,r=I0&8191,e=I0>>>13,D0=T[6]|0,c=D0&8191,o=D0>>>13,x0=T[7]|0,s=x0&8191,T0=x0>>>13,y0=T[8]|0,L0=y0&8191,$0=y0>>>13,n0=T[9]|0,V0=n0&8191,K0=n0>>>13,t0=O[0]|0,H0=t0&8191,W0=t0>>>13,RU=O[1]|0,C0=RU&8191,_0=RU>>>13,DU=O[2]|0,k0=DU&8191,z0=DU>>>13,WU=O[3]|0,v0=WU&8191,S0=WU>>>13,AU=O[4]|0,j0=AU&8191,N0=AU>>>13,LU=O[5]|0,M0=LU&8191,x=LU>>>13,b=O[6]|0,a=b&8191,E0=b>>>13,w0=O[7]|0,A0=w0&8191,F0=w0>>>13,m0=O[8]|0,q0=m0&8191,B0=m0>>>13,HU=O[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^X.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,C0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,C0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,C0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,C0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,C0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,C0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,C0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,C0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,C0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,C0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,C0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,C0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(T0,H0)|0,V=Math.imul(T0,W0),J=J+Math.imul(c,C0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,C0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,C0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(T0,C0)|0,V=V+Math.imul(T0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,C0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,C0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(T0,k0)|0,V=V+Math.imul(T0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,C0),E=Math.imul(V0,_0),E=E+Math.imul(K0,C0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(T0,v0)|0,V=V+Math.imul(T0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(T0,j0)|0,V=V+Math.imul(T0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(T0,M0)|0,V=V+Math.imul(T0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(T0,a)|0,V=V+Math.imul(T0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(T0,A0)|0,V=V+Math.imul(T0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(T0,q0)|0,V=V+Math.imul(T0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(T0,P0)|0,V=V+Math.imul(T0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var JU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var GU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(GU>>>26)|0,GU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=a0,A[6]=e0,A[7]=i0,A[8]=UU,A[9]=EU,A[10]=TU,A[11]=XU,A[12]=IU,A[13]=YU,A[14]=OU,A[15]=ZU,A[16]=QU,A[17]=JU,A[18]=GU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,X,Q){Q.negative=X.negative^U.negative,Q.length=U.length+X.length;var T=0,O=0;for(var A=0;A>>26)|0,O+=$>>>26,$&=67108863}Q.words[A]=J,T=$,$=O}if(T!==0)Q.words[A]=T;else Q.length--;return Q.strip()}function v(U,X,Q){var T=new B;return T.mulp(U,X,Q)}Z.prototype.mulTo=function(U,X){var Q,T=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,X);else if(T<63)Q=k(this,U,X);else if(T<1024)Q=N(this,U,X);else Q=v(this,U,X);return Q};function B(U,X){this.x=U,this.y=X}B.prototype.makeRBT=function(U){var X=Array(U),Q=Z.prototype._countBits(U)-1;for(var T=0;T>=1;return T},B.prototype.permute=function(U,X,Q,T,O,A){for(var $=0;$>>1)O++;return 1<>>13,Q[2*A+1]=O&8191,O=O>>>13;for(A=2*X;A>=26,X+=T/67108864|0,X+=O>>>26,this.words[Q]=O&67108863}if(X!==0)this.words[Q]=X,this.length++;return this.length=U===0?1:this.length,this},Z.prototype.muln=function(U){return this.clone().imuln(U)},Z.prototype.sqr=function(){return this.mul(this)},Z.prototype.isqr=function(){return this.imul(this.clone())},Z.prototype.pow=function(U){var X=P(U);if(X.length===0)return new Z(1);var Q=this;for(var T=0;T=0);var X=U%26,Q=(U-X)/26,T=67108863>>>26-X<<26-X,O;if(X!==0){var A=0;for(O=0;O>>26-X}if(A)this.words[O]=A,this.length++}if(Q!==0){for(O=this.length-1;O>=0;O--)this.words[O+Q]=this.words[O];for(O=0;O=0);var T;if(X)T=(X-X%26)/26;else T=0;var O=U%26,A=Math.min((U-O)/26,this.length),$=67108863^67108863>>>O<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=T);E--){var S=this.words[E]|0;this.words[E]=V<<26-O|S>>>O,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},Z.prototype.ishrn=function(U,X,Q){return L(this.negative===0),this.iushrn(U,X,Q)},Z.prototype.shln=function(U){return this.clone().ishln(U)},Z.prototype.ushln=function(U){return this.clone().iushln(U)},Z.prototype.shrn=function(U){return this.clone().ishrn(U)},Z.prototype.ushrn=function(U){return this.clone().iushrn(U)},Z.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var X=U%26,Q=(U-X)/26,T=1<=0);var X=U%26,Q=(U-X)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(X!==0)Q++;if(this.length=Math.min(Q,this.length),X!==0){var T=67108863^67108863>>>X<=67108864;X++)if(this.words[X]-=67108864,X===this.length-1)this.words[X+1]=1;else this.words[X+1]++;return this.length=Math.max(this.length,X+1),this},Z.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var X=0;X>26)-(J/67108864|0),this.words[O+Q]=A&67108863}for(;O>26,this.words[O+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(O=0;O>26,this.words[O]=A&67108863;return this.negative=1,this.strip()},Z.prototype._wordDiv=function(U,X){var Q=this.length-U.length,T=this.clone(),O=U,A=O.words[O.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)O=O.ushln(Q),T.iushln(Q),A=O.words[O.length-1]|0;var J=T.length-O.length,E;if(X!=="mod"){E=new Z(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(T.words[O.length+H]|0)*67108864+(T.words[O.length+H-1]|0);j=Math.min(j/A|0,67108863),T._ishlnsubmul(O,j,H);while(T.negative!==0)if(j--,T.negative=0,T._ishlnsubmul(O,1,H),!T.isZero())T.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(T.strip(),X!=="div"&&Q!==0)T.iushrn(Q);return{div:E||null,mod:T}},Z.prototype.divmod=function(U,X,Q){if(L(!U.isZero()),this.isZero())return{div:new Z(0),mod:new Z(0)};var T,O,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,X),X!=="mod")T=A.div.neg();if(X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.iadd(U)}return{div:T,mod:O}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),X),X!=="mod")T=A.div.neg();return{div:T,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),X),X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.isub(U)}return{div:A.div,mod:O}}if(U.length>this.length||this.cmp(U)<0)return{div:new Z(0),mod:this};if(U.length===1){if(X==="div")return{div:this.divn(U.words[0]),mod:null};if(X==="mod")return{div:null,mod:new Z(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new Z(this.modn(U.words[0]))}}return this._wordDiv(U,X)},Z.prototype.div=function(U){return this.divmod(U,"div",!1).div},Z.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},Z.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},Z.prototype.divRound=function(U){var X=this.divmod(U);if(X.mod.isZero())return X.div;var Q=X.div.negative!==0?X.mod.isub(U):X.mod,T=U.ushrn(1),O=U.andln(1),A=Q.cmp(T);if(A<0||O===1&&A===0)return X.div;return X.div.negative!==0?X.div.isubn(1):X.div.iaddn(1)},Z.prototype.modn=function(U){L(U<=67108863);var X=67108864%U,Q=0;for(var T=this.length-1;T>=0;T--)Q=(X*Q+(this.words[T]|0))%U;return Q},Z.prototype.idivn=function(U){L(U<=67108863);var X=0;for(var Q=this.length-1;Q>=0;Q--){var T=(this.words[Q]|0)+X*67108864;this.words[Q]=T/U|0,X=T%U}return this.strip()},Z.prototype.divn=function(U){return this.clone().idivn(U)},Z.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=new Z(0),$=new Z(1),J=0;while(X.isEven()&&Q.isEven())X.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=X.clone();while(!X.isZero()){for(var S=0,H=1;(X.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){X.iushrn(S);while(S-- >0){if(T.isOdd()||O.isOdd())T.iadd(E),O.isub(V);T.iushrn(1),O.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(A),O.isub($);else Q.isub(X),A.isub(T),$.isub(O)}return{a:A,b:$,gcd:Q.iushln(J)}},Z.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=Q.clone();while(X.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(X.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){X.iushrn($);while($-- >0){if(T.isOdd())T.iadd(A);T.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(O.isOdd())O.iadd(A);O.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(O);else Q.isub(X),O.isub(T)}var S;if(X.cmpn(1)===0)S=T;else S=O;if(S.cmpn(0)<0)S.iadd(U);return S},Z.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var X=this.clone(),Q=U.clone();X.negative=0,Q.negative=0;for(var T=0;X.isEven()&&Q.isEven();T++)X.iushrn(1),Q.iushrn(1);do{while(X.isEven())X.iushrn(1);while(Q.isEven())Q.iushrn(1);var O=X.cmp(Q);if(O<0){var A=X;X=Q,Q=A}else if(O===0||Q.cmpn(1)===0)break;X.isub(Q)}while(!0);return Q.iushln(T)},Z.prototype.invm=function(U){return this.egcd(U).a.umod(U)},Z.prototype.isEven=function(){return(this.words[0]&1)===0},Z.prototype.isOdd=function(){return(this.words[0]&1)===1},Z.prototype.andln=function(U){return this.words[0]&U},Z.prototype.bincn=function(U){L(typeof U==="number");var X=U%26,Q=(U-X)/26,T=1<>>26,$&=67108863,this.words[A]=$}if(O!==0)this.words[A]=O,this.length++;return this},Z.prototype.isZero=function(){return this.length===1&&this.words[0]===0},Z.prototype.cmpn=function(U){var X=U<0;if(this.negative!==0&&!X)return-1;if(this.negative===0&&X)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(X)U=-U;L(U<=67108863,"Number is too big");var T=this.words[0]|0;Q=T===U?0:TU.length)return 1;if(this.length=0;Q--){var T=this.words[Q]|0,O=U.words[Q]|0;if(T===O)continue;if(TO)X=1;break}return X},Z.prototype.gtn=function(U){return this.cmpn(U)===1},Z.prototype.gt=function(U){return this.cmp(U)===1},Z.prototype.gten=function(U){return this.cmpn(U)>=0},Z.prototype.gte=function(U){return this.cmp(U)>=0},Z.prototype.ltn=function(U){return this.cmpn(U)===-1},Z.prototype.lt=function(U){return this.cmp(U)===-1},Z.prototype.lten=function(U){return this.cmpn(U)<=0},Z.prototype.lte=function(U){return this.cmp(U)<=0},Z.prototype.eqn=function(U){return this.cmpn(U)===0},Z.prototype.eq=function(U){return this.cmp(U)===0},Z.red=function(U){return new u(U)},Z.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},Z.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},Z.prototype._forceRed=function(U){return this.red=U,this},Z.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},Z.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},Z.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},Z.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},Z.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},Z.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},Z.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},Z.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},Z.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},Z.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},Z.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},Z.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},Z.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},Z.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,X){this.name=U,this.p=new Z(X,16),this.n=this.p.bitLength(),this.k=new Z(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new Z(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var X=U,Q;do this.split(X,this.tmp),X=this.imulK(X),X=X.iadd(this.tmp),Q=X.bitLength();while(Q>this.n);var T=Q0)X.isub(this.p);else if(X.strip!==void 0)X.strip();else X._strip();return X},y.prototype.split=function(U,X){U.iushrn(this.n,0,X)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,X){var Q=4194303,T=Math.min(U.length,9);for(var O=0;O>>22,A=$}if(A>>>=22,U.words[O-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var X=0;for(var Q=0;Q>>=26,U.words[Q]=O,X=T}if(X!==0)U.words[U.length++]=X;return U},Z._prime=function(U){if(g[U])return g[U];var X;if(U==="k256")X=new l;else if(U==="p224")X=new Y0;else if(U==="p192")X=new Z0;else if(U==="p25519")X=new O0;else throw Error("Unknown prime "+U);return g[U]=X,X};function u(U){if(typeof U==="string"){var X=Z._prime(U);this.m=X.p,this.prime=X}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,X){L((U.negative|X.negative)===0,"red works only with positives"),L(U.red&&U.red===X.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,X){this._verify2(U,X);var Q=U.add(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,X){this._verify2(U,X);var Q=U.iadd(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,X){this._verify2(U,X);var Q=U.sub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,X){this._verify2(U,X);var Q=U.isub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,X){return this._verify1(U),this.imod(U.ushln(X))},u.prototype.imul=function(U,X){return this._verify2(U,X),this.imod(U.imul(X))},u.prototype.mul=function(U,X){return this._verify2(U,X),this.imod(U.mul(X))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var X=this.m.andln(3);if(L(X%2===1),X===3){var Q=this.m.add(new Z(1)).iushrn(2);return this.pow(U,Q)}var T=this.m.subn(1),O=0;while(!T.isZero()&&T.andln(1)===0)O++,T.iushrn(1);L(!T.isZero());var A=new Z(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new Z(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,T),S=this.pow(U,T.addn(1).iushrn(1)),H=this.pow(U,T),j=O;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;O--){var V=X.words[O];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==T[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(O!==0||S!==0))continue;A=this.mul(A,T[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var X=U.umod(this.m);return X===U?X.clone():X},u.prototype.convertFrom=function(U){var X=U.clone();return X.red=null,X},Z.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new Z(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var X=this.imod(U.mul(this.rinv));return X.red=null,X},i.prototype.imul=function(U,X){if(U.isZero()||X.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,X){if(U.isZero()||X.isZero())return new Z(0)._forceRed(this);var Q=U.mul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var X=this.imod(U._invmp(this.m).mul(this.r2));return X._forceRed(this)}})(typeof Y>"u"||Y,I)}),LQ=Q0((I,Y)=>{var G=VQ(),K=AQ();Y.exports=function(z){return new W(z)};var L={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};L.p224=L.secp224r1,L.p256=L.secp256r1=L.prime256v1,L.p192=L.secp192r1=L.prime192v1,L.p384=L.secp384r1,L.p521=L.secp521r1;function W(z){if(this.curveType=L[z],!this.curveType)this.curveType={name:z};this.curve=new G.ec(this.curveType.name),this.keys=void 0}W.prototype.generateKeys=function(z,q){return this.keys=this.curve.genKeyPair(),this.getPublicKey(z,q)},W.prototype.computeSecret=function(z,q,C){if(q=q||"utf8",!Buffer.isBuffer(z))z=new Buffer(z,q);var D=this.curve.keyFromPublic(z).getPublic(),F=D.mul(this.keys.getPrivate()).getX();return Z(F,C,this.curveType.byteLength)},W.prototype.getPublicKey=function(z,q){var C=this.keys.getPublic(q==="compressed",!0);if(q==="hybrid")if(C[C.length-1]%2)C[0]=7;else C[0]=6;return Z(C,z)},W.prototype.getPrivateKey=function(z){return Z(this.keys.getPrivate(),z)},W.prototype.setPublicKey=function(z,q){if(q=q||"utf8",!Buffer.isBuffer(z))z=new Buffer(z,q);return this.keys._importPublic(z),this},W.prototype.setPrivateKey=function(z,q){if(q=q||"utf8",!Buffer.isBuffer(z))z=new Buffer(z,q);var C=new K(z);return C=C.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(C),this};function Z(z,q,C){if(!Array.isArray(z))z=z.toArray();var D=new Buffer(z);if(C&&D.length{var G=(CU(),h0(PU)).createECDH;Y.exports=G||LQ()}),KQ=Q0((I,Y)=>{(function(G,K){function L(U,X){if(!U)throw Error(X||"Assertion failed")}function W(U,X){U.super_=X;var Q=function(){};Q.prototype=X.prototype,U.prototype=new Q,U.prototype.constructor=U}function Z(U,X,Q){if(Z.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(X==="le"||X==="be")Q=X,X=10;this._init(U||0,X||10,Q||"be")}}if(typeof G==="object")G.exports=Z;else K.BN=Z;Z.BN=Z,Z.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}Z.isBN=function(U){if(U instanceof Z)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===Z.wordSize&&Array.isArray(U.words)},Z.max=function(U,X){if(U.cmp(X)>0)return U;return X},Z.min=function(U,X){if(U.cmp(X)<0)return U;return X},Z.prototype._init=function(U,X,Q){if(typeof U==="number")return this._initNumber(U,X,Q);if(typeof U==="object")return this._initArray(U,X,Q);if(X==="hex")X=16;L(X===(X|0)&&X>=2&&X<=36),U=U.toString().replace(/\s+/g,"");var T=0;if(U[0]==="-")T++,this.negative=1;if(T=0;T-=3)if(A=U[T]|U[T-1]<<8|U[T-2]<<16,this.words[O]|=A<<$&67108863,this.words[O+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,O++}else if(Q==="le"){for(T=0,O=0;T>>26-$&67108863,$+=24,$>=26)$-=26,O++}return this.strip()};function q(U,X){var Q=U.charCodeAt(X);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function C(U,X,Q){var T=q(U,Q);if(Q-1>=X)T|=q(U,Q-1)<<4;return T}Z.prototype._parseHex=function(U,X,Q){this.length=Math.ceil((U.length-X)/6),this.words=Array(this.length);for(var T=0;T=X;T-=2)if($=C(U,X,T)<=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8;else{var J=U.length-X;for(T=J%2===0?X+1:X;T=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8}this.strip()};function D(U,X,Q,T){var O=0,A=Math.min(U.length,Q);for(var $=X;$=49)O+=J-49+10;else if(J>=17)O+=J-17+10;else O+=J}return O}Z.prototype._parseBase=function(U,X,Q){this.words=[0],this.length=1;for(var T=0,O=1;O<=67108863;O*=X)T++;T--,O=O/X|0;var A=U.length-Q,$=A%T,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},Z.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},Z.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(Z.prototype.toString=function(U,X){U=U||10,X=X|0||1;var Q;if(U===16||U==="hex"){Q="";var T=0,O=0;for(var A=0;A>>24-T&16777215,T+=2,T>=26)T-=26,A--;if(O!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(O!==0)Q=O.toString(16)+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},Z.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},Z.prototype.toJSON=function(){return this.toString(16)},Z.prototype.toBuffer=function(U,X){return L(typeof z<"u"),this.toArrayLike(z,U,X)},Z.prototype.toArray=function(U,X){return this.toArrayLike(Array,U,X)},Z.prototype.toArrayLike=function(U,X,Q){var T=this.byteLength(),O=Q||Math.max(1,T);L(T<=O,"byte array longer than desired length"),L(O>0,"Requested array length <= 0"),this.strip();var A=X==="le",$=new U(O),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,X>>>=13;if(X>=64)Q+=7,X>>>=7;if(X>=8)Q+=4,X>>>=4;if(X>=2)Q+=2,X>>>=2;return Q+X};Z.prototype._zeroBits=function(U){if(U===0)return 26;var X=U,Q=0;if((X&8191)===0)Q+=13,X>>>=13;if((X&127)===0)Q+=7,X>>>=7;if((X&15)===0)Q+=4,X>>>=4;if((X&3)===0)Q+=2,X>>>=2;if((X&1)===0)Q++;return Q},Z.prototype.bitLength=function(){var U=this.words[this.length-1],X=this._countBits(U);return(this.length-1)*26+X};function P(U){var X=Array(U.bitLength());for(var Q=0;Q>>O}return X}Z.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var X=0;XU.length)return this.clone().ior(U);return U.clone().ior(this)},Z.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},Z.prototype.iuand=function(U){var X;if(this.length>U.length)X=U;else X=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},Z.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},Z.prototype.iuxor=function(U){var X,Q;if(this.length>U.length)X=this,Q=U;else X=U,Q=this;for(var T=0;TU.length)return this.clone().ixor(U);return U.clone().ixor(this)},Z.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},Z.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var X=Math.ceil(U/26)|0,Q=U%26;if(this._expand(X),Q>0)X--;for(var T=0;T0)this.words[T]=~this.words[T]&67108863>>26-Q;return this.strip()},Z.prototype.notn=function(U){return this.clone().inotn(U)},Z.prototype.setn=function(U,X){L(typeof U==="number"&&U>=0);var Q=U/26|0,T=U%26;if(this._expand(Q+1),X)this.words[Q]=this.words[Q]|1<U.length)Q=this,T=U;else Q=U,T=this;var O=0;for(var A=0;A>>26;for(;O!==0&&A>>26;if(this.length=Q.length,O!==0)this.words[this.length]=O,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},Z.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var X=this.iadd(U);return U.negative=1,X._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var T,O;if(Q>0)T=this,O=U;else T=U,O=this;var A=0;for(var $=0;$>26,this.words[$]=X&67108863;for(;A!==0&&$>26,this.words[$]=X&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,X.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;O=U.words[p]|0,A=X.words[w]|0,$=O*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,X,Q){var T=U.words,O=X.words,A=Q.words,$=0,J,E,V,S=T[0]|0,H=S&8191,j=S>>>13,w=T[1]|0,p=w&8191,n=w>>>13,G0=T[2]|0,t=G0&8191,d=G0>>>13,X0=T[3]|0,m=X0&8191,U0=X0>>>13,g0=T[4]|0,f=g0&8191,h=g0>>>13,I0=T[5]|0,r=I0&8191,e=I0>>>13,D0=T[6]|0,c=D0&8191,o=D0>>>13,x0=T[7]|0,s=x0&8191,T0=x0>>>13,y0=T[8]|0,L0=y0&8191,$0=y0>>>13,n0=T[9]|0,V0=n0&8191,K0=n0>>>13,t0=O[0]|0,H0=t0&8191,W0=t0>>>13,RU=O[1]|0,C0=RU&8191,_0=RU>>>13,DU=O[2]|0,k0=DU&8191,z0=DU>>>13,WU=O[3]|0,v0=WU&8191,S0=WU>>>13,AU=O[4]|0,j0=AU&8191,N0=AU>>>13,LU=O[5]|0,M0=LU&8191,x=LU>>>13,b=O[6]|0,a=b&8191,E0=b>>>13,w0=O[7]|0,A0=w0&8191,F0=w0>>>13,m0=O[8]|0,q0=m0&8191,B0=m0>>>13,HU=O[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^X.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,C0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,C0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,C0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,C0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,C0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,C0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,C0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,C0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,C0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,C0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,C0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,C0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(T0,H0)|0,V=Math.imul(T0,W0),J=J+Math.imul(c,C0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,C0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,C0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(T0,C0)|0,V=V+Math.imul(T0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,C0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,C0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(T0,k0)|0,V=V+Math.imul(T0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,C0),E=Math.imul(V0,_0),E=E+Math.imul(K0,C0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(T0,v0)|0,V=V+Math.imul(T0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(T0,j0)|0,V=V+Math.imul(T0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(T0,M0)|0,V=V+Math.imul(T0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(T0,a)|0,V=V+Math.imul(T0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(T0,A0)|0,V=V+Math.imul(T0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(T0,q0)|0,V=V+Math.imul(T0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(T0,P0)|0,V=V+Math.imul(T0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var JU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var GU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(GU>>>26)|0,GU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=a0,A[6]=e0,A[7]=i0,A[8]=UU,A[9]=EU,A[10]=TU,A[11]=XU,A[12]=IU,A[13]=YU,A[14]=OU,A[15]=ZU,A[16]=QU,A[17]=JU,A[18]=GU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,X,Q){Q.negative=X.negative^U.negative,Q.length=U.length+X.length;var T=0,O=0;for(var A=0;A>>26)|0,O+=$>>>26,$&=67108863}Q.words[A]=J,T=$,$=O}if(T!==0)Q.words[A]=T;else Q.length--;return Q.strip()}function v(U,X,Q){var T=new B;return T.mulp(U,X,Q)}Z.prototype.mulTo=function(U,X){var Q,T=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,X);else if(T<63)Q=k(this,U,X);else if(T<1024)Q=N(this,U,X);else Q=v(this,U,X);return Q};function B(U,X){this.x=U,this.y=X}B.prototype.makeRBT=function(U){var X=Array(U),Q=Z.prototype._countBits(U)-1;for(var T=0;T>=1;return T},B.prototype.permute=function(U,X,Q,T,O,A){for(var $=0;$>>1)O++;return 1<>>13,Q[2*A+1]=O&8191,O=O>>>13;for(A=2*X;A>=26,X+=T/67108864|0,X+=O>>>26,this.words[Q]=O&67108863}if(X!==0)this.words[Q]=X,this.length++;return this.length=U===0?1:this.length,this},Z.prototype.muln=function(U){return this.clone().imuln(U)},Z.prototype.sqr=function(){return this.mul(this)},Z.prototype.isqr=function(){return this.imul(this.clone())},Z.prototype.pow=function(U){var X=P(U);if(X.length===0)return new Z(1);var Q=this;for(var T=0;T=0);var X=U%26,Q=(U-X)/26,T=67108863>>>26-X<<26-X,O;if(X!==0){var A=0;for(O=0;O>>26-X}if(A)this.words[O]=A,this.length++}if(Q!==0){for(O=this.length-1;O>=0;O--)this.words[O+Q]=this.words[O];for(O=0;O=0);var T;if(X)T=(X-X%26)/26;else T=0;var O=U%26,A=Math.min((U-O)/26,this.length),$=67108863^67108863>>>O<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=T);E--){var S=this.words[E]|0;this.words[E]=V<<26-O|S>>>O,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},Z.prototype.ishrn=function(U,X,Q){return L(this.negative===0),this.iushrn(U,X,Q)},Z.prototype.shln=function(U){return this.clone().ishln(U)},Z.prototype.ushln=function(U){return this.clone().iushln(U)},Z.prototype.shrn=function(U){return this.clone().ishrn(U)},Z.prototype.ushrn=function(U){return this.clone().iushrn(U)},Z.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var X=U%26,Q=(U-X)/26,T=1<=0);var X=U%26,Q=(U-X)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(X!==0)Q++;if(this.length=Math.min(Q,this.length),X!==0){var T=67108863^67108863>>>X<=67108864;X++)if(this.words[X]-=67108864,X===this.length-1)this.words[X+1]=1;else this.words[X+1]++;return this.length=Math.max(this.length,X+1),this},Z.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var X=0;X>26)-(J/67108864|0),this.words[O+Q]=A&67108863}for(;O>26,this.words[O+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(O=0;O>26,this.words[O]=A&67108863;return this.negative=1,this.strip()},Z.prototype._wordDiv=function(U,X){var Q=this.length-U.length,T=this.clone(),O=U,A=O.words[O.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)O=O.ushln(Q),T.iushln(Q),A=O.words[O.length-1]|0;var J=T.length-O.length,E;if(X!=="mod"){E=new Z(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(T.words[O.length+H]|0)*67108864+(T.words[O.length+H-1]|0);j=Math.min(j/A|0,67108863),T._ishlnsubmul(O,j,H);while(T.negative!==0)if(j--,T.negative=0,T._ishlnsubmul(O,1,H),!T.isZero())T.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(T.strip(),X!=="div"&&Q!==0)T.iushrn(Q);return{div:E||null,mod:T}},Z.prototype.divmod=function(U,X,Q){if(L(!U.isZero()),this.isZero())return{div:new Z(0),mod:new Z(0)};var T,O,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,X),X!=="mod")T=A.div.neg();if(X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.iadd(U)}return{div:T,mod:O}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),X),X!=="mod")T=A.div.neg();return{div:T,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),X),X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.isub(U)}return{div:A.div,mod:O}}if(U.length>this.length||this.cmp(U)<0)return{div:new Z(0),mod:this};if(U.length===1){if(X==="div")return{div:this.divn(U.words[0]),mod:null};if(X==="mod")return{div:null,mod:new Z(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new Z(this.modn(U.words[0]))}}return this._wordDiv(U,X)},Z.prototype.div=function(U){return this.divmod(U,"div",!1).div},Z.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},Z.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},Z.prototype.divRound=function(U){var X=this.divmod(U);if(X.mod.isZero())return X.div;var Q=X.div.negative!==0?X.mod.isub(U):X.mod,T=U.ushrn(1),O=U.andln(1),A=Q.cmp(T);if(A<0||O===1&&A===0)return X.div;return X.div.negative!==0?X.div.isubn(1):X.div.iaddn(1)},Z.prototype.modn=function(U){L(U<=67108863);var X=67108864%U,Q=0;for(var T=this.length-1;T>=0;T--)Q=(X*Q+(this.words[T]|0))%U;return Q},Z.prototype.idivn=function(U){L(U<=67108863);var X=0;for(var Q=this.length-1;Q>=0;Q--){var T=(this.words[Q]|0)+X*67108864;this.words[Q]=T/U|0,X=T%U}return this.strip()},Z.prototype.divn=function(U){return this.clone().idivn(U)},Z.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=new Z(0),$=new Z(1),J=0;while(X.isEven()&&Q.isEven())X.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=X.clone();while(!X.isZero()){for(var S=0,H=1;(X.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){X.iushrn(S);while(S-- >0){if(T.isOdd()||O.isOdd())T.iadd(E),O.isub(V);T.iushrn(1),O.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(A),O.isub($);else Q.isub(X),A.isub(T),$.isub(O)}return{a:A,b:$,gcd:Q.iushln(J)}},Z.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=Q.clone();while(X.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(X.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){X.iushrn($);while($-- >0){if(T.isOdd())T.iadd(A);T.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(O.isOdd())O.iadd(A);O.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(O);else Q.isub(X),O.isub(T)}var S;if(X.cmpn(1)===0)S=T;else S=O;if(S.cmpn(0)<0)S.iadd(U);return S},Z.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var X=this.clone(),Q=U.clone();X.negative=0,Q.negative=0;for(var T=0;X.isEven()&&Q.isEven();T++)X.iushrn(1),Q.iushrn(1);do{while(X.isEven())X.iushrn(1);while(Q.isEven())Q.iushrn(1);var O=X.cmp(Q);if(O<0){var A=X;X=Q,Q=A}else if(O===0||Q.cmpn(1)===0)break;X.isub(Q)}while(!0);return Q.iushln(T)},Z.prototype.invm=function(U){return this.egcd(U).a.umod(U)},Z.prototype.isEven=function(){return(this.words[0]&1)===0},Z.prototype.isOdd=function(){return(this.words[0]&1)===1},Z.prototype.andln=function(U){return this.words[0]&U},Z.prototype.bincn=function(U){L(typeof U==="number");var X=U%26,Q=(U-X)/26,T=1<>>26,$&=67108863,this.words[A]=$}if(O!==0)this.words[A]=O,this.length++;return this},Z.prototype.isZero=function(){return this.length===1&&this.words[0]===0},Z.prototype.cmpn=function(U){var X=U<0;if(this.negative!==0&&!X)return-1;if(this.negative===0&&X)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(X)U=-U;L(U<=67108863,"Number is too big");var T=this.words[0]|0;Q=T===U?0:TU.length)return 1;if(this.length=0;Q--){var T=this.words[Q]|0,O=U.words[Q]|0;if(T===O)continue;if(TO)X=1;break}return X},Z.prototype.gtn=function(U){return this.cmpn(U)===1},Z.prototype.gt=function(U){return this.cmp(U)===1},Z.prototype.gten=function(U){return this.cmpn(U)>=0},Z.prototype.gte=function(U){return this.cmp(U)>=0},Z.prototype.ltn=function(U){return this.cmpn(U)===-1},Z.prototype.lt=function(U){return this.cmp(U)===-1},Z.prototype.lten=function(U){return this.cmpn(U)<=0},Z.prototype.lte=function(U){return this.cmp(U)<=0},Z.prototype.eqn=function(U){return this.cmpn(U)===0},Z.prototype.eq=function(U){return this.cmp(U)===0},Z.red=function(U){return new u(U)},Z.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},Z.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},Z.prototype._forceRed=function(U){return this.red=U,this},Z.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},Z.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},Z.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},Z.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},Z.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},Z.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},Z.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},Z.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},Z.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},Z.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},Z.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},Z.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},Z.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},Z.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,X){this.name=U,this.p=new Z(X,16),this.n=this.p.bitLength(),this.k=new Z(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new Z(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var X=U,Q;do this.split(X,this.tmp),X=this.imulK(X),X=X.iadd(this.tmp),Q=X.bitLength();while(Q>this.n);var T=Q0)X.isub(this.p);else if(X.strip!==void 0)X.strip();else X._strip();return X},y.prototype.split=function(U,X){U.iushrn(this.n,0,X)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,X){var Q=4194303,T=Math.min(U.length,9);for(var O=0;O>>22,A=$}if(A>>>=22,U.words[O-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var X=0;for(var Q=0;Q>>=26,U.words[Q]=O,X=T}if(X!==0)U.words[U.length++]=X;return U},Z._prime=function(U){if(g[U])return g[U];var X;if(U==="k256")X=new l;else if(U==="p224")X=new Y0;else if(U==="p192")X=new Z0;else if(U==="p25519")X=new O0;else throw Error("Unknown prime "+U);return g[U]=X,X};function u(U){if(typeof U==="string"){var X=Z._prime(U);this.m=X.p,this.prime=X}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,X){L((U.negative|X.negative)===0,"red works only with positives"),L(U.red&&U.red===X.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,X){this._verify2(U,X);var Q=U.add(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,X){this._verify2(U,X);var Q=U.iadd(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,X){this._verify2(U,X);var Q=U.sub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,X){this._verify2(U,X);var Q=U.isub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,X){return this._verify1(U),this.imod(U.ushln(X))},u.prototype.imul=function(U,X){return this._verify2(U,X),this.imod(U.imul(X))},u.prototype.mul=function(U,X){return this._verify2(U,X),this.imod(U.mul(X))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var X=this.m.andln(3);if(L(X%2===1),X===3){var Q=this.m.add(new Z(1)).iushrn(2);return this.pow(U,Q)}var T=this.m.subn(1),O=0;while(!T.isZero()&&T.andln(1)===0)O++,T.iushrn(1);L(!T.isZero());var A=new Z(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new Z(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,T),S=this.pow(U,T.addn(1).iushrn(1)),H=this.pow(U,T),j=O;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;O--){var V=X.words[O];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==T[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(O!==0||S!==0))continue;A=this.mul(A,T[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var X=U.umod(this.m);return X===U?X.clone():X},u.prototype.convertFrom=function(U){var X=U.clone();return X.red=null,X},Z.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new Z(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var X=this.imod(U.mul(this.rinv));return X.red=null,X},i.prototype.imul=function(U,X){if(U.isZero()||X.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,X){if(U.isZero()||X.isZero())return new Z(0)._forceRed(this);var Q=U.mul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var X=this.imod(U._invmp(this.m).mul(this.r2));return X._forceRed(this)}})(typeof Y>"u"||Y,I)}),FQ=Q0((I)=>{var Y=RE(),G=_U(),K=I;K.define=function(W,Z){return new L(W,Z)};function L(W,Z){this.name=W,this.body=Z,this.decoders={},this.encoders={}}L.prototype._createNamed=function(W){var Z;try{Z=(()=>{throw new Error("Cannot require module "+"vm");})().runInThisContext("(function "+this.name+`(entity) { this._initNamed(entity); -})`)}catch(z){O=function(q){this._initNamed(q)}}return G(O,W),O.prototype._initNamed=function(z){W.call(this,z)},new O(this)},L.prototype._getDecoder=function(W){if(W=W||"der",!this.decoders.hasOwnProperty(W))this.decoders[W]=this._createNamed(Y.decoders[W]);return this.decoders[W]},L.prototype.decode=function(W,O,z){return this._getDecoder(O).decode(W,z)},L.prototype._getEncoder=function(W){if(W=W||"der",!this.encoders.hasOwnProperty(W))this.encoders[W]=this._createNamed(Y.encoders[W]);return this.encoders[W]},L.prototype.encode=function(W,O,z){return this._getEncoder(O).encode(W,z)}}),WQ=Q0((T)=>{var Y=_U();function G(L){this._reporterState={obj:null,path:[],options:L||{},errors:[]}}T.Reporter=G,G.prototype.isError=function(L){return L instanceof K},G.prototype.save=function(){var L=this._reporterState;return{obj:L.obj,pathLen:L.path.length}},G.prototype.restore=function(L){var W=this._reporterState;W.obj=L.obj,W.path=W.path.slice(0,L.pathLen)},G.prototype.enterKey=function(L){return this._reporterState.path.push(L)},G.prototype.exitKey=function(L){var W=this._reporterState;W.path=W.path.slice(0,L-1)},G.prototype.leaveKey=function(L,W,O){var z=this._reporterState;if(this.exitKey(L),z.obj!==null)z.obj[W]=O},G.prototype.path=function(){return this._reporterState.path.join("/")},G.prototype.enterObject=function(){var L=this._reporterState,W=L.obj;return L.obj={},W},G.prototype.leaveObject=function(L){var W=this._reporterState,O=W.obj;return W.obj=L,O},G.prototype.error=function(L){var W,O=this._reporterState,z=L instanceof K;if(z)W=L;else W=new K(O.path.map(function(q){return"["+JSON.stringify(q)+"]"}).join(""),L.message||L,L.stack);if(!O.options.partial)throw W;if(!z)O.errors.push(W);return W},G.prototype.wrapResult=function(L){var W=this._reporterState;if(!W.options.partial)return L;return{result:this.isError(L)?null:L,errors:W.errors}};function K(L,W){this.path=L,this.rethrow(W)}Y(K,Error),K.prototype.rethrow=function(L){if(this.message=L+" at: "+(this.path||"(shallow)"),Error.captureStackTrace)Error.captureStackTrace(this,K);if(!this.stack)try{throw Error(this.message)}catch(W){this.stack=W.stack}return this}}),TT=Q0((T)=>{var Y=_U(),G=$E().Reporter,K=(FU(),h0(KU)).Buffer;function L(O,z){if(G.call(this,z),!K.isBuffer(O)){this.error("Input not Buffer");return}this.base=O,this.offset=0,this.length=O.length}Y(L,G),T.DecoderBuffer=L,L.prototype.save=function(){return{offset:this.offset,reporter:G.prototype.save.call(this)}},L.prototype.restore=function(O){var z=new L(this.base);return z.offset=O.offset,z.length=this.offset,this.offset=O.offset,G.prototype.restore.call(this,O.reporter),z},L.prototype.isEmpty=function(){return this.offset===this.length},L.prototype.readUInt8=function(O){if(this.offset+1<=this.length)return this.base.readUInt8(this.offset++,!0);else return this.error(O||"DecoderBuffer overrun")},L.prototype.skip=function(O,z){if(!(this.offset+O<=this.length))return this.error(z||"DecoderBuffer overrun");var q=new L(this.base);return q._reporterState=this._reporterState,q.offset=this.offset,q.length=this.offset+O,this.offset+=O,q},L.prototype.raw=function(O){return this.base.slice(O?O.offset:this.offset,this.length)};function W(O,z){if(Array.isArray(O))this.length=0,this.value=O.map(function(q){if(!(q instanceof W))q=new W(q,z);return this.length+=q.length,q},this);else if(typeof O==="number"){if(!(0<=O&&O<=255))return z.error("non-byte EncoderBuffer value");this.value=O,this.length=1}else if(typeof O==="string")this.value=O,this.length=K.byteLength(O);else if(K.isBuffer(O))this.value=O,this.length=O.length;else return z.error("Unsupported type: "+typeof O)}T.EncoderBuffer=W,W.prototype.join=function(O,z){if(!O)O=new K(this.length);if(!z)z=0;if(this.length===0)return O;if(Array.isArray(this.value))this.value.forEach(function(q){q.join(O,z),z+=q.length});else{if(typeof this.value==="number")O[z]=this.value;else if(typeof this.value==="string")O.write(this.value,z);else if(K.isBuffer(this.value))this.value.copy(O,z);z+=this.length}return O}}),HQ=Q0((T,Y)=>{var G=$E().Reporter,K=$E().EncoderBuffer,L=$E().DecoderBuffer,W=dU(),O=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],z=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(O),q=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function D(F,R){var M={};if(this._baseState=M,M.enc=F,M.parent=R||null,M.children=null,M.tag=null,M.args=null,M.reverseArgs=null,M.choice=null,M.optional=!1,M.any=!1,M.obj=!1,M.use=null,M.useDecoder=null,M.key=null,M.default=null,M.explicit=null,M.implicit=null,M.contains=null,!M.parent)M.children=[],this._wrap()}Y.exports=D;var C=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];D.prototype.clone=function(){var F=this._baseState,R={};C.forEach(function(P){R[P]=F[P]});var M=new this.constructor(R.parent);return M._baseState=R,M},D.prototype._wrap=function(){var F=this._baseState;z.forEach(function(R){this[R]=function(){var M=new this.constructor(this);return F.children.push(M),M[R].apply(M,arguments)}},this)},D.prototype._init=function(F){var R=this._baseState;W(R.parent===null),F.call(this),R.children=R.children.filter(function(M){return M._baseState.parent===this},this),W.equal(R.children.length,1,"Root node can have only one child")},D.prototype._useArgs=function(F){var R=this._baseState,M=F.filter(function(P){return P instanceof this.constructor},this);if(F=F.filter(function(P){return!(P instanceof this.constructor)},this),M.length!==0)W(R.children===null),R.children=M,M.forEach(function(P){P._baseState.parent=this},this);if(F.length!==0)W(R.args===null),R.args=F,R.reverseArgs=F.map(function(P){if(typeof P!=="object"||P.constructor!==Object)return P;var k={};return Object.keys(P).forEach(function(_){if(_==(_|0))_|=0;var N=P[_];k[N]=_}),k})},q.forEach(function(F){D.prototype[F]=function(){var R=this._baseState;throw Error(F+" not implemented for encoding: "+R.enc)}}),O.forEach(function(F){D.prototype[F]=function(){var R=this._baseState,M=Array.prototype.slice.call(arguments);return W(R.tag===null),R.tag=F,this._useArgs(M),this}}),D.prototype.use=function(F){W(F);var R=this._baseState;return W(R.use===null),R.use=F,this},D.prototype.optional=function(){var F=this._baseState;return F.optional=!0,this},D.prototype.def=function(F){var R=this._baseState;return W(R.default===null),R.default=F,R.optional=!0,this},D.prototype.explicit=function(F){var R=this._baseState;return W(R.explicit===null&&R.implicit===null),R.explicit=F,this},D.prototype.implicit=function(F){var R=this._baseState;return W(R.explicit===null&&R.implicit===null),R.implicit=F,this},D.prototype.obj=function(){var F=this._baseState,R=Array.prototype.slice.call(arguments);if(F.obj=!0,R.length!==0)this._useArgs(R);return this},D.prototype.key=function(F){var R=this._baseState;return W(R.key===null),R.key=F,this},D.prototype.any=function(){var F=this._baseState;return F.any=!0,this},D.prototype.choice=function(F){var R=this._baseState;return W(R.choice===null),R.choice=F,this._useArgs(Object.keys(F).map(function(M){return F[M]})),this},D.prototype.contains=function(F){var R=this._baseState;return W(R.use===null),R.contains=F,this},D.prototype._decode=function(F,R){var M=this._baseState;if(M.parent===null)return F.wrapResult(M.children[0]._decode(F,R));var P=M.default,k=!0,_=null;if(M.key!==null)_=F.enterKey(M.key);if(M.optional){var N=null;if(M.explicit!==null)N=M.explicit;else if(M.implicit!==null)N=M.implicit;else if(M.tag!==null)N=M.tag;if(N===null&&!M.any){var v=F.save();try{if(M.choice===null)this._decodeGeneric(M.tag,F,R);else this._decodeChoice(F,R);k=!0}catch(O0){k=!1}F.restore(v)}else if(k=this._peekTag(F,N,M.any),F.isError(k))return k}var B;if(M.obj&&k)B=F.enterObject();if(k){if(M.explicit!==null){var g=this._decodeTag(F,M.explicit);if(F.isError(g))return g;F=g}var y=F.offset;if(M.use===null&&M.choice===null){if(M.any)var v=F.save();var l=this._decodeTag(F,M.implicit!==null?M.implicit:M.tag,M.any);if(F.isError(l))return l;if(M.any)P=F.raw(v);else F=l}if(R&&R.track&&M.tag!==null)R.track(F.path(),y,F.length,"tagged");if(R&&R.track&&M.tag!==null)R.track(F.path(),F.offset,F.length,"content");if(M.any)P=P;else if(M.choice===null)P=this._decodeGeneric(M.tag,F,R);else P=this._decodeChoice(F,R);if(F.isError(P))return P;if(!M.any&&M.choice===null&&M.children!==null)M.children.forEach(function(O0){O0._decode(F,R)});if(M.contains&&(M.tag==="octstr"||M.tag==="bitstr")){var Y0=new L(P);P=this._getUse(M.contains,F._reporterState.obj)._decode(Y0,R)}}if(M.obj&&k)P=F.leaveObject(B);if(M.key!==null&&(P!==null||k===!0))F.leaveKey(_,M.key,P);else if(_!==null)F.exitKey(_);return P},D.prototype._decodeGeneric=function(F,R,M){var P=this._baseState;if(F==="seq"||F==="set")return null;if(F==="seqof"||F==="setof")return this._decodeList(R,F,P.args[0],M);else if(/str$/.test(F))return this._decodeStr(R,F,M);else if(F==="objid"&&P.args)return this._decodeObjid(R,P.args[0],P.args[1],M);else if(F==="objid")return this._decodeObjid(R,null,null,M);else if(F==="gentime"||F==="utctime")return this._decodeTime(R,F,M);else if(F==="null_")return this._decodeNull(R,M);else if(F==="bool")return this._decodeBool(R,M);else if(F==="objDesc")return this._decodeStr(R,F,M);else if(F==="int"||F==="enum")return this._decodeInt(R,P.args&&P.args[0],M);if(P.use!==null)return this._getUse(P.use,R._reporterState.obj)._decode(R,M);else return R.error("unknown tag: "+F)},D.prototype._getUse=function(F,R){var M=this._baseState;if(M.useDecoder=this._use(F,R),W(M.useDecoder._baseState.parent===null),M.useDecoder=M.useDecoder._baseState.children[0],M.implicit!==M.useDecoder._baseState.implicit)M.useDecoder=M.useDecoder.clone(),M.useDecoder._baseState.implicit=M.implicit;return M.useDecoder},D.prototype._decodeChoice=function(F,R){var M=this._baseState,P=null,k=!1;if(Object.keys(M.choice).some(function(_){var N=F.save(),v=M.choice[_];try{var B=v._decode(F,R);if(F.isError(B))return!1;P={type:_,value:B},k=!0}catch(g){return F.restore(N),!1}return!0},this),!k)return F.error("Choice not matched");return P},D.prototype._createEncoderBuffer=function(F){return new K(F,this.reporter)},D.prototype._encode=function(F,R,M){var P=this._baseState;if(P.default!==null&&P.default===F)return;var k=this._encodeValue(F,R,M);if(k===void 0)return;if(this._skipDefault(k,R,M))return;return k},D.prototype._encodeValue=function(F,R,M){var P=this._baseState;if(P.parent===null)return P.children[0]._encode(F,R||new G);var v=null;if(this.reporter=R,P.optional&&F===void 0)if(P.default!==null)F=P.default;else return;var k=null,_=!1;if(P.any)v=this._createEncoderBuffer(F);else if(P.choice)v=this._encodeChoice(F,R);else if(P.contains)k=this._getUse(P.contains,M)._encode(F,R),_=!0;else if(P.children)k=P.children.map(function(y){if(y._baseState.tag==="null_")return y._encode(null,R,F);if(y._baseState.key===null)return R.error("Child should have a key");var l=R.enterKey(y._baseState.key);if(typeof F!=="object")return R.error("Child expected, but input is not object");var Y0=y._encode(F[y._baseState.key],R,F);return R.leaveKey(l),Y0},this).filter(function(y){return y}),k=this._createEncoderBuffer(k);else if(P.tag==="seqof"||P.tag==="setof"){if(!(P.args&&P.args.length===1))return R.error("Too many args for : "+P.tag);if(!Array.isArray(F))return R.error("seqof/setof, but data is not Array");var N=this.clone();N._baseState.implicit=null,k=this._createEncoderBuffer(F.map(function(y){var l=this._baseState;return this._getUse(l.args[0],F)._encode(y,R)},N))}else if(P.use!==null)v=this._getUse(P.use,M)._encode(F,R);else k=this._encodePrimitive(P.tag,F),_=!0;var v;if(!P.any&&P.choice===null){var B=P.implicit!==null?P.implicit:P.tag,g=P.implicit===null?"universal":"context";if(B===null){if(P.use===null)R.error("Tag could be omitted only for .use()")}else if(P.use===null)v=this._encodeComposite(B,_,g,k)}if(P.explicit!==null)v=this._encodeComposite(P.explicit,!1,"context",v);return v},D.prototype._encodeChoice=function(F,R){var M=this._baseState,P=M.choice[F.type];if(!P)W(!1,F.type+" not found in "+JSON.stringify(Object.keys(M.choice)));return P._encode(F.value,R)},D.prototype._encodePrimitive=function(F,R){var M=this._baseState;if(/str$/.test(F))return this._encodeStr(R,F);else if(F==="objid"&&M.args)return this._encodeObjid(R,M.reverseArgs[0],M.args[1]);else if(F==="objid")return this._encodeObjid(R,null,null);else if(F==="gentime"||F==="utctime")return this._encodeTime(R,F);else if(F==="null_")return this._encodeNull();else if(F==="int"||F==="enum")return this._encodeInt(R,M.args&&M.reverseArgs[0]);else if(F==="bool")return this._encodeBool(R);else if(F==="objDesc")return this._encodeStr(R,F);else throw Error("Unsupported tag: "+F)},D.prototype._isNumstr=function(F){return/^[0-9 ]*$/.test(F)},D.prototype._isPrintstr=function(F){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(F)}}),$E=Q0((T)=>{var Y=T;Y.Reporter=WQ().Reporter,Y.DecoderBuffer=TT().DecoderBuffer,Y.EncoderBuffer=TT().EncoderBuffer,Y.Node=HQ()}),RQ=Q0((T)=>{var Y=ST();T.tagClass={0:"universal",1:"application",2:"context",3:"private"},T.tagClassByName=Y._reverse(T.tagClass),T.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},T.tagByName=Y._reverse(T.tag)}),ST=Q0((T)=>{var Y=T;Y._reverse=function(G){var K={};return Object.keys(G).forEach(function(L){if((L|0)==L)L=L|0;var W=G[L];K[W]=L}),K},Y.der=RQ()}),MT=Q0((T,Y)=>{var G=_U(),K=RE(),L=K.base,W=K.bignum,O=K.constants.der;function z(F){this.enc="der",this.name=F.name,this.entity=F,this.tree=new q,this.tree._init(F.body)}Y.exports=z,z.prototype.decode=function(F,R){if(!(F instanceof L.DecoderBuffer))F=new L.DecoderBuffer(F,R);return this.tree._decode(F,R)};function q(F){L.Node.call(this,"der",F)}G(q,L.Node),q.prototype._peekTag=function(F,R,M){if(F.isEmpty())return!1;var P=F.save(),k=D(F,'Failed to peek tag: "'+R+'"');if(F.isError(k))return k;return F.restore(P),k.tag===R||k.tagStr===R||k.tagStr+"of"===R||M},q.prototype._decodeTag=function(F,R,M){var P=D(F,'Failed to decode tag of "'+R+'"');if(F.isError(P))return P;var k=C(F,P.primitive,'Failed to get length of "'+R+'"');if(F.isError(k))return k;if(!M&&P.tag!==R&&P.tagStr!==R&&P.tagStr+"of"!==R)return F.error('Failed to match tag: "'+R+'"');if(P.primitive||k!==null)return F.skip(k,'Failed to match body of: "'+R+'"');var _=F.save(),N=this._skipUntilEnd(F,'Failed to skip indefinite length body: "'+this.tag+'"');if(F.isError(N))return N;return k=F.offset-_.offset,F.restore(_),F.skip(k,'Failed to match body of: "'+R+'"')},q.prototype._skipUntilEnd=function(F,R){while(!0){var M=D(F,R);if(F.isError(M))return M;var P=C(F,M.primitive,R);if(F.isError(P))return P;var k;if(M.primitive||P!==null)k=F.skip(P);else k=this._skipUntilEnd(F,R);if(F.isError(k))return k;if(M.tagStr==="end")break}},q.prototype._decodeList=function(F,R,M,P){var k=[];while(!F.isEmpty()){var _=this._peekTag(F,"end");if(F.isError(_))return _;var N=M.decode(F,"der",P);if(F.isError(N)&&_)break;k.push(N)}return k},q.prototype._decodeStr=function(F,R){if(R==="bitstr"){var M=F.readUInt8();if(F.isError(M))return M;return{unused:M,data:F.raw()}}else if(R==="bmpstr"){var P=F.raw();if(P.length%2===1)return F.error("Decoding of string type: bmpstr length mismatch");var k="";for(var _=0;_>6],k=(M&32)===0;if((M&31)===31){var _=M;M=0;while((_&128)===128){if(_=F.readUInt8(R),F.isError(_))return _;M<<=7,M|=_&127}}else M&=31;var N=O.tag[M];return{cls:P,primitive:k,tag:M,tagStr:N}}function C(F,R,M){var P=F.readUInt8(M);if(F.isError(P))return P;if(!R&&P===128)return null;if((P&128)===0)return P;var k=P&127;if(k>4)return F.error("length octect is too long");P=0;for(var _=0;_{var G=_U(),K=(FU(),h0(KU)).Buffer,L=MT();function W(O){L.call(this,O),this.enc="pem"}G(W,L),Y.exports=W,W.prototype.decode=function(O,z){var q=O.toString().split(/[\r\n]+/g),D=z.label.toUpperCase(),C=/^-----(BEGIN|END) ([^-]+)-----$/,F=-1,R=-1;for(var M=0;M{var Y=T;Y.der=MT(),Y.pem=CQ()}),qT=Q0((T,Y)=>{var G=_U(),K=(FU(),h0(KU)).Buffer,L=RE(),W=L.base,O=L.constants.der;function z(F){this.enc="der",this.name=F.name,this.entity=F,this.tree=new q,this.tree._init(F.body)}Y.exports=z,z.prototype.encode=function(F,R){return this.tree._encode(F,R).join()};function q(F){W.Node.call(this,"der",F)}G(q,W.Node),q.prototype._encodeComposite=function(F,R,M,P){var k=C(F,R,M,this.reporter);if(P.length<128){var v=new K(2);return v[0]=k,v[1]=P.length,this._createEncoderBuffer([v,P])}var _=1;for(var N=P.length;N>=256;N>>=8)_++;var v=new K(2+_);v[0]=k,v[1]=128|_;for(var N=1+_,B=P.length;B>0;N--,B>>=8)v[N]=B&255;return this._createEncoderBuffer([v,P])},q.prototype._encodeStr=function(F,R){if(R==="bitstr")return this._createEncoderBuffer([F.unused|0,F.data]);else if(R==="bmpstr"){var M=new K(F.length*2);for(var P=0;P=40)return this.reporter.error("Second objid identifier OOB");F.splice(0,2,F[0]*40+F[1])}var k=0;for(var P=0;P=128;_>>=7)k++}var N=new K(k),v=N.length-1;for(var P=F.length-1;P>=0;P--){var _=F[P];N[v--]=_&127;while((_>>=7)>0)N[v--]=128|_&127}return this._createEncoderBuffer(N)};function D(F){if(F<10)return"0"+F;else return F}q.prototype._encodeTime=function(F,R){var M,P=new Date(F);if(R==="gentime")M=[D(P.getFullYear()),D(P.getUTCMonth()+1),D(P.getUTCDate()),D(P.getUTCHours()),D(P.getUTCMinutes()),D(P.getUTCSeconds()),"Z"].join("");else if(R==="utctime")M=[D(P.getFullYear()%100),D(P.getUTCMonth()+1),D(P.getUTCDate()),D(P.getUTCHours()),D(P.getUTCMinutes()),D(P.getUTCSeconds()),"Z"].join("");else this.reporter.error("Encoding "+R+" time is not supported yet");return this._encodeStr(M,"octstr")},q.prototype._encodeNull=function(){return this._createEncoderBuffer("")},q.prototype._encodeInt=function(F,R){if(typeof F==="string"){if(!R)return this.reporter.error("String int or enum given, but no values map");if(!R.hasOwnProperty(F))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(F));F=R[F]}if(typeof F!=="number"&&!K.isBuffer(F)){var M=F.toArray();if(!F.sign&&M[0]&128)M.unshift(0);F=new K(M)}if(K.isBuffer(F)){var P=F.length;if(F.length===0)P++;var _=new K(P);if(F.copy(_),F.length===0)_[0]=0;return this._createEncoderBuffer(_)}if(F<128)return this._createEncoderBuffer(F);if(F<256)return this._createEncoderBuffer([0,F]);var P=1;for(var k=F;k>=256;k>>=8)P++;var _=Array(P);for(var k=_.length-1;k>=0;k--)_[k]=F&255,F>>=8;if(_[0]&128)_.unshift(0);return this._createEncoderBuffer(new K(_))},q.prototype._encodeBool=function(F){return this._createEncoderBuffer(F?255:0)},q.prototype._use=function(F,R){if(typeof F==="function")F=F(R);return F._getEncoder("der").tree},q.prototype._skipDefault=function(F,R,M){var P=this._baseState,k;if(P.default===null)return!1;var _=F.join();if(P.defaultBuffer===void 0)P.defaultBuffer=this._encodeValue(P.default,R,M).join();if(_.length!==P.defaultBuffer.length)return!1;for(k=0;k<_.length;k++)if(_[k]!==P.defaultBuffer[k])return!1;return!0};function C(F,R,M,P){var k;if(F==="seqof")F="seq";else if(F==="setof")F="set";if(O.tagByName.hasOwnProperty(F))k=O.tagByName[F];else if(typeof F==="number"&&(F|0)===F)k=F;else return P.error("Unknown tag: "+F);if(k>=31)return P.error("Multi-octet tag encoding unsupported");if(!R)k|=32;return k|=O.tagClassByName[M||"universal"]<<6,k}}),zQ=Q0((T,Y)=>{var G=_U(),K=qT();function L(W){K.call(this,W),this.enc="pem"}G(L,K),Y.exports=L,L.prototype.encode=function(W,O){var z=K.prototype.encode.call(this,W),q=z.toString("base64"),D=["-----BEGIN "+O.label+"-----"];for(var C=0;C{var Y=T;Y.der=qT(),Y.pem=zQ()}),RE=Q0((T)=>{var Y=T;Y.bignum=KQ(),Y.define=FQ().define,Y.base=$E(),Y.constants=ST(),Y.decoders=DQ(),Y.encoders=SQ()}),MQ=Q0((T,Y)=>{var G=RE(),K=G.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),L=G.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),W=G.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),O=G.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(W),this.key("subjectPublicKey").bitstr())}),z=G.define("RelativeDistinguishedName",function(){this.setof(L)}),q=G.define("RDNSequence",function(){this.seqof(z)}),D=G.define("Name",function(){this.choice({rdnSequence:this.use(q)})}),C=G.define("Validity",function(){this.seq().obj(this.key("notBefore").use(K),this.key("notAfter").use(K))}),F=G.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),R=G.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(W),this.key("issuer").use(D),this.key("validity").use(C),this.key("subject").use(D),this.key("subjectPublicKeyInfo").use(O),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(F).optional())}),M=G.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(R),this.key("signatureAlgorithm").use(W),this.key("signatureValue").bitstr())});Y.exports=M}),qQ=Q0((T)=>{var Y=RE();T.certificate=MQ();var G=Y.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});T.RSAPrivateKey=G;var K=Y.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});T.RSAPublicKey=K;var L=Y.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),W=Y.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(L),this.key("subjectPublicKey").bitstr())});T.PublicKey=W;var O=Y.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(L),this.key("subjectPrivateKey").octstr())});T.PrivateKey=O;var z=Y.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});T.EncryptedPrivateKey=z;var q=Y.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});T.DSAPrivateKey=q,T.DSAparam=Y.define("DSAparam",function(){this.int()});var D=Y.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),C=Y.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(D),this.key("publicKey").optional().explicit(1).bitstr())});T.ECPrivateKey=C,T.signature=Y.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),PQ=Q0((T,Y)=>{Y.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}}),_Q=Q0((T,Y)=>{var G=SU().Buffer,K=MX().Transform,L=_U();function W(D){K.call(this),this._block=G.allocUnsafe(D),this._blockSize=D,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}L(W,K),W.prototype._transform=function(D,C,F){var R=null;try{this.update(D,C)}catch(M){R=M}F(R)},W.prototype._flush=function(D){var C=null;try{this.push(this.digest())}catch(F){C=F}D(C)};var O=typeof Uint8Array<"u",z=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(G.prototype instanceof Uint8Array||G.TYPED_ARRAY_SUPPORT);function q(D,C){if(D instanceof G)return D;if(typeof D==="string")return G.from(D,C);if(z&&ArrayBuffer.isView(D)){if(D.byteLength===0)return G.alloc(0);var F=G.from(D.buffer,D.byteOffset,D.byteLength);if(F.byteLength===D.byteLength)return F}if(O&&D instanceof Uint8Array)return G.from(D);if(G.isBuffer(D)&&D.constructor&&typeof D.constructor.isBuffer==="function"&&D.constructor.isBuffer(D))return G.from(D);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}W.prototype.update=function(D,C){if(this._finalized)throw Error("Digest already called");D=q(D,C);var F=this._block,R=0;while(this._blockOffset+D.length-R>=this._blockSize){for(var M=this._blockOffset;M0;++P)if(this._length[P]+=k,k=this._length[P]/4294967296|0,k>0)this._length[P]-=4294967296*k;return this},W.prototype._update=function(){throw Error("_update is not implemented")},W.prototype.digest=function(D){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var C=this._digest();if(D!==void 0)C=C.toString(D);this._block.fill(0),this._blockOffset=0;for(var F=0;F<4;++F)this._length[F]=0;return C},W.prototype._digest=function(){throw Error("_digest is not implemented")},Y.exports=W}),kQ=Q0((T,Y)=>{var G=_U(),K=_Q(),L=SU().Buffer,W=Array(16);function O(){K.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}G(O,K),O.prototype._update=function(){var R=W;for(var M=0;M<16;++M)R[M]=this._block.readInt32LE(M*4);var P=this._a,k=this._b,_=this._c,N=this._d;P=q(P,k,_,N,R[0],3614090360,7),N=q(N,P,k,_,R[1],3905402710,12),_=q(_,N,P,k,R[2],606105819,17),k=q(k,_,N,P,R[3],3250441966,22),P=q(P,k,_,N,R[4],4118548399,7),N=q(N,P,k,_,R[5],1200080426,12),_=q(_,N,P,k,R[6],2821735955,17),k=q(k,_,N,P,R[7],4249261313,22),P=q(P,k,_,N,R[8],1770035416,7),N=q(N,P,k,_,R[9],2336552879,12),_=q(_,N,P,k,R[10],4294925233,17),k=q(k,_,N,P,R[11],2304563134,22),P=q(P,k,_,N,R[12],1804603682,7),N=q(N,P,k,_,R[13],4254626195,12),_=q(_,N,P,k,R[14],2792965006,17),k=q(k,_,N,P,R[15],1236535329,22),P=D(P,k,_,N,R[1],4129170786,5),N=D(N,P,k,_,R[6],3225465664,9),_=D(_,N,P,k,R[11],643717713,14),k=D(k,_,N,P,R[0],3921069994,20),P=D(P,k,_,N,R[5],3593408605,5),N=D(N,P,k,_,R[10],38016083,9),_=D(_,N,P,k,R[15],3634488961,14),k=D(k,_,N,P,R[4],3889429448,20),P=D(P,k,_,N,R[9],568446438,5),N=D(N,P,k,_,R[14],3275163606,9),_=D(_,N,P,k,R[3],4107603335,14),k=D(k,_,N,P,R[8],1163531501,20),P=D(P,k,_,N,R[13],2850285829,5),N=D(N,P,k,_,R[2],4243563512,9),_=D(_,N,P,k,R[7],1735328473,14),k=D(k,_,N,P,R[12],2368359562,20),P=C(P,k,_,N,R[5],4294588738,4),N=C(N,P,k,_,R[8],2272392833,11),_=C(_,N,P,k,R[11],1839030562,16),k=C(k,_,N,P,R[14],4259657740,23),P=C(P,k,_,N,R[1],2763975236,4),N=C(N,P,k,_,R[4],1272893353,11),_=C(_,N,P,k,R[7],4139469664,16),k=C(k,_,N,P,R[10],3200236656,23),P=C(P,k,_,N,R[13],681279174,4),N=C(N,P,k,_,R[0],3936430074,11),_=C(_,N,P,k,R[3],3572445317,16),k=C(k,_,N,P,R[6],76029189,23),P=C(P,k,_,N,R[9],3654602809,4),N=C(N,P,k,_,R[12],3873151461,11),_=C(_,N,P,k,R[15],530742520,16),k=C(k,_,N,P,R[2],3299628645,23),P=F(P,k,_,N,R[0],4096336452,6),N=F(N,P,k,_,R[7],1126891415,10),_=F(_,N,P,k,R[14],2878612391,15),k=F(k,_,N,P,R[5],4237533241,21),P=F(P,k,_,N,R[12],1700485571,6),N=F(N,P,k,_,R[3],2399980690,10),_=F(_,N,P,k,R[10],4293915773,15),k=F(k,_,N,P,R[1],2240044497,21),P=F(P,k,_,N,R[8],1873313359,6),N=F(N,P,k,_,R[15],4264355552,10),_=F(_,N,P,k,R[6],2734768916,15),k=F(k,_,N,P,R[13],1309151649,21),P=F(P,k,_,N,R[4],4149444226,6),N=F(N,P,k,_,R[11],3174756917,10),_=F(_,N,P,k,R[2],718787259,15),k=F(k,_,N,P,R[9],3951481745,21),this._a=this._a+P|0,this._b=this._b+k|0,this._c=this._c+_|0,this._d=this._d+N|0},O.prototype._digest=function(){if(this._block[this._blockOffset++]=128,this._blockOffset>56)this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0;this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var R=L.allocUnsafe(16);return R.writeInt32LE(this._a,0),R.writeInt32LE(this._b,4),R.writeInt32LE(this._c,8),R.writeInt32LE(this._d,12),R};function z(R,M){return R<>>32-M}function q(R,M,P,k,_,N,v){return z(R+(M&P|~M&k)+_+N|0,v)+M|0}function D(R,M,P,k,_,N,v){return z(R+(M&k|P&~k)+_+N|0,v)+M|0}function C(R,M,P,k,_,N,v){return z(R+(M^P^k)+_+N|0,v)+M|0}function F(R,M,P,k,_,N,v){return z(R+(P^(M|~k))+_+N|0,v)+M|0}Y.exports=O}),vQ=Q0((T,Y)=>{var G=SU().Buffer,K=kQ();function L(W,O,z,q){if(!G.isBuffer(W))W=G.from(W,"binary");if(O){if(!G.isBuffer(O))O=G.from(O,"binary");if(O.length!==8)throw RangeError("salt should be Buffer with 8 byte length")}var D=z/8,C=G.alloc(D),F=G.alloc(q||0),R=G.alloc(0);while(D>0||q>0){var M=new K;if(M.update(R),M.update(W),O)M.update(O);R=M.digest();var P=0;if(D>0){var k=C.length-D;P=Math.min(D,R.length),R.copy(C,k,0,P),D-=P}if(P0){var _=F.length-q,N=Math.min(q,R.length-P);R.copy(F,_,P,P+N),q-=N}}return R.fill(0),{key:C,iv:F}}Y.exports=L}),PT=Q0((T)=>{var Y=(DU(),h0(PU));T.createCipher=T.Cipher=Y.createCipher,T.createCipheriv=T.Cipheriv=Y.createCipheriv,T.createDecipher=T.Decipher=Y.createDecipher,T.createDecipheriv=T.Decipheriv=Y.createDecipheriv,T.listCiphers=T.getCiphers=Y.getCiphers}),jQ=Q0((T,Y)=>{var G=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,K=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,L=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,W=vQ(),O=PT(),z=SU().Buffer;Y.exports=function(q,D){var C=q.toString(),F=C.match(G),R;if(!F){var M=C.match(L);R=z.from(M[2].replace(/[\r\n]/g,""),"base64")}else{var P="aes"+F[1],k=z.from(F[2],"hex"),_=z.from(F[3].replace(/[\r\n]/g,""),"base64"),N=W(D,k.slice(0,8),parseInt(F[1],10)).key,v=[],B=O.createDecipheriv(P,N,k);v.push(B.update(_)),v.push(B.final()),R=z.concat(v)}var g=C.match(K)[1];return{tag:g,data:R}}}),_T=Q0((T,Y)=>{var G=qQ(),K=PQ(),L=jQ(),W=PT(),O=FT().pbkdf2Sync,z=SU().Buffer;function q(C,F){var R=C.algorithm.decrypt.kde.kdeparams.salt,M=parseInt(C.algorithm.decrypt.kde.kdeparams.iters.toString(),10),P=K[C.algorithm.decrypt.cipher.algo.join(".")],k=C.algorithm.decrypt.cipher.iv,_=C.subjectPrivateKey,N=parseInt(P.split("-")[1],10)/8,v=O(F,R,M,N,"sha1"),B=W.createDecipheriv(P,v,k),g=[];return g.push(B.update(_)),g.push(B.final()),z.concat(g)}function D(C){var F;if(typeof C==="object"&&!z.isBuffer(C))F=C.passphrase,C=C.key;if(typeof C==="string")C=z.from(C);var R=L(C,F),M=R.tag,P=R.data,k,_;switch(M){case"CERTIFICATE":_=G.certificate.decode(P,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":if(!_)_=G.PublicKey.decode(P,"der");switch(k=_.algorithm.algorithm.join("."),k){case"1.2.840.113549.1.1.1":return G.RSAPublicKey.decode(_.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return _.subjectPrivateKey=_.subjectPublicKey,{type:"ec",data:_};case"1.2.840.10040.4.1":return _.algorithm.params.pub_key=G.DSAparam.decode(_.subjectPublicKey.data,"der"),{type:"dsa",data:_.algorithm.params};default:throw Error("unknown key id "+k)}case"ENCRYPTED PRIVATE KEY":P=G.EncryptedPrivateKey.decode(P,"der"),P=q(P,F);case"PRIVATE KEY":switch(_=G.PrivateKey.decode(P,"der"),k=_.algorithm.algorithm.join("."),k){case"1.2.840.113549.1.1.1":return G.RSAPrivateKey.decode(_.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:_.algorithm.curve,privateKey:G.ECPrivateKey.decode(_.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return _.algorithm.params.priv_key=G.DSAparam.decode(_.subjectPrivateKey,"der"),{type:"dsa",params:_.algorithm.params};default:throw Error("unknown key id "+k)}case"RSA PUBLIC KEY":return G.RSAPublicKey.decode(P,"der");case"RSA PRIVATE KEY":return G.RSAPrivateKey.decode(P,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:G.DSAPrivateKey.decode(P,"der")};case"EC PRIVATE KEY":return P=G.ECPrivateKey.decode(P,"der"),{curve:P.parameters.value,privateKey:P.privateKey};default:throw Error("unknown key type "+M)}}D.signature=G.signature,Y.exports=D}),kT=Q0((T,Y)=>{var G=pE(),K=SU().Buffer;Y.exports=function(W,O){var z=K.alloc(0),q=0,D;while(z.length{Y.exports=function(G,K){var L=G.length,W=-1;while(++W{(function(G,K){function L(U,I){if(!U)throw Error(I||"Assertion failed")}function W(U,I){U.super_=I;var Q=function(){};Q.prototype=I.prototype,U.prototype=new Q,U.prototype.constructor=U}function O(U,I,Q){if(O.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(I==="le"||I==="be")Q=I,I=10;this._init(U||0,I||10,Q||"be")}}if(typeof G==="object")G.exports=O;else K.BN=O;O.BN=O,O.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}O.isBN=function(U){if(U instanceof O)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===O.wordSize&&Array.isArray(U.words)},O.max=function(U,I){if(U.cmp(I)>0)return U;return I},O.min=function(U,I){if(U.cmp(I)<0)return U;return I},O.prototype._init=function(U,I,Q){if(typeof U==="number")return this._initNumber(U,I,Q);if(typeof U==="object")return this._initArray(U,I,Q);if(I==="hex")I=16;L(I===(I|0)&&I>=2&&I<=36),U=U.toString().replace(/\s+/g,"");var X=0;if(U[0]==="-")X++,this.negative=1;if(X=0;X-=3)if(A=U[X]|U[X-1]<<8|U[X-2]<<16,this.words[Z]|=A<<$&67108863,this.words[Z+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,Z++}else if(Q==="le"){for(X=0,Z=0;X>>26-$&67108863,$+=24,$>=26)$-=26,Z++}return this.strip()};function q(U,I){var Q=U.charCodeAt(I);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function D(U,I,Q){var X=q(U,Q);if(Q-1>=I)X|=q(U,Q-1)<<4;return X}O.prototype._parseHex=function(U,I,Q){this.length=Math.ceil((U.length-I)/6),this.words=Array(this.length);for(var X=0;X=I;X-=2)if($=D(U,I,X)<=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8;else{var J=U.length-I;for(X=J%2===0?I+1:I;X=18)Z-=18,A+=1,this.words[A]|=$>>>26;else Z+=8}this.strip()};function C(U,I,Q,X){var Z=0,A=Math.min(U.length,Q);for(var $=I;$=49)Z+=J-49+10;else if(J>=17)Z+=J-17+10;else Z+=J}return Z}O.prototype._parseBase=function(U,I,Q){this.words=[0],this.length=1;for(var X=0,Z=1;Z<=67108863;Z*=I)X++;X--,Z=Z/I|0;var A=U.length-Q,$=A%X,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},O.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},O.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(O.prototype.toString=function(U,I){U=U||10,I=I|0||1;var Q;if(U===16||U==="hex"){Q="";var X=0,Z=0;for(var A=0;A>>24-X&16777215,X+=2,X>=26)X-=26,A--;if(Z!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(Z!==0)Q=Z.toString(16)+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%I!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},O.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},O.prototype.toJSON=function(){return this.toString(16)},O.prototype.toBuffer=function(U,I){return L(typeof z<"u"),this.toArrayLike(z,U,I)},O.prototype.toArray=function(U,I){return this.toArrayLike(Array,U,I)},O.prototype.toArrayLike=function(U,I,Q){var X=this.byteLength(),Z=Q||Math.max(1,X);L(X<=Z,"byte array longer than desired length"),L(Z>0,"Requested array length <= 0"),this.strip();var A=I==="le",$=new U(Z),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,I>>>=13;if(I>=64)Q+=7,I>>>=7;if(I>=8)Q+=4,I>>>=4;if(I>=2)Q+=2,I>>>=2;return Q+I};O.prototype._zeroBits=function(U){if(U===0)return 26;var I=U,Q=0;if((I&8191)===0)Q+=13,I>>>=13;if((I&127)===0)Q+=7,I>>>=7;if((I&15)===0)Q+=4,I>>>=4;if((I&3)===0)Q+=2,I>>>=2;if((I&1)===0)Q++;return Q},O.prototype.bitLength=function(){var U=this.words[this.length-1],I=this._countBits(U);return(this.length-1)*26+I};function P(U){var I=Array(U.bitLength());for(var Q=0;Q>>Z}return I}O.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var I=0;IU.length)return this.clone().ior(U);return U.clone().ior(this)},O.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},O.prototype.iuand=function(U){var I;if(this.length>U.length)I=U;else I=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},O.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},O.prototype.iuxor=function(U){var I,Q;if(this.length>U.length)I=this,Q=U;else I=U,Q=this;for(var X=0;XU.length)return this.clone().ixor(U);return U.clone().ixor(this)},O.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},O.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var I=Math.ceil(U/26)|0,Q=U%26;if(this._expand(I),Q>0)I--;for(var X=0;X0)this.words[X]=~this.words[X]&67108863>>26-Q;return this.strip()},O.prototype.notn=function(U){return this.clone().inotn(U)},O.prototype.setn=function(U,I){L(typeof U==="number"&&U>=0);var Q=U/26|0,X=U%26;if(this._expand(Q+1),I)this.words[Q]=this.words[Q]|1<U.length)Q=this,X=U;else Q=U,X=this;var Z=0;for(var A=0;A>>26;for(;Z!==0&&A>>26;if(this.length=Q.length,Z!==0)this.words[this.length]=Z,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},O.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var I=this.iadd(U);return U.negative=1,I._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var X,Z;if(Q>0)X=this,Z=U;else X=U,Z=this;var A=0;for(var $=0;$>26,this.words[$]=I&67108863;for(;A!==0&&$>26,this.words[$]=I&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,I.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;Z=U.words[p]|0,A=I.words[w]|0,$=Z*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,I,Q){var X=U.words,Z=I.words,A=Q.words,$=0,J,E,V,S=X[0]|0,H=S&8191,j=S>>>13,w=X[1]|0,p=w&8191,n=w>>>13,G0=X[2]|0,t=G0&8191,d=G0>>>13,I0=X[3]|0,m=I0&8191,U0=I0>>>13,g0=X[4]|0,f=g0&8191,h=g0>>>13,T0=X[5]|0,r=T0&8191,e=T0>>>13,C0=X[6]|0,c=C0&8191,o=C0>>>13,x0=X[7]|0,s=x0&8191,X0=x0>>>13,y0=X[8]|0,L0=y0&8191,$0=y0>>>13,n0=X[9]|0,V0=n0&8191,K0=n0>>>13,r0=Z[0]|0,H0=r0&8191,W0=r0>>>13,RU=Z[1]|0,D0=RU&8191,_0=RU>>>13,CU=Z[2]|0,k0=CU&8191,z0=CU>>>13,WU=Z[3]|0,v0=WU&8191,S0=WU>>>13,AU=Z[4]|0,j0=AU&8191,N0=AU>>>13,LU=Z[5]|0,M0=LU&8191,x=LU>>>13,b=Z[6]|0,a=b&8191,E0=b>>>13,w0=Z[7]|0,A0=w0&8191,F0=w0>>>13,m0=Z[8]|0,q0=m0&8191,B0=m0>>>13,HU=Z[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^I.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,D0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,D0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,D0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,D0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,D0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,D0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,D0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,D0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,D0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,D0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var t0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(t0>>>26)|0,t0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,D0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,D0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(X0,H0)|0,V=Math.imul(X0,W0),J=J+Math.imul(c,D0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,D0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,D0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(X0,D0)|0,V=V+Math.imul(X0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,D0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,D0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(X0,k0)|0,V=V+Math.imul(X0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,D0),E=Math.imul(V0,_0),E=E+Math.imul(K0,D0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(X0,v0)|0,V=V+Math.imul(X0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(X0,j0)|0,V=V+Math.imul(X0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(X0,M0)|0,V=V+Math.imul(X0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(X0,a)|0,V=V+Math.imul(X0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(X0,A0)|0,V=V+Math.imul(X0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(X0,q0)|0,V=V+Math.imul(X0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(X0,P0)|0,V=V+Math.imul(X0,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var JU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=t0,A[6]=a0,A[7]=e0,A[8]=i0,A[9]=UU,A[10]=EU,A[11]=XU,A[12]=IU,A[13]=TU,A[14]=YU,A[15]=ZU,A[16]=OU,A[17]=QU,A[18]=JU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,I,Q){Q.negative=I.negative^U.negative,Q.length=U.length+I.length;var X=0,Z=0;for(var A=0;A>>26)|0,Z+=$>>>26,$&=67108863}Q.words[A]=J,X=$,$=Z}if(X!==0)Q.words[A]=X;else Q.length--;return Q.strip()}function v(U,I,Q){var X=new B;return X.mulp(U,I,Q)}O.prototype.mulTo=function(U,I){var Q,X=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,I);else if(X<63)Q=k(this,U,I);else if(X<1024)Q=N(this,U,I);else Q=v(this,U,I);return Q};function B(U,I){this.x=U,this.y=I}B.prototype.makeRBT=function(U){var I=Array(U),Q=O.prototype._countBits(U)-1;for(var X=0;X>=1;return X},B.prototype.permute=function(U,I,Q,X,Z,A){for(var $=0;$>>1)Z++;return 1<>>13,Q[2*A+1]=Z&8191,Z=Z>>>13;for(A=2*I;A>=26,I+=X/67108864|0,I+=Z>>>26,this.words[Q]=Z&67108863}if(I!==0)this.words[Q]=I,this.length++;return this.length=U===0?1:this.length,this},O.prototype.muln=function(U){return this.clone().imuln(U)},O.prototype.sqr=function(){return this.mul(this)},O.prototype.isqr=function(){return this.imul(this.clone())},O.prototype.pow=function(U){var I=P(U);if(I.length===0)return new O(1);var Q=this;for(var X=0;X=0);var I=U%26,Q=(U-I)/26,X=67108863>>>26-I<<26-I,Z;if(I!==0){var A=0;for(Z=0;Z>>26-I}if(A)this.words[Z]=A,this.length++}if(Q!==0){for(Z=this.length-1;Z>=0;Z--)this.words[Z+Q]=this.words[Z];for(Z=0;Z=0);var X;if(I)X=(I-I%26)/26;else X=0;var Z=U%26,A=Math.min((U-Z)/26,this.length),$=67108863^67108863>>>Z<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=X);E--){var S=this.words[E]|0;this.words[E]=V<<26-Z|S>>>Z,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},O.prototype.ishrn=function(U,I,Q){return L(this.negative===0),this.iushrn(U,I,Q)},O.prototype.shln=function(U){return this.clone().ishln(U)},O.prototype.ushln=function(U){return this.clone().iushln(U)},O.prototype.shrn=function(U){return this.clone().ishrn(U)},O.prototype.ushrn=function(U){return this.clone().iushrn(U)},O.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var I=U%26,Q=(U-I)/26,X=1<=0);var I=U%26,Q=(U-I)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(I!==0)Q++;if(this.length=Math.min(Q,this.length),I!==0){var X=67108863^67108863>>>I<=67108864;I++)if(this.words[I]-=67108864,I===this.length-1)this.words[I+1]=1;else this.words[I+1]++;return this.length=Math.max(this.length,I+1),this},O.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var I=0;I>26)-(J/67108864|0),this.words[Z+Q]=A&67108863}for(;Z>26,this.words[Z+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(Z=0;Z>26,this.words[Z]=A&67108863;return this.negative=1,this.strip()},O.prototype._wordDiv=function(U,I){var Q=this.length-U.length,X=this.clone(),Z=U,A=Z.words[Z.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)Z=Z.ushln(Q),X.iushln(Q),A=Z.words[Z.length-1]|0;var J=X.length-Z.length,E;if(I!=="mod"){E=new O(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(X.words[Z.length+H]|0)*67108864+(X.words[Z.length+H-1]|0);j=Math.min(j/A|0,67108863),X._ishlnsubmul(Z,j,H);while(X.negative!==0)if(j--,X.negative=0,X._ishlnsubmul(Z,1,H),!X.isZero())X.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(X.strip(),I!=="div"&&Q!==0)X.iushrn(Q);return{div:E||null,mod:X}},O.prototype.divmod=function(U,I,Q){if(L(!U.isZero()),this.isZero())return{div:new O(0),mod:new O(0)};var X,Z,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,I),I!=="mod")X=A.div.neg();if(I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.iadd(U)}return{div:X,mod:Z}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),I),I!=="mod")X=A.div.neg();return{div:X,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),I),I!=="div"){if(Z=A.mod.neg(),Q&&Z.negative!==0)Z.isub(U)}return{div:A.div,mod:Z}}if(U.length>this.length||this.cmp(U)<0)return{div:new O(0),mod:this};if(U.length===1){if(I==="div")return{div:this.divn(U.words[0]),mod:null};if(I==="mod")return{div:null,mod:new O(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new O(this.modn(U.words[0]))}}return this._wordDiv(U,I)},O.prototype.div=function(U){return this.divmod(U,"div",!1).div},O.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},O.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},O.prototype.divRound=function(U){var I=this.divmod(U);if(I.mod.isZero())return I.div;var Q=I.div.negative!==0?I.mod.isub(U):I.mod,X=U.ushrn(1),Z=U.andln(1),A=Q.cmp(X);if(A<0||Z===1&&A===0)return I.div;return I.div.negative!==0?I.div.isubn(1):I.div.iaddn(1)},O.prototype.modn=function(U){L(U<=67108863);var I=67108864%U,Q=0;for(var X=this.length-1;X>=0;X--)Q=(I*Q+(this.words[X]|0))%U;return Q},O.prototype.idivn=function(U){L(U<=67108863);var I=0;for(var Q=this.length-1;Q>=0;Q--){var X=(this.words[Q]|0)+I*67108864;this.words[Q]=X/U|0,I=X%U}return this.strip()},O.prototype.divn=function(U){return this.clone().idivn(U)},O.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=new O(0),$=new O(1),J=0;while(I.isEven()&&Q.isEven())I.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=I.clone();while(!I.isZero()){for(var S=0,H=1;(I.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){I.iushrn(S);while(S-- >0){if(X.isOdd()||Z.isOdd())X.iadd(E),Z.isub(V);X.iushrn(1),Z.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(A),Z.isub($);else Q.isub(I),A.isub(X),$.isub(Z)}return{a:A,b:$,gcd:Q.iushln(J)}},O.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var I=this,Q=U.clone();if(I.negative!==0)I=I.umod(U);else I=I.clone();var X=new O(1),Z=new O(0),A=Q.clone();while(I.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(I.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){I.iushrn($);while($-- >0){if(X.isOdd())X.iadd(A);X.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(Z.isOdd())Z.iadd(A);Z.iushrn(1)}}if(I.cmp(Q)>=0)I.isub(Q),X.isub(Z);else Q.isub(I),Z.isub(X)}var S;if(I.cmpn(1)===0)S=X;else S=Z;if(S.cmpn(0)<0)S.iadd(U);return S},O.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var I=this.clone(),Q=U.clone();I.negative=0,Q.negative=0;for(var X=0;I.isEven()&&Q.isEven();X++)I.iushrn(1),Q.iushrn(1);do{while(I.isEven())I.iushrn(1);while(Q.isEven())Q.iushrn(1);var Z=I.cmp(Q);if(Z<0){var A=I;I=Q,Q=A}else if(Z===0||Q.cmpn(1)===0)break;I.isub(Q)}while(!0);return Q.iushln(X)},O.prototype.invm=function(U){return this.egcd(U).a.umod(U)},O.prototype.isEven=function(){return(this.words[0]&1)===0},O.prototype.isOdd=function(){return(this.words[0]&1)===1},O.prototype.andln=function(U){return this.words[0]&U},O.prototype.bincn=function(U){L(typeof U==="number");var I=U%26,Q=(U-I)/26,X=1<>>26,$&=67108863,this.words[A]=$}if(Z!==0)this.words[A]=Z,this.length++;return this},O.prototype.isZero=function(){return this.length===1&&this.words[0]===0},O.prototype.cmpn=function(U){var I=U<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(I)U=-U;L(U<=67108863,"Number is too big");var X=this.words[0]|0;Q=X===U?0:XU.length)return 1;if(this.length=0;Q--){var X=this.words[Q]|0,Z=U.words[Q]|0;if(X===Z)continue;if(XZ)I=1;break}return I},O.prototype.gtn=function(U){return this.cmpn(U)===1},O.prototype.gt=function(U){return this.cmp(U)===1},O.prototype.gten=function(U){return this.cmpn(U)>=0},O.prototype.gte=function(U){return this.cmp(U)>=0},O.prototype.ltn=function(U){return this.cmpn(U)===-1},O.prototype.lt=function(U){return this.cmp(U)===-1},O.prototype.lten=function(U){return this.cmpn(U)<=0},O.prototype.lte=function(U){return this.cmp(U)<=0},O.prototype.eqn=function(U){return this.cmpn(U)===0},O.prototype.eq=function(U){return this.cmp(U)===0},O.red=function(U){return new u(U)},O.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},O.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},O.prototype._forceRed=function(U){return this.red=U,this},O.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},O.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},O.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},O.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},O.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},O.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},O.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},O.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},O.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},O.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},O.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},O.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},O.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},O.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,I){this.name=U,this.p=new O(I,16),this.n=this.p.bitLength(),this.k=new O(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new O(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var I=U,Q;do this.split(I,this.tmp),I=this.imulK(I),I=I.iadd(this.tmp),Q=I.bitLength();while(Q>this.n);var X=Q0)I.isub(this.p);else if(I.strip!==void 0)I.strip();else I._strip();return I},y.prototype.split=function(U,I){U.iushrn(this.n,0,I)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,I){var Q=4194303,X=Math.min(U.length,9);for(var Z=0;Z>>22,A=$}if(A>>>=22,U.words[Z-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var I=0;for(var Q=0;Q>>=26,U.words[Q]=Z,I=X}if(I!==0)U.words[U.length++]=I;return U},O._prime=function(U){if(g[U])return g[U];var I;if(U==="k256")I=new l;else if(U==="p224")I=new Y0;else if(U==="p192")I=new O0;else if(U==="p25519")I=new Z0;else throw Error("Unknown prime "+U);return g[U]=I,I};function u(U){if(typeof U==="string"){var I=O._prime(U);this.m=I.p,this.prime=I}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,I){L((U.negative|I.negative)===0,"red works only with positives"),L(U.red&&U.red===I.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,I){this._verify2(U,I);var Q=U.add(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,I){this._verify2(U,I);var Q=U.iadd(I);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,I){this._verify2(U,I);var Q=U.sub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,I){this._verify2(U,I);var Q=U.isub(I);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,I){return this._verify1(U),this.imod(U.ushln(I))},u.prototype.imul=function(U,I){return this._verify2(U,I),this.imod(U.imul(I))},u.prototype.mul=function(U,I){return this._verify2(U,I),this.imod(U.mul(I))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var I=this.m.andln(3);if(L(I%2===1),I===3){var Q=this.m.add(new O(1)).iushrn(2);return this.pow(U,Q)}var X=this.m.subn(1),Z=0;while(!X.isZero()&&X.andln(1)===0)Z++,X.iushrn(1);L(!X.isZero());var A=new O(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new O(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,X),S=this.pow(U,X.addn(1).iushrn(1)),H=this.pow(U,X),j=Z;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;Z--){var V=I.words[Z];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==X[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(Z!==0||S!==0))continue;A=this.mul(A,X[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var I=U.umod(this.m);return I===U?I.clone():I},u.prototype.convertFrom=function(U){var I=U.clone();return I.red=null,I},O.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new O(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var I=this.imod(U.mul(this.rinv));return I.red=null,I},i.prototype.imul=function(U,I){if(U.isZero()||I.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,I){if(U.isZero()||I.isZero())return new O(0)._forceRed(this);var Q=U.mul(I),X=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Z=Q.isub(X).iushrn(this.shift),A=Z;if(Z.cmp(this.m)>=0)A=Z.isub(this.m);else if(Z.cmpn(0)<0)A=Z.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var I=this.imod(U._invmp(this.m).mul(this.r2));return I._forceRed(this)}})(typeof Y>"u"||Y,T)}),jT=Q0((T,Y)=>{var G=gX(),K=SU().Buffer;function L(W,O){return K.from(W.toRed(G.mont(O.modulus)).redPow(new G(O.publicExponent)).fromRed().toArray())}Y.exports=L}),NQ=Q0((T,Y)=>{(function(G,K){function L(X,Z){if(!X)throw Error(Z||"Assertion failed")}function W(X,Z){X.super_=Z;var A=function(){};A.prototype=Z.prototype,X.prototype=new A,X.prototype.constructor=X}function O(X,Z,A){if(O.isBN(X))return X;if(this.negative=0,this.words=null,this.length=0,this.red=null,X!==null){if(Z==="le"||Z==="be")A=Z,Z=10;this._init(X||0,Z||10,A||"be")}}if(typeof G==="object")G.exports=O;else K.BN=O;O.BN=O,O.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(X){}O.isBN=function(X){if(X instanceof O)return!0;return X!==null&&typeof X==="object"&&X.constructor.wordSize===O.wordSize&&Array.isArray(X.words)},O.max=function(X,Z){if(X.cmp(Z)>0)return X;return Z},O.min=function(X,Z){if(X.cmp(Z)<0)return X;return Z},O.prototype._init=function(X,Z,A){if(typeof X==="number")return this._initNumber(X,Z,A);if(typeof X==="object")return this._initArray(X,Z,A);if(Z==="hex")Z=16;L(Z===(Z|0)&&Z>=2&&Z<=36),X=X.toString().replace(/\s+/g,"");var $=0;if(X[0]==="-")$++,this.negative=1;if($=0;$-=3)if(E=X[$]|X[$-1]<<8|X[$-2]<<16,this.words[J]|=E<>>26-V&67108863,V+=24,V>=26)V-=26,J++}else if(A==="le"){for($=0,J=0;$>>26-V&67108863,V+=24,V>=26)V-=26,J++}return this._strip()};function q(X,Z){var A=X.charCodeAt(Z);if(A>=48&&A<=57)return A-48;else if(A>=65&&A<=70)return A-55;else if(A>=97&&A<=102)return A-87;else L(!1,"Invalid character in "+X)}function D(X,Z,A){var $=q(X,A);if(A-1>=Z)$|=q(X,A-1)<<4;return $}O.prototype._parseHex=function(X,Z,A){this.length=Math.ceil((X.length-Z)/6),this.words=Array(this.length);for(var $=0;$=Z;$-=2)if(V=D(X,Z,$)<=18)J-=18,E+=1,this.words[E]|=V>>>26;else J+=8;else{var S=X.length-Z;for($=S%2===0?Z+1:Z;$=18)J-=18,E+=1,this.words[E]|=V>>>26;else J+=8}this._strip()};function C(X,Z,A,$){var J=0,E=0,V=Math.min(X.length,A);for(var S=Z;S=49)E=H-49+10;else if(H>=17)E=H-17+10;else E=H;L(H>=0&&E<$,"Invalid character"),J+=E}return J}O.prototype._parseBase=function(X,Z,A){this.words=[0],this.length=1;for(var $=0,J=1;J<=67108863;J*=Z)$++;$--,J=J/Z|0;var E=X.length-A,V=E%$,S=Math.min(E,E-V)+A,H=0;for(var j=A;j1&&this.words[this.length-1]===0)this.length--;return this._normSign()},O.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{O.prototype[Symbol.for("nodejs.util.inspect.custom")]=R}catch(X){O.prototype.inspect=R}else O.prototype.inspect=R;function R(){return(this.red?""}var M=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],P=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(O.prototype.toString=function(X,Z){X=X||10,Z=Z|0||1;var A;if(X===16||X==="hex"){A="";var $=0,J=0;for(var E=0;E>>24-$&16777215,$+=2,$>=26)$-=26,E--;if(J!==0||E!==this.length-1)A=M[6-S.length]+S+A;else A=S+A}if(J!==0)A=J.toString(16)+A;while(A.length%Z!==0)A="0"+A;if(this.negative!==0)A="-"+A;return A}if(X===(X|0)&&X>=2&&X<=36){var H=P[X],j=k[X];A="";var w=this.clone();w.negative=0;while(!w.isZero()){var p=w.modrn(j).toString(X);if(w=w.idivn(j),!w.isZero())A=M[H-p.length]+p+A;else A=p+A}if(this.isZero())A="0"+A;while(A.length%Z!==0)A="0"+A;if(this.negative!==0)A="-"+A;return A}L(!1,"Base should be between 2 and 36")},O.prototype.toNumber=function(){var X=this.words[0];if(this.length===2)X+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)X+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-X:X},O.prototype.toJSON=function(){return this.toString(16,2)},z)O.prototype.toBuffer=function(X,Z){return this.toArrayLike(z,X,Z)};O.prototype.toArray=function(X,Z){return this.toArrayLike(Array,X,Z)};var _=function(X,Z){if(X.allocUnsafe)return X.allocUnsafe(Z);return new X(Z)};if(O.prototype.toArrayLike=function(X,Z,A){this._strip();var $=this.byteLength(),J=A||Math.max(1,$);L($<=J,"byte array longer than desired length"),L(J>0,"Requested array length <= 0");var E=_(X,J),V=Z==="le"?"LE":"BE";return this["_toArrayLike"+V](E,$),E},O.prototype._toArrayLikeLE=function(X,Z){var A=0,$=0;for(var J=0,E=0;J>8&255;if(A>16&255;if(E===6){if(A>24&255;$=0,E=0}else $=V>>>24,E+=2}if(A=0)X[A--]=V>>8&255;if(A>=0)X[A--]=V>>16&255;if(E===6){if(A>=0)X[A--]=V>>24&255;$=0,E=0}else $=V>>>24,E+=2}if(A>=0){X[A--]=$;while(A>=0)X[A--]=0}},Math.clz32)O.prototype._countBits=function(X){return 32-Math.clz32(X)};else O.prototype._countBits=function(X){var Z=X,A=0;if(Z>=4096)A+=13,Z>>>=13;if(Z>=64)A+=7,Z>>>=7;if(Z>=8)A+=4,Z>>>=4;if(Z>=2)A+=2,Z>>>=2;return A+Z};O.prototype._zeroBits=function(X){if(X===0)return 26;var Z=X,A=0;if((Z&8191)===0)A+=13,Z>>>=13;if((Z&127)===0)A+=7,Z>>>=7;if((Z&15)===0)A+=4,Z>>>=4;if((Z&3)===0)A+=2,Z>>>=2;if((Z&1)===0)A++;return A},O.prototype.bitLength=function(){var X=this.words[this.length-1],Z=this._countBits(X);return(this.length-1)*26+Z};function N(X){var Z=Array(X.bitLength());for(var A=0;A>>J&1}return Z}O.prototype.zeroBits=function(){if(this.isZero())return 0;var X=0;for(var Z=0;ZX.length)return this.clone().ior(X);return X.clone().ior(this)},O.prototype.uor=function(X){if(this.length>X.length)return this.clone().iuor(X);return X.clone().iuor(this)},O.prototype.iuand=function(X){var Z;if(this.length>X.length)Z=X;else Z=this;for(var A=0;AX.length)return this.clone().iand(X);return X.clone().iand(this)},O.prototype.uand=function(X){if(this.length>X.length)return this.clone().iuand(X);return X.clone().iuand(this)},O.prototype.iuxor=function(X){var Z,A;if(this.length>X.length)Z=this,A=X;else Z=X,A=this;for(var $=0;$X.length)return this.clone().ixor(X);return X.clone().ixor(this)},O.prototype.uxor=function(X){if(this.length>X.length)return this.clone().iuxor(X);return X.clone().iuxor(this)},O.prototype.inotn=function(X){L(typeof X==="number"&&X>=0);var Z=Math.ceil(X/26)|0,A=X%26;if(this._expand(Z),A>0)Z--;for(var $=0;$0)this.words[$]=~this.words[$]&67108863>>26-A;return this._strip()},O.prototype.notn=function(X){return this.clone().inotn(X)},O.prototype.setn=function(X,Z){L(typeof X==="number"&&X>=0);var A=X/26|0,$=X%26;if(this._expand(A+1),Z)this.words[A]=this.words[A]|1<<$;else this.words[A]=this.words[A]&~(1<<$);return this._strip()},O.prototype.iadd=function(X){var Z;if(this.negative!==0&&X.negative===0)return this.negative=0,Z=this.isub(X),this.negative^=1,this._normSign();else if(this.negative===0&&X.negative!==0)return X.negative=0,Z=this.isub(X),X.negative=1,Z._normSign();var A,$;if(this.length>X.length)A=this,$=X;else A=X,$=this;var J=0;for(var E=0;E<$.length;E++)Z=(A.words[E]|0)+($.words[E]|0)+J,this.words[E]=Z&67108863,J=Z>>>26;for(;J!==0&&E>>26;if(this.length=A.length,J!==0)this.words[this.length]=J,this.length++;else if(A!==this)for(;EX.length)return this.clone().iadd(X);return X.clone().iadd(this)},O.prototype.isub=function(X){if(X.negative!==0){X.negative=0;var Z=this.iadd(X);return X.negative=1,Z._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(X),this.negative=1,this._normSign();var A=this.cmp(X);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var $,J;if(A>0)$=this,J=X;else $=X,J=this;var E=0;for(var V=0;V>26,this.words[V]=Z&67108863;for(;E!==0&&V<$.length;V++)Z=($.words[V]|0)+E,E=Z>>26,this.words[V]=Z&67108863;if(E===0&&V<$.length&&$!==this)for(;V<$.length;V++)this.words[V]=$.words[V];if(this.length=Math.max(this.length,V),$!==this)this.negative=1;return this._strip()},O.prototype.sub=function(X){return this.clone().isub(X)};function v(X,Z,A){A.negative=Z.negative^X.negative;var $=X.length+Z.length|0;A.length=$,$=$-1|0;var J=X.words[0]|0,E=Z.words[0]|0,V=J*E,S=V&67108863,H=V/67108864|0;A.words[0]=S;for(var j=1;j<$;j++){var w=H>>>26,p=H&67108863,n=Math.min(j,Z.length-1);for(var G0=Math.max(0,j-X.length+1);G0<=n;G0++){var t=j-G0|0;J=X.words[t]|0,E=Z.words[G0]|0,V=J*E+p,w+=V/67108864|0,p=V&67108863}A.words[j]=p|0,H=w|0}if(H!==0)A.words[j]=H|0;else A.length--;return A._strip()}var B=function(X,Z,A){var $=X.words,J=Z.words,E=A.words,V=0,S,H,j,w=$[0]|0,p=w&8191,n=w>>>13,G0=$[1]|0,t=G0&8191,d=G0>>>13,I0=$[2]|0,m=I0&8191,U0=I0>>>13,g0=$[3]|0,f=g0&8191,h=g0>>>13,T0=$[4]|0,r=T0&8191,e=T0>>>13,C0=$[5]|0,c=C0&8191,o=C0>>>13,x0=$[6]|0,s=x0&8191,X0=x0>>>13,y0=$[7]|0,L0=y0&8191,$0=y0>>>13,n0=$[8]|0,V0=n0&8191,K0=n0>>>13,r0=$[9]|0,H0=r0&8191,W0=r0>>>13,RU=J[0]|0,D0=RU&8191,_0=RU>>>13,CU=J[1]|0,k0=CU&8191,z0=CU>>>13,WU=J[2]|0,v0=WU&8191,S0=WU>>>13,AU=J[3]|0,j0=AU&8191,N0=AU>>>13,LU=J[4]|0,M0=LU&8191,x=LU>>>13,b=J[5]|0,a=b&8191,E0=b>>>13,w0=J[6]|0,A0=w0&8191,F0=w0>>>13,m0=J[7]|0,q0=m0&8191,B0=m0>>>13,HU=J[8]|0,P0=HU&8191,R0=HU>>>13,s0=J[9]|0,c0=s0&8191,f0=s0>>>13;A.negative=X.negative^Z.negative,A.length=19,S=Math.imul(p,D0),H=Math.imul(p,_0),H=H+Math.imul(n,D0)|0,j=Math.imul(n,_0);var d0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(d0>>>26)|0,d0&=67108863,S=Math.imul(t,D0),H=Math.imul(t,_0),H=H+Math.imul(d,D0)|0,j=Math.imul(d,_0),S=S+Math.imul(p,k0)|0,H=H+Math.imul(p,z0)|0,H=H+Math.imul(n,k0)|0,j=j+Math.imul(n,z0)|0;var b0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(b0>>>26)|0,b0&=67108863,S=Math.imul(m,D0),H=Math.imul(m,_0),H=H+Math.imul(U0,D0)|0,j=Math.imul(U0,_0),S=S+Math.imul(t,k0)|0,H=H+Math.imul(t,z0)|0,H=H+Math.imul(d,k0)|0,j=j+Math.imul(d,z0)|0,S=S+Math.imul(p,v0)|0,H=H+Math.imul(p,S0)|0,H=H+Math.imul(n,v0)|0,j=j+Math.imul(n,S0)|0;var t0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(t0>>>26)|0,t0&=67108863,S=Math.imul(f,D0),H=Math.imul(f,_0),H=H+Math.imul(h,D0)|0,j=Math.imul(h,_0),S=S+Math.imul(m,k0)|0,H=H+Math.imul(m,z0)|0,H=H+Math.imul(U0,k0)|0,j=j+Math.imul(U0,z0)|0,S=S+Math.imul(t,v0)|0,H=H+Math.imul(t,S0)|0,H=H+Math.imul(d,v0)|0,j=j+Math.imul(d,S0)|0,S=S+Math.imul(p,j0)|0,H=H+Math.imul(p,N0)|0,H=H+Math.imul(n,j0)|0,j=j+Math.imul(n,N0)|0;var a0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(a0>>>26)|0,a0&=67108863,S=Math.imul(r,D0),H=Math.imul(r,_0),H=H+Math.imul(e,D0)|0,j=Math.imul(e,_0),S=S+Math.imul(f,k0)|0,H=H+Math.imul(f,z0)|0,H=H+Math.imul(h,k0)|0,j=j+Math.imul(h,z0)|0,S=S+Math.imul(m,v0)|0,H=H+Math.imul(m,S0)|0,H=H+Math.imul(U0,v0)|0,j=j+Math.imul(U0,S0)|0,S=S+Math.imul(t,j0)|0,H=H+Math.imul(t,N0)|0,H=H+Math.imul(d,j0)|0,j=j+Math.imul(d,N0)|0,S=S+Math.imul(p,M0)|0,H=H+Math.imul(p,x)|0,H=H+Math.imul(n,M0)|0,j=j+Math.imul(n,x)|0;var e0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(e0>>>26)|0,e0&=67108863,S=Math.imul(c,D0),H=Math.imul(c,_0),H=H+Math.imul(o,D0)|0,j=Math.imul(o,_0),S=S+Math.imul(r,k0)|0,H=H+Math.imul(r,z0)|0,H=H+Math.imul(e,k0)|0,j=j+Math.imul(e,z0)|0,S=S+Math.imul(f,v0)|0,H=H+Math.imul(f,S0)|0,H=H+Math.imul(h,v0)|0,j=j+Math.imul(h,S0)|0,S=S+Math.imul(m,j0)|0,H=H+Math.imul(m,N0)|0,H=H+Math.imul(U0,j0)|0,j=j+Math.imul(U0,N0)|0,S=S+Math.imul(t,M0)|0,H=H+Math.imul(t,x)|0,H=H+Math.imul(d,M0)|0,j=j+Math.imul(d,x)|0,S=S+Math.imul(p,a)|0,H=H+Math.imul(p,E0)|0,H=H+Math.imul(n,a)|0,j=j+Math.imul(n,E0)|0;var i0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(i0>>>26)|0,i0&=67108863,S=Math.imul(s,D0),H=Math.imul(s,_0),H=H+Math.imul(X0,D0)|0,j=Math.imul(X0,_0),S=S+Math.imul(c,k0)|0,H=H+Math.imul(c,z0)|0,H=H+Math.imul(o,k0)|0,j=j+Math.imul(o,z0)|0,S=S+Math.imul(r,v0)|0,H=H+Math.imul(r,S0)|0,H=H+Math.imul(e,v0)|0,j=j+Math.imul(e,S0)|0,S=S+Math.imul(f,j0)|0,H=H+Math.imul(f,N0)|0,H=H+Math.imul(h,j0)|0,j=j+Math.imul(h,N0)|0,S=S+Math.imul(m,M0)|0,H=H+Math.imul(m,x)|0,H=H+Math.imul(U0,M0)|0,j=j+Math.imul(U0,x)|0,S=S+Math.imul(t,a)|0,H=H+Math.imul(t,E0)|0,H=H+Math.imul(d,a)|0,j=j+Math.imul(d,E0)|0,S=S+Math.imul(p,A0)|0,H=H+Math.imul(p,F0)|0,H=H+Math.imul(n,A0)|0,j=j+Math.imul(n,F0)|0;var UU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(UU>>>26)|0,UU&=67108863,S=Math.imul(L0,D0),H=Math.imul(L0,_0),H=H+Math.imul($0,D0)|0,j=Math.imul($0,_0),S=S+Math.imul(s,k0)|0,H=H+Math.imul(s,z0)|0,H=H+Math.imul(X0,k0)|0,j=j+Math.imul(X0,z0)|0,S=S+Math.imul(c,v0)|0,H=H+Math.imul(c,S0)|0,H=H+Math.imul(o,v0)|0,j=j+Math.imul(o,S0)|0,S=S+Math.imul(r,j0)|0,H=H+Math.imul(r,N0)|0,H=H+Math.imul(e,j0)|0,j=j+Math.imul(e,N0)|0,S=S+Math.imul(f,M0)|0,H=H+Math.imul(f,x)|0,H=H+Math.imul(h,M0)|0,j=j+Math.imul(h,x)|0,S=S+Math.imul(m,a)|0,H=H+Math.imul(m,E0)|0,H=H+Math.imul(U0,a)|0,j=j+Math.imul(U0,E0)|0,S=S+Math.imul(t,A0)|0,H=H+Math.imul(t,F0)|0,H=H+Math.imul(d,A0)|0,j=j+Math.imul(d,F0)|0,S=S+Math.imul(p,q0)|0,H=H+Math.imul(p,B0)|0,H=H+Math.imul(n,q0)|0,j=j+Math.imul(n,B0)|0;var EU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(EU>>>26)|0,EU&=67108863,S=Math.imul(V0,D0),H=Math.imul(V0,_0),H=H+Math.imul(K0,D0)|0,j=Math.imul(K0,_0),S=S+Math.imul(L0,k0)|0,H=H+Math.imul(L0,z0)|0,H=H+Math.imul($0,k0)|0,j=j+Math.imul($0,z0)|0,S=S+Math.imul(s,v0)|0,H=H+Math.imul(s,S0)|0,H=H+Math.imul(X0,v0)|0,j=j+Math.imul(X0,S0)|0,S=S+Math.imul(c,j0)|0,H=H+Math.imul(c,N0)|0,H=H+Math.imul(o,j0)|0,j=j+Math.imul(o,N0)|0,S=S+Math.imul(r,M0)|0,H=H+Math.imul(r,x)|0,H=H+Math.imul(e,M0)|0,j=j+Math.imul(e,x)|0,S=S+Math.imul(f,a)|0,H=H+Math.imul(f,E0)|0,H=H+Math.imul(h,a)|0,j=j+Math.imul(h,E0)|0,S=S+Math.imul(m,A0)|0,H=H+Math.imul(m,F0)|0,H=H+Math.imul(U0,A0)|0,j=j+Math.imul(U0,F0)|0,S=S+Math.imul(t,q0)|0,H=H+Math.imul(t,B0)|0,H=H+Math.imul(d,q0)|0,j=j+Math.imul(d,B0)|0,S=S+Math.imul(p,P0)|0,H=H+Math.imul(p,R0)|0,H=H+Math.imul(n,P0)|0,j=j+Math.imul(n,R0)|0;var XU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(XU>>>26)|0,XU&=67108863,S=Math.imul(H0,D0),H=Math.imul(H0,_0),H=H+Math.imul(W0,D0)|0,j=Math.imul(W0,_0),S=S+Math.imul(V0,k0)|0,H=H+Math.imul(V0,z0)|0,H=H+Math.imul(K0,k0)|0,j=j+Math.imul(K0,z0)|0,S=S+Math.imul(L0,v0)|0,H=H+Math.imul(L0,S0)|0,H=H+Math.imul($0,v0)|0,j=j+Math.imul($0,S0)|0,S=S+Math.imul(s,j0)|0,H=H+Math.imul(s,N0)|0,H=H+Math.imul(X0,j0)|0,j=j+Math.imul(X0,N0)|0,S=S+Math.imul(c,M0)|0,H=H+Math.imul(c,x)|0,H=H+Math.imul(o,M0)|0,j=j+Math.imul(o,x)|0,S=S+Math.imul(r,a)|0,H=H+Math.imul(r,E0)|0,H=H+Math.imul(e,a)|0,j=j+Math.imul(e,E0)|0,S=S+Math.imul(f,A0)|0,H=H+Math.imul(f,F0)|0,H=H+Math.imul(h,A0)|0,j=j+Math.imul(h,F0)|0,S=S+Math.imul(m,q0)|0,H=H+Math.imul(m,B0)|0,H=H+Math.imul(U0,q0)|0,j=j+Math.imul(U0,B0)|0,S=S+Math.imul(t,P0)|0,H=H+Math.imul(t,R0)|0,H=H+Math.imul(d,P0)|0,j=j+Math.imul(d,R0)|0,S=S+Math.imul(p,c0)|0,H=H+Math.imul(p,f0)|0,H=H+Math.imul(n,c0)|0,j=j+Math.imul(n,f0)|0;var IU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(IU>>>26)|0,IU&=67108863,S=Math.imul(H0,k0),H=Math.imul(H0,z0),H=H+Math.imul(W0,k0)|0,j=Math.imul(W0,z0),S=S+Math.imul(V0,v0)|0,H=H+Math.imul(V0,S0)|0,H=H+Math.imul(K0,v0)|0,j=j+Math.imul(K0,S0)|0,S=S+Math.imul(L0,j0)|0,H=H+Math.imul(L0,N0)|0,H=H+Math.imul($0,j0)|0,j=j+Math.imul($0,N0)|0,S=S+Math.imul(s,M0)|0,H=H+Math.imul(s,x)|0,H=H+Math.imul(X0,M0)|0,j=j+Math.imul(X0,x)|0,S=S+Math.imul(c,a)|0,H=H+Math.imul(c,E0)|0,H=H+Math.imul(o,a)|0,j=j+Math.imul(o,E0)|0,S=S+Math.imul(r,A0)|0,H=H+Math.imul(r,F0)|0,H=H+Math.imul(e,A0)|0,j=j+Math.imul(e,F0)|0,S=S+Math.imul(f,q0)|0,H=H+Math.imul(f,B0)|0,H=H+Math.imul(h,q0)|0,j=j+Math.imul(h,B0)|0,S=S+Math.imul(m,P0)|0,H=H+Math.imul(m,R0)|0,H=H+Math.imul(U0,P0)|0,j=j+Math.imul(U0,R0)|0,S=S+Math.imul(t,c0)|0,H=H+Math.imul(t,f0)|0,H=H+Math.imul(d,c0)|0,j=j+Math.imul(d,f0)|0;var TU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(TU>>>26)|0,TU&=67108863,S=Math.imul(H0,v0),H=Math.imul(H0,S0),H=H+Math.imul(W0,v0)|0,j=Math.imul(W0,S0),S=S+Math.imul(V0,j0)|0,H=H+Math.imul(V0,N0)|0,H=H+Math.imul(K0,j0)|0,j=j+Math.imul(K0,N0)|0,S=S+Math.imul(L0,M0)|0,H=H+Math.imul(L0,x)|0,H=H+Math.imul($0,M0)|0,j=j+Math.imul($0,x)|0,S=S+Math.imul(s,a)|0,H=H+Math.imul(s,E0)|0,H=H+Math.imul(X0,a)|0,j=j+Math.imul(X0,E0)|0,S=S+Math.imul(c,A0)|0,H=H+Math.imul(c,F0)|0,H=H+Math.imul(o,A0)|0,j=j+Math.imul(o,F0)|0,S=S+Math.imul(r,q0)|0,H=H+Math.imul(r,B0)|0,H=H+Math.imul(e,q0)|0,j=j+Math.imul(e,B0)|0,S=S+Math.imul(f,P0)|0,H=H+Math.imul(f,R0)|0,H=H+Math.imul(h,P0)|0,j=j+Math.imul(h,R0)|0,S=S+Math.imul(m,c0)|0,H=H+Math.imul(m,f0)|0,H=H+Math.imul(U0,c0)|0,j=j+Math.imul(U0,f0)|0;var YU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(YU>>>26)|0,YU&=67108863,S=Math.imul(H0,j0),H=Math.imul(H0,N0),H=H+Math.imul(W0,j0)|0,j=Math.imul(W0,N0),S=S+Math.imul(V0,M0)|0,H=H+Math.imul(V0,x)|0,H=H+Math.imul(K0,M0)|0,j=j+Math.imul(K0,x)|0,S=S+Math.imul(L0,a)|0,H=H+Math.imul(L0,E0)|0,H=H+Math.imul($0,a)|0,j=j+Math.imul($0,E0)|0,S=S+Math.imul(s,A0)|0,H=H+Math.imul(s,F0)|0,H=H+Math.imul(X0,A0)|0,j=j+Math.imul(X0,F0)|0,S=S+Math.imul(c,q0)|0,H=H+Math.imul(c,B0)|0,H=H+Math.imul(o,q0)|0,j=j+Math.imul(o,B0)|0,S=S+Math.imul(r,P0)|0,H=H+Math.imul(r,R0)|0,H=H+Math.imul(e,P0)|0,j=j+Math.imul(e,R0)|0,S=S+Math.imul(f,c0)|0,H=H+Math.imul(f,f0)|0,H=H+Math.imul(h,c0)|0,j=j+Math.imul(h,f0)|0;var ZU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,S=Math.imul(H0,M0),H=Math.imul(H0,x),H=H+Math.imul(W0,M0)|0,j=Math.imul(W0,x),S=S+Math.imul(V0,a)|0,H=H+Math.imul(V0,E0)|0,H=H+Math.imul(K0,a)|0,j=j+Math.imul(K0,E0)|0,S=S+Math.imul(L0,A0)|0,H=H+Math.imul(L0,F0)|0,H=H+Math.imul($0,A0)|0,j=j+Math.imul($0,F0)|0,S=S+Math.imul(s,q0)|0,H=H+Math.imul(s,B0)|0,H=H+Math.imul(X0,q0)|0,j=j+Math.imul(X0,B0)|0,S=S+Math.imul(c,P0)|0,H=H+Math.imul(c,R0)|0,H=H+Math.imul(o,P0)|0,j=j+Math.imul(o,R0)|0,S=S+Math.imul(r,c0)|0,H=H+Math.imul(r,f0)|0,H=H+Math.imul(e,c0)|0,j=j+Math.imul(e,f0)|0;var OU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(OU>>>26)|0,OU&=67108863,S=Math.imul(H0,a),H=Math.imul(H0,E0),H=H+Math.imul(W0,a)|0,j=Math.imul(W0,E0),S=S+Math.imul(V0,A0)|0,H=H+Math.imul(V0,F0)|0,H=H+Math.imul(K0,A0)|0,j=j+Math.imul(K0,F0)|0,S=S+Math.imul(L0,q0)|0,H=H+Math.imul(L0,B0)|0,H=H+Math.imul($0,q0)|0,j=j+Math.imul($0,B0)|0,S=S+Math.imul(s,P0)|0,H=H+Math.imul(s,R0)|0,H=H+Math.imul(X0,P0)|0,j=j+Math.imul(X0,R0)|0,S=S+Math.imul(c,c0)|0,H=H+Math.imul(c,f0)|0,H=H+Math.imul(o,c0)|0,j=j+Math.imul(o,f0)|0;var QU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(QU>>>26)|0,QU&=67108863,S=Math.imul(H0,A0),H=Math.imul(H0,F0),H=H+Math.imul(W0,A0)|0,j=Math.imul(W0,F0),S=S+Math.imul(V0,q0)|0,H=H+Math.imul(V0,B0)|0,H=H+Math.imul(K0,q0)|0,j=j+Math.imul(K0,B0)|0,S=S+Math.imul(L0,P0)|0,H=H+Math.imul(L0,R0)|0,H=H+Math.imul($0,P0)|0,j=j+Math.imul($0,R0)|0,S=S+Math.imul(s,c0)|0,H=H+Math.imul(s,f0)|0,H=H+Math.imul(X0,c0)|0,j=j+Math.imul(X0,f0)|0;var JU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(JU>>>26)|0,JU&=67108863,S=Math.imul(H0,q0),H=Math.imul(H0,B0),H=H+Math.imul(W0,q0)|0,j=Math.imul(W0,B0),S=S+Math.imul(V0,P0)|0,H=H+Math.imul(V0,R0)|0,H=H+Math.imul(K0,P0)|0,j=j+Math.imul(K0,R0)|0,S=S+Math.imul(L0,c0)|0,H=H+Math.imul(L0,f0)|0,H=H+Math.imul($0,c0)|0,j=j+Math.imul($0,f0)|0;var rE=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(rE>>>26)|0,rE&=67108863,S=Math.imul(H0,P0),H=Math.imul(H0,R0),H=H+Math.imul(W0,P0)|0,j=Math.imul(W0,R0),S=S+Math.imul(V0,c0)|0,H=H+Math.imul(V0,f0)|0,H=H+Math.imul(K0,c0)|0,j=j+Math.imul(K0,f0)|0;var tE=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(tE>>>26)|0,tE&=67108863,S=Math.imul(H0,c0),H=Math.imul(H0,f0),H=H+Math.imul(W0,c0)|0,j=Math.imul(W0,f0);var aE=(V+S|0)+((H&8191)<<13)|0;if(V=(j+(H>>>13)|0)+(aE>>>26)|0,aE&=67108863,E[0]=d0,E[1]=b0,E[2]=t0,E[3]=a0,E[4]=e0,E[5]=i0,E[6]=UU,E[7]=EU,E[8]=XU,E[9]=IU,E[10]=TU,E[11]=YU,E[12]=ZU,E[13]=OU,E[14]=QU,E[15]=JU,E[16]=rE,E[17]=tE,E[18]=aE,V!==0)E[19]=V,A.length++;return A};if(!Math.imul)B=v;function g(X,Z,A){A.negative=Z.negative^X.negative,A.length=X.length+Z.length;var $=0,J=0;for(var E=0;E>>26)|0,J+=V>>>26,V&=67108863}A.words[E]=S,$=V,V=J}if($!==0)A.words[E]=$;else A.length--;return A._strip()}function y(X,Z,A){return g(X,Z,A)}O.prototype.mulTo=function(X,Z){var A,$=this.length+X.length;if(this.length===10&&X.length===10)A=B(this,X,Z);else if($<63)A=v(this,X,Z);else if($<1024)A=g(this,X,Z);else A=y(this,X,Z);return A};function l(X,Z){this.x=X,this.y=Z}l.prototype.makeRBT=function(X){var Z=Array(X),A=O.prototype._countBits(X)-1;for(var $=0;$>=1;return $},l.prototype.permute=function(X,Z,A,$,J,E){for(var V=0;V>>1)J++;return 1<>>13,A[2*E+1]=J&8191,J=J>>>13;for(E=2*Z;E<$;++E)A[E]=0;L(J===0),L((J&-8192)===0)},l.prototype.stub=function(X){var Z=Array(X);for(var A=0;A>=26,A+=J/67108864|0,A+=E>>>26,this.words[$]=E&67108863}if(A!==0)this.words[$]=A,this.length++;return this.length=X===0?1:this.length,Z?this.ineg():this},O.prototype.muln=function(X){return this.clone().imuln(X)},O.prototype.sqr=function(){return this.mul(this)},O.prototype.isqr=function(){return this.imul(this.clone())},O.prototype.pow=function(X){var Z=N(X);if(Z.length===0)return new O(1);var A=this;for(var $=0;$=0);var Z=X%26,A=(X-Z)/26,$=67108863>>>26-Z<<26-Z,J;if(Z!==0){var E=0;for(J=0;J>>26-Z}if(E)this.words[J]=E,this.length++}if(A!==0){for(J=this.length-1;J>=0;J--)this.words[J+A]=this.words[J];for(J=0;J=0);var $;if(Z)$=(Z-Z%26)/26;else $=0;var J=X%26,E=Math.min((X-J)/26,this.length),V=67108863^67108863>>>J<E){this.length-=E;for(H=0;H=0&&(j!==0||H>=$);H--){var w=this.words[H]|0;this.words[H]=j<<26-J|w>>>J,j=w&V}if(S&&j!==0)S.words[S.length++]=j;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},O.prototype.ishrn=function(X,Z,A){return L(this.negative===0),this.iushrn(X,Z,A)},O.prototype.shln=function(X){return this.clone().ishln(X)},O.prototype.ushln=function(X){return this.clone().iushln(X)},O.prototype.shrn=function(X){return this.clone().ishrn(X)},O.prototype.ushrn=function(X){return this.clone().iushrn(X)},O.prototype.testn=function(X){L(typeof X==="number"&&X>=0);var Z=X%26,A=(X-Z)/26,$=1<=0);var Z=X%26,A=(X-Z)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(Z!==0)A++;if(this.length=Math.min(A,this.length),Z!==0){var $=67108863^67108863>>>Z<=67108864;Z++)if(this.words[Z]-=67108864,Z===this.length-1)this.words[Z+1]=1;else this.words[Z+1]++;return this.length=Math.max(this.length,Z+1),this},O.prototype.isubn=function(X){if(L(typeof X==="number"),L(X<67108864),X<0)return this.iaddn(-X);if(this.negative!==0)return this.negative=0,this.iaddn(X),this.negative=1,this;if(this.words[0]-=X,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Z=0;Z>26)-(S/67108864|0),this.words[J+A]=E&67108863}for(;J>26,this.words[J+A]=E&67108863;if(V===0)return this._strip();L(V===-1),V=0;for(J=0;J>26,this.words[J]=E&67108863;return this.negative=1,this._strip()},O.prototype._wordDiv=function(X,Z){var A=this.length-X.length,$=this.clone(),J=X,E=J.words[J.length-1]|0,V=this._countBits(E);if(A=26-V,A!==0)J=J.ushln(A),$.iushln(A),E=J.words[J.length-1]|0;var S=$.length-J.length,H;if(Z!=="mod"){H=new O(null),H.length=S+1,H.words=Array(H.length);for(var j=0;j=0;p--){var n=($.words[J.length+p]|0)*67108864+($.words[J.length+p-1]|0);n=Math.min(n/E|0,67108863),$._ishlnsubmul(J,n,p);while($.negative!==0)if(n--,$.negative=0,$._ishlnsubmul(J,1,p),!$.isZero())$.negative^=1;if(H)H.words[p]=n}if(H)H._strip();if($._strip(),Z!=="div"&&A!==0)$.iushrn(A);return{div:H||null,mod:$}},O.prototype.divmod=function(X,Z,A){if(L(!X.isZero()),this.isZero())return{div:new O(0),mod:new O(0)};var $,J,E;if(this.negative!==0&&X.negative===0){if(E=this.neg().divmod(X,Z),Z!=="mod")$=E.div.neg();if(Z!=="div"){if(J=E.mod.neg(),A&&J.negative!==0)J.iadd(X)}return{div:$,mod:J}}if(this.negative===0&&X.negative!==0){if(E=this.divmod(X.neg(),Z),Z!=="mod")$=E.div.neg();return{div:$,mod:E.mod}}if((this.negative&X.negative)!==0){if(E=this.neg().divmod(X.neg(),Z),Z!=="div"){if(J=E.mod.neg(),A&&J.negative!==0)J.isub(X)}return{div:E.div,mod:J}}if(X.length>this.length||this.cmp(X)<0)return{div:new O(0),mod:this};if(X.length===1){if(Z==="div")return{div:this.divn(X.words[0]),mod:null};if(Z==="mod")return{div:null,mod:new O(this.modrn(X.words[0]))};return{div:this.divn(X.words[0]),mod:new O(this.modrn(X.words[0]))}}return this._wordDiv(X,Z)},O.prototype.div=function(X){return this.divmod(X,"div",!1).div},O.prototype.mod=function(X){return this.divmod(X,"mod",!1).mod},O.prototype.umod=function(X){return this.divmod(X,"mod",!0).mod},O.prototype.divRound=function(X){var Z=this.divmod(X);if(Z.mod.isZero())return Z.div;var A=Z.div.negative!==0?Z.mod.isub(X):Z.mod,$=X.ushrn(1),J=X.andln(1),E=A.cmp($);if(E<0||J===1&&E===0)return Z.div;return Z.div.negative!==0?Z.div.isubn(1):Z.div.iaddn(1)},O.prototype.modrn=function(X){var Z=X<0;if(Z)X=-X;L(X<=67108863);var A=67108864%X,$=0;for(var J=this.length-1;J>=0;J--)$=(A*$+(this.words[J]|0))%X;return Z?-$:$},O.prototype.modn=function(X){return this.modrn(X)},O.prototype.idivn=function(X){var Z=X<0;if(Z)X=-X;L(X<=67108863);var A=0;for(var $=this.length-1;$>=0;$--){var J=(this.words[$]|0)+A*67108864;this.words[$]=J/X|0,A=J%X}return this._strip(),Z?this.ineg():this},O.prototype.divn=function(X){return this.clone().idivn(X)},O.prototype.egcd=function(X){L(X.negative===0),L(!X.isZero());var Z=this,A=X.clone();if(Z.negative!==0)Z=Z.umod(X);else Z=Z.clone();var $=new O(1),J=new O(0),E=new O(0),V=new O(1),S=0;while(Z.isEven()&&A.isEven())Z.iushrn(1),A.iushrn(1),++S;var H=A.clone(),j=Z.clone();while(!Z.isZero()){for(var w=0,p=1;(Z.words[0]&p)===0&&w<26;++w,p<<=1);if(w>0){Z.iushrn(w);while(w-- >0){if($.isOdd()||J.isOdd())$.iadd(H),J.isub(j);$.iushrn(1),J.iushrn(1)}}for(var n=0,G0=1;(A.words[0]&G0)===0&&n<26;++n,G0<<=1);if(n>0){A.iushrn(n);while(n-- >0){if(E.isOdd()||V.isOdd())E.iadd(H),V.isub(j);E.iushrn(1),V.iushrn(1)}}if(Z.cmp(A)>=0)Z.isub(A),$.isub(E),J.isub(V);else A.isub(Z),E.isub($),V.isub(J)}return{a:E,b:V,gcd:A.iushln(S)}},O.prototype._invmp=function(X){L(X.negative===0),L(!X.isZero());var Z=this,A=X.clone();if(Z.negative!==0)Z=Z.umod(X);else Z=Z.clone();var $=new O(1),J=new O(0),E=A.clone();while(Z.cmpn(1)>0&&A.cmpn(1)>0){for(var V=0,S=1;(Z.words[0]&S)===0&&V<26;++V,S<<=1);if(V>0){Z.iushrn(V);while(V-- >0){if($.isOdd())$.iadd(E);$.iushrn(1)}}for(var H=0,j=1;(A.words[0]&j)===0&&H<26;++H,j<<=1);if(H>0){A.iushrn(H);while(H-- >0){if(J.isOdd())J.iadd(E);J.iushrn(1)}}if(Z.cmp(A)>=0)Z.isub(A),$.isub(J);else A.isub(Z),J.isub($)}var w;if(Z.cmpn(1)===0)w=$;else w=J;if(w.cmpn(0)<0)w.iadd(X);return w},O.prototype.gcd=function(X){if(this.isZero())return X.abs();if(X.isZero())return this.abs();var Z=this.clone(),A=X.clone();Z.negative=0,A.negative=0;for(var $=0;Z.isEven()&&A.isEven();$++)Z.iushrn(1),A.iushrn(1);do{while(Z.isEven())Z.iushrn(1);while(A.isEven())A.iushrn(1);var J=Z.cmp(A);if(J<0){var E=Z;Z=A,A=E}else if(J===0||A.cmpn(1)===0)break;Z.isub(A)}while(!0);return A.iushln($)},O.prototype.invm=function(X){return this.egcd(X).a.umod(X)},O.prototype.isEven=function(){return(this.words[0]&1)===0},O.prototype.isOdd=function(){return(this.words[0]&1)===1},O.prototype.andln=function(X){return this.words[0]&X},O.prototype.bincn=function(X){L(typeof X==="number");var Z=X%26,A=(X-Z)/26,$=1<>>26,V&=67108863,this.words[E]=V}if(J!==0)this.words[E]=J,this.length++;return this},O.prototype.isZero=function(){return this.length===1&&this.words[0]===0},O.prototype.cmpn=function(X){var Z=X<0;if(this.negative!==0&&!Z)return-1;if(this.negative===0&&Z)return 1;this._strip();var A;if(this.length>1)A=1;else{if(Z)X=-X;L(X<=67108863,"Number is too big");var $=this.words[0]|0;A=$===X?0:$X.length)return 1;if(this.length=0;A--){var $=this.words[A]|0,J=X.words[A]|0;if($===J)continue;if($J)Z=1;break}return Z},O.prototype.gtn=function(X){return this.cmpn(X)===1},O.prototype.gt=function(X){return this.cmp(X)===1},O.prototype.gten=function(X){return this.cmpn(X)>=0},O.prototype.gte=function(X){return this.cmp(X)>=0},O.prototype.ltn=function(X){return this.cmpn(X)===-1},O.prototype.lt=function(X){return this.cmp(X)===-1},O.prototype.lten=function(X){return this.cmpn(X)<=0},O.prototype.lte=function(X){return this.cmp(X)<=0},O.prototype.eqn=function(X){return this.cmpn(X)===0},O.prototype.eq=function(X){return this.cmp(X)===0},O.red=function(X){return new I(X)},O.prototype.toRed=function(X){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),X.convertTo(this)._forceRed(X)},O.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},O.prototype._forceRed=function(X){return this.red=X,this},O.prototype.forceRed=function(X){return L(!this.red,"Already a number in reduction context"),this._forceRed(X)},O.prototype.redAdd=function(X){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,X)},O.prototype.redIAdd=function(X){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,X)},O.prototype.redSub=function(X){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,X)},O.prototype.redISub=function(X){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,X)},O.prototype.redShl=function(X){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,X)},O.prototype.redMul=function(X){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,X),this.red.mul(this,X)},O.prototype.redIMul=function(X){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,X),this.red.imul(this,X)},O.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},O.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},O.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},O.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},O.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},O.prototype.redPow=function(X){return L(this.red&&!X.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,X)};var Y0={k256:null,p224:null,p192:null,p25519:null};function O0(X,Z){this.name=X,this.p=new O(Z,16),this.n=this.p.bitLength(),this.k=new O(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O0.prototype._tmp=function(){var X=new O(null);return X.words=Array(Math.ceil(this.n/13)),X},O0.prototype.ireduce=function(X){var Z=X,A;do this.split(Z,this.tmp),Z=this.imulK(Z),Z=Z.iadd(this.tmp),A=Z.bitLength();while(A>this.n);var $=A0)Z.isub(this.p);else if(Z.strip!==void 0)Z.strip();else Z._strip();return Z},O0.prototype.split=function(X,Z){X.iushrn(this.n,0,Z)},O0.prototype.imulK=function(X){return X.imul(this.k)};function Z0(){O0.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(Z0,O0),Z0.prototype.split=function(X,Z){var A=4194303,$=Math.min(X.length,9);for(var J=0;J<$;J++)Z.words[J]=X.words[J];if(Z.length=$,X.length<=9){X.words[0]=0,X.length=1;return}var E=X.words[9];Z.words[Z.length++]=E&A;for(J=10;J>>22,E=V}if(E>>>=22,X.words[J-10]=E,E===0&&X.length>10)X.length-=10;else X.length-=9},Z0.prototype.imulK=function(X){X.words[X.length]=0,X.words[X.length+1]=0,X.length+=2;var Z=0;for(var A=0;A>>=26,X.words[A]=J,Z=$}if(Z!==0)X.words[X.length++]=Z;return X},O._prime=function(X){if(Y0[X])return Y0[X];var Z;if(X==="k256")Z=new Z0;else if(X==="p224")Z=new u;else if(X==="p192")Z=new i;else if(X==="p25519")Z=new U;else throw Error("Unknown prime "+X);return Y0[X]=Z,Z};function I(X){if(typeof X==="string"){var Z=O._prime(X);this.m=Z.p,this.prime=Z}else L(X.gtn(1),"modulus must be greater than 1"),this.m=X,this.prime=null}I.prototype._verify1=function(X){L(X.negative===0,"red works only with positives"),L(X.red,"red works only with red numbers")},I.prototype._verify2=function(X,Z){L((X.negative|Z.negative)===0,"red works only with positives"),L(X.red&&X.red===Z.red,"red works only with red numbers")},I.prototype.imod=function(X){if(this.prime)return this.prime.ireduce(X)._forceRed(this);return F(X,X.umod(this.m)._forceRed(this)),X},I.prototype.neg=function(X){if(X.isZero())return X.clone();return this.m.sub(X)._forceRed(this)},I.prototype.add=function(X,Z){this._verify2(X,Z);var A=X.add(Z);if(A.cmp(this.m)>=0)A.isub(this.m);return A._forceRed(this)},I.prototype.iadd=function(X,Z){this._verify2(X,Z);var A=X.iadd(Z);if(A.cmp(this.m)>=0)A.isub(this.m);return A},I.prototype.sub=function(X,Z){this._verify2(X,Z);var A=X.sub(Z);if(A.cmpn(0)<0)A.iadd(this.m);return A._forceRed(this)},I.prototype.isub=function(X,Z){this._verify2(X,Z);var A=X.isub(Z);if(A.cmpn(0)<0)A.iadd(this.m);return A},I.prototype.shl=function(X,Z){return this._verify1(X),this.imod(X.ushln(Z))},I.prototype.imul=function(X,Z){return this._verify2(X,Z),this.imod(X.imul(Z))},I.prototype.mul=function(X,Z){return this._verify2(X,Z),this.imod(X.mul(Z))},I.prototype.isqr=function(X){return this.imul(X,X.clone())},I.prototype.sqr=function(X){return this.mul(X,X)},I.prototype.sqrt=function(X){if(X.isZero())return X.clone();var Z=this.m.andln(3);if(L(Z%2===1),Z===3){var A=this.m.add(new O(1)).iushrn(2);return this.pow(X,A)}var $=this.m.subn(1),J=0;while(!$.isZero()&&$.andln(1)===0)J++,$.iushrn(1);L(!$.isZero());var E=new O(1).toRed(this),V=E.redNeg(),S=this.m.subn(1).iushrn(1),H=this.m.bitLength();H=new O(2*H*H).toRed(this);while(this.pow(H,S).cmp(V)!==0)H.redIAdd(V);var j=this.pow(H,$),w=this.pow(X,$.addn(1).iushrn(1)),p=this.pow(X,$),n=J;while(p.cmp(E)!==0){var G0=p;for(var t=0;G0.cmp(E)!==0;t++)G0=G0.redSqr();L(t=0;J--){var j=Z.words[J];for(var w=H-1;w>=0;w--){var p=j>>w&1;if(E!==$[0])E=this.sqr(E);if(p===0&&V===0){S=0;continue}if(V<<=1,V|=p,S++,S!==A&&(J!==0||w!==0))continue;E=this.mul(E,$[V]),S=0,V=0}H=26}return E},I.prototype.convertTo=function(X){var Z=X.umod(this.m);return Z===X?Z.clone():Z},I.prototype.convertFrom=function(X){var Z=X.clone();return Z.red=null,Z},O.mont=function(X){return new Q(X)};function Q(X){if(I.call(this,X),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new O(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(Q,I),Q.prototype.convertTo=function(X){return this.imod(X.ushln(this.shift))},Q.prototype.convertFrom=function(X){var Z=this.imod(X.mul(this.rinv));return Z.red=null,Z},Q.prototype.imul=function(X,Z){if(X.isZero()||Z.isZero())return X.words[0]=0,X.length=1,X;var A=X.imul(Z),$=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=A.isub($).iushrn(this.shift),E=J;if(J.cmp(this.m)>=0)E=J.isub(this.m);else if(J.cmpn(0)<0)E=J.iadd(this.m);return E._forceRed(this)},Q.prototype.mul=function(X,Z){if(X.isZero()||Z.isZero())return new O(0)._forceRed(this);var A=X.mul(Z),$=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=A.isub($).iushrn(this.shift),E=J;if(J.cmp(this.m)>=0)E=J.isub(this.m);else if(J.cmpn(0)<0)E=J.iadd(this.m);return E._forceRed(this)},Q.prototype.invm=function(X){var Z=this.imod(X._invmp(this.m).mul(this.r2));return Z._forceRed(this)}})(typeof Y>"u"||Y,T)}),NT=Q0((T,Y)=>{var G=NQ(),K=cE(),L=SU().Buffer;function W(q){var D=q.modulus.byteLength(),C;do C=new G(K(D));while(C.cmp(q.modulus)>=0||!C.umod(q.prime1)||!C.umod(q.prime2));return C}function O(q){var D=W(q),C=D.toRed(G.mont(q.modulus)).redPow(new G(q.publicExponent)).fromRed();return{blinder:C,unblinder:D.invm(q.modulus)}}function z(q,D){var C=O(D),F=D.modulus.byteLength(),R=new G(q).mul(C.blinder).umod(D.modulus),M=R.toRed(G.mont(D.prime1)),P=R.toRed(G.mont(D.prime2)),k=D.coefficient,_=D.prime1,N=D.prime2,v=M.redPow(D.exponent1).fromRed(),B=P.redPow(D.exponent2).fromRed(),g=v.isub(B).imul(k).umod(_).imul(N);return B.iadd(g).imul(C.unblinder).umod(D.modulus).toArrayLike(L,"be",F)}z.getr=W,Y.exports=z}),BQ=Q0((T,Y)=>{var G=_T(),K=cE(),L=pE(),W=kT(),O=vT(),z=gX(),q=jT(),D=NT(),C=SU().Buffer;Y.exports=function(P,k,_){var N;if(P.padding)N=P.padding;else if(_)N=1;else N=4;var v=G(P),B;if(N===4)B=F(v,k);else if(N===1)B=R(v,k,_);else if(N===3){if(B=new z(k),B.cmp(v.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");if(_)return D(B,v);else return q(B,v)};function F(P,k){var _=P.modulus.byteLength(),N=k.length,v=L("sha1").update(C.alloc(0)).digest(),B=v.length,g=2*B;if(N>_-g-2)throw Error("message too long");var y=C.alloc(_-N-g-2),l=_-B-1,Y0=K(B),O0=O(C.concat([v,y,C.alloc(1,1),k],l),W(Y0,l)),Z0=O(Y0,W(O0,B));return new z(C.concat([C.alloc(1),Z0,O0],_))}function R(P,k,_){var N=k.length,v=P.modulus.byteLength();if(N>v-11)throw Error("message too long");var B;if(_)B=C.alloc(v-N-3,255);else B=M(v-N-3);return new z(C.concat([C.from([0,_?1:2]),B,C.alloc(1),k],v))}function M(P){var k=C.allocUnsafe(P),_=0,N=K(P*2),v=0,B;while(_{var G=_T(),K=kT(),L=vT(),W=gX(),O=NT(),z=pE(),q=jT(),D=SU().Buffer;Y.exports=function(M,P,k){var _;if(M.padding)_=M.padding;else if(k)_=1;else _=4;var N=G(M),v=N.modulus.byteLength();if(P.length>v||new W(P).cmp(N.modulus)>=0)throw Error("decryption error");var B;if(k)B=q(new W(P),N);else B=O(P,N);var g=D.alloc(v-B.length);if(B=D.concat([g,B],v),_===4)return C(N,B);else if(_===1)return F(N,B,k);else if(_===3)return B;else throw Error("unknown padding")};function C(M,P){var k=M.modulus.byteLength(),_=z("sha1").update(D.alloc(0)).digest(),N=_.length;if(P[0]!==0)throw Error("decryption error");var v=P.slice(1,N+1),B=P.slice(N+1),g=L(v,K(B,N)),y=L(B,K(g,k-N-1));if(R(_,y.slice(0,N)))throw Error("decryption error");var l=N;while(y[l]===0)l++;if(y[l++]!==1)throw Error("decryption error");return y.slice(l)}function F(M,P,k){var _=P.slice(0,2),N=2,v=0;while(P[N++]!==0)if(N>=P.length){v++;break}var B=P.slice(2,N-1);if(_.toString("hex")!=="0002"&&!k||_.toString("hex")!=="0001"&&k)v++;if(B.length<8)v++;if(v)throw Error("decryption error");return P.slice(N)}function R(M,P){M=D.from(M),P=D.from(P);var k=0,_=M.length;if(M.length!==P.length)k++,_=Math.min(M.length,P.length);var N=-1;while(++N<_)k+=M[N]^P[N];return k}}),qX=Q0((T)=>{T.publicEncrypt=BQ(),T.privateDecrypt=xQ(),T.privateEncrypt=function(Y,G){return T.publicEncrypt(Y,G,!0)},T.publicDecrypt=function(Y,G){return T.privateDecrypt(Y,G,!0)}}),gQ=Q0((T)=>{var Y=(DU(),h0(PU));if(typeof Y.publicEncrypt!=="function")Y=qX();if(T.publicEncrypt=Y.publicEncrypt,T.privateDecrypt=Y.privateDecrypt,typeof Y.privateEncrypt!=="function")T.privateEncrypt=qX().privateEncrypt;else T.privateEncrypt=Y.privateEncrypt;if(typeof Y.publicDecrypt!=="function")T.publicDecrypt=qX().publicDecrypt;else T.publicDecrypt=Y.publicDecrypt}),wQ=Q0((T)=>{var Y=SU(),G=cE(),K=Y.Buffer,L=Y.kMaxLength,W=globalThis.crypto||globalThis.msCrypto,O=Math.pow(2,32)-1;function z(R,M){if(typeof R!=="number"||R!==R)throw TypeError("offset must be a number");if(R>O||R<0)throw TypeError("offset must be a uint32");if(R>L||R>M)throw RangeError("offset out of range")}function q(R,M,P){if(typeof R!=="number"||R!==R)throw TypeError("size must be a number");if(R>O||R<0)throw TypeError("size must be a uint32");if(R+M>P||R>L)throw RangeError("buffer too small")}W&&W.getRandomValues,T.randomFill=D,T.randomFillSync=F;function D(R,M,P,k){if(!K.isBuffer(R)&&!(R instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof M==="function")k=M,M=0,P=R.length;else if(typeof P==="function")k=P,P=R.length-M;else if(typeof k!=="function")throw TypeError('"cb" argument must be a function');return z(M,R.length),q(P,M,R.length),C(R,M,P,k)}function C(R,M,P,k){if(!1)var _,N;if(k){G(P,function(B,g){if(B)return k(B);g.copy(R,M),k(null,R)});return}var v=G(P);return v.copy(R,M),R}function F(R,M,P){if(typeof M>"u")M=0;if(!K.isBuffer(R)&&!(R instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(z(M,R.length),P===void 0)P=R.length-M;return q(P,M,R.length),C(R,M,P)}}),yQ=Q0((T,Y)=>{var G=(DU(),h0(PU));if(typeof G.randomFill==="function"&&typeof G.randomFillSync==="function")T.randomFill=G.randomFill,T.randomFillSync=G.randomFillSync;else Y.exports=wQ()}),fQ=Q0((T)=>{T.randomBytes=T.rng=T.pseudoRandomBytes=T.prng=cE(),T.createHash=T.Hash=pE(),T.createHmac=T.Hmac=YT();var Y=OO(),G=Object.keys(Y),K=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(G);T.getHashes=function(){return K};var L=FT();T.pbkdf2=L.pbkdf2,T.pbkdf2Sync=L.pbkdf2Sync;var W=dO();T.Cipher=W.Cipher,T.createCipher=W.createCipher,T.Cipheriv=W.Cipheriv,T.createCipheriv=W.createCipheriv,T.Decipher=W.Decipher,T.createDecipher=W.createDecipher,T.Decipheriv=W.Decipheriv,T.createDecipheriv=W.createDecipheriv,T.getCiphers=W.getCiphers,T.listCiphers=W.listCiphers;var O=lO();T.DiffieHellmanGroup=O.DiffieHellmanGroup,T.createDiffieHellmanGroup=O.createDiffieHellmanGroup,T.getDiffieHellman=O.getDiffieHellman,T.createDiffieHellman=O.createDiffieHellman,T.DiffieHellman=O.DiffieHellman;var z=oO();T.createSign=z.createSign,T.Sign=z.Sign,T.createVerify=z.createVerify,T.Verify=z.Verify,T.createECDH=$Q();var q=gQ();T.publicEncrypt=q.publicEncrypt,T.privateEncrypt=q.privateEncrypt,T.publicDecrypt=q.publicDecrypt,T.privateDecrypt=q.privateDecrypt;var D=yQ();T.randomFill=D.randomFill,T.randomFillSync=D.randomFillSync,T.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet +})`)}catch(z){Z=function(q){this._initNamed(q)}}return G(Z,W),Z.prototype._initNamed=function(z){W.call(this,z)},new Z(this)},L.prototype._getDecoder=function(W){if(W=W||"der",!this.decoders.hasOwnProperty(W))this.decoders[W]=this._createNamed(Y.decoders[W]);return this.decoders[W]},L.prototype.decode=function(W,Z,z){return this._getDecoder(Z).decode(W,z)},L.prototype._getEncoder=function(W){if(W=W||"der",!this.encoders.hasOwnProperty(W))this.encoders[W]=this._createNamed(Y.encoders[W]);return this.encoders[W]},L.prototype.encode=function(W,Z,z){return this._getEncoder(Z).encode(W,z)}}),WQ=Q0((I)=>{var Y=_U();function G(L){this._reporterState={obj:null,path:[],options:L||{},errors:[]}}I.Reporter=G,G.prototype.isError=function(L){return L instanceof K},G.prototype.save=function(){var L=this._reporterState;return{obj:L.obj,pathLen:L.path.length}},G.prototype.restore=function(L){var W=this._reporterState;W.obj=L.obj,W.path=W.path.slice(0,L.pathLen)},G.prototype.enterKey=function(L){return this._reporterState.path.push(L)},G.prototype.exitKey=function(L){var W=this._reporterState;W.path=W.path.slice(0,L-1)},G.prototype.leaveKey=function(L,W,Z){var z=this._reporterState;if(this.exitKey(L),z.obj!==null)z.obj[W]=Z},G.prototype.path=function(){return this._reporterState.path.join("/")},G.prototype.enterObject=function(){var L=this._reporterState,W=L.obj;return L.obj={},W},G.prototype.leaveObject=function(L){var W=this._reporterState,Z=W.obj;return W.obj=L,Z},G.prototype.error=function(L){var W,Z=this._reporterState,z=L instanceof K;if(z)W=L;else W=new K(Z.path.map(function(q){return"["+JSON.stringify(q)+"]"}).join(""),L.message||L,L.stack);if(!Z.options.partial)throw W;if(!z)Z.errors.push(W);return W},G.prototype.wrapResult=function(L){var W=this._reporterState;if(!W.options.partial)return L;return{result:this.isError(L)?null:L,errors:W.errors}};function K(L,W){this.path=L,this.rethrow(W)}Y(K,Error),K.prototype.rethrow=function(L){if(this.message=L+" at: "+(this.path||"(shallow)"),Error.captureStackTrace)Error.captureStackTrace(this,K);if(!this.stack)try{throw Error(this.message)}catch(W){this.stack=W.stack}return this}}),YI=Q0((I)=>{var Y=_U(),G=$E().Reporter,K=(FU(),h0(KU)).Buffer;function L(Z,z){if(G.call(this,z),!K.isBuffer(Z)){this.error("Input not Buffer");return}this.base=Z,this.offset=0,this.length=Z.length}Y(L,G),I.DecoderBuffer=L,L.prototype.save=function(){return{offset:this.offset,reporter:G.prototype.save.call(this)}},L.prototype.restore=function(Z){var z=new L(this.base);return z.offset=Z.offset,z.length=this.offset,this.offset=Z.offset,G.prototype.restore.call(this,Z.reporter),z},L.prototype.isEmpty=function(){return this.offset===this.length},L.prototype.readUInt8=function(Z){if(this.offset+1<=this.length)return this.base.readUInt8(this.offset++,!0);else return this.error(Z||"DecoderBuffer overrun")},L.prototype.skip=function(Z,z){if(!(this.offset+Z<=this.length))return this.error(z||"DecoderBuffer overrun");var q=new L(this.base);return q._reporterState=this._reporterState,q.offset=this.offset,q.length=this.offset+Z,this.offset+=Z,q},L.prototype.raw=function(Z){return this.base.slice(Z?Z.offset:this.offset,this.length)};function W(Z,z){if(Array.isArray(Z))this.length=0,this.value=Z.map(function(q){if(!(q instanceof W))q=new W(q,z);return this.length+=q.length,q},this);else if(typeof Z==="number"){if(!(0<=Z&&Z<=255))return z.error("non-byte EncoderBuffer value");this.value=Z,this.length=1}else if(typeof Z==="string")this.value=Z,this.length=K.byteLength(Z);else if(K.isBuffer(Z))this.value=Z,this.length=Z.length;else return z.error("Unsupported type: "+typeof Z)}I.EncoderBuffer=W,W.prototype.join=function(Z,z){if(!Z)Z=new K(this.length);if(!z)z=0;if(this.length===0)return Z;if(Array.isArray(this.value))this.value.forEach(function(q){q.join(Z,z),z+=q.length});else{if(typeof this.value==="number")Z[z]=this.value;else if(typeof this.value==="string")Z.write(this.value,z);else if(K.isBuffer(this.value))this.value.copy(Z,z);z+=this.length}return Z}}),HQ=Q0((I,Y)=>{var G=$E().Reporter,K=$E().EncoderBuffer,L=$E().DecoderBuffer,W=dU(),Z=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],z=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(Z),q=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function C(F,R){var M={};if(this._baseState=M,M.enc=F,M.parent=R||null,M.children=null,M.tag=null,M.args=null,M.reverseArgs=null,M.choice=null,M.optional=!1,M.any=!1,M.obj=!1,M.use=null,M.useDecoder=null,M.key=null,M.default=null,M.explicit=null,M.implicit=null,M.contains=null,!M.parent)M.children=[],this._wrap()}Y.exports=C;var D=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];C.prototype.clone=function(){var F=this._baseState,R={};D.forEach(function(P){R[P]=F[P]});var M=new this.constructor(R.parent);return M._baseState=R,M},C.prototype._wrap=function(){var F=this._baseState;z.forEach(function(R){this[R]=function(){var M=new this.constructor(this);return F.children.push(M),M[R].apply(M,arguments)}},this)},C.prototype._init=function(F){var R=this._baseState;W(R.parent===null),F.call(this),R.children=R.children.filter(function(M){return M._baseState.parent===this},this),W.equal(R.children.length,1,"Root node can have only one child")},C.prototype._useArgs=function(F){var R=this._baseState,M=F.filter(function(P){return P instanceof this.constructor},this);if(F=F.filter(function(P){return!(P instanceof this.constructor)},this),M.length!==0)W(R.children===null),R.children=M,M.forEach(function(P){P._baseState.parent=this},this);if(F.length!==0)W(R.args===null),R.args=F,R.reverseArgs=F.map(function(P){if(typeof P!=="object"||P.constructor!==Object)return P;var k={};return Object.keys(P).forEach(function(_){if(_==(_|0))_|=0;var N=P[_];k[N]=_}),k})},q.forEach(function(F){C.prototype[F]=function(){var R=this._baseState;throw Error(F+" not implemented for encoding: "+R.enc)}}),Z.forEach(function(F){C.prototype[F]=function(){var R=this._baseState,M=Array.prototype.slice.call(arguments);return W(R.tag===null),R.tag=F,this._useArgs(M),this}}),C.prototype.use=function(F){W(F);var R=this._baseState;return W(R.use===null),R.use=F,this},C.prototype.optional=function(){var F=this._baseState;return F.optional=!0,this},C.prototype.def=function(F){var R=this._baseState;return W(R.default===null),R.default=F,R.optional=!0,this},C.prototype.explicit=function(F){var R=this._baseState;return W(R.explicit===null&&R.implicit===null),R.explicit=F,this},C.prototype.implicit=function(F){var R=this._baseState;return W(R.explicit===null&&R.implicit===null),R.implicit=F,this},C.prototype.obj=function(){var F=this._baseState,R=Array.prototype.slice.call(arguments);if(F.obj=!0,R.length!==0)this._useArgs(R);return this},C.prototype.key=function(F){var R=this._baseState;return W(R.key===null),R.key=F,this},C.prototype.any=function(){var F=this._baseState;return F.any=!0,this},C.prototype.choice=function(F){var R=this._baseState;return W(R.choice===null),R.choice=F,this._useArgs(Object.keys(F).map(function(M){return F[M]})),this},C.prototype.contains=function(F){var R=this._baseState;return W(R.use===null),R.contains=F,this},C.prototype._decode=function(F,R){var M=this._baseState;if(M.parent===null)return F.wrapResult(M.children[0]._decode(F,R));var P=M.default,k=!0,_=null;if(M.key!==null)_=F.enterKey(M.key);if(M.optional){var N=null;if(M.explicit!==null)N=M.explicit;else if(M.implicit!==null)N=M.implicit;else if(M.tag!==null)N=M.tag;if(N===null&&!M.any){var v=F.save();try{if(M.choice===null)this._decodeGeneric(M.tag,F,R);else this._decodeChoice(F,R);k=!0}catch(Z0){k=!1}F.restore(v)}else if(k=this._peekTag(F,N,M.any),F.isError(k))return k}var B;if(M.obj&&k)B=F.enterObject();if(k){if(M.explicit!==null){var g=this._decodeTag(F,M.explicit);if(F.isError(g))return g;F=g}var y=F.offset;if(M.use===null&&M.choice===null){if(M.any)var v=F.save();var l=this._decodeTag(F,M.implicit!==null?M.implicit:M.tag,M.any);if(F.isError(l))return l;if(M.any)P=F.raw(v);else F=l}if(R&&R.track&&M.tag!==null)R.track(F.path(),y,F.length,"tagged");if(R&&R.track&&M.tag!==null)R.track(F.path(),F.offset,F.length,"content");if(M.any)P=P;else if(M.choice===null)P=this._decodeGeneric(M.tag,F,R);else P=this._decodeChoice(F,R);if(F.isError(P))return P;if(!M.any&&M.choice===null&&M.children!==null)M.children.forEach(function(Z0){Z0._decode(F,R)});if(M.contains&&(M.tag==="octstr"||M.tag==="bitstr")){var Y0=new L(P);P=this._getUse(M.contains,F._reporterState.obj)._decode(Y0,R)}}if(M.obj&&k)P=F.leaveObject(B);if(M.key!==null&&(P!==null||k===!0))F.leaveKey(_,M.key,P);else if(_!==null)F.exitKey(_);return P},C.prototype._decodeGeneric=function(F,R,M){var P=this._baseState;if(F==="seq"||F==="set")return null;if(F==="seqof"||F==="setof")return this._decodeList(R,F,P.args[0],M);else if(/str$/.test(F))return this._decodeStr(R,F,M);else if(F==="objid"&&P.args)return this._decodeObjid(R,P.args[0],P.args[1],M);else if(F==="objid")return this._decodeObjid(R,null,null,M);else if(F==="gentime"||F==="utctime")return this._decodeTime(R,F,M);else if(F==="null_")return this._decodeNull(R,M);else if(F==="bool")return this._decodeBool(R,M);else if(F==="objDesc")return this._decodeStr(R,F,M);else if(F==="int"||F==="enum")return this._decodeInt(R,P.args&&P.args[0],M);if(P.use!==null)return this._getUse(P.use,R._reporterState.obj)._decode(R,M);else return R.error("unknown tag: "+F)},C.prototype._getUse=function(F,R){var M=this._baseState;if(M.useDecoder=this._use(F,R),W(M.useDecoder._baseState.parent===null),M.useDecoder=M.useDecoder._baseState.children[0],M.implicit!==M.useDecoder._baseState.implicit)M.useDecoder=M.useDecoder.clone(),M.useDecoder._baseState.implicit=M.implicit;return M.useDecoder},C.prototype._decodeChoice=function(F,R){var M=this._baseState,P=null,k=!1;if(Object.keys(M.choice).some(function(_){var N=F.save(),v=M.choice[_];try{var B=v._decode(F,R);if(F.isError(B))return!1;P={type:_,value:B},k=!0}catch(g){return F.restore(N),!1}return!0},this),!k)return F.error("Choice not matched");return P},C.prototype._createEncoderBuffer=function(F){return new K(F,this.reporter)},C.prototype._encode=function(F,R,M){var P=this._baseState;if(P.default!==null&&P.default===F)return;var k=this._encodeValue(F,R,M);if(k===void 0)return;if(this._skipDefault(k,R,M))return;return k},C.prototype._encodeValue=function(F,R,M){var P=this._baseState;if(P.parent===null)return P.children[0]._encode(F,R||new G);var v=null;if(this.reporter=R,P.optional&&F===void 0)if(P.default!==null)F=P.default;else return;var k=null,_=!1;if(P.any)v=this._createEncoderBuffer(F);else if(P.choice)v=this._encodeChoice(F,R);else if(P.contains)k=this._getUse(P.contains,M)._encode(F,R),_=!0;else if(P.children)k=P.children.map(function(y){if(y._baseState.tag==="null_")return y._encode(null,R,F);if(y._baseState.key===null)return R.error("Child should have a key");var l=R.enterKey(y._baseState.key);if(typeof F!=="object")return R.error("Child expected, but input is not object");var Y0=y._encode(F[y._baseState.key],R,F);return R.leaveKey(l),Y0},this).filter(function(y){return y}),k=this._createEncoderBuffer(k);else if(P.tag==="seqof"||P.tag==="setof"){if(!(P.args&&P.args.length===1))return R.error("Too many args for : "+P.tag);if(!Array.isArray(F))return R.error("seqof/setof, but data is not Array");var N=this.clone();N._baseState.implicit=null,k=this._createEncoderBuffer(F.map(function(y){var l=this._baseState;return this._getUse(l.args[0],F)._encode(y,R)},N))}else if(P.use!==null)v=this._getUse(P.use,M)._encode(F,R);else k=this._encodePrimitive(P.tag,F),_=!0;var v;if(!P.any&&P.choice===null){var B=P.implicit!==null?P.implicit:P.tag,g=P.implicit===null?"universal":"context";if(B===null){if(P.use===null)R.error("Tag could be omitted only for .use()")}else if(P.use===null)v=this._encodeComposite(B,_,g,k)}if(P.explicit!==null)v=this._encodeComposite(P.explicit,!1,"context",v);return v},C.prototype._encodeChoice=function(F,R){var M=this._baseState,P=M.choice[F.type];if(!P)W(!1,F.type+" not found in "+JSON.stringify(Object.keys(M.choice)));return P._encode(F.value,R)},C.prototype._encodePrimitive=function(F,R){var M=this._baseState;if(/str$/.test(F))return this._encodeStr(R,F);else if(F==="objid"&&M.args)return this._encodeObjid(R,M.reverseArgs[0],M.args[1]);else if(F==="objid")return this._encodeObjid(R,null,null);else if(F==="gentime"||F==="utctime")return this._encodeTime(R,F);else if(F==="null_")return this._encodeNull();else if(F==="int"||F==="enum")return this._encodeInt(R,M.args&&M.reverseArgs[0]);else if(F==="bool")return this._encodeBool(R);else if(F==="objDesc")return this._encodeStr(R,F);else throw Error("Unsupported tag: "+F)},C.prototype._isNumstr=function(F){return/^[0-9 ]*$/.test(F)},C.prototype._isPrintstr=function(F){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(F)}}),$E=Q0((I)=>{var Y=I;Y.Reporter=WQ().Reporter,Y.DecoderBuffer=YI().DecoderBuffer,Y.EncoderBuffer=YI().EncoderBuffer,Y.Node=HQ()}),RQ=Q0((I)=>{var Y=MI();I.tagClass={0:"universal",1:"application",2:"context",3:"private"},I.tagClassByName=Y._reverse(I.tagClass),I.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},I.tagByName=Y._reverse(I.tag)}),MI=Q0((I)=>{var Y=I;Y._reverse=function(G){var K={};return Object.keys(G).forEach(function(L){if((L|0)==L)L=L|0;var W=G[L];K[W]=L}),K},Y.der=RQ()}),qI=Q0((I,Y)=>{var G=_U(),K=RE(),L=K.base,W=K.bignum,Z=K.constants.der;function z(F){this.enc="der",this.name=F.name,this.entity=F,this.tree=new q,this.tree._init(F.body)}Y.exports=z,z.prototype.decode=function(F,R){if(!(F instanceof L.DecoderBuffer))F=new L.DecoderBuffer(F,R);return this.tree._decode(F,R)};function q(F){L.Node.call(this,"der",F)}G(q,L.Node),q.prototype._peekTag=function(F,R,M){if(F.isEmpty())return!1;var P=F.save(),k=C(F,'Failed to peek tag: "'+R+'"');if(F.isError(k))return k;return F.restore(P),k.tag===R||k.tagStr===R||k.tagStr+"of"===R||M},q.prototype._decodeTag=function(F,R,M){var P=C(F,'Failed to decode tag of "'+R+'"');if(F.isError(P))return P;var k=D(F,P.primitive,'Failed to get length of "'+R+'"');if(F.isError(k))return k;if(!M&&P.tag!==R&&P.tagStr!==R&&P.tagStr+"of"!==R)return F.error('Failed to match tag: "'+R+'"');if(P.primitive||k!==null)return F.skip(k,'Failed to match body of: "'+R+'"');var _=F.save(),N=this._skipUntilEnd(F,'Failed to skip indefinite length body: "'+this.tag+'"');if(F.isError(N))return N;return k=F.offset-_.offset,F.restore(_),F.skip(k,'Failed to match body of: "'+R+'"')},q.prototype._skipUntilEnd=function(F,R){while(!0){var M=C(F,R);if(F.isError(M))return M;var P=D(F,M.primitive,R);if(F.isError(P))return P;var k;if(M.primitive||P!==null)k=F.skip(P);else k=this._skipUntilEnd(F,R);if(F.isError(k))return k;if(M.tagStr==="end")break}},q.prototype._decodeList=function(F,R,M,P){var k=[];while(!F.isEmpty()){var _=this._peekTag(F,"end");if(F.isError(_))return _;var N=M.decode(F,"der",P);if(F.isError(N)&&_)break;k.push(N)}return k},q.prototype._decodeStr=function(F,R){if(R==="bitstr"){var M=F.readUInt8();if(F.isError(M))return M;return{unused:M,data:F.raw()}}else if(R==="bmpstr"){var P=F.raw();if(P.length%2===1)return F.error("Decoding of string type: bmpstr length mismatch");var k="";for(var _=0;_>6],k=(M&32)===0;if((M&31)===31){var _=M;M=0;while((_&128)===128){if(_=F.readUInt8(R),F.isError(_))return _;M<<=7,M|=_&127}}else M&=31;var N=Z.tag[M];return{cls:P,primitive:k,tag:M,tagStr:N}}function D(F,R,M){var P=F.readUInt8(M);if(F.isError(P))return P;if(!R&&P===128)return null;if((P&128)===0)return P;var k=P&127;if(k>4)return F.error("length octect is too long");P=0;for(var _=0;_{var G=_U(),K=(FU(),h0(KU)).Buffer,L=qI();function W(Z){L.call(this,Z),this.enc="pem"}G(W,L),Y.exports=W,W.prototype.decode=function(Z,z){var q=Z.toString().split(/[\r\n]+/g),C=z.label.toUpperCase(),D=/^-----(BEGIN|END) ([^-]+)-----$/,F=-1,R=-1;for(var M=0;M{var Y=I;Y.der=qI(),Y.pem=DQ()}),PI=Q0((I,Y)=>{var G=_U(),K=(FU(),h0(KU)).Buffer,L=RE(),W=L.base,Z=L.constants.der;function z(F){this.enc="der",this.name=F.name,this.entity=F,this.tree=new q,this.tree._init(F.body)}Y.exports=z,z.prototype.encode=function(F,R){return this.tree._encode(F,R).join()};function q(F){W.Node.call(this,"der",F)}G(q,W.Node),q.prototype._encodeComposite=function(F,R,M,P){var k=D(F,R,M,this.reporter);if(P.length<128){var v=new K(2);return v[0]=k,v[1]=P.length,this._createEncoderBuffer([v,P])}var _=1;for(var N=P.length;N>=256;N>>=8)_++;var v=new K(2+_);v[0]=k,v[1]=128|_;for(var N=1+_,B=P.length;B>0;N--,B>>=8)v[N]=B&255;return this._createEncoderBuffer([v,P])},q.prototype._encodeStr=function(F,R){if(R==="bitstr")return this._createEncoderBuffer([F.unused|0,F.data]);else if(R==="bmpstr"){var M=new K(F.length*2);for(var P=0;P=40)return this.reporter.error("Second objid identifier OOB");F.splice(0,2,F[0]*40+F[1])}var k=0;for(var P=0;P=128;_>>=7)k++}var N=new K(k),v=N.length-1;for(var P=F.length-1;P>=0;P--){var _=F[P];N[v--]=_&127;while((_>>=7)>0)N[v--]=128|_&127}return this._createEncoderBuffer(N)};function C(F){if(F<10)return"0"+F;else return F}q.prototype._encodeTime=function(F,R){var M,P=new Date(F);if(R==="gentime")M=[C(P.getFullYear()),C(P.getUTCMonth()+1),C(P.getUTCDate()),C(P.getUTCHours()),C(P.getUTCMinutes()),C(P.getUTCSeconds()),"Z"].join("");else if(R==="utctime")M=[C(P.getFullYear()%100),C(P.getUTCMonth()+1),C(P.getUTCDate()),C(P.getUTCHours()),C(P.getUTCMinutes()),C(P.getUTCSeconds()),"Z"].join("");else this.reporter.error("Encoding "+R+" time is not supported yet");return this._encodeStr(M,"octstr")},q.prototype._encodeNull=function(){return this._createEncoderBuffer("")},q.prototype._encodeInt=function(F,R){if(typeof F==="string"){if(!R)return this.reporter.error("String int or enum given, but no values map");if(!R.hasOwnProperty(F))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(F));F=R[F]}if(typeof F!=="number"&&!K.isBuffer(F)){var M=F.toArray();if(!F.sign&&M[0]&128)M.unshift(0);F=new K(M)}if(K.isBuffer(F)){var P=F.length;if(F.length===0)P++;var _=new K(P);if(F.copy(_),F.length===0)_[0]=0;return this._createEncoderBuffer(_)}if(F<128)return this._createEncoderBuffer(F);if(F<256)return this._createEncoderBuffer([0,F]);var P=1;for(var k=F;k>=256;k>>=8)P++;var _=Array(P);for(var k=_.length-1;k>=0;k--)_[k]=F&255,F>>=8;if(_[0]&128)_.unshift(0);return this._createEncoderBuffer(new K(_))},q.prototype._encodeBool=function(F){return this._createEncoderBuffer(F?255:0)},q.prototype._use=function(F,R){if(typeof F==="function")F=F(R);return F._getEncoder("der").tree},q.prototype._skipDefault=function(F,R,M){var P=this._baseState,k;if(P.default===null)return!1;var _=F.join();if(P.defaultBuffer===void 0)P.defaultBuffer=this._encodeValue(P.default,R,M).join();if(_.length!==P.defaultBuffer.length)return!1;for(k=0;k<_.length;k++)if(_[k]!==P.defaultBuffer[k])return!1;return!0};function D(F,R,M,P){var k;if(F==="seqof")F="seq";else if(F==="setof")F="set";if(Z.tagByName.hasOwnProperty(F))k=Z.tagByName[F];else if(typeof F==="number"&&(F|0)===F)k=F;else return P.error("Unknown tag: "+F);if(k>=31)return P.error("Multi-octet tag encoding unsupported");if(!R)k|=32;return k|=Z.tagClassByName[M||"universal"]<<6,k}}),zQ=Q0((I,Y)=>{var G=_U(),K=PI();function L(W){K.call(this,W),this.enc="pem"}G(L,K),Y.exports=L,L.prototype.encode=function(W,Z){var z=K.prototype.encode.call(this,W),q=z.toString("base64"),C=["-----BEGIN "+Z.label+"-----"];for(var D=0;D{var Y=I;Y.der=PI(),Y.pem=zQ()}),RE=Q0((I)=>{var Y=I;Y.bignum=KQ(),Y.define=FQ().define,Y.base=$E(),Y.constants=MI(),Y.decoders=CQ(),Y.encoders=SQ()}),MQ=Q0((I,Y)=>{var G=RE(),K=G.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),L=G.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),W=G.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),Z=G.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(W),this.key("subjectPublicKey").bitstr())}),z=G.define("RelativeDistinguishedName",function(){this.setof(L)}),q=G.define("RDNSequence",function(){this.seqof(z)}),C=G.define("Name",function(){this.choice({rdnSequence:this.use(q)})}),D=G.define("Validity",function(){this.seq().obj(this.key("notBefore").use(K),this.key("notAfter").use(K))}),F=G.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),R=G.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(W),this.key("issuer").use(C),this.key("validity").use(D),this.key("subject").use(C),this.key("subjectPublicKeyInfo").use(Z),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(F).optional())}),M=G.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(R),this.key("signatureAlgorithm").use(W),this.key("signatureValue").bitstr())});Y.exports=M}),qQ=Q0((I)=>{var Y=RE();I.certificate=MQ();var G=Y.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});I.RSAPrivateKey=G;var K=Y.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});I.RSAPublicKey=K;var L=Y.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),W=Y.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(L),this.key("subjectPublicKey").bitstr())});I.PublicKey=W;var Z=Y.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(L),this.key("subjectPrivateKey").octstr())});I.PrivateKey=Z;var z=Y.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});I.EncryptedPrivateKey=z;var q=Y.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});I.DSAPrivateKey=q,I.DSAparam=Y.define("DSAparam",function(){this.int()});var C=Y.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),D=Y.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(C),this.key("publicKey").optional().explicit(1).bitstr())});I.ECPrivateKey=D,I.signature=Y.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),PQ=Q0((I,Y)=>{Y.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}}),_Q=Q0((I,Y)=>{var G=SU().Buffer,K=PT().Transform,L=_U();function W(C){K.call(this),this._block=G.allocUnsafe(C),this._blockSize=C,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}L(W,K),W.prototype._transform=function(C,D,F){var R=null;try{this.update(C,D)}catch(M){R=M}F(R)},W.prototype._flush=function(C){var D=null;try{this.push(this.digest())}catch(F){D=F}C(D)};var Z=typeof Uint8Array<"u",z=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(G.prototype instanceof Uint8Array||G.TYPED_ARRAY_SUPPORT);function q(C,D){if(C instanceof G)return C;if(typeof C==="string")return G.from(C,D);if(z&&ArrayBuffer.isView(C)){if(C.byteLength===0)return G.alloc(0);var F=G.from(C.buffer,C.byteOffset,C.byteLength);if(F.byteLength===C.byteLength)return F}if(Z&&C instanceof Uint8Array)return G.from(C);if(G.isBuffer(C)&&C.constructor&&typeof C.constructor.isBuffer==="function"&&C.constructor.isBuffer(C))return G.from(C);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}W.prototype.update=function(C,D){if(this._finalized)throw Error("Digest already called");C=q(C,D);var F=this._block,R=0;while(this._blockOffset+C.length-R>=this._blockSize){for(var M=this._blockOffset;M0;++P)if(this._length[P]+=k,k=this._length[P]/4294967296|0,k>0)this._length[P]-=4294967296*k;return this},W.prototype._update=function(){throw Error("_update is not implemented")},W.prototype.digest=function(C){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var D=this._digest();if(C!==void 0)D=D.toString(C);this._block.fill(0),this._blockOffset=0;for(var F=0;F<4;++F)this._length[F]=0;return D},W.prototype._digest=function(){throw Error("_digest is not implemented")},Y.exports=W}),kQ=Q0((I,Y)=>{var G=_U(),K=_Q(),L=SU().Buffer,W=Array(16);function Z(){K.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}G(Z,K),Z.prototype._update=function(){var R=W;for(var M=0;M<16;++M)R[M]=this._block.readInt32LE(M*4);var P=this._a,k=this._b,_=this._c,N=this._d;P=q(P,k,_,N,R[0],3614090360,7),N=q(N,P,k,_,R[1],3905402710,12),_=q(_,N,P,k,R[2],606105819,17),k=q(k,_,N,P,R[3],3250441966,22),P=q(P,k,_,N,R[4],4118548399,7),N=q(N,P,k,_,R[5],1200080426,12),_=q(_,N,P,k,R[6],2821735955,17),k=q(k,_,N,P,R[7],4249261313,22),P=q(P,k,_,N,R[8],1770035416,7),N=q(N,P,k,_,R[9],2336552879,12),_=q(_,N,P,k,R[10],4294925233,17),k=q(k,_,N,P,R[11],2304563134,22),P=q(P,k,_,N,R[12],1804603682,7),N=q(N,P,k,_,R[13],4254626195,12),_=q(_,N,P,k,R[14],2792965006,17),k=q(k,_,N,P,R[15],1236535329,22),P=C(P,k,_,N,R[1],4129170786,5),N=C(N,P,k,_,R[6],3225465664,9),_=C(_,N,P,k,R[11],643717713,14),k=C(k,_,N,P,R[0],3921069994,20),P=C(P,k,_,N,R[5],3593408605,5),N=C(N,P,k,_,R[10],38016083,9),_=C(_,N,P,k,R[15],3634488961,14),k=C(k,_,N,P,R[4],3889429448,20),P=C(P,k,_,N,R[9],568446438,5),N=C(N,P,k,_,R[14],3275163606,9),_=C(_,N,P,k,R[3],4107603335,14),k=C(k,_,N,P,R[8],1163531501,20),P=C(P,k,_,N,R[13],2850285829,5),N=C(N,P,k,_,R[2],4243563512,9),_=C(_,N,P,k,R[7],1735328473,14),k=C(k,_,N,P,R[12],2368359562,20),P=D(P,k,_,N,R[5],4294588738,4),N=D(N,P,k,_,R[8],2272392833,11),_=D(_,N,P,k,R[11],1839030562,16),k=D(k,_,N,P,R[14],4259657740,23),P=D(P,k,_,N,R[1],2763975236,4),N=D(N,P,k,_,R[4],1272893353,11),_=D(_,N,P,k,R[7],4139469664,16),k=D(k,_,N,P,R[10],3200236656,23),P=D(P,k,_,N,R[13],681279174,4),N=D(N,P,k,_,R[0],3936430074,11),_=D(_,N,P,k,R[3],3572445317,16),k=D(k,_,N,P,R[6],76029189,23),P=D(P,k,_,N,R[9],3654602809,4),N=D(N,P,k,_,R[12],3873151461,11),_=D(_,N,P,k,R[15],530742520,16),k=D(k,_,N,P,R[2],3299628645,23),P=F(P,k,_,N,R[0],4096336452,6),N=F(N,P,k,_,R[7],1126891415,10),_=F(_,N,P,k,R[14],2878612391,15),k=F(k,_,N,P,R[5],4237533241,21),P=F(P,k,_,N,R[12],1700485571,6),N=F(N,P,k,_,R[3],2399980690,10),_=F(_,N,P,k,R[10],4293915773,15),k=F(k,_,N,P,R[1],2240044497,21),P=F(P,k,_,N,R[8],1873313359,6),N=F(N,P,k,_,R[15],4264355552,10),_=F(_,N,P,k,R[6],2734768916,15),k=F(k,_,N,P,R[13],1309151649,21),P=F(P,k,_,N,R[4],4149444226,6),N=F(N,P,k,_,R[11],3174756917,10),_=F(_,N,P,k,R[2],718787259,15),k=F(k,_,N,P,R[9],3951481745,21),this._a=this._a+P|0,this._b=this._b+k|0,this._c=this._c+_|0,this._d=this._d+N|0},Z.prototype._digest=function(){if(this._block[this._blockOffset++]=128,this._blockOffset>56)this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0;this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var R=L.allocUnsafe(16);return R.writeInt32LE(this._a,0),R.writeInt32LE(this._b,4),R.writeInt32LE(this._c,8),R.writeInt32LE(this._d,12),R};function z(R,M){return R<>>32-M}function q(R,M,P,k,_,N,v){return z(R+(M&P|~M&k)+_+N|0,v)+M|0}function C(R,M,P,k,_,N,v){return z(R+(M&k|P&~k)+_+N|0,v)+M|0}function D(R,M,P,k,_,N,v){return z(R+(M^P^k)+_+N|0,v)+M|0}function F(R,M,P,k,_,N,v){return z(R+(P^(M|~k))+_+N|0,v)+M|0}Y.exports=Z}),vQ=Q0((I,Y)=>{var G=SU().Buffer,K=kQ();function L(W,Z,z,q){if(!G.isBuffer(W))W=G.from(W,"binary");if(Z){if(!G.isBuffer(Z))Z=G.from(Z,"binary");if(Z.length!==8)throw RangeError("salt should be Buffer with 8 byte length")}var C=z/8,D=G.alloc(C),F=G.alloc(q||0),R=G.alloc(0);while(C>0||q>0){var M=new K;if(M.update(R),M.update(W),Z)M.update(Z);R=M.digest();var P=0;if(C>0){var k=D.length-C;P=Math.min(C,R.length),R.copy(D,k,0,P),C-=P}if(P0){var _=F.length-q,N=Math.min(q,R.length-P);R.copy(F,_,P,P+N),q-=N}}return R.fill(0),{key:D,iv:F}}Y.exports=L}),_I=Q0((I)=>{var Y=(CU(),h0(PU));I.createCipher=I.Cipher=Y.createCipher,I.createCipheriv=I.Cipheriv=Y.createCipheriv,I.createDecipher=I.Decipher=Y.createDecipher,I.createDecipheriv=I.Decipheriv=Y.createDecipheriv,I.listCiphers=I.getCiphers=Y.getCiphers}),jQ=Q0((I,Y)=>{var G=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,K=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,L=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,W=vQ(),Z=_I(),z=SU().Buffer;Y.exports=function(q,C){var D=q.toString(),F=D.match(G),R;if(!F){var M=D.match(L);R=z.from(M[2].replace(/[\r\n]/g,""),"base64")}else{var P="aes"+F[1],k=z.from(F[2],"hex"),_=z.from(F[3].replace(/[\r\n]/g,""),"base64"),N=W(C,k.slice(0,8),parseInt(F[1],10)).key,v=[],B=Z.createDecipheriv(P,N,k);v.push(B.update(_)),v.push(B.final()),R=z.concat(v)}var g=D.match(K)[1];return{tag:g,data:R}}}),kI=Q0((I,Y)=>{var G=qQ(),K=PQ(),L=jQ(),W=_I(),Z=WI().pbkdf2Sync,z=SU().Buffer;function q(D,F){var R=D.algorithm.decrypt.kde.kdeparams.salt,M=parseInt(D.algorithm.decrypt.kde.kdeparams.iters.toString(),10),P=K[D.algorithm.decrypt.cipher.algo.join(".")],k=D.algorithm.decrypt.cipher.iv,_=D.subjectPrivateKey,N=parseInt(P.split("-")[1],10)/8,v=Z(F,R,M,N,"sha1"),B=W.createDecipheriv(P,v,k),g=[];return g.push(B.update(_)),g.push(B.final()),z.concat(g)}function C(D){var F;if(typeof D==="object"&&!z.isBuffer(D))F=D.passphrase,D=D.key;if(typeof D==="string")D=z.from(D);var R=L(D,F),M=R.tag,P=R.data,k,_;switch(M){case"CERTIFICATE":_=G.certificate.decode(P,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":if(!_)_=G.PublicKey.decode(P,"der");switch(k=_.algorithm.algorithm.join("."),k){case"1.2.840.113549.1.1.1":return G.RSAPublicKey.decode(_.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return _.subjectPrivateKey=_.subjectPublicKey,{type:"ec",data:_};case"1.2.840.10040.4.1":return _.algorithm.params.pub_key=G.DSAparam.decode(_.subjectPublicKey.data,"der"),{type:"dsa",data:_.algorithm.params};default:throw Error("unknown key id "+k)}case"ENCRYPTED PRIVATE KEY":P=G.EncryptedPrivateKey.decode(P,"der"),P=q(P,F);case"PRIVATE KEY":switch(_=G.PrivateKey.decode(P,"der"),k=_.algorithm.algorithm.join("."),k){case"1.2.840.113549.1.1.1":return G.RSAPrivateKey.decode(_.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:_.algorithm.curve,privateKey:G.ECPrivateKey.decode(_.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return _.algorithm.params.priv_key=G.DSAparam.decode(_.subjectPrivateKey,"der"),{type:"dsa",params:_.algorithm.params};default:throw Error("unknown key id "+k)}case"RSA PUBLIC KEY":return G.RSAPublicKey.decode(P,"der");case"RSA PRIVATE KEY":return G.RSAPrivateKey.decode(P,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:G.DSAPrivateKey.decode(P,"der")};case"EC PRIVATE KEY":return P=G.ECPrivateKey.decode(P,"der"),{curve:P.parameters.value,privateKey:P.privateKey};default:throw Error("unknown key type "+M)}}C.signature=G.signature,Y.exports=C}),vI=Q0((I,Y)=>{var G=uE(),K=SU().Buffer;Y.exports=function(W,Z){var z=K.alloc(0),q=0,C;while(z.length{Y.exports=function(G,K){var L=G.length,W=-1;while(++W{(function(G,K){function L(U,X){if(!U)throw Error(X||"Assertion failed")}function W(U,X){U.super_=X;var Q=function(){};Q.prototype=X.prototype,U.prototype=new Q,U.prototype.constructor=U}function Z(U,X,Q){if(Z.isBN(U))return U;if(this.negative=0,this.words=null,this.length=0,this.red=null,U!==null){if(X==="le"||X==="be")Q=X,X=10;this._init(U||0,X||10,Q||"be")}}if(typeof G==="object")G.exports=Z;else K.BN=Z;Z.BN=Z,Z.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(U){}Z.isBN=function(U){if(U instanceof Z)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===Z.wordSize&&Array.isArray(U.words)},Z.max=function(U,X){if(U.cmp(X)>0)return U;return X},Z.min=function(U,X){if(U.cmp(X)<0)return U;return X},Z.prototype._init=function(U,X,Q){if(typeof U==="number")return this._initNumber(U,X,Q);if(typeof U==="object")return this._initArray(U,X,Q);if(X==="hex")X=16;L(X===(X|0)&&X>=2&&X<=36),U=U.toString().replace(/\s+/g,"");var T=0;if(U[0]==="-")T++,this.negative=1;if(T=0;T-=3)if(A=U[T]|U[T-1]<<8|U[T-2]<<16,this.words[O]|=A<<$&67108863,this.words[O+1]=A>>>26-$&67108863,$+=24,$>=26)$-=26,O++}else if(Q==="le"){for(T=0,O=0;T>>26-$&67108863,$+=24,$>=26)$-=26,O++}return this.strip()};function q(U,X){var Q=U.charCodeAt(X);if(Q>=65&&Q<=70)return Q-55;else if(Q>=97&&Q<=102)return Q-87;else return Q-48&15}function C(U,X,Q){var T=q(U,Q);if(Q-1>=X)T|=q(U,Q-1)<<4;return T}Z.prototype._parseHex=function(U,X,Q){this.length=Math.ceil((U.length-X)/6),this.words=Array(this.length);for(var T=0;T=X;T-=2)if($=C(U,X,T)<=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8;else{var J=U.length-X;for(T=J%2===0?X+1:X;T=18)O-=18,A+=1,this.words[A]|=$>>>26;else O+=8}this.strip()};function D(U,X,Q,T){var O=0,A=Math.min(U.length,Q);for(var $=X;$=49)O+=J-49+10;else if(J>=17)O+=J-17+10;else O+=J}return O}Z.prototype._parseBase=function(U,X,Q){this.words=[0],this.length=1;for(var T=0,O=1;O<=67108863;O*=X)T++;T--,O=O/X|0;var A=U.length-Q,$=A%T,J=Math.min(A,A-$)+Q,E=0;for(var V=Q;V1&&this.words[this.length-1]===0)this.length--;return this._normSign()},Z.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},Z.prototype.inspect=function(){return(this.red?""};var F=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(Z.prototype.toString=function(U,X){U=U||10,X=X|0||1;var Q;if(U===16||U==="hex"){Q="";var T=0,O=0;for(var A=0;A>>24-T&16777215,T+=2,T>=26)T-=26,A--;if(O!==0||A!==this.length-1)Q=F[6-J.length]+J+Q;else Q=J+Q}if(O!==0)Q=O.toString(16)+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}if(U===(U|0)&&U>=2&&U<=36){var E=R[U],V=M[U];Q="";var S=this.clone();S.negative=0;while(!S.isZero()){var H=S.modn(V).toString(U);if(S=S.idivn(V),!S.isZero())Q=F[E-H.length]+H+Q;else Q=H+Q}if(this.isZero())Q="0"+Q;while(Q.length%X!==0)Q="0"+Q;if(this.negative!==0)Q="-"+Q;return Q}L(!1,"Base should be between 2 and 36")},Z.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},Z.prototype.toJSON=function(){return this.toString(16)},Z.prototype.toBuffer=function(U,X){return L(typeof z<"u"),this.toArrayLike(z,U,X)},Z.prototype.toArray=function(U,X){return this.toArrayLike(Array,U,X)},Z.prototype.toArrayLike=function(U,X,Q){var T=this.byteLength(),O=Q||Math.max(1,T);L(T<=O,"byte array longer than desired length"),L(O>0,"Requested array length <= 0"),this.strip();var A=X==="le",$=new U(O),J,E,V=this.clone();if(!A){for(E=0;E=4096)Q+=13,X>>>=13;if(X>=64)Q+=7,X>>>=7;if(X>=8)Q+=4,X>>>=4;if(X>=2)Q+=2,X>>>=2;return Q+X};Z.prototype._zeroBits=function(U){if(U===0)return 26;var X=U,Q=0;if((X&8191)===0)Q+=13,X>>>=13;if((X&127)===0)Q+=7,X>>>=7;if((X&15)===0)Q+=4,X>>>=4;if((X&3)===0)Q+=2,X>>>=2;if((X&1)===0)Q++;return Q},Z.prototype.bitLength=function(){var U=this.words[this.length-1],X=this._countBits(U);return(this.length-1)*26+X};function P(U){var X=Array(U.bitLength());for(var Q=0;Q>>O}return X}Z.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var X=0;XU.length)return this.clone().ior(U);return U.clone().ior(this)},Z.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},Z.prototype.iuand=function(U){var X;if(this.length>U.length)X=U;else X=this;for(var Q=0;QU.length)return this.clone().iand(U);return U.clone().iand(this)},Z.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},Z.prototype.iuxor=function(U){var X,Q;if(this.length>U.length)X=this,Q=U;else X=U,Q=this;for(var T=0;TU.length)return this.clone().ixor(U);return U.clone().ixor(this)},Z.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},Z.prototype.inotn=function(U){L(typeof U==="number"&&U>=0);var X=Math.ceil(U/26)|0,Q=U%26;if(this._expand(X),Q>0)X--;for(var T=0;T0)this.words[T]=~this.words[T]&67108863>>26-Q;return this.strip()},Z.prototype.notn=function(U){return this.clone().inotn(U)},Z.prototype.setn=function(U,X){L(typeof U==="number"&&U>=0);var Q=U/26|0,T=U%26;if(this._expand(Q+1),X)this.words[Q]=this.words[Q]|1<U.length)Q=this,T=U;else Q=U,T=this;var O=0;for(var A=0;A>>26;for(;O!==0&&A>>26;if(this.length=Q.length,O!==0)this.words[this.length]=O,this.length++;else if(Q!==this)for(;AU.length)return this.clone().iadd(U);return U.clone().iadd(this)},Z.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var X=this.iadd(U);return U.negative=1,X._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Q=this.cmp(U);if(Q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var T,O;if(Q>0)T=this,O=U;else T=U,O=this;var A=0;for(var $=0;$>26,this.words[$]=X&67108863;for(;A!==0&&$>26,this.words[$]=X&67108863;if(A===0&&$>>26,H=E&67108863,j=Math.min(V,X.length-1);for(var w=Math.max(0,V-U.length+1);w<=j;w++){var p=V-w|0;O=U.words[p]|0,A=X.words[w]|0,$=O*A+H,S+=$/67108864|0,H=$&67108863}Q.words[V]=H|0,E=S|0}if(E!==0)Q.words[V]=E|0;else Q.length--;return Q.strip()}var _=function(U,X,Q){var T=U.words,O=X.words,A=Q.words,$=0,J,E,V,S=T[0]|0,H=S&8191,j=S>>>13,w=T[1]|0,p=w&8191,n=w>>>13,G0=T[2]|0,t=G0&8191,d=G0>>>13,X0=T[3]|0,m=X0&8191,U0=X0>>>13,g0=T[4]|0,f=g0&8191,h=g0>>>13,I0=T[5]|0,r=I0&8191,e=I0>>>13,D0=T[6]|0,c=D0&8191,o=D0>>>13,x0=T[7]|0,s=x0&8191,T0=x0>>>13,y0=T[8]|0,L0=y0&8191,$0=y0>>>13,n0=T[9]|0,V0=n0&8191,K0=n0>>>13,t0=O[0]|0,H0=t0&8191,W0=t0>>>13,RU=O[1]|0,C0=RU&8191,_0=RU>>>13,DU=O[2]|0,k0=DU&8191,z0=DU>>>13,WU=O[3]|0,v0=WU&8191,S0=WU>>>13,AU=O[4]|0,j0=AU&8191,N0=AU>>>13,LU=O[5]|0,M0=LU&8191,x=LU>>>13,b=O[6]|0,a=b&8191,E0=b>>>13,w0=O[7]|0,A0=w0&8191,F0=w0>>>13,m0=O[8]|0,q0=m0&8191,B0=m0>>>13,HU=O[9]|0,P0=HU&8191,R0=HU>>>13;Q.negative=U.negative^X.negative,Q.length=19,J=Math.imul(H,H0),E=Math.imul(H,W0),E=E+Math.imul(j,H0)|0,V=Math.imul(j,W0);var s0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(s0>>>26)|0,s0&=67108863,J=Math.imul(p,H0),E=Math.imul(p,W0),E=E+Math.imul(n,H0)|0,V=Math.imul(n,W0),J=J+Math.imul(H,C0)|0,E=E+Math.imul(H,_0)|0,E=E+Math.imul(j,C0)|0,V=V+Math.imul(j,_0)|0;var c0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(c0>>>26)|0,c0&=67108863,J=Math.imul(t,H0),E=Math.imul(t,W0),E=E+Math.imul(d,H0)|0,V=Math.imul(d,W0),J=J+Math.imul(p,C0)|0,E=E+Math.imul(p,_0)|0,E=E+Math.imul(n,C0)|0,V=V+Math.imul(n,_0)|0,J=J+Math.imul(H,k0)|0,E=E+Math.imul(H,z0)|0,E=E+Math.imul(j,k0)|0,V=V+Math.imul(j,z0)|0;var f0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(f0>>>26)|0,f0&=67108863,J=Math.imul(m,H0),E=Math.imul(m,W0),E=E+Math.imul(U0,H0)|0,V=Math.imul(U0,W0),J=J+Math.imul(t,C0)|0,E=E+Math.imul(t,_0)|0,E=E+Math.imul(d,C0)|0,V=V+Math.imul(d,_0)|0,J=J+Math.imul(p,k0)|0,E=E+Math.imul(p,z0)|0,E=E+Math.imul(n,k0)|0,V=V+Math.imul(n,z0)|0,J=J+Math.imul(H,v0)|0,E=E+Math.imul(H,S0)|0,E=E+Math.imul(j,v0)|0,V=V+Math.imul(j,S0)|0;var d0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(d0>>>26)|0,d0&=67108863,J=Math.imul(f,H0),E=Math.imul(f,W0),E=E+Math.imul(h,H0)|0,V=Math.imul(h,W0),J=J+Math.imul(m,C0)|0,E=E+Math.imul(m,_0)|0,E=E+Math.imul(U0,C0)|0,V=V+Math.imul(U0,_0)|0,J=J+Math.imul(t,k0)|0,E=E+Math.imul(t,z0)|0,E=E+Math.imul(d,k0)|0,V=V+Math.imul(d,z0)|0,J=J+Math.imul(p,v0)|0,E=E+Math.imul(p,S0)|0,E=E+Math.imul(n,v0)|0,V=V+Math.imul(n,S0)|0,J=J+Math.imul(H,j0)|0,E=E+Math.imul(H,N0)|0,E=E+Math.imul(j,j0)|0,V=V+Math.imul(j,N0)|0;var b0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(b0>>>26)|0,b0&=67108863,J=Math.imul(r,H0),E=Math.imul(r,W0),E=E+Math.imul(e,H0)|0,V=Math.imul(e,W0),J=J+Math.imul(f,C0)|0,E=E+Math.imul(f,_0)|0,E=E+Math.imul(h,C0)|0,V=V+Math.imul(h,_0)|0,J=J+Math.imul(m,k0)|0,E=E+Math.imul(m,z0)|0,E=E+Math.imul(U0,k0)|0,V=V+Math.imul(U0,z0)|0,J=J+Math.imul(t,v0)|0,E=E+Math.imul(t,S0)|0,E=E+Math.imul(d,v0)|0,V=V+Math.imul(d,S0)|0,J=J+Math.imul(p,j0)|0,E=E+Math.imul(p,N0)|0,E=E+Math.imul(n,j0)|0,V=V+Math.imul(n,N0)|0,J=J+Math.imul(H,M0)|0,E=E+Math.imul(H,x)|0,E=E+Math.imul(j,M0)|0,V=V+Math.imul(j,x)|0;var a0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(a0>>>26)|0,a0&=67108863,J=Math.imul(c,H0),E=Math.imul(c,W0),E=E+Math.imul(o,H0)|0,V=Math.imul(o,W0),J=J+Math.imul(r,C0)|0,E=E+Math.imul(r,_0)|0,E=E+Math.imul(e,C0)|0,V=V+Math.imul(e,_0)|0,J=J+Math.imul(f,k0)|0,E=E+Math.imul(f,z0)|0,E=E+Math.imul(h,k0)|0,V=V+Math.imul(h,z0)|0,J=J+Math.imul(m,v0)|0,E=E+Math.imul(m,S0)|0,E=E+Math.imul(U0,v0)|0,V=V+Math.imul(U0,S0)|0,J=J+Math.imul(t,j0)|0,E=E+Math.imul(t,N0)|0,E=E+Math.imul(d,j0)|0,V=V+Math.imul(d,N0)|0,J=J+Math.imul(p,M0)|0,E=E+Math.imul(p,x)|0,E=E+Math.imul(n,M0)|0,V=V+Math.imul(n,x)|0,J=J+Math.imul(H,a)|0,E=E+Math.imul(H,E0)|0,E=E+Math.imul(j,a)|0,V=V+Math.imul(j,E0)|0;var e0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(e0>>>26)|0,e0&=67108863,J=Math.imul(s,H0),E=Math.imul(s,W0),E=E+Math.imul(T0,H0)|0,V=Math.imul(T0,W0),J=J+Math.imul(c,C0)|0,E=E+Math.imul(c,_0)|0,E=E+Math.imul(o,C0)|0,V=V+Math.imul(o,_0)|0,J=J+Math.imul(r,k0)|0,E=E+Math.imul(r,z0)|0,E=E+Math.imul(e,k0)|0,V=V+Math.imul(e,z0)|0,J=J+Math.imul(f,v0)|0,E=E+Math.imul(f,S0)|0,E=E+Math.imul(h,v0)|0,V=V+Math.imul(h,S0)|0,J=J+Math.imul(m,j0)|0,E=E+Math.imul(m,N0)|0,E=E+Math.imul(U0,j0)|0,V=V+Math.imul(U0,N0)|0,J=J+Math.imul(t,M0)|0,E=E+Math.imul(t,x)|0,E=E+Math.imul(d,M0)|0,V=V+Math.imul(d,x)|0,J=J+Math.imul(p,a)|0,E=E+Math.imul(p,E0)|0,E=E+Math.imul(n,a)|0,V=V+Math.imul(n,E0)|0,J=J+Math.imul(H,A0)|0,E=E+Math.imul(H,F0)|0,E=E+Math.imul(j,A0)|0,V=V+Math.imul(j,F0)|0;var i0=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(i0>>>26)|0,i0&=67108863,J=Math.imul(L0,H0),E=Math.imul(L0,W0),E=E+Math.imul($0,H0)|0,V=Math.imul($0,W0),J=J+Math.imul(s,C0)|0,E=E+Math.imul(s,_0)|0,E=E+Math.imul(T0,C0)|0,V=V+Math.imul(T0,_0)|0,J=J+Math.imul(c,k0)|0,E=E+Math.imul(c,z0)|0,E=E+Math.imul(o,k0)|0,V=V+Math.imul(o,z0)|0,J=J+Math.imul(r,v0)|0,E=E+Math.imul(r,S0)|0,E=E+Math.imul(e,v0)|0,V=V+Math.imul(e,S0)|0,J=J+Math.imul(f,j0)|0,E=E+Math.imul(f,N0)|0,E=E+Math.imul(h,j0)|0,V=V+Math.imul(h,N0)|0,J=J+Math.imul(m,M0)|0,E=E+Math.imul(m,x)|0,E=E+Math.imul(U0,M0)|0,V=V+Math.imul(U0,x)|0,J=J+Math.imul(t,a)|0,E=E+Math.imul(t,E0)|0,E=E+Math.imul(d,a)|0,V=V+Math.imul(d,E0)|0,J=J+Math.imul(p,A0)|0,E=E+Math.imul(p,F0)|0,E=E+Math.imul(n,A0)|0,V=V+Math.imul(n,F0)|0,J=J+Math.imul(H,q0)|0,E=E+Math.imul(H,B0)|0,E=E+Math.imul(j,q0)|0,V=V+Math.imul(j,B0)|0;var UU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(UU>>>26)|0,UU&=67108863,J=Math.imul(V0,H0),E=Math.imul(V0,W0),E=E+Math.imul(K0,H0)|0,V=Math.imul(K0,W0),J=J+Math.imul(L0,C0)|0,E=E+Math.imul(L0,_0)|0,E=E+Math.imul($0,C0)|0,V=V+Math.imul($0,_0)|0,J=J+Math.imul(s,k0)|0,E=E+Math.imul(s,z0)|0,E=E+Math.imul(T0,k0)|0,V=V+Math.imul(T0,z0)|0,J=J+Math.imul(c,v0)|0,E=E+Math.imul(c,S0)|0,E=E+Math.imul(o,v0)|0,V=V+Math.imul(o,S0)|0,J=J+Math.imul(r,j0)|0,E=E+Math.imul(r,N0)|0,E=E+Math.imul(e,j0)|0,V=V+Math.imul(e,N0)|0,J=J+Math.imul(f,M0)|0,E=E+Math.imul(f,x)|0,E=E+Math.imul(h,M0)|0,V=V+Math.imul(h,x)|0,J=J+Math.imul(m,a)|0,E=E+Math.imul(m,E0)|0,E=E+Math.imul(U0,a)|0,V=V+Math.imul(U0,E0)|0,J=J+Math.imul(t,A0)|0,E=E+Math.imul(t,F0)|0,E=E+Math.imul(d,A0)|0,V=V+Math.imul(d,F0)|0,J=J+Math.imul(p,q0)|0,E=E+Math.imul(p,B0)|0,E=E+Math.imul(n,q0)|0,V=V+Math.imul(n,B0)|0,J=J+Math.imul(H,P0)|0,E=E+Math.imul(H,R0)|0,E=E+Math.imul(j,P0)|0,V=V+Math.imul(j,R0)|0;var EU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(EU>>>26)|0,EU&=67108863,J=Math.imul(V0,C0),E=Math.imul(V0,_0),E=E+Math.imul(K0,C0)|0,V=Math.imul(K0,_0),J=J+Math.imul(L0,k0)|0,E=E+Math.imul(L0,z0)|0,E=E+Math.imul($0,k0)|0,V=V+Math.imul($0,z0)|0,J=J+Math.imul(s,v0)|0,E=E+Math.imul(s,S0)|0,E=E+Math.imul(T0,v0)|0,V=V+Math.imul(T0,S0)|0,J=J+Math.imul(c,j0)|0,E=E+Math.imul(c,N0)|0,E=E+Math.imul(o,j0)|0,V=V+Math.imul(o,N0)|0,J=J+Math.imul(r,M0)|0,E=E+Math.imul(r,x)|0,E=E+Math.imul(e,M0)|0,V=V+Math.imul(e,x)|0,J=J+Math.imul(f,a)|0,E=E+Math.imul(f,E0)|0,E=E+Math.imul(h,a)|0,V=V+Math.imul(h,E0)|0,J=J+Math.imul(m,A0)|0,E=E+Math.imul(m,F0)|0,E=E+Math.imul(U0,A0)|0,V=V+Math.imul(U0,F0)|0,J=J+Math.imul(t,q0)|0,E=E+Math.imul(t,B0)|0,E=E+Math.imul(d,q0)|0,V=V+Math.imul(d,B0)|0,J=J+Math.imul(p,P0)|0,E=E+Math.imul(p,R0)|0,E=E+Math.imul(n,P0)|0,V=V+Math.imul(n,R0)|0;var TU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(TU>>>26)|0,TU&=67108863,J=Math.imul(V0,k0),E=Math.imul(V0,z0),E=E+Math.imul(K0,k0)|0,V=Math.imul(K0,z0),J=J+Math.imul(L0,v0)|0,E=E+Math.imul(L0,S0)|0,E=E+Math.imul($0,v0)|0,V=V+Math.imul($0,S0)|0,J=J+Math.imul(s,j0)|0,E=E+Math.imul(s,N0)|0,E=E+Math.imul(T0,j0)|0,V=V+Math.imul(T0,N0)|0,J=J+Math.imul(c,M0)|0,E=E+Math.imul(c,x)|0,E=E+Math.imul(o,M0)|0,V=V+Math.imul(o,x)|0,J=J+Math.imul(r,a)|0,E=E+Math.imul(r,E0)|0,E=E+Math.imul(e,a)|0,V=V+Math.imul(e,E0)|0,J=J+Math.imul(f,A0)|0,E=E+Math.imul(f,F0)|0,E=E+Math.imul(h,A0)|0,V=V+Math.imul(h,F0)|0,J=J+Math.imul(m,q0)|0,E=E+Math.imul(m,B0)|0,E=E+Math.imul(U0,q0)|0,V=V+Math.imul(U0,B0)|0,J=J+Math.imul(t,P0)|0,E=E+Math.imul(t,R0)|0,E=E+Math.imul(d,P0)|0,V=V+Math.imul(d,R0)|0;var XU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(XU>>>26)|0,XU&=67108863,J=Math.imul(V0,v0),E=Math.imul(V0,S0),E=E+Math.imul(K0,v0)|0,V=Math.imul(K0,S0),J=J+Math.imul(L0,j0)|0,E=E+Math.imul(L0,N0)|0,E=E+Math.imul($0,j0)|0,V=V+Math.imul($0,N0)|0,J=J+Math.imul(s,M0)|0,E=E+Math.imul(s,x)|0,E=E+Math.imul(T0,M0)|0,V=V+Math.imul(T0,x)|0,J=J+Math.imul(c,a)|0,E=E+Math.imul(c,E0)|0,E=E+Math.imul(o,a)|0,V=V+Math.imul(o,E0)|0,J=J+Math.imul(r,A0)|0,E=E+Math.imul(r,F0)|0,E=E+Math.imul(e,A0)|0,V=V+Math.imul(e,F0)|0,J=J+Math.imul(f,q0)|0,E=E+Math.imul(f,B0)|0,E=E+Math.imul(h,q0)|0,V=V+Math.imul(h,B0)|0,J=J+Math.imul(m,P0)|0,E=E+Math.imul(m,R0)|0,E=E+Math.imul(U0,P0)|0,V=V+Math.imul(U0,R0)|0;var IU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(IU>>>26)|0,IU&=67108863,J=Math.imul(V0,j0),E=Math.imul(V0,N0),E=E+Math.imul(K0,j0)|0,V=Math.imul(K0,N0),J=J+Math.imul(L0,M0)|0,E=E+Math.imul(L0,x)|0,E=E+Math.imul($0,M0)|0,V=V+Math.imul($0,x)|0,J=J+Math.imul(s,a)|0,E=E+Math.imul(s,E0)|0,E=E+Math.imul(T0,a)|0,V=V+Math.imul(T0,E0)|0,J=J+Math.imul(c,A0)|0,E=E+Math.imul(c,F0)|0,E=E+Math.imul(o,A0)|0,V=V+Math.imul(o,F0)|0,J=J+Math.imul(r,q0)|0,E=E+Math.imul(r,B0)|0,E=E+Math.imul(e,q0)|0,V=V+Math.imul(e,B0)|0,J=J+Math.imul(f,P0)|0,E=E+Math.imul(f,R0)|0,E=E+Math.imul(h,P0)|0,V=V+Math.imul(h,R0)|0;var YU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(YU>>>26)|0,YU&=67108863,J=Math.imul(V0,M0),E=Math.imul(V0,x),E=E+Math.imul(K0,M0)|0,V=Math.imul(K0,x),J=J+Math.imul(L0,a)|0,E=E+Math.imul(L0,E0)|0,E=E+Math.imul($0,a)|0,V=V+Math.imul($0,E0)|0,J=J+Math.imul(s,A0)|0,E=E+Math.imul(s,F0)|0,E=E+Math.imul(T0,A0)|0,V=V+Math.imul(T0,F0)|0,J=J+Math.imul(c,q0)|0,E=E+Math.imul(c,B0)|0,E=E+Math.imul(o,q0)|0,V=V+Math.imul(o,B0)|0,J=J+Math.imul(r,P0)|0,E=E+Math.imul(r,R0)|0,E=E+Math.imul(e,P0)|0,V=V+Math.imul(e,R0)|0;var OU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(OU>>>26)|0,OU&=67108863,J=Math.imul(V0,a),E=Math.imul(V0,E0),E=E+Math.imul(K0,a)|0,V=Math.imul(K0,E0),J=J+Math.imul(L0,A0)|0,E=E+Math.imul(L0,F0)|0,E=E+Math.imul($0,A0)|0,V=V+Math.imul($0,F0)|0,J=J+Math.imul(s,q0)|0,E=E+Math.imul(s,B0)|0,E=E+Math.imul(T0,q0)|0,V=V+Math.imul(T0,B0)|0,J=J+Math.imul(c,P0)|0,E=E+Math.imul(c,R0)|0,E=E+Math.imul(o,P0)|0,V=V+Math.imul(o,R0)|0;var ZU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,J=Math.imul(V0,A0),E=Math.imul(V0,F0),E=E+Math.imul(K0,A0)|0,V=Math.imul(K0,F0),J=J+Math.imul(L0,q0)|0,E=E+Math.imul(L0,B0)|0,E=E+Math.imul($0,q0)|0,V=V+Math.imul($0,B0)|0,J=J+Math.imul(s,P0)|0,E=E+Math.imul(s,R0)|0,E=E+Math.imul(T0,P0)|0,V=V+Math.imul(T0,R0)|0;var QU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(QU>>>26)|0,QU&=67108863,J=Math.imul(V0,q0),E=Math.imul(V0,B0),E=E+Math.imul(K0,q0)|0,V=Math.imul(K0,B0),J=J+Math.imul(L0,P0)|0,E=E+Math.imul(L0,R0)|0,E=E+Math.imul($0,P0)|0,V=V+Math.imul($0,R0)|0;var JU=($+J|0)+((E&8191)<<13)|0;$=(V+(E>>>13)|0)+(JU>>>26)|0,JU&=67108863,J=Math.imul(V0,P0),E=Math.imul(V0,R0),E=E+Math.imul(K0,P0)|0,V=Math.imul(K0,R0);var GU=($+J|0)+((E&8191)<<13)|0;if($=(V+(E>>>13)|0)+(GU>>>26)|0,GU&=67108863,A[0]=s0,A[1]=c0,A[2]=f0,A[3]=d0,A[4]=b0,A[5]=a0,A[6]=e0,A[7]=i0,A[8]=UU,A[9]=EU,A[10]=TU,A[11]=XU,A[12]=IU,A[13]=YU,A[14]=OU,A[15]=ZU,A[16]=QU,A[17]=JU,A[18]=GU,$!==0)A[19]=$,Q.length++;return Q};if(!Math.imul)_=k;function N(U,X,Q){Q.negative=X.negative^U.negative,Q.length=U.length+X.length;var T=0,O=0;for(var A=0;A>>26)|0,O+=$>>>26,$&=67108863}Q.words[A]=J,T=$,$=O}if(T!==0)Q.words[A]=T;else Q.length--;return Q.strip()}function v(U,X,Q){var T=new B;return T.mulp(U,X,Q)}Z.prototype.mulTo=function(U,X){var Q,T=this.length+U.length;if(this.length===10&&U.length===10)Q=_(this,U,X);else if(T<63)Q=k(this,U,X);else if(T<1024)Q=N(this,U,X);else Q=v(this,U,X);return Q};function B(U,X){this.x=U,this.y=X}B.prototype.makeRBT=function(U){var X=Array(U),Q=Z.prototype._countBits(U)-1;for(var T=0;T>=1;return T},B.prototype.permute=function(U,X,Q,T,O,A){for(var $=0;$>>1)O++;return 1<>>13,Q[2*A+1]=O&8191,O=O>>>13;for(A=2*X;A>=26,X+=T/67108864|0,X+=O>>>26,this.words[Q]=O&67108863}if(X!==0)this.words[Q]=X,this.length++;return this.length=U===0?1:this.length,this},Z.prototype.muln=function(U){return this.clone().imuln(U)},Z.prototype.sqr=function(){return this.mul(this)},Z.prototype.isqr=function(){return this.imul(this.clone())},Z.prototype.pow=function(U){var X=P(U);if(X.length===0)return new Z(1);var Q=this;for(var T=0;T=0);var X=U%26,Q=(U-X)/26,T=67108863>>>26-X<<26-X,O;if(X!==0){var A=0;for(O=0;O>>26-X}if(A)this.words[O]=A,this.length++}if(Q!==0){for(O=this.length-1;O>=0;O--)this.words[O+Q]=this.words[O];for(O=0;O=0);var T;if(X)T=(X-X%26)/26;else T=0;var O=U%26,A=Math.min((U-O)/26,this.length),$=67108863^67108863>>>O<A){this.length-=A;for(E=0;E=0&&(V!==0||E>=T);E--){var S=this.words[E]|0;this.words[E]=V<<26-O|S>>>O,V=S&$}if(J&&V!==0)J.words[J.length++]=V;if(this.length===0)this.words[0]=0,this.length=1;return this.strip()},Z.prototype.ishrn=function(U,X,Q){return L(this.negative===0),this.iushrn(U,X,Q)},Z.prototype.shln=function(U){return this.clone().ishln(U)},Z.prototype.ushln=function(U){return this.clone().iushln(U)},Z.prototype.shrn=function(U){return this.clone().ishrn(U)},Z.prototype.ushrn=function(U){return this.clone().iushrn(U)},Z.prototype.testn=function(U){L(typeof U==="number"&&U>=0);var X=U%26,Q=(U-X)/26,T=1<=0);var X=U%26,Q=(U-X)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=Q)return this;if(X!==0)Q++;if(this.length=Math.min(Q,this.length),X!==0){var T=67108863^67108863>>>X<=67108864;X++)if(this.words[X]-=67108864,X===this.length-1)this.words[X+1]=1;else this.words[X+1]++;return this.length=Math.max(this.length,X+1),this},Z.prototype.isubn=function(U){if(L(typeof U==="number"),L(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var X=0;X>26)-(J/67108864|0),this.words[O+Q]=A&67108863}for(;O>26,this.words[O+Q]=A&67108863;if($===0)return this.strip();L($===-1),$=0;for(O=0;O>26,this.words[O]=A&67108863;return this.negative=1,this.strip()},Z.prototype._wordDiv=function(U,X){var Q=this.length-U.length,T=this.clone(),O=U,A=O.words[O.length-1]|0,$=this._countBits(A);if(Q=26-$,Q!==0)O=O.ushln(Q),T.iushln(Q),A=O.words[O.length-1]|0;var J=T.length-O.length,E;if(X!=="mod"){E=new Z(null),E.length=J+1,E.words=Array(E.length);for(var V=0;V=0;H--){var j=(T.words[O.length+H]|0)*67108864+(T.words[O.length+H-1]|0);j=Math.min(j/A|0,67108863),T._ishlnsubmul(O,j,H);while(T.negative!==0)if(j--,T.negative=0,T._ishlnsubmul(O,1,H),!T.isZero())T.negative^=1;if(E)E.words[H]=j}if(E)E.strip();if(T.strip(),X!=="div"&&Q!==0)T.iushrn(Q);return{div:E||null,mod:T}},Z.prototype.divmod=function(U,X,Q){if(L(!U.isZero()),this.isZero())return{div:new Z(0),mod:new Z(0)};var T,O,A;if(this.negative!==0&&U.negative===0){if(A=this.neg().divmod(U,X),X!=="mod")T=A.div.neg();if(X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.iadd(U)}return{div:T,mod:O}}if(this.negative===0&&U.negative!==0){if(A=this.divmod(U.neg(),X),X!=="mod")T=A.div.neg();return{div:T,mod:A.mod}}if((this.negative&U.negative)!==0){if(A=this.neg().divmod(U.neg(),X),X!=="div"){if(O=A.mod.neg(),Q&&O.negative!==0)O.isub(U)}return{div:A.div,mod:O}}if(U.length>this.length||this.cmp(U)<0)return{div:new Z(0),mod:this};if(U.length===1){if(X==="div")return{div:this.divn(U.words[0]),mod:null};if(X==="mod")return{div:null,mod:new Z(this.modn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new Z(this.modn(U.words[0]))}}return this._wordDiv(U,X)},Z.prototype.div=function(U){return this.divmod(U,"div",!1).div},Z.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},Z.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},Z.prototype.divRound=function(U){var X=this.divmod(U);if(X.mod.isZero())return X.div;var Q=X.div.negative!==0?X.mod.isub(U):X.mod,T=U.ushrn(1),O=U.andln(1),A=Q.cmp(T);if(A<0||O===1&&A===0)return X.div;return X.div.negative!==0?X.div.isubn(1):X.div.iaddn(1)},Z.prototype.modn=function(U){L(U<=67108863);var X=67108864%U,Q=0;for(var T=this.length-1;T>=0;T--)Q=(X*Q+(this.words[T]|0))%U;return Q},Z.prototype.idivn=function(U){L(U<=67108863);var X=0;for(var Q=this.length-1;Q>=0;Q--){var T=(this.words[Q]|0)+X*67108864;this.words[Q]=T/U|0,X=T%U}return this.strip()},Z.prototype.divn=function(U){return this.clone().idivn(U)},Z.prototype.egcd=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=new Z(0),$=new Z(1),J=0;while(X.isEven()&&Q.isEven())X.iushrn(1),Q.iushrn(1),++J;var E=Q.clone(),V=X.clone();while(!X.isZero()){for(var S=0,H=1;(X.words[0]&H)===0&&S<26;++S,H<<=1);if(S>0){X.iushrn(S);while(S-- >0){if(T.isOdd()||O.isOdd())T.iadd(E),O.isub(V);T.iushrn(1),O.iushrn(1)}}for(var j=0,w=1;(Q.words[0]&w)===0&&j<26;++j,w<<=1);if(j>0){Q.iushrn(j);while(j-- >0){if(A.isOdd()||$.isOdd())A.iadd(E),$.isub(V);A.iushrn(1),$.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(A),O.isub($);else Q.isub(X),A.isub(T),$.isub(O)}return{a:A,b:$,gcd:Q.iushln(J)}},Z.prototype._invmp=function(U){L(U.negative===0),L(!U.isZero());var X=this,Q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var T=new Z(1),O=new Z(0),A=Q.clone();while(X.cmpn(1)>0&&Q.cmpn(1)>0){for(var $=0,J=1;(X.words[0]&J)===0&&$<26;++$,J<<=1);if($>0){X.iushrn($);while($-- >0){if(T.isOdd())T.iadd(A);T.iushrn(1)}}for(var E=0,V=1;(Q.words[0]&V)===0&&E<26;++E,V<<=1);if(E>0){Q.iushrn(E);while(E-- >0){if(O.isOdd())O.iadd(A);O.iushrn(1)}}if(X.cmp(Q)>=0)X.isub(Q),T.isub(O);else Q.isub(X),O.isub(T)}var S;if(X.cmpn(1)===0)S=T;else S=O;if(S.cmpn(0)<0)S.iadd(U);return S},Z.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var X=this.clone(),Q=U.clone();X.negative=0,Q.negative=0;for(var T=0;X.isEven()&&Q.isEven();T++)X.iushrn(1),Q.iushrn(1);do{while(X.isEven())X.iushrn(1);while(Q.isEven())Q.iushrn(1);var O=X.cmp(Q);if(O<0){var A=X;X=Q,Q=A}else if(O===0||Q.cmpn(1)===0)break;X.isub(Q)}while(!0);return Q.iushln(T)},Z.prototype.invm=function(U){return this.egcd(U).a.umod(U)},Z.prototype.isEven=function(){return(this.words[0]&1)===0},Z.prototype.isOdd=function(){return(this.words[0]&1)===1},Z.prototype.andln=function(U){return this.words[0]&U},Z.prototype.bincn=function(U){L(typeof U==="number");var X=U%26,Q=(U-X)/26,T=1<>>26,$&=67108863,this.words[A]=$}if(O!==0)this.words[A]=O,this.length++;return this},Z.prototype.isZero=function(){return this.length===1&&this.words[0]===0},Z.prototype.cmpn=function(U){var X=U<0;if(this.negative!==0&&!X)return-1;if(this.negative===0&&X)return 1;this.strip();var Q;if(this.length>1)Q=1;else{if(X)U=-U;L(U<=67108863,"Number is too big");var T=this.words[0]|0;Q=T===U?0:TU.length)return 1;if(this.length=0;Q--){var T=this.words[Q]|0,O=U.words[Q]|0;if(T===O)continue;if(TO)X=1;break}return X},Z.prototype.gtn=function(U){return this.cmpn(U)===1},Z.prototype.gt=function(U){return this.cmp(U)===1},Z.prototype.gten=function(U){return this.cmpn(U)>=0},Z.prototype.gte=function(U){return this.cmp(U)>=0},Z.prototype.ltn=function(U){return this.cmpn(U)===-1},Z.prototype.lt=function(U){return this.cmp(U)===-1},Z.prototype.lten=function(U){return this.cmpn(U)<=0},Z.prototype.lte=function(U){return this.cmp(U)<=0},Z.prototype.eqn=function(U){return this.cmpn(U)===0},Z.prototype.eq=function(U){return this.cmp(U)===0},Z.red=function(U){return new u(U)},Z.prototype.toRed=function(U){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},Z.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},Z.prototype._forceRed=function(U){return this.red=U,this},Z.prototype.forceRed=function(U){return L(!this.red,"Already a number in reduction context"),this._forceRed(U)},Z.prototype.redAdd=function(U){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},Z.prototype.redIAdd=function(U){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},Z.prototype.redSub=function(U){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},Z.prototype.redISub=function(U){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},Z.prototype.redShl=function(U){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},Z.prototype.redMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},Z.prototype.redIMul=function(U){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},Z.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},Z.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},Z.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},Z.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},Z.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},Z.prototype.redPow=function(U){return L(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var g={k256:null,p224:null,p192:null,p25519:null};function y(U,X){this.name=U,this.p=new Z(X,16),this.n=this.p.bitLength(),this.k=new Z(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var U=new Z(null);return U.words=Array(Math.ceil(this.n/13)),U},y.prototype.ireduce=function(U){var X=U,Q;do this.split(X,this.tmp),X=this.imulK(X),X=X.iadd(this.tmp),Q=X.bitLength();while(Q>this.n);var T=Q0)X.isub(this.p);else if(X.strip!==void 0)X.strip();else X._strip();return X},y.prototype.split=function(U,X){U.iushrn(this.n,0,X)},y.prototype.imulK=function(U){return U.imul(this.k)};function l(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(l,y),l.prototype.split=function(U,X){var Q=4194303,T=Math.min(U.length,9);for(var O=0;O>>22,A=$}if(A>>>=22,U.words[O-10]=A,A===0&&U.length>10)U.length-=10;else U.length-=9},l.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var X=0;for(var Q=0;Q>>=26,U.words[Q]=O,X=T}if(X!==0)U.words[U.length++]=X;return U},Z._prime=function(U){if(g[U])return g[U];var X;if(U==="k256")X=new l;else if(U==="p224")X=new Y0;else if(U==="p192")X=new Z0;else if(U==="p25519")X=new O0;else throw Error("Unknown prime "+U);return g[U]=X,X};function u(U){if(typeof U==="string"){var X=Z._prime(U);this.m=X.p,this.prime=X}else L(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}u.prototype._verify1=function(U){L(U.negative===0,"red works only with positives"),L(U.red,"red works only with red numbers")},u.prototype._verify2=function(U,X){L((U.negative|X.negative)===0,"red works only with positives"),L(U.red&&U.red===X.red,"red works only with red numbers")},u.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return U.umod(this.m)._forceRed(this)},u.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},u.prototype.add=function(U,X){this._verify2(U,X);var Q=U.add(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q._forceRed(this)},u.prototype.iadd=function(U,X){this._verify2(U,X);var Q=U.iadd(X);if(Q.cmp(this.m)>=0)Q.isub(this.m);return Q},u.prototype.sub=function(U,X){this._verify2(U,X);var Q=U.sub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q._forceRed(this)},u.prototype.isub=function(U,X){this._verify2(U,X);var Q=U.isub(X);if(Q.cmpn(0)<0)Q.iadd(this.m);return Q},u.prototype.shl=function(U,X){return this._verify1(U),this.imod(U.ushln(X))},u.prototype.imul=function(U,X){return this._verify2(U,X),this.imod(U.imul(X))},u.prototype.mul=function(U,X){return this._verify2(U,X),this.imod(U.mul(X))},u.prototype.isqr=function(U){return this.imul(U,U.clone())},u.prototype.sqr=function(U){return this.mul(U,U)},u.prototype.sqrt=function(U){if(U.isZero())return U.clone();var X=this.m.andln(3);if(L(X%2===1),X===3){var Q=this.m.add(new Z(1)).iushrn(2);return this.pow(U,Q)}var T=this.m.subn(1),O=0;while(!T.isZero()&&T.andln(1)===0)O++,T.iushrn(1);L(!T.isZero());var A=new Z(1).toRed(this),$=A.redNeg(),J=this.m.subn(1).iushrn(1),E=this.m.bitLength();E=new Z(2*E*E).toRed(this);while(this.pow(E,J).cmp($)!==0)E.redIAdd($);var V=this.pow(E,T),S=this.pow(U,T.addn(1).iushrn(1)),H=this.pow(U,T),j=O;while(H.cmp(A)!==0){var w=H;for(var p=0;w.cmp(A)!==0;p++)w=w.redSqr();L(p=0;O--){var V=X.words[O];for(var S=E-1;S>=0;S--){var H=V>>S&1;if(A!==T[0])A=this.sqr(A);if(H===0&&$===0){J=0;continue}if($<<=1,$|=H,J++,J!==Q&&(O!==0||S!==0))continue;A=this.mul(A,T[$]),J=0,$=0}E=26}return A},u.prototype.convertTo=function(U){var X=U.umod(this.m);return X===U?X.clone():X},u.prototype.convertFrom=function(U){var X=U.clone();return X.red=null,X},Z.mont=function(U){return new i(U)};function i(U){if(u.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new Z(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(i,u),i.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},i.prototype.convertFrom=function(U){var X=this.imod(U.mul(this.rinv));return X.red=null,X},i.prototype.imul=function(U,X){if(U.isZero()||X.isZero())return U.words[0]=0,U.length=1,U;var Q=U.imul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.mul=function(U,X){if(U.isZero()||X.isZero())return new Z(0)._forceRed(this);var Q=U.mul(X),T=Q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=Q.isub(T).iushrn(this.shift),A=O;if(O.cmp(this.m)>=0)A=O.isub(this.m);else if(O.cmpn(0)<0)A=O.iadd(this.m);return A._forceRed(this)},i.prototype.invm=function(U){var X=this.imod(U._invmp(this.m).mul(this.r2));return X._forceRed(this)}})(typeof Y>"u"||Y,I)}),NI=Q0((I,Y)=>{var G=yT(),K=SU().Buffer;function L(W,Z){return K.from(W.toRed(G.mont(Z.modulus)).redPow(new G(Z.publicExponent)).fromRed().toArray())}Y.exports=L}),NQ=Q0((I,Y)=>{(function(G,K){function L(T,O){if(!T)throw Error(O||"Assertion failed")}function W(T,O){T.super_=O;var A=function(){};A.prototype=O.prototype,T.prototype=new A,T.prototype.constructor=T}function Z(T,O,A){if(Z.isBN(T))return T;if(this.negative=0,this.words=null,this.length=0,this.red=null,T!==null){if(O==="le"||O==="be")A=O,O=10;this._init(T||0,O||10,A||"be")}}if(typeof G==="object")G.exports=Z;else K.BN=Z;Z.BN=Z,Z.wordSize=26;var z;try{if(typeof window<"u"&&typeof window.Buffer<"u")z=window.Buffer;else z=(FU(),h0(KU)).Buffer}catch(T){}Z.isBN=function(T){if(T instanceof Z)return!0;return T!==null&&typeof T==="object"&&T.constructor.wordSize===Z.wordSize&&Array.isArray(T.words)},Z.max=function(T,O){if(T.cmp(O)>0)return T;return O},Z.min=function(T,O){if(T.cmp(O)<0)return T;return O},Z.prototype._init=function(T,O,A){if(typeof T==="number")return this._initNumber(T,O,A);if(typeof T==="object")return this._initArray(T,O,A);if(O==="hex")O=16;L(O===(O|0)&&O>=2&&O<=36),T=T.toString().replace(/\s+/g,"");var $=0;if(T[0]==="-")$++,this.negative=1;if($=0;$-=3)if(E=T[$]|T[$-1]<<8|T[$-2]<<16,this.words[J]|=E<>>26-V&67108863,V+=24,V>=26)V-=26,J++}else if(A==="le"){for($=0,J=0;$>>26-V&67108863,V+=24,V>=26)V-=26,J++}return this._strip()};function q(T,O){var A=T.charCodeAt(O);if(A>=48&&A<=57)return A-48;else if(A>=65&&A<=70)return A-55;else if(A>=97&&A<=102)return A-87;else L(!1,"Invalid character in "+T)}function C(T,O,A){var $=q(T,A);if(A-1>=O)$|=q(T,A-1)<<4;return $}Z.prototype._parseHex=function(T,O,A){this.length=Math.ceil((T.length-O)/6),this.words=Array(this.length);for(var $=0;$=O;$-=2)if(V=C(T,O,$)<=18)J-=18,E+=1,this.words[E]|=V>>>26;else J+=8;else{var S=T.length-O;for($=S%2===0?O+1:O;$=18)J-=18,E+=1,this.words[E]|=V>>>26;else J+=8}this._strip()};function D(T,O,A,$){var J=0,E=0,V=Math.min(T.length,A);for(var S=O;S=49)E=H-49+10;else if(H>=17)E=H-17+10;else E=H;L(H>=0&&E<$,"Invalid character"),J+=E}return J}Z.prototype._parseBase=function(T,O,A){this.words=[0],this.length=1;for(var $=0,J=1;J<=67108863;J*=O)$++;$--,J=J/O|0;var E=T.length-A,V=E%$,S=Math.min(E,E-V)+A,H=0;for(var j=A;j1&&this.words[this.length-1]===0)this.length--;return this._normSign()},Z.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{Z.prototype[Symbol.for("nodejs.util.inspect.custom")]=R}catch(T){Z.prototype.inspect=R}else Z.prototype.inspect=R;function R(){return(this.red?""}var M=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],P=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(Z.prototype.toString=function(T,O){T=T||10,O=O|0||1;var A;if(T===16||T==="hex"){A="";var $=0,J=0;for(var E=0;E>>24-$&16777215,$+=2,$>=26)$-=26,E--;if(J!==0||E!==this.length-1)A=M[6-S.length]+S+A;else A=S+A}if(J!==0)A=J.toString(16)+A;while(A.length%O!==0)A="0"+A;if(this.negative!==0)A="-"+A;return A}if(T===(T|0)&&T>=2&&T<=36){var H=P[T],j=k[T];A="";var w=this.clone();w.negative=0;while(!w.isZero()){var p=w.modrn(j).toString(T);if(w=w.idivn(j),!w.isZero())A=M[H-p.length]+p+A;else A=p+A}if(this.isZero())A="0"+A;while(A.length%O!==0)A="0"+A;if(this.negative!==0)A="-"+A;return A}L(!1,"Base should be between 2 and 36")},Z.prototype.toNumber=function(){var T=this.words[0];if(this.length===2)T+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)T+=4503599627370496+this.words[1]*67108864;else if(this.length>2)L(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-T:T},Z.prototype.toJSON=function(){return this.toString(16,2)},z)Z.prototype.toBuffer=function(T,O){return this.toArrayLike(z,T,O)};Z.prototype.toArray=function(T,O){return this.toArrayLike(Array,T,O)};var _=function(T,O){if(T.allocUnsafe)return T.allocUnsafe(O);return new T(O)};if(Z.prototype.toArrayLike=function(T,O,A){this._strip();var $=this.byteLength(),J=A||Math.max(1,$);L($<=J,"byte array longer than desired length"),L(J>0,"Requested array length <= 0");var E=_(T,J),V=O==="le"?"LE":"BE";return this["_toArrayLike"+V](E,$),E},Z.prototype._toArrayLikeLE=function(T,O){var A=0,$=0;for(var J=0,E=0;J>8&255;if(A>16&255;if(E===6){if(A>24&255;$=0,E=0}else $=V>>>24,E+=2}if(A=0)T[A--]=V>>8&255;if(A>=0)T[A--]=V>>16&255;if(E===6){if(A>=0)T[A--]=V>>24&255;$=0,E=0}else $=V>>>24,E+=2}if(A>=0){T[A--]=$;while(A>=0)T[A--]=0}},Math.clz32)Z.prototype._countBits=function(T){return 32-Math.clz32(T)};else Z.prototype._countBits=function(T){var O=T,A=0;if(O>=4096)A+=13,O>>>=13;if(O>=64)A+=7,O>>>=7;if(O>=8)A+=4,O>>>=4;if(O>=2)A+=2,O>>>=2;return A+O};Z.prototype._zeroBits=function(T){if(T===0)return 26;var O=T,A=0;if((O&8191)===0)A+=13,O>>>=13;if((O&127)===0)A+=7,O>>>=7;if((O&15)===0)A+=4,O>>>=4;if((O&3)===0)A+=2,O>>>=2;if((O&1)===0)A++;return A},Z.prototype.bitLength=function(){var T=this.words[this.length-1],O=this._countBits(T);return(this.length-1)*26+O};function N(T){var O=Array(T.bitLength());for(var A=0;A>>J&1}return O}Z.prototype.zeroBits=function(){if(this.isZero())return 0;var T=0;for(var O=0;OT.length)return this.clone().ior(T);return T.clone().ior(this)},Z.prototype.uor=function(T){if(this.length>T.length)return this.clone().iuor(T);return T.clone().iuor(this)},Z.prototype.iuand=function(T){var O;if(this.length>T.length)O=T;else O=this;for(var A=0;AT.length)return this.clone().iand(T);return T.clone().iand(this)},Z.prototype.uand=function(T){if(this.length>T.length)return this.clone().iuand(T);return T.clone().iuand(this)},Z.prototype.iuxor=function(T){var O,A;if(this.length>T.length)O=this,A=T;else O=T,A=this;for(var $=0;$T.length)return this.clone().ixor(T);return T.clone().ixor(this)},Z.prototype.uxor=function(T){if(this.length>T.length)return this.clone().iuxor(T);return T.clone().iuxor(this)},Z.prototype.inotn=function(T){L(typeof T==="number"&&T>=0);var O=Math.ceil(T/26)|0,A=T%26;if(this._expand(O),A>0)O--;for(var $=0;$0)this.words[$]=~this.words[$]&67108863>>26-A;return this._strip()},Z.prototype.notn=function(T){return this.clone().inotn(T)},Z.prototype.setn=function(T,O){L(typeof T==="number"&&T>=0);var A=T/26|0,$=T%26;if(this._expand(A+1),O)this.words[A]=this.words[A]|1<<$;else this.words[A]=this.words[A]&~(1<<$);return this._strip()},Z.prototype.iadd=function(T){var O;if(this.negative!==0&&T.negative===0)return this.negative=0,O=this.isub(T),this.negative^=1,this._normSign();else if(this.negative===0&&T.negative!==0)return T.negative=0,O=this.isub(T),T.negative=1,O._normSign();var A,$;if(this.length>T.length)A=this,$=T;else A=T,$=this;var J=0;for(var E=0;E<$.length;E++)O=(A.words[E]|0)+($.words[E]|0)+J,this.words[E]=O&67108863,J=O>>>26;for(;J!==0&&E>>26;if(this.length=A.length,J!==0)this.words[this.length]=J,this.length++;else if(A!==this)for(;ET.length)return this.clone().iadd(T);return T.clone().iadd(this)},Z.prototype.isub=function(T){if(T.negative!==0){T.negative=0;var O=this.iadd(T);return T.negative=1,O._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(T),this.negative=1,this._normSign();var A=this.cmp(T);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var $,J;if(A>0)$=this,J=T;else $=T,J=this;var E=0;for(var V=0;V>26,this.words[V]=O&67108863;for(;E!==0&&V<$.length;V++)O=($.words[V]|0)+E,E=O>>26,this.words[V]=O&67108863;if(E===0&&V<$.length&&$!==this)for(;V<$.length;V++)this.words[V]=$.words[V];if(this.length=Math.max(this.length,V),$!==this)this.negative=1;return this._strip()},Z.prototype.sub=function(T){return this.clone().isub(T)};function v(T,O,A){A.negative=O.negative^T.negative;var $=T.length+O.length|0;A.length=$,$=$-1|0;var J=T.words[0]|0,E=O.words[0]|0,V=J*E,S=V&67108863,H=V/67108864|0;A.words[0]=S;for(var j=1;j<$;j++){var w=H>>>26,p=H&67108863,n=Math.min(j,O.length-1);for(var G0=Math.max(0,j-T.length+1);G0<=n;G0++){var t=j-G0|0;J=T.words[t]|0,E=O.words[G0]|0,V=J*E+p,w+=V/67108864|0,p=V&67108863}A.words[j]=p|0,H=w|0}if(H!==0)A.words[j]=H|0;else A.length--;return A._strip()}var B=function(T,O,A){var $=T.words,J=O.words,E=A.words,V=0,S,H,j,w=$[0]|0,p=w&8191,n=w>>>13,G0=$[1]|0,t=G0&8191,d=G0>>>13,X0=$[2]|0,m=X0&8191,U0=X0>>>13,g0=$[3]|0,f=g0&8191,h=g0>>>13,I0=$[4]|0,r=I0&8191,e=I0>>>13,D0=$[5]|0,c=D0&8191,o=D0>>>13,x0=$[6]|0,s=x0&8191,T0=x0>>>13,y0=$[7]|0,L0=y0&8191,$0=y0>>>13,n0=$[8]|0,V0=n0&8191,K0=n0>>>13,t0=$[9]|0,H0=t0&8191,W0=t0>>>13,RU=J[0]|0,C0=RU&8191,_0=RU>>>13,DU=J[1]|0,k0=DU&8191,z0=DU>>>13,WU=J[2]|0,v0=WU&8191,S0=WU>>>13,AU=J[3]|0,j0=AU&8191,N0=AU>>>13,LU=J[4]|0,M0=LU&8191,x=LU>>>13,b=J[5]|0,a=b&8191,E0=b>>>13,w0=J[6]|0,A0=w0&8191,F0=w0>>>13,m0=J[7]|0,q0=m0&8191,B0=m0>>>13,HU=J[8]|0,P0=HU&8191,R0=HU>>>13,s0=J[9]|0,c0=s0&8191,f0=s0>>>13;A.negative=T.negative^O.negative,A.length=19,S=Math.imul(p,C0),H=Math.imul(p,_0),H=H+Math.imul(n,C0)|0,j=Math.imul(n,_0);var d0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(d0>>>26)|0,d0&=67108863,S=Math.imul(t,C0),H=Math.imul(t,_0),H=H+Math.imul(d,C0)|0,j=Math.imul(d,_0),S=S+Math.imul(p,k0)|0,H=H+Math.imul(p,z0)|0,H=H+Math.imul(n,k0)|0,j=j+Math.imul(n,z0)|0;var b0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(b0>>>26)|0,b0&=67108863,S=Math.imul(m,C0),H=Math.imul(m,_0),H=H+Math.imul(U0,C0)|0,j=Math.imul(U0,_0),S=S+Math.imul(t,k0)|0,H=H+Math.imul(t,z0)|0,H=H+Math.imul(d,k0)|0,j=j+Math.imul(d,z0)|0,S=S+Math.imul(p,v0)|0,H=H+Math.imul(p,S0)|0,H=H+Math.imul(n,v0)|0,j=j+Math.imul(n,S0)|0;var a0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(a0>>>26)|0,a0&=67108863,S=Math.imul(f,C0),H=Math.imul(f,_0),H=H+Math.imul(h,C0)|0,j=Math.imul(h,_0),S=S+Math.imul(m,k0)|0,H=H+Math.imul(m,z0)|0,H=H+Math.imul(U0,k0)|0,j=j+Math.imul(U0,z0)|0,S=S+Math.imul(t,v0)|0,H=H+Math.imul(t,S0)|0,H=H+Math.imul(d,v0)|0,j=j+Math.imul(d,S0)|0,S=S+Math.imul(p,j0)|0,H=H+Math.imul(p,N0)|0,H=H+Math.imul(n,j0)|0,j=j+Math.imul(n,N0)|0;var e0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(e0>>>26)|0,e0&=67108863,S=Math.imul(r,C0),H=Math.imul(r,_0),H=H+Math.imul(e,C0)|0,j=Math.imul(e,_0),S=S+Math.imul(f,k0)|0,H=H+Math.imul(f,z0)|0,H=H+Math.imul(h,k0)|0,j=j+Math.imul(h,z0)|0,S=S+Math.imul(m,v0)|0,H=H+Math.imul(m,S0)|0,H=H+Math.imul(U0,v0)|0,j=j+Math.imul(U0,S0)|0,S=S+Math.imul(t,j0)|0,H=H+Math.imul(t,N0)|0,H=H+Math.imul(d,j0)|0,j=j+Math.imul(d,N0)|0,S=S+Math.imul(p,M0)|0,H=H+Math.imul(p,x)|0,H=H+Math.imul(n,M0)|0,j=j+Math.imul(n,x)|0;var i0=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(i0>>>26)|0,i0&=67108863,S=Math.imul(c,C0),H=Math.imul(c,_0),H=H+Math.imul(o,C0)|0,j=Math.imul(o,_0),S=S+Math.imul(r,k0)|0,H=H+Math.imul(r,z0)|0,H=H+Math.imul(e,k0)|0,j=j+Math.imul(e,z0)|0,S=S+Math.imul(f,v0)|0,H=H+Math.imul(f,S0)|0,H=H+Math.imul(h,v0)|0,j=j+Math.imul(h,S0)|0,S=S+Math.imul(m,j0)|0,H=H+Math.imul(m,N0)|0,H=H+Math.imul(U0,j0)|0,j=j+Math.imul(U0,N0)|0,S=S+Math.imul(t,M0)|0,H=H+Math.imul(t,x)|0,H=H+Math.imul(d,M0)|0,j=j+Math.imul(d,x)|0,S=S+Math.imul(p,a)|0,H=H+Math.imul(p,E0)|0,H=H+Math.imul(n,a)|0,j=j+Math.imul(n,E0)|0;var UU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(UU>>>26)|0,UU&=67108863,S=Math.imul(s,C0),H=Math.imul(s,_0),H=H+Math.imul(T0,C0)|0,j=Math.imul(T0,_0),S=S+Math.imul(c,k0)|0,H=H+Math.imul(c,z0)|0,H=H+Math.imul(o,k0)|0,j=j+Math.imul(o,z0)|0,S=S+Math.imul(r,v0)|0,H=H+Math.imul(r,S0)|0,H=H+Math.imul(e,v0)|0,j=j+Math.imul(e,S0)|0,S=S+Math.imul(f,j0)|0,H=H+Math.imul(f,N0)|0,H=H+Math.imul(h,j0)|0,j=j+Math.imul(h,N0)|0,S=S+Math.imul(m,M0)|0,H=H+Math.imul(m,x)|0,H=H+Math.imul(U0,M0)|0,j=j+Math.imul(U0,x)|0,S=S+Math.imul(t,a)|0,H=H+Math.imul(t,E0)|0,H=H+Math.imul(d,a)|0,j=j+Math.imul(d,E0)|0,S=S+Math.imul(p,A0)|0,H=H+Math.imul(p,F0)|0,H=H+Math.imul(n,A0)|0,j=j+Math.imul(n,F0)|0;var EU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(EU>>>26)|0,EU&=67108863,S=Math.imul(L0,C0),H=Math.imul(L0,_0),H=H+Math.imul($0,C0)|0,j=Math.imul($0,_0),S=S+Math.imul(s,k0)|0,H=H+Math.imul(s,z0)|0,H=H+Math.imul(T0,k0)|0,j=j+Math.imul(T0,z0)|0,S=S+Math.imul(c,v0)|0,H=H+Math.imul(c,S0)|0,H=H+Math.imul(o,v0)|0,j=j+Math.imul(o,S0)|0,S=S+Math.imul(r,j0)|0,H=H+Math.imul(r,N0)|0,H=H+Math.imul(e,j0)|0,j=j+Math.imul(e,N0)|0,S=S+Math.imul(f,M0)|0,H=H+Math.imul(f,x)|0,H=H+Math.imul(h,M0)|0,j=j+Math.imul(h,x)|0,S=S+Math.imul(m,a)|0,H=H+Math.imul(m,E0)|0,H=H+Math.imul(U0,a)|0,j=j+Math.imul(U0,E0)|0,S=S+Math.imul(t,A0)|0,H=H+Math.imul(t,F0)|0,H=H+Math.imul(d,A0)|0,j=j+Math.imul(d,F0)|0,S=S+Math.imul(p,q0)|0,H=H+Math.imul(p,B0)|0,H=H+Math.imul(n,q0)|0,j=j+Math.imul(n,B0)|0;var TU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(TU>>>26)|0,TU&=67108863,S=Math.imul(V0,C0),H=Math.imul(V0,_0),H=H+Math.imul(K0,C0)|0,j=Math.imul(K0,_0),S=S+Math.imul(L0,k0)|0,H=H+Math.imul(L0,z0)|0,H=H+Math.imul($0,k0)|0,j=j+Math.imul($0,z0)|0,S=S+Math.imul(s,v0)|0,H=H+Math.imul(s,S0)|0,H=H+Math.imul(T0,v0)|0,j=j+Math.imul(T0,S0)|0,S=S+Math.imul(c,j0)|0,H=H+Math.imul(c,N0)|0,H=H+Math.imul(o,j0)|0,j=j+Math.imul(o,N0)|0,S=S+Math.imul(r,M0)|0,H=H+Math.imul(r,x)|0,H=H+Math.imul(e,M0)|0,j=j+Math.imul(e,x)|0,S=S+Math.imul(f,a)|0,H=H+Math.imul(f,E0)|0,H=H+Math.imul(h,a)|0,j=j+Math.imul(h,E0)|0,S=S+Math.imul(m,A0)|0,H=H+Math.imul(m,F0)|0,H=H+Math.imul(U0,A0)|0,j=j+Math.imul(U0,F0)|0,S=S+Math.imul(t,q0)|0,H=H+Math.imul(t,B0)|0,H=H+Math.imul(d,q0)|0,j=j+Math.imul(d,B0)|0,S=S+Math.imul(p,P0)|0,H=H+Math.imul(p,R0)|0,H=H+Math.imul(n,P0)|0,j=j+Math.imul(n,R0)|0;var XU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(XU>>>26)|0,XU&=67108863,S=Math.imul(H0,C0),H=Math.imul(H0,_0),H=H+Math.imul(W0,C0)|0,j=Math.imul(W0,_0),S=S+Math.imul(V0,k0)|0,H=H+Math.imul(V0,z0)|0,H=H+Math.imul(K0,k0)|0,j=j+Math.imul(K0,z0)|0,S=S+Math.imul(L0,v0)|0,H=H+Math.imul(L0,S0)|0,H=H+Math.imul($0,v0)|0,j=j+Math.imul($0,S0)|0,S=S+Math.imul(s,j0)|0,H=H+Math.imul(s,N0)|0,H=H+Math.imul(T0,j0)|0,j=j+Math.imul(T0,N0)|0,S=S+Math.imul(c,M0)|0,H=H+Math.imul(c,x)|0,H=H+Math.imul(o,M0)|0,j=j+Math.imul(o,x)|0,S=S+Math.imul(r,a)|0,H=H+Math.imul(r,E0)|0,H=H+Math.imul(e,a)|0,j=j+Math.imul(e,E0)|0,S=S+Math.imul(f,A0)|0,H=H+Math.imul(f,F0)|0,H=H+Math.imul(h,A0)|0,j=j+Math.imul(h,F0)|0,S=S+Math.imul(m,q0)|0,H=H+Math.imul(m,B0)|0,H=H+Math.imul(U0,q0)|0,j=j+Math.imul(U0,B0)|0,S=S+Math.imul(t,P0)|0,H=H+Math.imul(t,R0)|0,H=H+Math.imul(d,P0)|0,j=j+Math.imul(d,R0)|0,S=S+Math.imul(p,c0)|0,H=H+Math.imul(p,f0)|0,H=H+Math.imul(n,c0)|0,j=j+Math.imul(n,f0)|0;var IU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(IU>>>26)|0,IU&=67108863,S=Math.imul(H0,k0),H=Math.imul(H0,z0),H=H+Math.imul(W0,k0)|0,j=Math.imul(W0,z0),S=S+Math.imul(V0,v0)|0,H=H+Math.imul(V0,S0)|0,H=H+Math.imul(K0,v0)|0,j=j+Math.imul(K0,S0)|0,S=S+Math.imul(L0,j0)|0,H=H+Math.imul(L0,N0)|0,H=H+Math.imul($0,j0)|0,j=j+Math.imul($0,N0)|0,S=S+Math.imul(s,M0)|0,H=H+Math.imul(s,x)|0,H=H+Math.imul(T0,M0)|0,j=j+Math.imul(T0,x)|0,S=S+Math.imul(c,a)|0,H=H+Math.imul(c,E0)|0,H=H+Math.imul(o,a)|0,j=j+Math.imul(o,E0)|0,S=S+Math.imul(r,A0)|0,H=H+Math.imul(r,F0)|0,H=H+Math.imul(e,A0)|0,j=j+Math.imul(e,F0)|0,S=S+Math.imul(f,q0)|0,H=H+Math.imul(f,B0)|0,H=H+Math.imul(h,q0)|0,j=j+Math.imul(h,B0)|0,S=S+Math.imul(m,P0)|0,H=H+Math.imul(m,R0)|0,H=H+Math.imul(U0,P0)|0,j=j+Math.imul(U0,R0)|0,S=S+Math.imul(t,c0)|0,H=H+Math.imul(t,f0)|0,H=H+Math.imul(d,c0)|0,j=j+Math.imul(d,f0)|0;var YU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(YU>>>26)|0,YU&=67108863,S=Math.imul(H0,v0),H=Math.imul(H0,S0),H=H+Math.imul(W0,v0)|0,j=Math.imul(W0,S0),S=S+Math.imul(V0,j0)|0,H=H+Math.imul(V0,N0)|0,H=H+Math.imul(K0,j0)|0,j=j+Math.imul(K0,N0)|0,S=S+Math.imul(L0,M0)|0,H=H+Math.imul(L0,x)|0,H=H+Math.imul($0,M0)|0,j=j+Math.imul($0,x)|0,S=S+Math.imul(s,a)|0,H=H+Math.imul(s,E0)|0,H=H+Math.imul(T0,a)|0,j=j+Math.imul(T0,E0)|0,S=S+Math.imul(c,A0)|0,H=H+Math.imul(c,F0)|0,H=H+Math.imul(o,A0)|0,j=j+Math.imul(o,F0)|0,S=S+Math.imul(r,q0)|0,H=H+Math.imul(r,B0)|0,H=H+Math.imul(e,q0)|0,j=j+Math.imul(e,B0)|0,S=S+Math.imul(f,P0)|0,H=H+Math.imul(f,R0)|0,H=H+Math.imul(h,P0)|0,j=j+Math.imul(h,R0)|0,S=S+Math.imul(m,c0)|0,H=H+Math.imul(m,f0)|0,H=H+Math.imul(U0,c0)|0,j=j+Math.imul(U0,f0)|0;var OU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(OU>>>26)|0,OU&=67108863,S=Math.imul(H0,j0),H=Math.imul(H0,N0),H=H+Math.imul(W0,j0)|0,j=Math.imul(W0,N0),S=S+Math.imul(V0,M0)|0,H=H+Math.imul(V0,x)|0,H=H+Math.imul(K0,M0)|0,j=j+Math.imul(K0,x)|0,S=S+Math.imul(L0,a)|0,H=H+Math.imul(L0,E0)|0,H=H+Math.imul($0,a)|0,j=j+Math.imul($0,E0)|0,S=S+Math.imul(s,A0)|0,H=H+Math.imul(s,F0)|0,H=H+Math.imul(T0,A0)|0,j=j+Math.imul(T0,F0)|0,S=S+Math.imul(c,q0)|0,H=H+Math.imul(c,B0)|0,H=H+Math.imul(o,q0)|0,j=j+Math.imul(o,B0)|0,S=S+Math.imul(r,P0)|0,H=H+Math.imul(r,R0)|0,H=H+Math.imul(e,P0)|0,j=j+Math.imul(e,R0)|0,S=S+Math.imul(f,c0)|0,H=H+Math.imul(f,f0)|0,H=H+Math.imul(h,c0)|0,j=j+Math.imul(h,f0)|0;var ZU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(ZU>>>26)|0,ZU&=67108863,S=Math.imul(H0,M0),H=Math.imul(H0,x),H=H+Math.imul(W0,M0)|0,j=Math.imul(W0,x),S=S+Math.imul(V0,a)|0,H=H+Math.imul(V0,E0)|0,H=H+Math.imul(K0,a)|0,j=j+Math.imul(K0,E0)|0,S=S+Math.imul(L0,A0)|0,H=H+Math.imul(L0,F0)|0,H=H+Math.imul($0,A0)|0,j=j+Math.imul($0,F0)|0,S=S+Math.imul(s,q0)|0,H=H+Math.imul(s,B0)|0,H=H+Math.imul(T0,q0)|0,j=j+Math.imul(T0,B0)|0,S=S+Math.imul(c,P0)|0,H=H+Math.imul(c,R0)|0,H=H+Math.imul(o,P0)|0,j=j+Math.imul(o,R0)|0,S=S+Math.imul(r,c0)|0,H=H+Math.imul(r,f0)|0,H=H+Math.imul(e,c0)|0,j=j+Math.imul(e,f0)|0;var QU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(QU>>>26)|0,QU&=67108863,S=Math.imul(H0,a),H=Math.imul(H0,E0),H=H+Math.imul(W0,a)|0,j=Math.imul(W0,E0),S=S+Math.imul(V0,A0)|0,H=H+Math.imul(V0,F0)|0,H=H+Math.imul(K0,A0)|0,j=j+Math.imul(K0,F0)|0,S=S+Math.imul(L0,q0)|0,H=H+Math.imul(L0,B0)|0,H=H+Math.imul($0,q0)|0,j=j+Math.imul($0,B0)|0,S=S+Math.imul(s,P0)|0,H=H+Math.imul(s,R0)|0,H=H+Math.imul(T0,P0)|0,j=j+Math.imul(T0,R0)|0,S=S+Math.imul(c,c0)|0,H=H+Math.imul(c,f0)|0,H=H+Math.imul(o,c0)|0,j=j+Math.imul(o,f0)|0;var JU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(JU>>>26)|0,JU&=67108863,S=Math.imul(H0,A0),H=Math.imul(H0,F0),H=H+Math.imul(W0,A0)|0,j=Math.imul(W0,F0),S=S+Math.imul(V0,q0)|0,H=H+Math.imul(V0,B0)|0,H=H+Math.imul(K0,q0)|0,j=j+Math.imul(K0,B0)|0,S=S+Math.imul(L0,P0)|0,H=H+Math.imul(L0,R0)|0,H=H+Math.imul($0,P0)|0,j=j+Math.imul($0,R0)|0,S=S+Math.imul(s,c0)|0,H=H+Math.imul(s,f0)|0,H=H+Math.imul(T0,c0)|0,j=j+Math.imul(T0,f0)|0;var GU=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(GU>>>26)|0,GU&=67108863,S=Math.imul(H0,q0),H=Math.imul(H0,B0),H=H+Math.imul(W0,q0)|0,j=Math.imul(W0,B0),S=S+Math.imul(V0,P0)|0,H=H+Math.imul(V0,R0)|0,H=H+Math.imul(K0,P0)|0,j=j+Math.imul(K0,R0)|0,S=S+Math.imul(L0,c0)|0,H=H+Math.imul(L0,f0)|0,H=H+Math.imul($0,c0)|0,j=j+Math.imul($0,f0)|0;var aE=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(aE>>>26)|0,aE&=67108863,S=Math.imul(H0,P0),H=Math.imul(H0,R0),H=H+Math.imul(W0,P0)|0,j=Math.imul(W0,R0),S=S+Math.imul(V0,c0)|0,H=H+Math.imul(V0,f0)|0,H=H+Math.imul(K0,c0)|0,j=j+Math.imul(K0,f0)|0;var eE=(V+S|0)+((H&8191)<<13)|0;V=(j+(H>>>13)|0)+(eE>>>26)|0,eE&=67108863,S=Math.imul(H0,c0),H=Math.imul(H0,f0),H=H+Math.imul(W0,c0)|0,j=Math.imul(W0,f0);var iE=(V+S|0)+((H&8191)<<13)|0;if(V=(j+(H>>>13)|0)+(iE>>>26)|0,iE&=67108863,E[0]=d0,E[1]=b0,E[2]=a0,E[3]=e0,E[4]=i0,E[5]=UU,E[6]=EU,E[7]=TU,E[8]=XU,E[9]=IU,E[10]=YU,E[11]=OU,E[12]=ZU,E[13]=QU,E[14]=JU,E[15]=GU,E[16]=aE,E[17]=eE,E[18]=iE,V!==0)E[19]=V,A.length++;return A};if(!Math.imul)B=v;function g(T,O,A){A.negative=O.negative^T.negative,A.length=T.length+O.length;var $=0,J=0;for(var E=0;E>>26)|0,J+=V>>>26,V&=67108863}A.words[E]=S,$=V,V=J}if($!==0)A.words[E]=$;else A.length--;return A._strip()}function y(T,O,A){return g(T,O,A)}Z.prototype.mulTo=function(T,O){var A,$=this.length+T.length;if(this.length===10&&T.length===10)A=B(this,T,O);else if($<63)A=v(this,T,O);else if($<1024)A=g(this,T,O);else A=y(this,T,O);return A};function l(T,O){this.x=T,this.y=O}l.prototype.makeRBT=function(T){var O=Array(T),A=Z.prototype._countBits(T)-1;for(var $=0;$>=1;return $},l.prototype.permute=function(T,O,A,$,J,E){for(var V=0;V>>1)J++;return 1<>>13,A[2*E+1]=J&8191,J=J>>>13;for(E=2*O;E<$;++E)A[E]=0;L(J===0),L((J&-8192)===0)},l.prototype.stub=function(T){var O=Array(T);for(var A=0;A>=26,A+=J/67108864|0,A+=E>>>26,this.words[$]=E&67108863}if(A!==0)this.words[$]=A,this.length++;return this.length=T===0?1:this.length,O?this.ineg():this},Z.prototype.muln=function(T){return this.clone().imuln(T)},Z.prototype.sqr=function(){return this.mul(this)},Z.prototype.isqr=function(){return this.imul(this.clone())},Z.prototype.pow=function(T){var O=N(T);if(O.length===0)return new Z(1);var A=this;for(var $=0;$=0);var O=T%26,A=(T-O)/26,$=67108863>>>26-O<<26-O,J;if(O!==0){var E=0;for(J=0;J>>26-O}if(E)this.words[J]=E,this.length++}if(A!==0){for(J=this.length-1;J>=0;J--)this.words[J+A]=this.words[J];for(J=0;J=0);var $;if(O)$=(O-O%26)/26;else $=0;var J=T%26,E=Math.min((T-J)/26,this.length),V=67108863^67108863>>>J<E){this.length-=E;for(H=0;H=0&&(j!==0||H>=$);H--){var w=this.words[H]|0;this.words[H]=j<<26-J|w>>>J,j=w&V}if(S&&j!==0)S.words[S.length++]=j;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},Z.prototype.ishrn=function(T,O,A){return L(this.negative===0),this.iushrn(T,O,A)},Z.prototype.shln=function(T){return this.clone().ishln(T)},Z.prototype.ushln=function(T){return this.clone().iushln(T)},Z.prototype.shrn=function(T){return this.clone().ishrn(T)},Z.prototype.ushrn=function(T){return this.clone().iushrn(T)},Z.prototype.testn=function(T){L(typeof T==="number"&&T>=0);var O=T%26,A=(T-O)/26,$=1<=0);var O=T%26,A=(T-O)/26;if(L(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(O!==0)A++;if(this.length=Math.min(A,this.length),O!==0){var $=67108863^67108863>>>O<=67108864;O++)if(this.words[O]-=67108864,O===this.length-1)this.words[O+1]=1;else this.words[O+1]++;return this.length=Math.max(this.length,O+1),this},Z.prototype.isubn=function(T){if(L(typeof T==="number"),L(T<67108864),T<0)return this.iaddn(-T);if(this.negative!==0)return this.negative=0,this.iaddn(T),this.negative=1,this;if(this.words[0]-=T,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var O=0;O>26)-(S/67108864|0),this.words[J+A]=E&67108863}for(;J>26,this.words[J+A]=E&67108863;if(V===0)return this._strip();L(V===-1),V=0;for(J=0;J>26,this.words[J]=E&67108863;return this.negative=1,this._strip()},Z.prototype._wordDiv=function(T,O){var A=this.length-T.length,$=this.clone(),J=T,E=J.words[J.length-1]|0,V=this._countBits(E);if(A=26-V,A!==0)J=J.ushln(A),$.iushln(A),E=J.words[J.length-1]|0;var S=$.length-J.length,H;if(O!=="mod"){H=new Z(null),H.length=S+1,H.words=Array(H.length);for(var j=0;j=0;p--){var n=($.words[J.length+p]|0)*67108864+($.words[J.length+p-1]|0);n=Math.min(n/E|0,67108863),$._ishlnsubmul(J,n,p);while($.negative!==0)if(n--,$.negative=0,$._ishlnsubmul(J,1,p),!$.isZero())$.negative^=1;if(H)H.words[p]=n}if(H)H._strip();if($._strip(),O!=="div"&&A!==0)$.iushrn(A);return{div:H||null,mod:$}},Z.prototype.divmod=function(T,O,A){if(L(!T.isZero()),this.isZero())return{div:new Z(0),mod:new Z(0)};var $,J,E;if(this.negative!==0&&T.negative===0){if(E=this.neg().divmod(T,O),O!=="mod")$=E.div.neg();if(O!=="div"){if(J=E.mod.neg(),A&&J.negative!==0)J.iadd(T)}return{div:$,mod:J}}if(this.negative===0&&T.negative!==0){if(E=this.divmod(T.neg(),O),O!=="mod")$=E.div.neg();return{div:$,mod:E.mod}}if((this.negative&T.negative)!==0){if(E=this.neg().divmod(T.neg(),O),O!=="div"){if(J=E.mod.neg(),A&&J.negative!==0)J.isub(T)}return{div:E.div,mod:J}}if(T.length>this.length||this.cmp(T)<0)return{div:new Z(0),mod:this};if(T.length===1){if(O==="div")return{div:this.divn(T.words[0]),mod:null};if(O==="mod")return{div:null,mod:new Z(this.modrn(T.words[0]))};return{div:this.divn(T.words[0]),mod:new Z(this.modrn(T.words[0]))}}return this._wordDiv(T,O)},Z.prototype.div=function(T){return this.divmod(T,"div",!1).div},Z.prototype.mod=function(T){return this.divmod(T,"mod",!1).mod},Z.prototype.umod=function(T){return this.divmod(T,"mod",!0).mod},Z.prototype.divRound=function(T){var O=this.divmod(T);if(O.mod.isZero())return O.div;var A=O.div.negative!==0?O.mod.isub(T):O.mod,$=T.ushrn(1),J=T.andln(1),E=A.cmp($);if(E<0||J===1&&E===0)return O.div;return O.div.negative!==0?O.div.isubn(1):O.div.iaddn(1)},Z.prototype.modrn=function(T){var O=T<0;if(O)T=-T;L(T<=67108863);var A=67108864%T,$=0;for(var J=this.length-1;J>=0;J--)$=(A*$+(this.words[J]|0))%T;return O?-$:$},Z.prototype.modn=function(T){return this.modrn(T)},Z.prototype.idivn=function(T){var O=T<0;if(O)T=-T;L(T<=67108863);var A=0;for(var $=this.length-1;$>=0;$--){var J=(this.words[$]|0)+A*67108864;this.words[$]=J/T|0,A=J%T}return this._strip(),O?this.ineg():this},Z.prototype.divn=function(T){return this.clone().idivn(T)},Z.prototype.egcd=function(T){L(T.negative===0),L(!T.isZero());var O=this,A=T.clone();if(O.negative!==0)O=O.umod(T);else O=O.clone();var $=new Z(1),J=new Z(0),E=new Z(0),V=new Z(1),S=0;while(O.isEven()&&A.isEven())O.iushrn(1),A.iushrn(1),++S;var H=A.clone(),j=O.clone();while(!O.isZero()){for(var w=0,p=1;(O.words[0]&p)===0&&w<26;++w,p<<=1);if(w>0){O.iushrn(w);while(w-- >0){if($.isOdd()||J.isOdd())$.iadd(H),J.isub(j);$.iushrn(1),J.iushrn(1)}}for(var n=0,G0=1;(A.words[0]&G0)===0&&n<26;++n,G0<<=1);if(n>0){A.iushrn(n);while(n-- >0){if(E.isOdd()||V.isOdd())E.iadd(H),V.isub(j);E.iushrn(1),V.iushrn(1)}}if(O.cmp(A)>=0)O.isub(A),$.isub(E),J.isub(V);else A.isub(O),E.isub($),V.isub(J)}return{a:E,b:V,gcd:A.iushln(S)}},Z.prototype._invmp=function(T){L(T.negative===0),L(!T.isZero());var O=this,A=T.clone();if(O.negative!==0)O=O.umod(T);else O=O.clone();var $=new Z(1),J=new Z(0),E=A.clone();while(O.cmpn(1)>0&&A.cmpn(1)>0){for(var V=0,S=1;(O.words[0]&S)===0&&V<26;++V,S<<=1);if(V>0){O.iushrn(V);while(V-- >0){if($.isOdd())$.iadd(E);$.iushrn(1)}}for(var H=0,j=1;(A.words[0]&j)===0&&H<26;++H,j<<=1);if(H>0){A.iushrn(H);while(H-- >0){if(J.isOdd())J.iadd(E);J.iushrn(1)}}if(O.cmp(A)>=0)O.isub(A),$.isub(J);else A.isub(O),J.isub($)}var w;if(O.cmpn(1)===0)w=$;else w=J;if(w.cmpn(0)<0)w.iadd(T);return w},Z.prototype.gcd=function(T){if(this.isZero())return T.abs();if(T.isZero())return this.abs();var O=this.clone(),A=T.clone();O.negative=0,A.negative=0;for(var $=0;O.isEven()&&A.isEven();$++)O.iushrn(1),A.iushrn(1);do{while(O.isEven())O.iushrn(1);while(A.isEven())A.iushrn(1);var J=O.cmp(A);if(J<0){var E=O;O=A,A=E}else if(J===0||A.cmpn(1)===0)break;O.isub(A)}while(!0);return A.iushln($)},Z.prototype.invm=function(T){return this.egcd(T).a.umod(T)},Z.prototype.isEven=function(){return(this.words[0]&1)===0},Z.prototype.isOdd=function(){return(this.words[0]&1)===1},Z.prototype.andln=function(T){return this.words[0]&T},Z.prototype.bincn=function(T){L(typeof T==="number");var O=T%26,A=(T-O)/26,$=1<>>26,V&=67108863,this.words[E]=V}if(J!==0)this.words[E]=J,this.length++;return this},Z.prototype.isZero=function(){return this.length===1&&this.words[0]===0},Z.prototype.cmpn=function(T){var O=T<0;if(this.negative!==0&&!O)return-1;if(this.negative===0&&O)return 1;this._strip();var A;if(this.length>1)A=1;else{if(O)T=-T;L(T<=67108863,"Number is too big");var $=this.words[0]|0;A=$===T?0:$T.length)return 1;if(this.length=0;A--){var $=this.words[A]|0,J=T.words[A]|0;if($===J)continue;if($J)O=1;break}return O},Z.prototype.gtn=function(T){return this.cmpn(T)===1},Z.prototype.gt=function(T){return this.cmp(T)===1},Z.prototype.gten=function(T){return this.cmpn(T)>=0},Z.prototype.gte=function(T){return this.cmp(T)>=0},Z.prototype.ltn=function(T){return this.cmpn(T)===-1},Z.prototype.lt=function(T){return this.cmp(T)===-1},Z.prototype.lten=function(T){return this.cmpn(T)<=0},Z.prototype.lte=function(T){return this.cmp(T)<=0},Z.prototype.eqn=function(T){return this.cmpn(T)===0},Z.prototype.eq=function(T){return this.cmp(T)===0},Z.red=function(T){return new X(T)},Z.prototype.toRed=function(T){return L(!this.red,"Already a number in reduction context"),L(this.negative===0,"red works only with positives"),T.convertTo(this)._forceRed(T)},Z.prototype.fromRed=function(){return L(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},Z.prototype._forceRed=function(T){return this.red=T,this},Z.prototype.forceRed=function(T){return L(!this.red,"Already a number in reduction context"),this._forceRed(T)},Z.prototype.redAdd=function(T){return L(this.red,"redAdd works only with red numbers"),this.red.add(this,T)},Z.prototype.redIAdd=function(T){return L(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,T)},Z.prototype.redSub=function(T){return L(this.red,"redSub works only with red numbers"),this.red.sub(this,T)},Z.prototype.redISub=function(T){return L(this.red,"redISub works only with red numbers"),this.red.isub(this,T)},Z.prototype.redShl=function(T){return L(this.red,"redShl works only with red numbers"),this.red.shl(this,T)},Z.prototype.redMul=function(T){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.mul(this,T)},Z.prototype.redIMul=function(T){return L(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.imul(this,T)},Z.prototype.redSqr=function(){return L(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},Z.prototype.redISqr=function(){return L(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},Z.prototype.redSqrt=function(){return L(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},Z.prototype.redInvm=function(){return L(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},Z.prototype.redNeg=function(){return L(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},Z.prototype.redPow=function(T){return L(this.red&&!T.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,T)};var Y0={k256:null,p224:null,p192:null,p25519:null};function Z0(T,O){this.name=T,this.p=new Z(O,16),this.n=this.p.bitLength(),this.k=new Z(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Z0.prototype._tmp=function(){var T=new Z(null);return T.words=Array(Math.ceil(this.n/13)),T},Z0.prototype.ireduce=function(T){var O=T,A;do this.split(O,this.tmp),O=this.imulK(O),O=O.iadd(this.tmp),A=O.bitLength();while(A>this.n);var $=A0)O.isub(this.p);else if(O.strip!==void 0)O.strip();else O._strip();return O},Z0.prototype.split=function(T,O){T.iushrn(this.n,0,O)},Z0.prototype.imulK=function(T){return T.imul(this.k)};function O0(){Z0.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}W(O0,Z0),O0.prototype.split=function(T,O){var A=4194303,$=Math.min(T.length,9);for(var J=0;J<$;J++)O.words[J]=T.words[J];if(O.length=$,T.length<=9){T.words[0]=0,T.length=1;return}var E=T.words[9];O.words[O.length++]=E&A;for(J=10;J>>22,E=V}if(E>>>=22,T.words[J-10]=E,E===0&&T.length>10)T.length-=10;else T.length-=9},O0.prototype.imulK=function(T){T.words[T.length]=0,T.words[T.length+1]=0,T.length+=2;var O=0;for(var A=0;A>>=26,T.words[A]=J,O=$}if(O!==0)T.words[T.length++]=O;return T},Z._prime=function(T){if(Y0[T])return Y0[T];var O;if(T==="k256")O=new O0;else if(T==="p224")O=new u;else if(T==="p192")O=new i;else if(T==="p25519")O=new U;else throw Error("Unknown prime "+T);return Y0[T]=O,O};function X(T){if(typeof T==="string"){var O=Z._prime(T);this.m=O.p,this.prime=O}else L(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}X.prototype._verify1=function(T){L(T.negative===0,"red works only with positives"),L(T.red,"red works only with red numbers")},X.prototype._verify2=function(T,O){L((T.negative|O.negative)===0,"red works only with positives"),L(T.red&&T.red===O.red,"red works only with red numbers")},X.prototype.imod=function(T){if(this.prime)return this.prime.ireduce(T)._forceRed(this);return F(T,T.umod(this.m)._forceRed(this)),T},X.prototype.neg=function(T){if(T.isZero())return T.clone();return this.m.sub(T)._forceRed(this)},X.prototype.add=function(T,O){this._verify2(T,O);var A=T.add(O);if(A.cmp(this.m)>=0)A.isub(this.m);return A._forceRed(this)},X.prototype.iadd=function(T,O){this._verify2(T,O);var A=T.iadd(O);if(A.cmp(this.m)>=0)A.isub(this.m);return A},X.prototype.sub=function(T,O){this._verify2(T,O);var A=T.sub(O);if(A.cmpn(0)<0)A.iadd(this.m);return A._forceRed(this)},X.prototype.isub=function(T,O){this._verify2(T,O);var A=T.isub(O);if(A.cmpn(0)<0)A.iadd(this.m);return A},X.prototype.shl=function(T,O){return this._verify1(T),this.imod(T.ushln(O))},X.prototype.imul=function(T,O){return this._verify2(T,O),this.imod(T.imul(O))},X.prototype.mul=function(T,O){return this._verify2(T,O),this.imod(T.mul(O))},X.prototype.isqr=function(T){return this.imul(T,T.clone())},X.prototype.sqr=function(T){return this.mul(T,T)},X.prototype.sqrt=function(T){if(T.isZero())return T.clone();var O=this.m.andln(3);if(L(O%2===1),O===3){var A=this.m.add(new Z(1)).iushrn(2);return this.pow(T,A)}var $=this.m.subn(1),J=0;while(!$.isZero()&&$.andln(1)===0)J++,$.iushrn(1);L(!$.isZero());var E=new Z(1).toRed(this),V=E.redNeg(),S=this.m.subn(1).iushrn(1),H=this.m.bitLength();H=new Z(2*H*H).toRed(this);while(this.pow(H,S).cmp(V)!==0)H.redIAdd(V);var j=this.pow(H,$),w=this.pow(T,$.addn(1).iushrn(1)),p=this.pow(T,$),n=J;while(p.cmp(E)!==0){var G0=p;for(var t=0;G0.cmp(E)!==0;t++)G0=G0.redSqr();L(t=0;J--){var j=O.words[J];for(var w=H-1;w>=0;w--){var p=j>>w&1;if(E!==$[0])E=this.sqr(E);if(p===0&&V===0){S=0;continue}if(V<<=1,V|=p,S++,S!==A&&(J!==0||w!==0))continue;E=this.mul(E,$[V]),S=0,V=0}H=26}return E},X.prototype.convertTo=function(T){var O=T.umod(this.m);return O===T?O.clone():O},X.prototype.convertFrom=function(T){var O=T.clone();return O.red=null,O},Z.mont=function(T){return new Q(T)};function Q(T){if(X.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new Z(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}W(Q,X),Q.prototype.convertTo=function(T){return this.imod(T.ushln(this.shift))},Q.prototype.convertFrom=function(T){var O=this.imod(T.mul(this.rinv));return O.red=null,O},Q.prototype.imul=function(T,O){if(T.isZero()||O.isZero())return T.words[0]=0,T.length=1,T;var A=T.imul(O),$=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=A.isub($).iushrn(this.shift),E=J;if(J.cmp(this.m)>=0)E=J.isub(this.m);else if(J.cmpn(0)<0)E=J.iadd(this.m);return E._forceRed(this)},Q.prototype.mul=function(T,O){if(T.isZero()||O.isZero())return new Z(0)._forceRed(this);var A=T.mul(O),$=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),J=A.isub($).iushrn(this.shift),E=J;if(J.cmp(this.m)>=0)E=J.isub(this.m);else if(J.cmpn(0)<0)E=J.iadd(this.m);return E._forceRed(this)},Q.prototype.invm=function(T){var O=this.imod(T._invmp(this.m).mul(this.r2));return O._forceRed(this)}})(typeof Y>"u"||Y,I)}),BI=Q0((I,Y)=>{var G=NQ(),K=hE(),L=SU().Buffer;function W(q){var C=q.modulus.byteLength(),D;do D=new G(K(C));while(D.cmp(q.modulus)>=0||!D.umod(q.prime1)||!D.umod(q.prime2));return D}function Z(q){var C=W(q),D=C.toRed(G.mont(q.modulus)).redPow(new G(q.publicExponent)).fromRed();return{blinder:D,unblinder:C.invm(q.modulus)}}function z(q,C){var D=Z(C),F=C.modulus.byteLength(),R=new G(q).mul(D.blinder).umod(C.modulus),M=R.toRed(G.mont(C.prime1)),P=R.toRed(G.mont(C.prime2)),k=C.coefficient,_=C.prime1,N=C.prime2,v=M.redPow(C.exponent1).fromRed(),B=P.redPow(C.exponent2).fromRed(),g=v.isub(B).imul(k).umod(_).imul(N);return B.iadd(g).imul(D.unblinder).umod(C.modulus).toArrayLike(L,"be",F)}z.getr=W,Y.exports=z}),BQ=Q0((I,Y)=>{var G=kI(),K=hE(),L=uE(),W=vI(),Z=jI(),z=yT(),q=NI(),C=BI(),D=SU().Buffer;Y.exports=function(P,k,_){var N;if(P.padding)N=P.padding;else if(_)N=1;else N=4;var v=G(P),B;if(N===4)B=F(v,k);else if(N===1)B=R(v,k,_);else if(N===3){if(B=new z(k),B.cmp(v.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");if(_)return C(B,v);else return q(B,v)};function F(P,k){var _=P.modulus.byteLength(),N=k.length,v=L("sha1").update(D.alloc(0)).digest(),B=v.length,g=2*B;if(N>_-g-2)throw Error("message too long");var y=D.alloc(_-N-g-2),l=_-B-1,Y0=K(B),Z0=Z(D.concat([v,y,D.alloc(1,1),k],l),W(Y0,l)),O0=Z(Y0,W(Z0,B));return new z(D.concat([D.alloc(1),O0,Z0],_))}function R(P,k,_){var N=k.length,v=P.modulus.byteLength();if(N>v-11)throw Error("message too long");var B;if(_)B=D.alloc(v-N-3,255);else B=M(v-N-3);return new z(D.concat([D.from([0,_?1:2]),B,D.alloc(1),k],v))}function M(P){var k=D.allocUnsafe(P),_=0,N=K(P*2),v=0,B;while(_{var G=kI(),K=vI(),L=jI(),W=yT(),Z=BI(),z=uE(),q=NI(),C=SU().Buffer;Y.exports=function(M,P,k){var _;if(M.padding)_=M.padding;else if(k)_=1;else _=4;var N=G(M),v=N.modulus.byteLength();if(P.length>v||new W(P).cmp(N.modulus)>=0)throw Error("decryption error");var B;if(k)B=q(new W(P),N);else B=Z(P,N);var g=C.alloc(v-B.length);if(B=C.concat([g,B],v),_===4)return D(N,B);else if(_===1)return F(N,B,k);else if(_===3)return B;else throw Error("unknown padding")};function D(M,P){var k=M.modulus.byteLength(),_=z("sha1").update(C.alloc(0)).digest(),N=_.length;if(P[0]!==0)throw Error("decryption error");var v=P.slice(1,N+1),B=P.slice(N+1),g=L(v,K(B,N)),y=L(B,K(g,k-N-1));if(R(_,y.slice(0,N)))throw Error("decryption error");var l=N;while(y[l]===0)l++;if(y[l++]!==1)throw Error("decryption error");return y.slice(l)}function F(M,P,k){var _=P.slice(0,2),N=2,v=0;while(P[N++]!==0)if(N>=P.length){v++;break}var B=P.slice(2,N-1);if(_.toString("hex")!=="0002"&&!k||_.toString("hex")!=="0001"&&k)v++;if(B.length<8)v++;if(v)throw Error("decryption error");return P.slice(N)}function R(M,P){M=C.from(M),P=C.from(P);var k=0,_=M.length;if(M.length!==P.length)k++,_=Math.min(M.length,P.length);var N=-1;while(++N<_)k+=M[N]^P[N];return k}}),_T=Q0((I)=>{I.publicEncrypt=BQ(),I.privateDecrypt=xQ(),I.privateEncrypt=function(Y,G){return I.publicEncrypt(Y,G,!0)},I.publicDecrypt=function(Y,G){return I.privateDecrypt(Y,G,!0)}}),gQ=Q0((I)=>{var Y=(CU(),h0(PU));if(typeof Y.publicEncrypt!=="function")Y=_T();if(I.publicEncrypt=Y.publicEncrypt,I.privateDecrypt=Y.privateDecrypt,typeof Y.privateEncrypt!=="function")I.privateEncrypt=_T().privateEncrypt;else I.privateEncrypt=Y.privateEncrypt;if(typeof Y.publicDecrypt!=="function")I.publicDecrypt=_T().publicDecrypt;else I.publicDecrypt=Y.publicDecrypt}),wQ=Q0((I)=>{var Y=SU(),G=hE(),K=Y.Buffer,L=Y.kMaxLength,W=globalThis.crypto||globalThis.msCrypto,Z=Math.pow(2,32)-1;function z(R,M){if(typeof R!=="number"||R!==R)throw TypeError("offset must be a number");if(R>Z||R<0)throw TypeError("offset must be a uint32");if(R>L||R>M)throw RangeError("offset out of range")}function q(R,M,P){if(typeof R!=="number"||R!==R)throw TypeError("size must be a number");if(R>Z||R<0)throw TypeError("size must be a uint32");if(R+M>P||R>L)throw RangeError("buffer too small")}W&&W.getRandomValues,I.randomFill=C,I.randomFillSync=F;function C(R,M,P,k){if(!K.isBuffer(R)&&!(R instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof M==="function")k=M,M=0,P=R.length;else if(typeof P==="function")k=P,P=R.length-M;else if(typeof k!=="function")throw TypeError('"cb" argument must be a function');return z(M,R.length),q(P,M,R.length),D(R,M,P,k)}function D(R,M,P,k){if(!1)var _,N;if(k){G(P,function(B,g){if(B)return k(B);g.copy(R,M),k(null,R)});return}var v=G(P);return v.copy(R,M),R}function F(R,M,P){if(typeof M>"u")M=0;if(!K.isBuffer(R)&&!(R instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(z(M,R.length),P===void 0)P=R.length-M;return q(P,M,R.length),D(R,M,P)}}),yQ=Q0((I,Y)=>{var G=(CU(),h0(PU));if(typeof G.randomFill==="function"&&typeof G.randomFillSync==="function")I.randomFill=G.randomFill,I.randomFillSync=G.randomFillSync;else Y.exports=wQ()}),fQ=Q0((I)=>{I.randomBytes=I.rng=I.pseudoRandomBytes=I.prng=hE(),I.createHash=I.Hash=uE(),I.createHmac=I.Hmac=OI();var Y=ZZ(),G=Object.keys(Y),K=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(G);I.getHashes=function(){return K};var L=WI();I.pbkdf2=L.pbkdf2,I.pbkdf2Sync=L.pbkdf2Sync;var W=dZ();I.Cipher=W.Cipher,I.createCipher=W.createCipher,I.Cipheriv=W.Cipheriv,I.createCipheriv=W.createCipheriv,I.Decipher=W.Decipher,I.createDecipher=W.createDecipher,I.Decipheriv=W.Decipheriv,I.createDecipheriv=W.createDecipheriv,I.getCiphers=W.getCiphers,I.listCiphers=W.listCiphers;var Z=lZ();I.DiffieHellmanGroup=Z.DiffieHellmanGroup,I.createDiffieHellmanGroup=Z.createDiffieHellmanGroup,I.getDiffieHellman=Z.getDiffieHellman,I.createDiffieHellman=Z.createDiffieHellman,I.DiffieHellman=Z.DiffieHellman;var z=oZ();I.createSign=z.createSign,I.Sign=z.Sign,I.createVerify=z.createVerify,I.Verify=z.Verify,I.createECDH=$Q();var q=gQ();I.publicEncrypt=q.publicEncrypt,I.privateEncrypt=q.privateEncrypt,I.publicDecrypt=q.publicDecrypt,I.privateDecrypt=q.privateDecrypt;var C=yQ();I.randomFill=C.randomFill,I.randomFillSync=C.randomFillSync,I.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet we accept pull requests -https://github.com/browserify/crypto-browserify`)},T.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}),p0=ZO(fQ(),1),cQ=p0.prng,pQ=p0.pseudoRandomBytes,hQ=p0.rng,uQ=p0.randomBytes,bQ=p0.Hash,CE=p0.createHash,dQ=p0.Hmac,lQ=p0.createHmac,oQ=p0.getHashes,nQ=p0.pbkdf2,mQ=p0.pbkdf2Sync,sQ=p0.Cipher,rQ=p0.createCipher,tQ=p0.Cipheriv,aQ=p0.createCipheriv,eQ=p0.Decipher,iQ=p0.createDecipher,UJ=p0.Decipheriv,EJ=p0.createDecipheriv,XJ=p0.getCiphers,IJ=p0.listCiphers,TJ=p0.DiffieHellmanGroup,YJ=p0.createDiffieHellmanGroup,ZJ=p0.getDiffieHellman,OJ=p0.createDiffieHellman,QJ=p0.DiffieHellman,JJ=p0.createSign,GJ=p0.Sign,VJ=p0.createVerify,AJ=p0.Verify,LJ=p0.createECDH,$J=p0.publicEncrypt,KJ=p0.privateEncrypt,FJ=p0.publicDecrypt,WJ=p0.privateDecrypt,HJ=p0.randomFill,RJ=p0.randomFillSync,CJ=p0.createCredentials,DJ=p0.constants,qJ=["p192","p224","p256","p384","p521","curve25519","ed25519","secp256k1","secp224r1","prime256v1","prime192v1","ed25519","secp384r1","secp521r1"];_J=crypto,kJ=crypto});import vJ from"gray-matter";function wX(T,Y){let{data:G,content:K}=vJ(T),{compiled_truth:L,timeline:W}=jJ(K),O=G.type||NJ(Y),z=G.title||BJ(Y),q=gJ(G),D=G.slug||xJ(Y),C={...G};return delete C.type,delete C.title,delete C.tags,delete C.slug,{frontmatter:C,compiled_truth:L.trim(),timeline:W.trim(),slug:D,type:O,title:z,tags:q}}function jJ(T){let Y=T.split(` +https://github.com/browserify/crypto-browserify`)},I.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}),p0=OZ(fQ(),1),cQ=p0.prng,pQ=p0.pseudoRandomBytes,hQ=p0.rng,uQ=p0.randomBytes,bQ=p0.Hash,DE=p0.createHash,dQ=p0.Hmac,lQ=p0.createHmac,oQ=p0.getHashes,nQ=p0.pbkdf2,mQ=p0.pbkdf2Sync,sQ=p0.Cipher,rQ=p0.createCipher,tQ=p0.Cipheriv,aQ=p0.createCipheriv,eQ=p0.Decipher,iQ=p0.createDecipher,UJ=p0.Decipheriv,EJ=p0.createDecipheriv,TJ=p0.getCiphers,XJ=p0.listCiphers,IJ=p0.DiffieHellmanGroup,YJ=p0.createDiffieHellmanGroup,OJ=p0.getDiffieHellman,ZJ=p0.createDiffieHellman,QJ=p0.DiffieHellman,JJ=p0.createSign,GJ=p0.Sign,VJ=p0.createVerify,AJ=p0.Verify,LJ=p0.createECDH,$J=p0.publicEncrypt,KJ=p0.privateEncrypt,FJ=p0.publicDecrypt,WJ=p0.privateDecrypt,HJ=p0.randomFill,RJ=p0.randomFillSync,DJ=p0.createCredentials,CJ=p0.constants,qJ=["p192","p224","p256","p384","p521","curve25519","ed25519","secp256k1","secp224r1","prime256v1","prime192v1","ed25519","secp384r1","secp521r1"];_J=crypto,kJ=crypto});function xI(I){let Y={added:[],modified:[],deleted:[],renamed:[]},G=I.split(` +`);for(let K of G){let L=K.trim();if(!L)continue;let W=L.split("\t");if(W.length<2)continue;let Z=W[0],z=W[W.length===3?2:1];if(Z==="A")Y.added.push(z);else if(Z==="M")Y.modified.push(z);else if(Z==="D")Y.deleted.push(W[1]);else if(Z.startsWith("R")){let q=W[1],C=W[2];if(q&&C)Y.renamed.push({from:q,to:C})}}return Y}function IE(I){if(!I.endsWith(".md"))return!1;if(I.split("/").some((K)=>K.startsWith(".")))return!1;if(I.includes(".raw/"))return!1;let Y=["schema.md","index.md","log.md","README.md"],G=I.split("/").pop()||"";if(Y.includes(G))return!1;if(I.startsWith("ops/"))return!1;return!0}function vJ(I){return I.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9.\s_-]/g,"").replace(/[\s]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function CE(I){let Y=I.replace(/\.md$/i,"");return Y=Y.replace(/\\/g,"/"),Y=Y.replace(/^\.?\//,""),Y.split("/").map(vJ).filter(Boolean).join("/")}function zE(I,Y){let G=CE(I);if(Y)G=`${Y}/${G}`;return G.toLowerCase()}import jJ from"gray-matter";function fT(I,Y){let{data:G,content:K}=jJ(I),{compiled_truth:L,timeline:W}=NJ(K),Z=G.type||BJ(Y),z=G.title||xJ(Y),q=wJ(G),C=G.slug||gJ(Y),D={...G};return delete D.type,delete D.title,delete D.tags,delete D.slug,{frontmatter:D,compiled_truth:L.trim(),timeline:W.trim(),slug:C,type:Z,title:z,tags:q}}function NJ(I){let Y=I.split(` `),G=-1;for(let W=0;W0){G=W;break}}if(G===-1)return{compiled_truth:T,timeline:""};let K=Y.slice(0,G).join(` +`).trim().length>0){G=W;break}}if(G===-1)return{compiled_truth:I,timeline:""};let K=Y.slice(0,G).join(` `),L=Y.slice(G+1).join(` -`);return{compiled_truth:K,timeline:L}}function NJ(T){if(!T)return"concept";let Y=("/"+T).toLowerCase();if(Y.includes("/people/")||Y.includes("/person/"))return"person";if(Y.includes("/companies/")||Y.includes("/company/"))return"company";if(Y.includes("/deals/")||Y.includes("/deal/"))return"deal";if(Y.includes("/yc/"))return"yc";if(Y.includes("/civic/"))return"civic";if(Y.includes("/projects/")||Y.includes("/project/"))return"project";if(Y.includes("/sources/")||Y.includes("/source/"))return"source";if(Y.includes("/media/"))return"media";return"concept"}function BJ(T){if(!T)return"Untitled";let Y=T.split("/");return(Y[Y.length-1]?.replace(/\.md$/i,"")||"Untitled").replace(/[-_]/g," ").replace(/\b\w/g,(K)=>K.toUpperCase())}function xJ(T){if(!T)return"untitled";let Y=T.replace(/\.md$/i,"").replace(/\\/g,"/");if(Y.startsWith("./"))Y=Y.slice(2);return Y.toLowerCase()}function gJ(T){let Y=T.tags;if(!Y)return[];if(Array.isArray(Y))return Y.map(String);if(typeof Y==="string")return Y.split(",").map((G)=>G.trim()).filter(Boolean);return[]}var BT=()=>{};function fX(T,Y){let G=Y?.chunkSize||300,K=Y?.chunkOverlap||50;if(!T||T.trim().length===0)return[];if(cX(T)<=G)return[{text:T.trim(),index:0}];let W=yX(T,0,G),O=yJ(W,G);return fJ(O,K).map((q,D)=>({text:q.trim(),index:D}))}function yX(T,Y,G){if(Y>=xT.length)return gT(T,G);let K=xT[Y];if(K.length===0)return gT(T,G);let L=wJ(T,K);if(L.length<=1)return yX(T,Y+1,G);let W=[];for(let O of L)if(cX(O)>G)W.push(...yX(O,Y+1,G));else W.push(O);return W}function wJ(T,Y){let G=[],K=T;while(K.length>0){let L=-1,W="";for(let z of Y){let q=K.indexOf(z);if(q!==-1&&(L===-1||q0)G.push(O);K=K.slice(L+W.length)}if(K.trim().length>0&&!G.includes(K));return G.filter((L)=>L.trim().length>0)}function gT(T,Y){let G=T.match(/\S+\s*/g)||[];if(G.length===0)return[];let K=[];for(let L=0;L0)K.push(W)}return K}function yJ(T,Y){if(T.length===0)return[];let G=[],K=T[0];for(let L=1;L0)G.push(K);return G}function fJ(T,Y){if(T.length<=1||Y<=0)return T;let G=[T[0]];for(let K=1;K0)return W}return K}function cX(T){return(T.match(/\S+/g)||[]).length}var xT;var wT=GU(()=>{xT=[[` +`);return{compiled_truth:K,timeline:L}}function BJ(I){if(!I)return"concept";let Y=("/"+I).toLowerCase();if(Y.includes("/people/")||Y.includes("/person/"))return"person";if(Y.includes("/companies/")||Y.includes("/company/"))return"company";if(Y.includes("/deals/")||Y.includes("/deal/"))return"deal";if(Y.includes("/yc/"))return"yc";if(Y.includes("/civic/"))return"civic";if(Y.includes("/projects/")||Y.includes("/project/"))return"project";if(Y.includes("/sources/")||Y.includes("/source/"))return"source";if(Y.includes("/media/"))return"media";return"concept"}function xJ(I){if(!I)return"Untitled";let Y=I.split("/");return(Y[Y.length-1]?.replace(/\.md$/i,"")||"Untitled").replace(/[-_]/g," ").replace(/\b\w/g,(K)=>K.toUpperCase())}function gJ(I){if(!I)return"untitled";return CE(I)}function wJ(I){let Y=I.tags;if(!Y)return[];if(Array.isArray(Y))return Y.map(String);if(typeof Y==="string")return Y.split(",").map((G)=>G.trim()).filter(Boolean);return[]}var gI=()=>{};function pT(I,Y){let G=Y?.chunkSize||300,K=Y?.chunkOverlap||50;if(!I||I.trim().length===0)return[];if(hT(I)<=G)return[{text:I.trim(),index:0}];let W=cT(I,0,G),Z=fJ(W,G);return cJ(Z,K).map((q,C)=>({text:q.trim(),index:C}))}function cT(I,Y,G){if(Y>=wI.length)return yI(I,G);let K=wI[Y];if(K.length===0)return yI(I,G);let L=yJ(I,K);if(L.length<=1)return cT(I,Y+1,G);let W=[];for(let Z of L)if(hT(Z)>G)W.push(...cT(Z,Y+1,G));else W.push(Z);return W}function yJ(I,Y){let G=[],K=I;while(K.length>0){let L=-1,W="";for(let z of Y){let q=K.indexOf(z);if(q!==-1&&(L===-1||q0)G.push(Z);K=K.slice(L+W.length)}if(K.trim().length>0&&!G.includes(K));return G.filter((L)=>L.trim().length>0)}function yI(I,Y){let G=I.match(/\S+\s*/g)||[];if(G.length===0)return[];let K=[];for(let L=0;L0)K.push(W)}return K}function fJ(I,Y){if(I.length===0)return[];let G=[],K=I[0];for(let L=1;L0)G.push(K);return G}function cJ(I,Y){if(I.length<=1||Y<=0)return I;let G=[I[0]];for(let K=1;K0)return W}return K}function hT(I){return(I.match(/\S+/g)||[]).length}var wI;var fI=VU(()=>{wI=[[` `],[` `],[". ","! ","? ",`. `,`! `,`? -`],["; ",": ",", "],[]]});import cT from"openai";function dJ(){if(!pX)pX=new cT;return pX}async function hT(T){let Y=T.slice(0,pT);return(await hX([Y]))[0]}async function hX(T){let Y=T.map((K)=>K.slice(0,pT)),G=[];for(let K=0;KL.index-W.index).map((L)=>new Float32Array(L.embedding))}catch(G){if(Y===yT-1)throw G;let K=oJ(Y);if(G instanceof cT.APIError&&G.status===429){let L=G.headers?.["retry-after"];if(L){let W=parseInt(L,10);if(!isNaN(W))K=W*1000}}await nJ(K)}throw Error("Embedding failed after all retries")}function oJ(T){let Y=uJ*Math.pow(2,T);return Math.min(Y,bJ)}function nJ(T){return new Promise((Y)=>setTimeout(Y,T))}var pJ="text-embedding-3-large",hJ=1536,pT=8000,yT=5,uJ=4000,bJ=120000,fT=100,pX=null;var uX=()=>{};var{readFileSync:mJ,statSync:sJ}=(()=>({}));async function bX(T,Y,G,K={}){let L=wX(G,Y+".md"),W=CE("sha256").update(JSON.stringify({title:L.title,type:L.type,compiled_truth:L.compiled_truth,timeline:L.timeline,frontmatter:L.frontmatter,tags:L.tags.sort()})).digest("hex"),O=await T.getPage(Y);if(O?.content_hash===W)return{slug:Y,status:"skipped",chunks:0};let z=[];if(L.compiled_truth.trim())for(let q of fX(L.compiled_truth))z.push({chunk_index:z.length,chunk_text:q.text,chunk_source:"compiled_truth"});if(L.timeline?.trim())for(let q of fX(L.timeline))z.push({chunk_index:z.length,chunk_text:q.text,chunk_source:"timeline"});if(!K.noEmbed&&z.length>0)try{let q=await hX(z.map((D)=>D.chunk_text));for(let D=0;D{if(O)await q.createVersion(Y);await q.putPage(Y,{type:L.type,title:L.title,compiled_truth:L.compiled_truth,timeline:L.timeline||"",frontmatter:L.frontmatter,content_hash:W});let D=await q.getTags(Y),C=new Set(L.tags);for(let F of D)if(!C.has(F))await q.removeTag(Y,F);for(let F of L.tags)await q.addTag(Y,F);if(z.length>0)await q.upsertChunks(Y,z)}),{slug:Y,status:"imported",chunks:z.length}}async function tJ(T,Y,G,K={}){let L=sJ(Y);if(L.size>rJ)return{slug:G,status:"skipped",chunks:0,error:`File too large (${L.size} bytes)`};let W=mJ(Y,"utf-8"),O=wX(W,G);return bX(T,O.slug,W,K)}var rJ=5000000,DE;var bE=GU(()=>{DU();BT();wT();uX();DE=tJ});var tU;var dE=GU(()=>{tU=class tU extends Error{problem;cause_description;fix;docs_url;constructor(T,Y,G,K){super(`${T}: ${Y}. Fix: ${G}`);this.problem=T;this.cause_description=Y;this.fix=G;this.docs_url=K;this.name="GBrainError"}}});var lX=` +`],["; ",": ",", "],[]]});import hI from"openai";function lJ(){if(!uT)uT=new hI;return uT}async function bI(I){let Y=I.slice(0,uI);return(await bT([Y]))[0]}async function bT(I){let Y=I.map((K)=>K.slice(0,uI)),G=[];for(let K=0;KL.index-W.index).map((L)=>new Float32Array(L.embedding))}catch(G){if(Y===cI-1)throw G;let K=nJ(Y);if(G instanceof hI.APIError&&G.status===429){let L=G.headers?.["retry-after"];if(L){let W=parseInt(L,10);if(!isNaN(W))K=W*1000}}await mJ(K)}throw Error("Embedding failed after all retries")}function nJ(I){let Y=bJ*Math.pow(2,I);return Math.min(Y,dJ)}function mJ(I){return new Promise((Y)=>setTimeout(Y,I))}var hJ="text-embedding-3-large",uJ=1536,uI=8000,cI=5,bJ=4000,dJ=120000,pI=100,uT=null;var dT=()=>{};var{readFileSync:sJ,statSync:rJ}=(()=>({}));async function lT(I,Y,G,K={}){let L=fT(G,Y+".md"),W=DE("sha256").update(JSON.stringify({title:L.title,type:L.type,compiled_truth:L.compiled_truth,timeline:L.timeline,frontmatter:L.frontmatter,tags:L.tags.sort()})).digest("hex"),Z=await I.getPage(Y);if(Z?.content_hash===W)return{slug:Y,status:"skipped",chunks:0};let z=[];if(L.compiled_truth.trim())for(let q of pT(L.compiled_truth))z.push({chunk_index:z.length,chunk_text:q.text,chunk_source:"compiled_truth"});if(L.timeline?.trim())for(let q of pT(L.timeline))z.push({chunk_index:z.length,chunk_text:q.text,chunk_source:"timeline"});if(!K.noEmbed&&z.length>0)try{let q=await bT(z.map((C)=>C.chunk_text));for(let C=0;C{if(Z)await q.createVersion(Y);await q.putPage(Y,{type:L.type,title:L.title,compiled_truth:L.compiled_truth,timeline:L.timeline||"",frontmatter:L.frontmatter,content_hash:W});let C=await q.getTags(Y),D=new Set(L.tags);for(let F of C)if(!D.has(F))await q.removeTag(Y,F);for(let F of L.tags)await q.addTag(Y,F);if(z.length>0)await q.upsertChunks(Y,z)}),{slug:Y,status:"imported",chunks:z.length}}async function aJ(I,Y,G,K={}){let L=rJ(Y);if(L.size>tJ)return{slug:G,status:"skipped",chunks:0,error:`File too large (${L.size} bytes)`};let W=sJ(Y,"utf-8"),Z=fT(W,G);return lT(I,Z.slug,W,K)}var tJ=5000000,SE;var lE=VU(()=>{CU();gI();fI();dT();SE=aJ});var aU;var oE=VU(()=>{aU=class aU extends Error{problem;cause_description;fix;docs_url;constructor(I,Y,G,K){super(`${I}: ${Y}. Fix: ${G}`);this.problem=I;this.cause_description=Y;this.fix=G;this.docs_url=K;this.name="GBrainError"}}});var nT=` -- GBrain Postgres + pgvector schema CREATE EXTENSION IF NOT EXISTS vector; @@ -168,6 +169,33 @@ INSERT INTO config (key, value) VALUES ('chunk_strategy', 'semantic') ON CONFLICT (key) DO NOTHING; +-- ============================================================ +-- access_tokens: bearer tokens for remote MCP access +-- ============================================================ +CREATE TABLE IF NOT EXISTS access_tokens ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name TEXT NOT NULL, + token_hash TEXT NOT NULL UNIQUE, + scopes TEXT[], + created_at TIMESTAMPTZ DEFAULT now(), + last_used_at TIMESTAMPTZ, + revoked_at TIMESTAMPTZ +); + +CREATE INDEX IF NOT EXISTS idx_access_tokens_hash ON access_tokens (token_hash) WHERE revoked_at IS NULL; + +-- ============================================================ +-- mcp_request_log: usage logging for remote MCP requests +-- ============================================================ +CREATE TABLE IF NOT EXISTS mcp_request_log ( + id SERIAL PRIMARY KEY, + token_name TEXT, + operation TEXT NOT NULL, + latency_ms INTEGER, + status TEXT NOT NULL DEFAULT 'success', + created_at TIMESTAMPTZ NOT NULL DEFAULT now() +); + -- ============================================================ -- files: binary attachments stored in Supabase Storage -- ============================================================ @@ -271,13 +299,12 @@ BEGIN RAISE WARNING 'Skipping RLS: role % does not have BYPASSRLS privilege. Run as postgres role to enable.', current_user; END IF; END $$; -`;import lT from"postgres";function eU(){if(!pU)throw new tU("No database connection","connect() has not been called","Run gbrain init --supabase or gbrain init --url ");return pU}async function oT(T){if(pU)return;let Y=T.database_url;if(!Y)throw new tU("No database URL","database_url is missing from config","Run gbrain init --supabase or gbrain init --url ");try{pU=lT(Y,{max:10,idle_timeout:20,connect_timeout:10,types:{bigint:lT.BigInt}}),await pU`SELECT 1`}catch(G){pU=null;let K=G instanceof Error?G.message:String(G);throw new tU("Cannot connect to database",K,"Check your connection URL in ~/.gbrain/config.json")}}async function nT(){if(pU)await pU.end(),pU=null}var pU=null;var oX=GU(()=>{dE()});var TY={};jU(TY,{sep:()=>EY,resolve:()=>lE,relative:()=>oE,posix:()=>IY,parse:()=>UY,normalize:()=>nX,join:()=>VU,isAbsolute:()=>rT,format:()=>iT,extname:()=>eT,dirname:()=>nE,delimiter:()=>XY,default:()=>JG,basename:()=>aT,_makeLong:()=>tT});function gU(T){if(typeof T!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(T))}function sT(T,Y){var G="",K=0,L=-1,W=0,O;for(var z=0;z<=T.length;++z){if(z2){var q=G.lastIndexOf("/");if(q!==G.length-1){if(q===-1)G="",K=0;else G=G.slice(0,q),K=G.length-1-G.lastIndexOf("/");L=z,W=0;continue}}else if(G.length===2||G.length===1){G="",K=0,L=z,W=0;continue}}if(Y){if(G.length>0)G+="/..";else G="..";K=2}}else{if(G.length>0)G+="/"+T.slice(L+1,z);else G=T.slice(L+1,z);K=z-L-1}L=z,W=0}else if(O===46&&W!==-1)++W;else W=-1}return G}function QG(T,Y){var G=Y.dir||Y.root,K=Y.base||(Y.name||"")+(Y.ext||"");if(!G)return K;if(G===Y.root)return G+K;return G+T+K}function lE(){var T="",Y=!1,G;for(var K=arguments.length-1;K>=-1&&!Y;K--){var L;if(K>=0)L=arguments[K];else{if(G===void 0)G=process.cwd();L=G}if(gU(L),L.length===0)continue;T=L+"/"+T,Y=L.charCodeAt(0)===47}if(T=sT(T,!Y),Y)if(T.length>0)return"/"+T;else return"/";else if(T.length>0)return T;else return"."}function nX(T){if(gU(T),T.length===0)return".";var Y=T.charCodeAt(0)===47,G=T.charCodeAt(T.length-1)===47;if(T=sT(T,!Y),T.length===0&&!Y)T=".";if(T.length>0&&G)T+="/";if(Y)return"/"+T;return T}function rT(T){return gU(T),T.length>0&&T.charCodeAt(0)===47}function VU(){if(arguments.length===0)return".";var T;for(var Y=0;Y0)if(T===void 0)T=G;else T+="/"+G}if(T===void 0)return".";return nX(T)}function oE(T,Y){if(gU(T),gU(Y),T===Y)return"";if(T=lE(T),Y=lE(Y),T===Y)return"";var G=1;for(;Gq){if(Y.charCodeAt(W+C)===47)return Y.slice(W+C+1);else if(C===0)return Y.slice(W+C)}else if(L>q){if(T.charCodeAt(G+C)===47)D=C;else if(C===0)D=0}break}var F=T.charCodeAt(G+C),R=Y.charCodeAt(W+C);if(F!==R)break;else if(F===47)D=C}var M="";for(C=G+D+1;C<=K;++C)if(C===K||T.charCodeAt(C)===47)if(M.length===0)M+="..";else M+="/..";if(M.length>0)return M+Y.slice(W+D);else{if(W+=D,Y.charCodeAt(W)===47)++W;return Y.slice(W)}}function tT(T){return T}function nE(T){if(gU(T),T.length===0)return".";var Y=T.charCodeAt(0),G=Y===47,K=-1,L=!0;for(var W=T.length-1;W>=1;--W)if(Y=T.charCodeAt(W),Y===47){if(!L){K=W;break}}else L=!1;if(K===-1)return G?"/":".";if(G&&K===1)return"//";return T.slice(0,K)}function aT(T,Y){if(Y!==void 0&&typeof Y!=="string")throw TypeError('"ext" argument must be a string');gU(T);var G=0,K=-1,L=!0,W;if(Y!==void 0&&Y.length>0&&Y.length<=T.length){if(Y.length===T.length&&Y===T)return"";var O=Y.length-1,z=-1;for(W=T.length-1;W>=0;--W){var q=T.charCodeAt(W);if(q===47){if(!L){G=W+1;break}}else{if(z===-1)L=!1,z=W+1;if(O>=0)if(q===Y.charCodeAt(O)){if(--O===-1)K=W}else O=-1,K=z}}if(G===K)K=z;else if(K===-1)K=T.length;return T.slice(G,K)}else{for(W=T.length-1;W>=0;--W)if(T.charCodeAt(W)===47){if(!L){G=W+1;break}}else if(K===-1)L=!1,K=W+1;if(K===-1)return"";return T.slice(G,K)}}function eT(T){gU(T);var Y=-1,G=0,K=-1,L=!0,W=0;for(var O=T.length-1;O>=0;--O){var z=T.charCodeAt(O);if(z===47){if(!L){G=O+1;break}continue}if(K===-1)L=!1,K=O+1;if(z===46){if(Y===-1)Y=O;else if(W!==1)W=1}else if(Y!==-1)W=-1}if(Y===-1||K===-1||W===0||W===1&&Y===K-1&&Y===G+1)return"";return T.slice(Y,K)}function iT(T){if(T===null||typeof T!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof T);return QG("/",T)}function UY(T){gU(T);var Y={root:"",dir:"",base:"",ext:"",name:""};if(T.length===0)return Y;var G=T.charCodeAt(0),K=G===47,L;if(K)Y.root="/",L=1;else L=0;var W=-1,O=0,z=-1,q=!0,D=T.length-1,C=0;for(;D>=L;--D){if(G=T.charCodeAt(D),G===47){if(!q){O=D+1;break}continue}if(z===-1)q=!1,z=D+1;if(G===46){if(W===-1)W=D;else if(C!==1)C=1}else if(W!==-1)C=-1}if(W===-1||z===-1||C===0||C===1&&W===z-1&&W===O+1){if(z!==-1)if(O===0&&K)Y.base=Y.name=T.slice(1,z);else Y.base=Y.name=T.slice(O,z)}else{if(O===0&&K)Y.name=T.slice(1,W),Y.base=T.slice(1,z);else Y.name=T.slice(O,W),Y.base=T.slice(O,z);Y.ext=T.slice(W,z)}if(O>0)Y.dir=T.slice(0,O-1);else if(K)Y.dir="/";return Y}var EY="/",XY=":",IY,JG;var TE=GU(()=>{IY=((T)=>(T.posix=T,T))({resolve:lE,normalize:nX,isAbsolute:rT,join:VU,relative:oE,_makeLong:tT,dirname:nE,basename:aT,extname:eT,format:iT,parse:UY,sep:EY,delimiter:XY,win32:null,posix:null}),JG=IY});function YY(T){let Y={added:[],modified:[],deleted:[],renamed:[]},G=T.split(` -`);for(let K of G){let L=K.trim();if(!L)continue;let W=L.split("\t");if(W.length<2)continue;let O=W[0],z=W[W.length===3?2:1];if(O==="A")Y.added.push(z);else if(O==="M")Y.modified.push(z);else if(O==="D")Y.deleted.push(W[1]);else if(O.startsWith("R")){let q=W[1],D=W[2];if(q&&D)Y.renamed.push({from:q,to:D})}}return Y}function YE(T){if(!T.endsWith(".md"))return!1;if(T.split("/").some((K)=>K.startsWith(".")))return!1;if(T.includes(".raw/"))return!1;let Y=["schema.md","index.md","log.md","README.md"],G=T.split("/").pop()||"";if(Y.includes(G))return!1;if(T.startsWith("ops/"))return!1;return!0}function zE(T,Y){let G=T.replace(/\.md$/,"");if(G=G.replace(/\\/g,"/"),G=G.replace(/^\//,""),Y)G=`${Y}/${G}`;return G.toLowerCase()}var mX=function(){return"/"};var sX=()=>{};async function ZY(T){let Y=await T.getConfig("version"),G=parseInt(Y||"1",10),K=0;for(let L of ZE)if(L.version>G)await T.transaction(async(W)=>{let O=W,z=O.sql||O._sql;if(z)await z.unsafe(L.sql),await z`UPDATE config SET value = ${String(L.version)} WHERE key = 'version'`}),console.log(` Migration ${L.version} applied: ${L.name}`),K++;return{applied:K,current:K>0?ZE[ZE.length-1].version:G}}var ZE,uV;var OY=GU(()=>{ZE=[{version:2,name:"unique_chunk_index",sql:` +`;import nI from"postgres";function eU(){if(!pU)throw new aU("No database connection","connect() has not been called","Run gbrain init --supabase or gbrain init --url ");return pU}async function mI(I){if(pU)return;let Y=I.database_url;if(!Y)throw new aU("No database URL","database_url is missing from config","Run gbrain init --supabase or gbrain init --url ");try{pU=nI(Y,{max:10,idle_timeout:20,connect_timeout:10,types:{bigint:nI.BigInt}}),await pU`SELECT 1`}catch(G){pU=null;let K=G instanceof Error?G.message:String(G);throw new aU("Cannot connect to database",K,"Check your connection URL in ~/.gbrain/config.json")}}async function sI(){if(pU)await pU.end(),pU=null}var pU=null;var mT=VU(()=>{oE()});var OY={};jU(OY,{sep:()=>XY,resolve:()=>nE,relative:()=>mE,posix:()=>YY,parse:()=>TY,normalize:()=>sT,join:()=>r0,isAbsolute:()=>aI,format:()=>EY,extname:()=>UY,dirname:()=>sE,delimiter:()=>IY,default:()=>GG,basename:()=>iI,_makeLong:()=>eI});function gU(I){if(typeof I!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(I))}function tI(I,Y){var G="",K=0,L=-1,W=0,Z;for(var z=0;z<=I.length;++z){if(z2){var q=G.lastIndexOf("/");if(q!==G.length-1){if(q===-1)G="",K=0;else G=G.slice(0,q),K=G.length-1-G.lastIndexOf("/");L=z,W=0;continue}}else if(G.length===2||G.length===1){G="",K=0,L=z,W=0;continue}}if(Y){if(G.length>0)G+="/..";else G="..";K=2}}else{if(G.length>0)G+="/"+I.slice(L+1,z);else G=I.slice(L+1,z);K=z-L-1}L=z,W=0}else if(Z===46&&W!==-1)++W;else W=-1}return G}function JG(I,Y){var G=Y.dir||Y.root,K=Y.base||(Y.name||"")+(Y.ext||"");if(!G)return K;if(G===Y.root)return G+K;return G+I+K}function nE(){var I="",Y=!1,G;for(var K=arguments.length-1;K>=-1&&!Y;K--){var L;if(K>=0)L=arguments[K];else{if(G===void 0)G=process.cwd();L=G}if(gU(L),L.length===0)continue;I=L+"/"+I,Y=L.charCodeAt(0)===47}if(I=tI(I,!Y),Y)if(I.length>0)return"/"+I;else return"/";else if(I.length>0)return I;else return"."}function sT(I){if(gU(I),I.length===0)return".";var Y=I.charCodeAt(0)===47,G=I.charCodeAt(I.length-1)===47;if(I=tI(I,!Y),I.length===0&&!Y)I=".";if(I.length>0&&G)I+="/";if(Y)return"/"+I;return I}function aI(I){return gU(I),I.length>0&&I.charCodeAt(0)===47}function r0(){if(arguments.length===0)return".";var I;for(var Y=0;Y0)if(I===void 0)I=G;else I+="/"+G}if(I===void 0)return".";return sT(I)}function mE(I,Y){if(gU(I),gU(Y),I===Y)return"";if(I=nE(I),Y=nE(Y),I===Y)return"";var G=1;for(;Gq){if(Y.charCodeAt(W+D)===47)return Y.slice(W+D+1);else if(D===0)return Y.slice(W+D)}else if(L>q){if(I.charCodeAt(G+D)===47)C=D;else if(D===0)C=0}break}var F=I.charCodeAt(G+D),R=Y.charCodeAt(W+D);if(F!==R)break;else if(F===47)C=D}var M="";for(D=G+C+1;D<=K;++D)if(D===K||I.charCodeAt(D)===47)if(M.length===0)M+="..";else M+="/..";if(M.length>0)return M+Y.slice(W+C);else{if(W+=C,Y.charCodeAt(W)===47)++W;return Y.slice(W)}}function eI(I){return I}function sE(I){if(gU(I),I.length===0)return".";var Y=I.charCodeAt(0),G=Y===47,K=-1,L=!0;for(var W=I.length-1;W>=1;--W)if(Y=I.charCodeAt(W),Y===47){if(!L){K=W;break}}else L=!1;if(K===-1)return G?"/":".";if(G&&K===1)return"//";return I.slice(0,K)}function iI(I,Y){if(Y!==void 0&&typeof Y!=="string")throw TypeError('"ext" argument must be a string');gU(I);var G=0,K=-1,L=!0,W;if(Y!==void 0&&Y.length>0&&Y.length<=I.length){if(Y.length===I.length&&Y===I)return"";var Z=Y.length-1,z=-1;for(W=I.length-1;W>=0;--W){var q=I.charCodeAt(W);if(q===47){if(!L){G=W+1;break}}else{if(z===-1)L=!1,z=W+1;if(Z>=0)if(q===Y.charCodeAt(Z)){if(--Z===-1)K=W}else Z=-1,K=z}}if(G===K)K=z;else if(K===-1)K=I.length;return I.slice(G,K)}else{for(W=I.length-1;W>=0;--W)if(I.charCodeAt(W)===47){if(!L){G=W+1;break}}else if(K===-1)L=!1,K=W+1;if(K===-1)return"";return I.slice(G,K)}}function UY(I){gU(I);var Y=-1,G=0,K=-1,L=!0,W=0;for(var Z=I.length-1;Z>=0;--Z){var z=I.charCodeAt(Z);if(z===47){if(!L){G=Z+1;break}continue}if(K===-1)L=!1,K=Z+1;if(z===46){if(Y===-1)Y=Z;else if(W!==1)W=1}else if(Y!==-1)W=-1}if(Y===-1||K===-1||W===0||W===1&&Y===K-1&&Y===G+1)return"";return I.slice(Y,K)}function EY(I){if(I===null||typeof I!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof I);return JG("/",I)}function TY(I){gU(I);var Y={root:"",dir:"",base:"",ext:"",name:""};if(I.length===0)return Y;var G=I.charCodeAt(0),K=G===47,L;if(K)Y.root="/",L=1;else L=0;var W=-1,Z=0,z=-1,q=!0,C=I.length-1,D=0;for(;C>=L;--C){if(G=I.charCodeAt(C),G===47){if(!q){Z=C+1;break}continue}if(z===-1)q=!1,z=C+1;if(G===46){if(W===-1)W=C;else if(D!==1)D=1}else if(W!==-1)D=-1}if(W===-1||z===-1||D===0||D===1&&W===z-1&&W===Z+1){if(z!==-1)if(Z===0&&K)Y.base=Y.name=I.slice(1,z);else Y.base=Y.name=I.slice(Z,z)}else{if(Z===0&&K)Y.name=I.slice(1,W),Y.base=I.slice(1,z);else Y.name=I.slice(Z,W),Y.base=I.slice(Z,z);Y.ext=I.slice(W,z)}if(Z>0)Y.dir=I.slice(0,Z-1);else if(K)Y.dir="/";return Y}var XY="/",IY=":",YY,GG;var YE=VU(()=>{YY=((I)=>(I.posix=I,I))({resolve:nE,normalize:sT,isAbsolute:aI,join:r0,relative:mE,_makeLong:eI,dirname:sE,basename:iI,extname:UY,format:EY,parse:TY,sep:XY,delimiter:IY,win32:null,posix:null}),GG=YY});var ME=function(){return"/"};var rT=()=>{};async function ZY(I){let Y=await I.getConfig("version"),G=parseInt(Y||"1",10),K=0;for(let L of OE)if(L.version>G){if(L.sql)await I.transaction(async(W)=>{let Z=W,z=Z.sql||Z._sql;if(z)await z.unsafe(L.sql)});if(L.handler)await L.handler(I);await I.setConfig("version",String(L.version)),console.log(` Migration ${L.version} applied: ${L.name}`),K++}return{applied:K,current:K>0?OE[OE.length-1].version:G}}var OE,nV;var QY=VU(()=>{OE=[{version:2,name:"slugify_existing_pages",sql:"",handler:async(I)=>{let Y=await I.listPages(),G=0;for(let K of Y){let L=CE(K.slug);if(L!==K.slug)try{await I.updateSlug(K.slug,L),await I.rewriteLinks(K.slug,L),G++}catch(W){let Z=W instanceof Error?W.message:String(W);console.error(` Warning: could not rename "${K.slug}" → "${L}": ${Z}`)}}if(G>0)console.log(` Renamed ${G} slugs`)}},{version:3,name:"unique_chunk_index",sql:` -- Deduplicate any existing duplicate (page_id, chunk_index) rows before adding constraint DELETE FROM content_chunks a USING content_chunks b WHERE a.page_id = b.page_id AND a.chunk_index = b.chunk_index AND a.id > b.id; CREATE UNIQUE INDEX IF NOT EXISTS idx_chunks_page_index ON content_chunks(page_id, chunk_index); - `},{version:3,name:"access_tokens_and_mcp_log",sql:` + `},{version:4,name:"access_tokens_and_mcp_log",sql:` CREATE TABLE IF NOT EXISTS access_tokens ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name TEXT NOT NULL, @@ -296,12 +323,12 @@ END $$; status TEXT NOT NULL DEFAULT 'success', created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); - `}],uV=ZE.length>0?ZE[ZE.length-1].version:1});import QY from"postgres";class mE{_sql=null;get sql(){if(this._sql)return this._sql;return eU()}async connect(T){if(T.poolSize){let Y=T.database_url;if(!Y)throw new tU("No database URL","database_url is missing","Provide --url");this._sql=QY(Y,{max:T.poolSize,idle_timeout:20,connect_timeout:10,types:{bigint:QY.BigInt}}),await this._sql`SELECT 1`}else await oT(T)}async disconnect(){if(this._sql)await this._sql.end(),this._sql=null;else await nT()}async initSchema(){await this.sql.unsafe(lX);let{applied:Y}=await ZY(this);if(Y>0)console.log(` ${Y} migration(s) applied`)}async transaction(T){return(this._sql||eU()).begin(async(G)=>{let K=Object.create(this);return Object.defineProperty(K,"sql",{get:()=>G}),Object.defineProperty(K,"_sql",{value:G,writable:!1}),T(K)})}async getPage(T){let G=await this.sql` + `}],nV=OE.length>0?OE[OE.length-1].version:1});import JY from"postgres";class rE{_sql=null;get sql(){if(this._sql)return this._sql;return eU()}async connect(I){if(I.poolSize){let Y=I.database_url;if(!Y)throw new aU("No database URL","database_url is missing","Provide --url");this._sql=JY(Y,{max:I.poolSize,idle_timeout:20,connect_timeout:10,types:{bigint:JY.BigInt}}),await this._sql`SELECT 1`}else await mI(I)}async disconnect(){if(this._sql)await this._sql.end(),this._sql=null;else await sI()}async initSchema(){let I=this.sql;await I`SELECT pg_advisory_lock(42)`;try{await I.unsafe(nT);let{applied:Y}=await ZY(this);if(Y>0)console.log(` ${Y} migration(s) applied`)}finally{await I`SELECT pg_advisory_unlock(42)`}}async transaction(I){return(this._sql||eU()).begin(async(G)=>{let K=Object.create(this);return Object.defineProperty(K,"sql",{get:()=>G}),Object.defineProperty(K,"_sql",{value:G,writable:!1}),I(K)})}async getPage(I){let G=await this.sql` SELECT id, slug, type, title, compiled_truth, timeline, frontmatter, content_hash, created_at, updated_at - FROM pages WHERE slug = ${T} - `;if(G.length===0)return null;return rX(G[0])}async putPage(T,Y){T=JY(T);let G=this.sql,K=Y.content_hash||GG(Y.compiled_truth,Y.timeline||""),L=Y.frontmatter||{},W=await G` + FROM pages WHERE slug = ${I} + `;if(G.length===0)return null;return tT(G[0])}async putPage(I,Y){I=GY(I);let G=this.sql,K=Y.content_hash||VG(Y.compiled_truth,Y.timeline||""),L=Y.frontmatter||{},W=await G` INSERT INTO pages (slug, type, title, compiled_truth, timeline, frontmatter, content_hash, updated_at) - VALUES (${T}, ${Y.type}, ${Y.title}, ${Y.compiled_truth}, ${Y.timeline||""}, ${JSON.stringify(L)}::jsonb, ${K}, now()) + VALUES (${I}, ${Y.type}, ${Y.title}, ${Y.compiled_truth}, ${Y.timeline||""}, ${JSON.stringify(L)}::jsonb, ${K}, now()) ON CONFLICT (slug) DO UPDATE SET type = EXCLUDED.type, title = EXCLUDED.title, @@ -311,41 +338,41 @@ END $$; content_hash = EXCLUDED.content_hash, updated_at = now() RETURNING id, slug, type, title, compiled_truth, timeline, frontmatter, content_hash, created_at, updated_at - `;return rX(W[0])}async deletePage(T){await this.sql`DELETE FROM pages WHERE slug = ${T}`}async listPages(T){let Y=this.sql,G=T?.limit||100,K=T?.offset||0,L;if(T?.type&&T?.tag)L=await Y` + `;return tT(W[0])}async deletePage(I){await this.sql`DELETE FROM pages WHERE slug = ${I}`}async listPages(I){let Y=this.sql,G=I?.limit||100,K=I?.offset||0,L;if(I?.type&&I?.tag)L=await Y` SELECT p.* FROM pages p JOIN tags t ON t.page_id = p.id - WHERE p.type = ${T.type} AND t.tag = ${T.tag} + WHERE p.type = ${I.type} AND t.tag = ${I.tag} ORDER BY p.updated_at DESC LIMIT ${G} OFFSET ${K} - `;else if(T?.type)L=await Y` - SELECT * FROM pages WHERE type = ${T.type} + `;else if(I?.type)L=await Y` + SELECT * FROM pages WHERE type = ${I.type} ORDER BY updated_at DESC LIMIT ${G} OFFSET ${K} - `;else if(T?.tag)L=await Y` + `;else if(I?.tag)L=await Y` SELECT p.* FROM pages p JOIN tags t ON t.page_id = p.id - WHERE t.tag = ${T.tag} + WHERE t.tag = ${I.tag} ORDER BY p.updated_at DESC LIMIT ${G} OFFSET ${K} `;else L=await Y` SELECT * FROM pages ORDER BY updated_at DESC LIMIT ${G} OFFSET ${K} - `;return L.map(rX)}async resolveSlugs(T){let Y=this.sql,G=await Y`SELECT slug FROM pages WHERE slug = ${T}`;if(G.length>0)return[G[0].slug];return(await Y` - SELECT slug, similarity(title, ${T}) AS sim + `;return L.map(tT)}async resolveSlugs(I){let Y=this.sql,G=await Y`SELECT slug FROM pages WHERE slug = ${I}`;if(G.length>0)return[G[0].slug];return(await Y` + SELECT slug, similarity(title, ${I}) AS sim FROM pages - WHERE title % ${T} OR slug ILIKE ${"%"+T+"%"} + WHERE title % ${I} OR slug ILIKE ${"%"+I+"%"} ORDER BY sim DESC LIMIT 5 - `).map((L)=>L.slug)}async searchKeyword(T,Y){let G=this.sql,K=Y?.limit||20,L=await G` + `).map((L)=>L.slug)}async searchKeyword(I,Y){let G=this.sql,K=Y?.limit||20,L=await G` SELECT DISTINCT ON (p.slug) p.slug, p.id as page_id, p.title, p.type, cc.chunk_text, cc.chunk_source, - ts_rank(p.search_vector, websearch_to_tsquery('english', ${T})) AS score, + ts_rank(p.search_vector, websearch_to_tsquery('english', ${I})) AS score, CASE WHEN p.updated_at < ( SELECT MAX(te.created_at) FROM timeline_entries te WHERE te.page_id = p.id ) THEN true ELSE false END AS stale FROM pages p JOIN content_chunks cc ON cc.page_id = p.id - WHERE p.search_vector @@ websearch_to_tsquery('english', ${T}) + WHERE p.search_vector @@ websearch_to_tsquery('english', ${I}) ORDER BY p.slug, score DESC - `;return L.sort((W,O)=>O.score-W.score),L.splice(K),L.map(GY)}async searchVector(T,Y){let G=this.sql,K=Y?.limit||20,L="["+Array.from(T).join(",")+"]";return(await G` + `;return L.sort((W,Z)=>Z.score-W.score),L.splice(K),L.map(VY)}async searchVector(I,Y){let G=this.sql,K=Y?.limit||20,L="["+Array.from(I).join(",")+"]";return(await G` SELECT p.slug, p.id as page_id, p.title, p.type, cc.chunk_text, cc.chunk_source, @@ -358,58 +385,49 @@ END $$; WHERE cc.embedding IS NOT NULL ORDER BY cc.embedding <=> ${L}::vector LIMIT ${K} - `).map(GY)}async upsertChunks(T,Y){let G=this.sql,K=await G`SELECT id FROM pages WHERE slug = ${T}`;if(K.length===0)throw Error(`Page not found: ${T}`);let L=K[0].id,W=Y.map((O)=>O.chunk_index);if(W.length>0)await G`DELETE FROM content_chunks WHERE page_id = ${L} AND chunk_index != ALL(${W})`;else{await G`DELETE FROM content_chunks WHERE page_id = ${L}`;return}for(let O of Y){let z=O.embedding?"["+Array.from(O.embedding).join(",")+"]":null;if(z)await G.unsafe(`INSERT INTO content_chunks (page_id, chunk_index, chunk_text, chunk_source, embedding, model, token_count, embedded_at) - VALUES ($1, $2, $3, $4, $5::vector, $6, $7, now()) - ON CONFLICT (page_id, chunk_index) DO UPDATE SET - chunk_text = EXCLUDED.chunk_text, - chunk_source = EXCLUDED.chunk_source, - embedding = EXCLUDED.embedding, - model = EXCLUDED.model, - token_count = EXCLUDED.token_count, - embedded_at = EXCLUDED.embedded_at`,[L,O.chunk_index,O.chunk_text,O.chunk_source,z,O.model||"text-embedding-3-large",O.token_count||null]);else await G.unsafe(`INSERT INTO content_chunks (page_id, chunk_index, chunk_text, chunk_source, embedding, model, token_count, embedded_at) - VALUES ($1, $2, $3, $4, NULL, $5, $6, NULL) - ON CONFLICT (page_id, chunk_index) DO UPDATE SET - chunk_text = EXCLUDED.chunk_text, - chunk_source = EXCLUDED.chunk_source, - embedding = COALESCE(content_chunks.embedding, EXCLUDED.embedding), - model = COALESCE(content_chunks.model, EXCLUDED.model), - token_count = EXCLUDED.token_count, - embedded_at = COALESCE(content_chunks.embedded_at, EXCLUDED.embedded_at)`,[L,O.chunk_index,O.chunk_text,O.chunk_source,O.model||"text-embedding-3-large",O.token_count||null])}}async getChunks(T){return(await this.sql` + `).map(VY)}async upsertChunks(I,Y){let G=this.sql,K=await G`SELECT id FROM pages WHERE slug = ${I}`;if(K.length===0)throw Error(`Page not found: ${I}`);let L=K[0].id,W=Y.map((D)=>D.chunk_index);if(W.length>0)await G`DELETE FROM content_chunks WHERE page_id = ${L} AND chunk_index != ALL(${W})`;else{await G`DELETE FROM content_chunks WHERE page_id = ${L}`;return}let Z="(page_id, chunk_index, chunk_text, chunk_source, embedding, model, token_count, embedded_at)",z=[],q=[],C=1;for(let D of Y){let F=D.embedding?"["+Array.from(D.embedding).join(",")+"]":null;if(F)z.push(`($${C++}, $${C++}, $${C++}, $${C++}, $${C++}::vector, $${C++}, $${C++}, now())`),q.push(L,D.chunk_index,D.chunk_text,D.chunk_source,F,D.model||"text-embedding-3-large",D.token_count||null);else z.push(`($${C++}, $${C++}, $${C++}, $${C++}, NULL, $${C++}, $${C++}, NULL)`),q.push(L,D.chunk_index,D.chunk_text,D.chunk_source,D.model||"text-embedding-3-large",D.token_count||null)}await G.unsafe(`INSERT INTO content_chunks ${Z} VALUES ${z.join(", ")} + ON CONFLICT (page_id, chunk_index) DO UPDATE SET + chunk_text = EXCLUDED.chunk_text, + chunk_source = EXCLUDED.chunk_source, + embedding = COALESCE(EXCLUDED.embedding, content_chunks.embedding), + model = COALESCE(EXCLUDED.model, content_chunks.model), + token_count = EXCLUDED.token_count, + embedded_at = COALESCE(EXCLUDED.embedded_at, content_chunks.embedded_at)`,q)}async getChunks(I){return(await this.sql` SELECT cc.* FROM content_chunks cc JOIN pages p ON p.id = cc.page_id - WHERE p.slug = ${T} + WHERE p.slug = ${I} ORDER BY cc.chunk_index - `).map(VG)}async deleteChunks(T){await this.sql` + `).map(AG)}async deleteChunks(I){await this.sql` DELETE FROM content_chunks - WHERE page_id = (SELECT id FROM pages WHERE slug = ${T}) - `}async addLink(T,Y,G,K){await this.sql` + WHERE page_id = (SELECT id FROM pages WHERE slug = ${I}) + `}async addLink(I,Y,G,K){await this.sql` INSERT INTO links (from_page_id, to_page_id, link_type, context) SELECT f.id, t.id, ${K||""}, ${G||""} FROM pages f, pages t - WHERE f.slug = ${T} AND t.slug = ${Y} + WHERE f.slug = ${I} AND t.slug = ${Y} ON CONFLICT (from_page_id, to_page_id) DO UPDATE SET link_type = EXCLUDED.link_type, context = EXCLUDED.context - `}async removeLink(T,Y){await this.sql` + `}async removeLink(I,Y){await this.sql` DELETE FROM links - WHERE from_page_id = (SELECT id FROM pages WHERE slug = ${T}) + WHERE from_page_id = (SELECT id FROM pages WHERE slug = ${I}) AND to_page_id = (SELECT id FROM pages WHERE slug = ${Y}) - `}async getLinks(T){return await this.sql` + `}async getLinks(I){return await this.sql` SELECT f.slug as from_slug, t.slug as to_slug, l.link_type, l.context FROM links l JOIN pages f ON f.id = l.from_page_id JOIN pages t ON t.id = l.to_page_id - WHERE f.slug = ${T} - `}async getBacklinks(T){return await this.sql` + WHERE f.slug = ${I} + `}async getBacklinks(I){return await this.sql` SELECT f.slug as from_slug, t.slug as to_slug, l.link_type, l.context FROM links l JOIN pages f ON f.id = l.from_page_id JOIN pages t ON t.id = l.to_page_id - WHERE t.slug = ${T} - `}async traverseGraph(T,Y=5){return(await this.sql` + WHERE t.slug = ${I} + `}async traverseGraph(I,Y=5){return(await this.sql` WITH RECURSIVE graph AS ( SELECT p.id, p.slug, p.title, p.type, 0 as depth - FROM pages p WHERE p.slug = ${T} + FROM pages p WHERE p.slug = ${I} UNION @@ -429,70 +447,70 @@ END $$; ) as links FROM graph g ORDER BY g.depth, g.slug - `).map((L)=>({slug:L.slug,title:L.title,type:L.type,depth:L.depth,links:typeof L.links==="string"?JSON.parse(L.links):L.links}))}async addTag(T,Y){await this.sql` + `).map((L)=>({slug:L.slug,title:L.title,type:L.type,depth:L.depth,links:typeof L.links==="string"?JSON.parse(L.links):L.links}))}async addTag(I,Y){await this.sql` INSERT INTO tags (page_id, tag) - SELECT id, ${Y} FROM pages WHERE slug = ${T} + SELECT id, ${Y} FROM pages WHERE slug = ${I} ON CONFLICT (page_id, tag) DO NOTHING - `}async removeTag(T,Y){await this.sql` + `}async removeTag(I,Y){await this.sql` DELETE FROM tags - WHERE page_id = (SELECT id FROM pages WHERE slug = ${T}) + WHERE page_id = (SELECT id FROM pages WHERE slug = ${I}) AND tag = ${Y} - `}async getTags(T){return(await this.sql` + `}async getTags(I){return(await this.sql` SELECT tag FROM tags - WHERE page_id = (SELECT id FROM pages WHERE slug = ${T}) + WHERE page_id = (SELECT id FROM pages WHERE slug = ${I}) ORDER BY tag - `).map((K)=>K.tag)}async addTimelineEntry(T,Y){await this.sql` + `).map((K)=>K.tag)}async addTimelineEntry(I,Y){await this.sql` INSERT INTO timeline_entries (page_id, date, source, summary, detail) SELECT id, ${Y.date}::date, ${Y.source||""}, ${Y.summary}, ${Y.detail||""} - FROM pages WHERE slug = ${T} - `}async getTimeline(T,Y){let G=this.sql,K=Y?.limit||100,L;if(Y?.after&&Y?.before)L=await G` + FROM pages WHERE slug = ${I} + `}async getTimeline(I,Y){let G=this.sql,K=Y?.limit||100,L;if(Y?.after&&Y?.before)L=await G` SELECT te.* FROM timeline_entries te JOIN pages p ON p.id = te.page_id - WHERE p.slug = ${T} AND te.date >= ${Y.after}::date AND te.date <= ${Y.before}::date + WHERE p.slug = ${I} AND te.date >= ${Y.after}::date AND te.date <= ${Y.before}::date ORDER BY te.date DESC LIMIT ${K} `;else if(Y?.after)L=await G` SELECT te.* FROM timeline_entries te JOIN pages p ON p.id = te.page_id - WHERE p.slug = ${T} AND te.date >= ${Y.after}::date + WHERE p.slug = ${I} AND te.date >= ${Y.after}::date ORDER BY te.date DESC LIMIT ${K} `;else L=await G` SELECT te.* FROM timeline_entries te JOIN pages p ON p.id = te.page_id - WHERE p.slug = ${T} + WHERE p.slug = ${I} ORDER BY te.date DESC LIMIT ${K} - `;return L}async putRawData(T,Y,G){await this.sql` + `;return L}async putRawData(I,Y,G){await this.sql` INSERT INTO raw_data (page_id, source, data) SELECT id, ${Y}, ${JSON.stringify(G)}::jsonb - FROM pages WHERE slug = ${T} + FROM pages WHERE slug = ${I} ON CONFLICT (page_id, source) DO UPDATE SET data = EXCLUDED.data, fetched_at = now() - `}async getRawData(T,Y){let G=this.sql,K;if(Y)K=await G` + `}async getRawData(I,Y){let G=this.sql,K;if(Y)K=await G` SELECT rd.source, rd.data, rd.fetched_at FROM raw_data rd JOIN pages p ON p.id = rd.page_id - WHERE p.slug = ${T} AND rd.source = ${Y} + WHERE p.slug = ${I} AND rd.source = ${Y} `;else K=await G` SELECT rd.source, rd.data, rd.fetched_at FROM raw_data rd JOIN pages p ON p.id = rd.page_id - WHERE p.slug = ${T} - `;return K}async createVersion(T){return(await this.sql` + WHERE p.slug = ${I} + `;return K}async createVersion(I){return(await this.sql` INSERT INTO page_versions (page_id, compiled_truth, frontmatter) SELECT id, compiled_truth, frontmatter - FROM pages WHERE slug = ${T} + FROM pages WHERE slug = ${I} RETURNING * - `)[0]}async getVersions(T){return await this.sql` + `)[0]}async getVersions(I){return await this.sql` SELECT pv.* FROM page_versions pv JOIN pages p ON p.id = pv.page_id - WHERE p.slug = ${T} + WHERE p.slug = ${I} ORDER BY pv.snapshot_at DESC - `}async revertToVersion(T,Y){await this.sql` + `}async revertToVersion(I,Y){await this.sql` UPDATE pages SET compiled_truth = pv.compiled_truth, frontmatter = pv.frontmatter, updated_at = now() FROM page_versions pv - WHERE pages.slug = ${T} AND pv.id = ${Y} AND pv.page_id = pages.id - `}async getStats(){let T=this.sql,[Y]=await T` + WHERE pages.slug = ${I} AND pv.id = ${Y} AND pv.page_id = pages.id + `}async getStats(){let I=this.sql,[Y]=await I` SELECT (SELECT count(*) FROM pages) as page_count, (SELECT count(*) FROM content_chunks) as chunk_count, @@ -500,9 +518,9 @@ END $$; (SELECT count(*) FROM links) as link_count, (SELECT count(DISTINCT tag) FROM tags) as tag_count, (SELECT count(*) FROM timeline_entries) as timeline_entry_count - `,G=await T` + `,G=await I` SELECT type, count(*)::int as count FROM pages GROUP BY type ORDER BY count DESC - `,K={};for(let L of G)K[L.type]=L.count;return{page_count:Number(Y.page_count),chunk_count:Number(Y.chunk_count),embedded_count:Number(Y.embedded_count),link_count:Number(Y.link_count),tag_count:Number(Y.tag_count),timeline_entry_count:Number(Y.timeline_entry_count),pages_by_type:K}}async getHealth(){let T=this.sql,[Y]=await T` + `,K={};for(let L of G)K[L.type]=L.count;return{page_count:Number(Y.page_count),chunk_count:Number(Y.chunk_count),embedded_count:Number(Y.embedded_count),link_count:Number(Y.link_count),tag_count:Number(Y.tag_count),timeline_entry_count:Number(Y.timeline_entry_count),pages_by_type:K}}async getHealth(){let I=this.sql,[Y]=await I` SELECT (SELECT count(*) FROM pages) as page_count, (SELECT count(*) FROM content_chunks WHERE embedded_at IS NOT NULL)::float / @@ -517,24 +535,24 @@ END $$; WHERE NOT EXISTS (SELECT 1 FROM pages p WHERE p.id = l.to_page_id) ) as dead_links, (SELECT count(*) FROM content_chunks WHERE embedded_at IS NULL) as missing_embeddings - `;return{page_count:Number(Y.page_count),embed_coverage:Number(Y.embed_coverage),stale_pages:Number(Y.stale_pages),orphan_pages:Number(Y.orphan_pages),dead_links:Number(Y.dead_links),missing_embeddings:Number(Y.missing_embeddings)}}async logIngest(T){await this.sql` + `;return{page_count:Number(Y.page_count),embed_coverage:Number(Y.embed_coverage),stale_pages:Number(Y.stale_pages),orphan_pages:Number(Y.orphan_pages),dead_links:Number(Y.dead_links),missing_embeddings:Number(Y.missing_embeddings)}}async logIngest(I){await this.sql` INSERT INTO ingest_log (source_type, source_ref, pages_updated, summary) - VALUES (${T.source_type}, ${T.source_ref}, ${JSON.stringify(T.pages_updated)}::jsonb, ${T.summary}) - `}async getIngestLog(T){let Y=this.sql,G=T?.limit||50;return await Y` + VALUES (${I.source_type}, ${I.source_ref}, ${JSON.stringify(I.pages_updated)}::jsonb, ${I.summary}) + `}async getIngestLog(I){let Y=this.sql,G=I?.limit||50;return await Y` SELECT * FROM ingest_log ORDER BY created_at DESC LIMIT ${G} - `}async updateSlug(T,Y){Y=JY(Y),await this.sql`UPDATE pages SET slug = ${Y}, updated_at = now() WHERE slug = ${T}`}async rewriteLinks(T,Y){}async getConfig(T){let G=await this.sql`SELECT value FROM config WHERE key = ${T}`;return G.length>0?G[0].value:null}async setConfig(T,Y){await this.sql` - INSERT INTO config (key, value) VALUES (${T}, ${Y}) + `}async updateSlug(I,Y){Y=GY(Y),await this.sql`UPDATE pages SET slug = ${Y}, updated_at = now() WHERE slug = ${I}`}async rewriteLinks(I,Y){}async getConfig(I){let G=await this.sql`SELECT value FROM config WHERE key = ${I}`;return G.length>0?G[0].value:null}async setConfig(I,Y){await this.sql` + INSERT INTO config (key, value) VALUES (${I}, ${Y}) ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value - `}}function JY(T){if(!T||/\.\./.test(T)||/^\//.test(T))throw Error(`Invalid slug: "${T}". Slugs cannot be empty, start with /, or contain path traversal.`);return T.toLowerCase()}function GG(T,Y){return CE("sha256").update(T+` + `}}function GY(I){if(!I||/\.\./.test(I)||/^\//.test(I))throw Error(`Invalid slug: "${I}". Slugs cannot be empty, start with /, or contain path traversal.`);return I.toLowerCase()}function VG(I,Y){return DE("sha256").update(I+` --- -`+Y).digest("hex")}function rX(T){return{id:T.id,slug:T.slug,type:T.type,title:T.title,compiled_truth:T.compiled_truth,timeline:T.timeline,frontmatter:typeof T.frontmatter==="string"?JSON.parse(T.frontmatter):T.frontmatter,content_hash:T.content_hash,created_at:new Date(T.created_at),updated_at:new Date(T.updated_at)}}function VG(T){return{id:T.id,page_id:T.page_id,chunk_index:T.chunk_index,chunk_text:T.chunk_text,chunk_source:T.chunk_source,embedding:null,model:T.model,token_count:T.token_count,embedded_at:T.embedded_at?new Date(T.embedded_at):null}}function GY(T){return{slug:T.slug,page_id:T.page_id,title:T.title,type:T.type,chunk_text:T.chunk_text,chunk_source:T.chunk_source,score:Number(T.score),stale:Boolean(T.stale)}}var tX=GU(()=>{DU();OY();dE();oX()});var{readFileSync:AG,writeFileSync:tV,mkdirSync:aV,chmodSync:eV}=(()=>({}));function VY(){let T=null;try{let G=AG(AY(),"utf-8");T=JSON.parse(G)}catch{}let Y=process.env.GBRAIN_DATABASE_URL||process.env.DATABASE_URL;if(!T&&!Y)return null;return{engine:"postgres",...T,...Y?{database_url:Y}:{},...process.env.OPENAI_API_KEY?{openai_api_key:process.env.OPENAI_API_KEY}:{}}}function AY(){return AY()}var LY=GU(()=>{TE();sX()});var $Y={};jU($Y,{runImport:()=>RG});var{readdirSync:LG,statSync:$G,existsSync:SE,writeFileSync:KG,readFileSync:FG,unlinkSync:WG}=(()=>({}));import{execFileSync as HG}from"child_process";async function RG(T,Y){let G=Y.includes("--no-embed"),K=Y.includes("--fresh"),L=Y.includes("--json"),W=Y.indexOf("--workers"),O=W!==-1?Y[W+1]:null,z=O?parseInt(O,10):1,q=new Set;if(W!==-1)q.add(W+1);let D=Y.find((u,i)=>!u.startsWith("--")&&!q.has(i));if(!D)console.error("Usage: gbrain import [--no-embed] [--workers N] [--fresh] [--json]"),process.exit(1);let C=CG(D);console.log(`Found ${C.length} markdown files`);let F=VU(mX(),".gbrain","import-checkpoint.json"),R=C,M=0;if(!K&&SE(F))try{let u=JSON.parse(FG(F,"utf-8"));if(u.dir===D&&u.totalFiles===C.length)M=u.processedIndex,R=C.slice(M),console.log(`Resuming from checkpoint: skipping ${M} already-processed files`)}catch{}let P=z>1?z:1;if(P>1)console.log(`Using ${P} parallel workers`);let k=0,_=0,N=0,v=0,B=0,g=[],y={},l=Date.now();function Y0(){let u=(Date.now()-l)/1000,i=u>0?Math.round(v/u):0,U=i>0?Math.round((R.length-v)/i):0,I=Math.round(v/R.length*100);console.log(`[gbrain import] ${v}/${R.length} (${I}%) | ${i} files/sec | imported: ${k} | skipped: ${_} | errors: ${N} | ETA: ${U}s`)}async function O0(u,i){let U=oE(D,i);try{let I=await DE(u,i,U,{noEmbed:G});if(I.status==="imported")k++,B+=I.chunks,g.push(I.slug);else if(_++,I.error&&I.error!=="unchanged")console.error(` Skipped ${U}: ${I.error}`)}catch(I){let Q=I instanceof Error?I.message:String(I),X=Q.replace(/"[^"]*"/g,'""');if(y[X]=(y[X]||0)+1,y[X]<=5)console.error(` Warning: skipped ${U}: ${Q}`);else if(y[X]===6)console.error(` (suppressing further "${X.slice(0,60)}..." errors)`);N++,_++}if(v++,v%100===0||v===R.length){if(Y0(),v%100===0)try{let I=VU(mX(),".gbrain");if(!SE(I)){let{mkdirSync:Q}=await import("fs");Q(I,{recursive:!0})}KG(F,JSON.stringify({dir:D,totalFiles:C.length,processedIndex:M+v,completedFiles:g.length+_,timestamp:new Date().toISOString()}))}catch{}}}if(P>1){let u=VY(),i=await Promise.all(Array.from({length:P},async()=>{let I=new mE;return await I.connect({database_url:u.database_url,poolSize:2}),I})),U=0;await Promise.all(i.map(async(I)=>{while(!0){let Q=U++;if(Q>=R.length)break;await O0(I,R[Q])}})),await Promise.all(i.map((I)=>I.disconnect()))}else for(let u of R)await O0(T,u);for(let[u,i]of Object.entries(y))if(i>5)console.error(` ${i} files failed: ${u.slice(0,100)}`);if(N===0&&SE(F))try{WG(F)}catch{}else if(N>0&&SE(F))console.log(` Checkpoint preserved (${N} errors). Run again to retry failed files.`);let Z0=((Date.now()-l)/1000).toFixed(1);if(L)console.log(JSON.stringify({status:"success",duration_s:parseFloat(Z0),imported:k,skipped:_,errors:N,chunks:B,total_files:C.length}));else console.log(` -Import complete (${Z0}s):`),console.log(` ${k} pages imported`),console.log(` ${_} pages skipped (${_-N} unchanged, ${N} errors)`),console.log(` ${B} chunks created`);await T.logIngest({source_type:"directory",source_ref:D,pages_updated:g,summary:`Imported ${k} pages, ${_} skipped, ${B} chunks`});try{if(SE(VU(D,".git"))){let u=HG("git",["-C",D,"rev-parse","HEAD"],{encoding:"utf-8"}).trim();await T.setConfig("sync.last_commit",u),await T.setConfig("sync.last_run",new Date().toISOString()),await T.setConfig("sync.repo_path",D)}}catch{}}function CG(T){let Y=[];function G(K){for(let L of LG(K)){if(L.startsWith("."))continue;let W=VU(K,L);if($G(W).isDirectory())G(W);else if(L.endsWith(".md"))Y.push(W)}}return G(T),Y.sort()}var KY=GU(()=>{TE();sX();tX();bE();LY()});var FY={};jU(FY,{runSync:()=>zG,performSync:()=>iX});var{existsSync:aX}=(()=>({}));import{execFileSync as DG}from"child_process";function ME(T,...Y){return DG("git",["-C",T,...Y],{encoding:"utf-8",timeout:30000}).trim()}async function iX(T,Y){let G=Y.repoPath||await T.getConfig("sync.repo_path");if(!G)throw Error("No repo path specified. Use --repo or run gbrain init with --repo first.");if(!aX(VU(G,".git")))throw Error(`Not a git repository: ${G}. GBrain sync requires a git-initialized repo.`);if(!Y.noPull)try{ME(G,"pull","--ff-only")}catch(N){let v=N instanceof Error?N.message:String(N);if(v.includes("non-fast-forward")||v.includes("diverged"))console.error("Warning: git pull failed (remote diverged). Syncing from local state.");else console.error(`Warning: git pull failed: ${v.slice(0,100)}`)}let K;try{K=ME(G,"rev-parse","HEAD")}catch{throw Error(`No commits in repo ${G}. Make at least one commit before syncing.`)}let L=Y.full?null:await T.getConfig("sync.last_commit");if(L){try{ME(G,"cat-file","-t",L)}catch{return console.error(`Sync anchor commit ${L.slice(0,8)} missing (force push?). Running full reimport.`),eX(T,G,K,Y)}try{ME(G,"merge-base","--is-ancestor",L,K)}catch{return console.error(`Sync anchor ${L.slice(0,8)} is not an ancestor of HEAD. Running full reimport.`),eX(T,G,K,Y)}}if(!L)return eX(T,G,K,Y);if(L===K)return{status:"up_to_date",fromCommit:L,toCommit:K,added:0,modified:0,deleted:0,renamed:0,chunksCreated:0,pagesAffected:[]};let W=ME(G,"diff","--name-status","-M",`${L}..${K}`),O=YY(W),z={added:O.added.filter((N)=>YE(N)),modified:O.modified.filter((N)=>YE(N)),deleted:O.deleted.filter((N)=>YE(N)),renamed:O.renamed.filter((N)=>YE(N.to))},q=O.modified.filter((N)=>!YE(N));for(let N of q){let v=zE(N);try{if(await T.getPage(v))await T.deletePage(v),console.log(` Deleted un-syncable page: ${v}`)}catch{}}let D=z.added.length+z.modified.length+z.deleted.length+z.renamed.length;if(Y.dryRun){if(console.log(`Sync dry run: ${L.slice(0,8)}..${K.slice(0,8)}`),z.added.length)console.log(` Added: ${z.added.join(", ")}`);if(z.modified.length)console.log(` Modified: ${z.modified.join(", ")}`);if(z.deleted.length)console.log(` Deleted: ${z.deleted.join(", ")}`);if(z.renamed.length)console.log(` Renamed: ${z.renamed.map((N)=>`${N.from} -> ${N.to}`).join(", ")}`);if(D===0)console.log(" No syncable changes.");return{status:"dry_run",fromCommit:L,toCommit:K,added:z.added.length,modified:z.modified.length,deleted:z.deleted.length,renamed:z.renamed.length,chunksCreated:0,pagesAffected:[]}}if(D===0)return await T.setConfig("sync.last_commit",K),await T.setConfig("sync.last_run",new Date().toISOString()),{status:"up_to_date",fromCommit:L,toCommit:K,added:0,modified:0,deleted:0,renamed:0,chunksCreated:0,pagesAffected:[]};let C=Y.noEmbed||D>100;if(D>100)console.log(`Large sync (${D} files). Importing text, deferring embeddings.`);let F=[],R=0,M=Date.now();for(let N of z.deleted){let v=zE(N);await T.deletePage(v),F.push(v)}for(let{from:N,to:v}of z.renamed){let B=zE(N),g=zE(v);try{await T.updateSlug(B,g)}catch{}let y=VU(G,v);if(aX(y)){let l=await DE(T,y,v,{noEmbed:C});if(l.status==="imported")R+=l.chunks}F.push(g)}let P=z.added.length+z.modified.length>10,k=async()=>{for(let N of[...z.added,...z.modified]){let v=VU(G,N);if(!aX(v))continue;try{let B=await DE(T,v,N,{noEmbed:C});if(B.status==="imported")R+=B.chunks,F.push(B.slug)}catch(B){let g=B instanceof Error?B.message:String(B);console.error(` Warning: skipped ${N}: ${g}`)}}};if(P)await T.transaction(async()=>{await k()});else await k();let _=Date.now()-M;if(await T.setConfig("sync.last_commit",K),await T.setConfig("sync.last_run",new Date().toISOString()),await T.setConfig("sync.repo_path",G),await T.logIngest({source_type:"git_sync",source_ref:`${G} @ ${K.slice(0,8)}`,pages_updated:F,summary:`Sync: +${z.added.length} ~${z.modified.length} -${z.deleted.length} R${z.renamed.length}, ${R} chunks, ${_}ms`}),C&&D>100)console.log("Text imported. Run 'gbrain embed --stale' to generate embeddings.");return{status:"synced",fromCommit:L,toCommit:K,added:z.added.length,modified:z.modified.length,deleted:z.deleted.length,renamed:z.renamed.length,chunksCreated:R,pagesAffected:F}}async function eX(T,Y,G,K){console.log(`Running full import of ${Y}...`);let{runImport:L}=await Promise.resolve().then(() => (KY(),$Y)),W=[Y];if(K.noEmbed)W.push("--no-embed");return await L(T,W),{status:"first_sync",fromCommit:null,toCommit:G,added:0,modified:0,deleted:0,renamed:0,chunksCreated:0,pagesAffected:[]}}async function zG(T,Y){let G=Y.find((R,M)=>Y[M-1]==="--repo")||void 0,K=Y.includes("--watch"),L=Y.find((R,M)=>Y[M-1]==="--interval"),W=L?parseInt(L,10):60,O=Y.includes("--dry-run"),z=Y.includes("--full"),q=Y.includes("--no-pull"),D=Y.includes("--no-embed"),C={repoPath:G,dryRun:O,full:z,noPull:q,noEmbed:D};if(!K){let R=await iX(T,C);SG(R);return}let F=0;console.log(`Watching for changes every ${W}s... (Ctrl+C to stop)`);while(!0){try{let R=await iX(T,{...C,full:!1});if(F=0,R.status==="synced"){let M=new Date().toISOString().slice(11,19);console.log(`[${M}] Synced: +${R.added} ~${R.modified} -${R.deleted} R${R.renamed}`)}}catch(R){F++;let M=R instanceof Error?R.message:String(R);if(console.error(`[${new Date().toISOString().slice(11,19)}] Sync error (${F}/5): ${M}`),F>=5)console.error("5 consecutive sync failures. Stopping watch."),process.exit(1)}await new Promise((R)=>setTimeout(R,W*1000))}}function SG(T){switch(T.status){case"up_to_date":console.log("Already up to date.");break;case"synced":console.log(`Synced ${T.fromCommit?.slice(0,8)}..${T.toCommit.slice(0,8)}:`),console.log(` +${T.added} added, ~${T.modified} modified, -${T.deleted} deleted, R${T.renamed} renamed`),console.log(` ${T.chunksCreated} chunks created`);break;case"first_sync":console.log(`First sync complete. Checkpoint: ${T.toCommit.slice(0,8)}`);break;case"dry_run":break}}var WY=GU(()=>{TE();bE()});var CY={};jU(CY,{S3Storage:()=>RY});import{S3Client as MG,PutObjectCommand as qG,GetObjectCommand as PG,DeleteObjectCommand as _G,HeadObjectCommand as HY,ListObjectsV2Command as kG}from"@aws-sdk/client-s3";class RY{client;bucket;constructor(T){this.bucket=T.bucket;let Y=T.region||"us-east-1";if(!T.accessKeyId||!T.secretAccessKey)throw Error("S3 storage requires accessKeyId and secretAccessKey in config");this.client=new MG({region:Y,...T.endpoint?{endpoint:T.endpoint,forcePathStyle:!0}:{},credentials:{accessKeyId:T.accessKeyId,secretAccessKey:T.secretAccessKey}})}async upload(T,Y,G){await this.client.send(new qG({Bucket:this.bucket,Key:T,Body:Y,ContentType:G||"application/octet-stream"}))}async download(T){let Y=await this.client.send(new PG({Bucket:this.bucket,Key:T}));if(!Y.Body)throw Error(`S3 download returned empty body: ${T}`);return Buffer.from(await Y.Body.transformToByteArray())}async delete(T){await this.client.send(new _G({Bucket:this.bucket,Key:T}))}async exists(T){try{return await this.client.send(new HY({Bucket:this.bucket,Key:T})),!0}catch(Y){if(Y.name==="NotFound"||Y.$metadata?.httpStatusCode===404)return!1;throw Y}}async list(T){return((await this.client.send(new kG({Bucket:this.bucket,Prefix:T}))).Contents||[]).map((G)=>G.Key).filter(Boolean)}async getUrl(T){let Y=this.client.config.endpoint;if(Y)return`${typeof Y==="function"?(await Y()).url.toString():Y}/${this.bucket}/${T}`;let G=await this.client.config.region();return`https://${this.bucket}.s3.${G}.amazonaws.com/${T}`}async getContentHash(T){try{return(await this.client.send(new HY({Bucket:this.bucket,Key:T}))).ETag?.replace(/"/g,"")||null}catch{return null}}}var DY=()=>{};var SY={};jU(SY,{SupabaseStorage:()=>zY});class zY{projectUrl;serviceRoleKey;bucket;constructor(T){if(this.projectUrl=T.projectUrl||"",this.serviceRoleKey=T.serviceRoleKey||"",this.bucket=T.bucket,!this.projectUrl||!this.serviceRoleKey)throw Error("Supabase storage requires projectUrl and serviceRoleKey in config")}url(T){return`${this.projectUrl}/storage/v1/object/${this.bucket}/${T}`}headers(){return{Authorization:`Bearer ${this.serviceRoleKey}`,apikey:this.serviceRoleKey}}async upload(T,Y,G){let K=await fetch(this.url(T),{method:"POST",headers:{...this.headers(),"Content-Type":G||"application/octet-stream","x-upsert":"true"},body:Y});if(!K.ok){let L=await K.text();throw Error(`Supabase upload failed: ${K.status} ${L}`)}}async download(T){let Y=await fetch(this.url(T),{headers:this.headers()});if(!Y.ok)throw Error(`Supabase download failed: ${Y.status}`);return Buffer.from(await Y.arrayBuffer())}async delete(T){let Y=await fetch(`${this.projectUrl}/storage/v1/object/${this.bucket}`,{method:"DELETE",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({prefixes:[T]})});if(!Y.ok&&Y.status!==404)throw Error(`Supabase delete failed: ${Y.status}`)}async exists(T){return(await fetch(this.url(T),{method:"HEAD",headers:this.headers()})).ok}async list(T){let Y=await fetch(`${this.projectUrl}/storage/v1/object/list/${this.bucket}`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({prefix:T,limit:1000})});if(!Y.ok)throw Error(`Supabase list failed: ${Y.status}`);return(await Y.json()).map((K)=>`${T}/${K.name}`)}async getUrl(T){return`${this.projectUrl}/storage/v1/object/public/${this.bucket}/${T}`}}var PY={};jU(PY,{LocalStorage:()=>qY});var{readFileSync:vG,writeFileSync:jG,unlinkSync:NG,existsSync:sE,mkdirSync:MY,readdirSync:BG}=(()=>({}));class qY{basePath;constructor(T){this.basePath=T;MY(T,{recursive:!0})}async upload(T,Y,G){let K=VU(this.basePath,T);MY(nE(K),{recursive:!0}),jG(K,Y)}async download(T){let Y=VU(this.basePath,T);if(!sE(Y))throw Error(`File not found in storage: ${T}`);return vG(Y)}async delete(T){let Y=VU(this.basePath,T);if(sE(Y))NG(Y)}async exists(T){return sE(VU(this.basePath,T))}async list(T){let Y=VU(this.basePath,T);if(!sE(Y))return[];let G=[];function K(L,W){for(let O of BG(L,{withFileTypes:!0})){let z=W?`${W}/${O.name}`:O.name;if(O.isDirectory())K(VU(L,O.name),z);else G.push(`${T}/${z}`)}}return K(Y,""),G}async getUrl(T){return`file://${VU(this.basePath,T)}`}}var _Y=GU(()=>{TE()});var UI={};jU(UI,{createStorage:()=>xG});async function xG(T){switch(T.backend){case"s3":{let{S3Storage:Y}=await Promise.resolve().then(() => (DY(),CY));return new Y(T)}case"supabase":{let{SupabaseStorage:Y}=await Promise.resolve().then(() => SY);return new Y(T)}case"local":{let{LocalStorage:Y}=await Promise.resolve().then(() => (_Y(),PY));return new Y(T.localPath||"/tmp/gbrain-storage")}default:throw Error(`Unknown storage backend: ${T.backend}`)}}bE();uX();function uT(T,Y){let G=Y?.cosineThreshold??0.85,K=Y?.maxTypeRatio??0.6,L=Y?.maxPerPage??2,W=T;return W=aJ(W),W=eJ(W,G),W=iJ(W,K),W=UG(W,L),W}function aJ(T){let Y=new Map;for(let K of T){let L=Y.get(K.slug)||[];L.push(K),Y.set(K.slug,L)}let G=[];for(let K of Y.values())K.sort((L,W)=>W.score-L.score),G.push(...K.slice(0,3));return G.sort((K,L)=>L.score-K.score)}function eJ(T,Y){let G=[];for(let K of T){let L=new Set(K.chunk_text.toLowerCase().split(/\s+/)),W=!1;for(let O of G){let z=new Set(O.chunk_text.toLowerCase().split(/\s+/)),q=new Set([...L].filter((F)=>z.has(F))),D=new Set([...L,...z]);if(q.size/D.size>Y){W=!0;break}}if(!W)G.push(K)}return G}function iJ(T,Y){let G=Math.max(1,Math.ceil(T.length*Y)),K=new Map,L=[];for(let W of T){let O=K.get(W.type)||0;if(OhT(F))),O=await Promise.all(W.map((F)=>T.searchVector(F,{limit:K*2}))),z=await T.searchKeyword(Y,{limit:K*2}),q=[...O,z],D=XG(q);return uT(D).slice(0,K)}function XG(T){let Y=new Map;for(let G of T)for(let K=0;KK.score-G.score).map(({result:G,score:K})=>({...G,score:K}))}import IG from"@anthropic-ai/sdk";var TG=3,YG=3,dX=null;function ZG(){if(!dX)dX=new IG;return dX}async function dT(T){if((T.match(/\S+/g)||[]).lengthW.toLowerCase().trim()))].slice(0,TG).map((W)=>K.find((O)=>O.toLowerCase().trim()===W)||W)}catch{return[T]}}async function OG(T){let Y=await ZG().messages.create({model:"claude-haiku-4-5-20251001",max_tokens:300,tools:[{name:"expand_query",description:"Generate alternative phrasings of a search query to improve recall",input_schema:{type:"object",properties:{alternative_queries:{type:"array",items:{type:"string"},description:"2 alternative phrasings of the original query, each approaching the topic from a different angle"}},required:["alternative_queries"]}}],tool_choice:{type:"tool",name:"expand_query"},messages:[{role:"user",content:`Generate 2 alternative search queries that would find relevant results for this question. Each alternative should approach the topic from a different angle or use different terminology. +`+Y).digest("hex")}function tT(I){return{id:I.id,slug:I.slug,type:I.type,title:I.title,compiled_truth:I.compiled_truth,timeline:I.timeline,frontmatter:typeof I.frontmatter==="string"?JSON.parse(I.frontmatter):I.frontmatter,content_hash:I.content_hash,created_at:new Date(I.created_at),updated_at:new Date(I.updated_at)}}function AG(I){return{id:I.id,page_id:I.page_id,chunk_index:I.chunk_index,chunk_text:I.chunk_text,chunk_source:I.chunk_source,embedding:null,model:I.model,token_count:I.token_count,embedded_at:I.embedded_at?new Date(I.embedded_at):null}}function VY(I){return{slug:I.slug,page_id:I.page_id,title:I.title,type:I.type,chunk_text:I.chunk_text,chunk_source:I.chunk_source,score:Number(I.score),stale:Boolean(I.stale)}}var aT=VU(()=>{CU();QY();oE();mT()});var{readFileSync:LG,writeFileSync:EA,mkdirSync:TA,chmodSync:XA}=(()=>({}));function $G(){return r0(ME(),".gbrain")}function KG(){return r0($G(),"config.json")}function AY(){let I=null;try{let G=LG(KG(),"utf-8");I=JSON.parse(G)}catch{}let Y=process.env.GBRAIN_DATABASE_URL||process.env.DATABASE_URL;if(!I&&!Y)return null;return{engine:"postgres",...I,...Y?{database_url:Y}:{},...process.env.OPENAI_API_KEY?{openai_api_key:process.env.OPENAI_API_KEY}:{}}}var LY=VU(()=>{YE();rT()});var $Y={};jU($Y,{runImport:()=>zG});var{readdirSync:FG,statSync:WG,existsSync:qE,writeFileSync:HG,readFileSync:RG,unlinkSync:DG}=(()=>({}));import{execFileSync as CG}from"child_process";async function zG(I,Y){let G=Y.includes("--no-embed"),K=Y.includes("--fresh"),L=Y.includes("--json"),W=Y.indexOf("--workers"),Z=W!==-1?Y[W+1]:null,z=Z?parseInt(Z,10):1,q=new Set;if(W!==-1)q.add(W+1);let C=Y.find((u,i)=>!u.startsWith("--")&&!q.has(i));if(!C)console.error("Usage: gbrain import [--no-embed] [--workers N] [--fresh] [--json]"),process.exit(1);let D=SG(C);console.log(`Found ${D.length} markdown files`);let F=r0(ME(),".gbrain","import-checkpoint.json"),R=D,M=0;if(!K&&qE(F))try{let u=JSON.parse(RG(F,"utf-8"));if(u.dir===C&&u.totalFiles===D.length)M=u.processedIndex,R=D.slice(M),console.log(`Resuming from checkpoint: skipping ${M} already-processed files`)}catch{}let P=z>1?z:1;if(P>1)console.log(`Using ${P} parallel workers`);let k=0,_=0,N=0,v=0,B=0,g=[],y={},l=Date.now();function Y0(){let u=(Date.now()-l)/1000,i=u>0?Math.round(v/u):0,U=i>0?Math.round((R.length-v)/i):0,X=Math.round(v/R.length*100);console.log(`[gbrain import] ${v}/${R.length} (${X}%) | ${i} files/sec | imported: ${k} | skipped: ${_} | errors: ${N} | ETA: ${U}s`)}async function Z0(u,i){let U=mE(C,i);try{let X=await SE(u,i,U,{noEmbed:G});if(X.status==="imported")k++,B+=X.chunks,g.push(X.slug);else if(_++,X.error&&X.error!=="unchanged")console.error(` Skipped ${U}: ${X.error}`)}catch(X){let Q=X instanceof Error?X.message:String(X),T=Q.replace(/"[^"]*"/g,'""');if(y[T]=(y[T]||0)+1,y[T]<=5)console.error(` Warning: skipped ${U}: ${Q}`);else if(y[T]===6)console.error(` (suppressing further "${T.slice(0,60)}..." errors)`);N++,_++}if(v++,v%100===0||v===R.length){if(Y0(),v%100===0)try{let X=r0(ME(),".gbrain");if(!qE(X)){let{mkdirSync:Q}=await import("fs");Q(X,{recursive:!0})}HG(F,JSON.stringify({dir:C,totalFiles:D.length,processedIndex:M+v,completedFiles:g.length+_,timestamp:new Date().toISOString()}))}catch{}}}if(P>1){let u=AY(),i=await Promise.all(Array.from({length:P},async()=>{let X=new rE;return await X.connect({database_url:u.database_url,poolSize:2}),X})),U=0;await Promise.all(i.map(async(X)=>{while(!0){let Q=U++;if(Q>=R.length)break;await Z0(X,R[Q])}})),await Promise.all(i.map((X)=>X.disconnect()))}else for(let u of R)await Z0(I,u);for(let[u,i]of Object.entries(y))if(i>5)console.error(` ${i} files failed: ${u.slice(0,100)}`);if(N===0&&qE(F))try{DG(F)}catch{}else if(N>0&&qE(F))console.log(` Checkpoint preserved (${N} errors). Run again to retry failed files.`);let O0=((Date.now()-l)/1000).toFixed(1);if(L)console.log(JSON.stringify({status:"success",duration_s:parseFloat(O0),imported:k,skipped:_,errors:N,chunks:B,total_files:D.length}));else console.log(` +Import complete (${O0}s):`),console.log(` ${k} pages imported`),console.log(` ${_} pages skipped (${_-N} unchanged, ${N} errors)`),console.log(` ${B} chunks created`);await I.logIngest({source_type:"directory",source_ref:C,pages_updated:g,summary:`Imported ${k} pages, ${_} skipped, ${B} chunks`});try{if(qE(r0(C,".git"))){let u=CG("git",["-C",C,"rev-parse","HEAD"],{encoding:"utf-8"}).trim();await I.setConfig("sync.last_commit",u),await I.setConfig("sync.last_run",new Date().toISOString()),await I.setConfig("sync.repo_path",C)}}catch{}}function SG(I){let Y=[];function G(K){for(let L of FG(K)){if(L.startsWith("."))continue;let W=r0(K,L);if(WG(W).isDirectory())G(W);else if(L.endsWith(".md"))Y.push(W)}}return G(I),Y.sort()}var KY=VU(()=>{YE();rT();aT();lE();LY()});var FY={};jU(FY,{runSync:()=>qG,performSync:()=>UX});var{existsSync:eT}=(()=>({}));import{execFileSync as MG}from"child_process";function PE(I,...Y){return MG("git",["-C",I,...Y],{encoding:"utf-8",timeout:30000}).trim()}async function UX(I,Y){let G=Y.repoPath||await I.getConfig("sync.repo_path");if(!G)throw Error("No repo path specified. Use --repo or run gbrain init with --repo first.");if(!eT(r0(G,".git")))throw Error(`Not a git repository: ${G}. GBrain sync requires a git-initialized repo.`);if(!Y.noPull)try{PE(G,"pull","--ff-only")}catch(N){let v=N instanceof Error?N.message:String(N);if(v.includes("non-fast-forward")||v.includes("diverged"))console.error("Warning: git pull failed (remote diverged). Syncing from local state.");else console.error(`Warning: git pull failed: ${v.slice(0,100)}`)}let K;try{K=PE(G,"rev-parse","HEAD")}catch{throw Error(`No commits in repo ${G}. Make at least one commit before syncing.`)}let L=Y.full?null:await I.getConfig("sync.last_commit");if(L){try{PE(G,"cat-file","-t",L)}catch{return console.error(`Sync anchor commit ${L.slice(0,8)} missing (force push?). Running full reimport.`),iT(I,G,K,Y)}try{PE(G,"merge-base","--is-ancestor",L,K)}catch{return console.error(`Sync anchor ${L.slice(0,8)} is not an ancestor of HEAD. Running full reimport.`),iT(I,G,K,Y)}}if(!L)return iT(I,G,K,Y);if(L===K)return{status:"up_to_date",fromCommit:L,toCommit:K,added:0,modified:0,deleted:0,renamed:0,chunksCreated:0,pagesAffected:[]};let W=PE(G,"diff","--name-status","-M",`${L}..${K}`),Z=xI(W),z={added:Z.added.filter((N)=>IE(N)),modified:Z.modified.filter((N)=>IE(N)),deleted:Z.deleted.filter((N)=>IE(N)),renamed:Z.renamed.filter((N)=>IE(N.to))},q=Z.modified.filter((N)=>!IE(N));for(let N of q){let v=zE(N);try{if(await I.getPage(v))await I.deletePage(v),console.log(` Deleted un-syncable page: ${v}`)}catch{}}let C=z.added.length+z.modified.length+z.deleted.length+z.renamed.length;if(Y.dryRun){if(console.log(`Sync dry run: ${L.slice(0,8)}..${K.slice(0,8)}`),z.added.length)console.log(` Added: ${z.added.join(", ")}`);if(z.modified.length)console.log(` Modified: ${z.modified.join(", ")}`);if(z.deleted.length)console.log(` Deleted: ${z.deleted.join(", ")}`);if(z.renamed.length)console.log(` Renamed: ${z.renamed.map((N)=>`${N.from} -> ${N.to}`).join(", ")}`);if(C===0)console.log(" No syncable changes.");return{status:"dry_run",fromCommit:L,toCommit:K,added:z.added.length,modified:z.modified.length,deleted:z.deleted.length,renamed:z.renamed.length,chunksCreated:0,pagesAffected:[]}}if(C===0)return await I.setConfig("sync.last_commit",K),await I.setConfig("sync.last_run",new Date().toISOString()),{status:"up_to_date",fromCommit:L,toCommit:K,added:0,modified:0,deleted:0,renamed:0,chunksCreated:0,pagesAffected:[]};let D=Y.noEmbed||C>100;if(C>100)console.log(`Large sync (${C} files). Importing text, deferring embeddings.`);let F=[],R=0,M=Date.now();for(let N of z.deleted){let v=zE(N);await I.deletePage(v),F.push(v)}for(let{from:N,to:v}of z.renamed){let B=zE(N),g=zE(v);try{await I.updateSlug(B,g)}catch{}let y=r0(G,v);if(eT(y)){let l=await SE(I,y,v,{noEmbed:D});if(l.status==="imported")R+=l.chunks}F.push(g)}let P=z.added.length+z.modified.length>10,k=async()=>{for(let N of[...z.added,...z.modified]){let v=r0(G,N);if(!eT(v))continue;try{let B=await SE(I,v,N,{noEmbed:D});if(B.status==="imported")R+=B.chunks,F.push(B.slug)}catch(B){let g=B instanceof Error?B.message:String(B);console.error(` Warning: skipped ${N}: ${g}`)}}};if(P)await I.transaction(async()=>{await k()});else await k();let _=Date.now()-M;if(await I.setConfig("sync.last_commit",K),await I.setConfig("sync.last_run",new Date().toISOString()),await I.setConfig("sync.repo_path",G),await I.logIngest({source_type:"git_sync",source_ref:`${G} @ ${K.slice(0,8)}`,pages_updated:F,summary:`Sync: +${z.added.length} ~${z.modified.length} -${z.deleted.length} R${z.renamed.length}, ${R} chunks, ${_}ms`}),D&&C>100)console.log("Text imported. Run 'gbrain embed --stale' to generate embeddings.");return{status:"synced",fromCommit:L,toCommit:K,added:z.added.length,modified:z.modified.length,deleted:z.deleted.length,renamed:z.renamed.length,chunksCreated:R,pagesAffected:F}}async function iT(I,Y,G,K){console.log(`Running full import of ${Y}...`);let{runImport:L}=await Promise.resolve().then(() => (KY(),$Y)),W=[Y];if(K.noEmbed)W.push("--no-embed");return await L(I,W),{status:"first_sync",fromCommit:null,toCommit:G,added:0,modified:0,deleted:0,renamed:0,chunksCreated:0,pagesAffected:[]}}async function qG(I,Y){let G=Y.find((R,M)=>Y[M-1]==="--repo")||void 0,K=Y.includes("--watch"),L=Y.find((R,M)=>Y[M-1]==="--interval"),W=L?parseInt(L,10):60,Z=Y.includes("--dry-run"),z=Y.includes("--full"),q=Y.includes("--no-pull"),C=Y.includes("--no-embed"),D={repoPath:G,dryRun:Z,full:z,noPull:q,noEmbed:C};if(!K){let R=await UX(I,D);PG(R);return}let F=0;console.log(`Watching for changes every ${W}s... (Ctrl+C to stop)`);while(!0){try{let R=await UX(I,{...D,full:!1});if(F=0,R.status==="synced"){let M=new Date().toISOString().slice(11,19);console.log(`[${M}] Synced: +${R.added} ~${R.modified} -${R.deleted} R${R.renamed}`)}}catch(R){F++;let M=R instanceof Error?R.message:String(R);if(console.error(`[${new Date().toISOString().slice(11,19)}] Sync error (${F}/5): ${M}`),F>=5)console.error("5 consecutive sync failures. Stopping watch."),process.exit(1)}await new Promise((R)=>setTimeout(R,W*1000))}}function PG(I){switch(I.status){case"up_to_date":console.log("Already up to date.");break;case"synced":console.log(`Synced ${I.fromCommit?.slice(0,8)}..${I.toCommit.slice(0,8)}:`),console.log(` +${I.added} added, ~${I.modified} modified, -${I.deleted} deleted, R${I.renamed} renamed`),console.log(` ${I.chunksCreated} chunks created`);break;case"first_sync":console.log(`First sync complete. Checkpoint: ${I.toCommit.slice(0,8)}`);break;case"dry_run":break}}var WY=VU(()=>{YE();lE()});var DY={};jU(DY,{S3Storage:()=>RY});import{S3Client as _G,PutObjectCommand as kG,GetObjectCommand as vG,DeleteObjectCommand as jG,HeadObjectCommand as HY,ListObjectsV2Command as NG}from"@aws-sdk/client-s3";class RY{client;bucket;constructor(I){this.bucket=I.bucket;let Y=I.region||"us-east-1";if(!I.accessKeyId||!I.secretAccessKey)throw Error("S3 storage requires accessKeyId and secretAccessKey in config");this.client=new _G({region:Y,...I.endpoint?{endpoint:I.endpoint,forcePathStyle:!0}:{},credentials:{accessKeyId:I.accessKeyId,secretAccessKey:I.secretAccessKey}})}async upload(I,Y,G){await this.client.send(new kG({Bucket:this.bucket,Key:I,Body:Y,ContentType:G||"application/octet-stream"}))}async download(I){let Y=await this.client.send(new vG({Bucket:this.bucket,Key:I}));if(!Y.Body)throw Error(`S3 download returned empty body: ${I}`);return Buffer.from(await Y.Body.transformToByteArray())}async delete(I){await this.client.send(new jG({Bucket:this.bucket,Key:I}))}async exists(I){try{return await this.client.send(new HY({Bucket:this.bucket,Key:I})),!0}catch(Y){if(Y.name==="NotFound"||Y.$metadata?.httpStatusCode===404)return!1;throw Y}}async list(I){return((await this.client.send(new NG({Bucket:this.bucket,Prefix:I}))).Contents||[]).map((G)=>G.Key).filter(Boolean)}async getUrl(I){let Y=this.client.config.endpoint;if(Y)return`${typeof Y==="function"?(await Y()).url.toString():Y}/${this.bucket}/${I}`;let G=await this.client.config.region();return`https://${this.bucket}.s3.${G}.amazonaws.com/${I}`}async getContentHash(I){try{return(await this.client.send(new HY({Bucket:this.bucket,Key:I}))).ETag?.replace(/"/g,"")||null}catch{return null}}}var CY=()=>{};var SY={};jU(SY,{SupabaseStorage:()=>zY});class zY{projectUrl;serviceRoleKey;bucket;constructor(I){if(this.projectUrl=I.projectUrl||"",this.serviceRoleKey=I.serviceRoleKey||"",this.bucket=I.bucket,!this.projectUrl||!this.serviceRoleKey)throw Error("Supabase storage requires projectUrl and serviceRoleKey in config")}url(I){return`${this.projectUrl}/storage/v1/object/${this.bucket}/${I}`}headers(){return{Authorization:`Bearer ${this.serviceRoleKey}`,apikey:this.serviceRoleKey}}async upload(I,Y,G){let K=await fetch(this.url(I),{method:"POST",headers:{...this.headers(),"Content-Type":G||"application/octet-stream","x-upsert":"true"},body:Y});if(!K.ok){let L=await K.text();throw Error(`Supabase upload failed: ${K.status} ${L}`)}}async download(I){let Y=await fetch(this.url(I),{headers:this.headers()});if(!Y.ok)throw Error(`Supabase download failed: ${Y.status}`);return Buffer.from(await Y.arrayBuffer())}async delete(I){let Y=await fetch(`${this.projectUrl}/storage/v1/object/${this.bucket}`,{method:"DELETE",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({prefixes:[I]})});if(!Y.ok&&Y.status!==404)throw Error(`Supabase delete failed: ${Y.status}`)}async exists(I){return(await fetch(this.url(I),{method:"HEAD",headers:this.headers()})).ok}async list(I){let Y=await fetch(`${this.projectUrl}/storage/v1/object/list/${this.bucket}`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({prefix:I,limit:1000})});if(!Y.ok)throw Error(`Supabase list failed: ${Y.status}`);return(await Y.json()).map((K)=>`${I}/${K.name}`)}async getUrl(I){return`${this.projectUrl}/storage/v1/object/public/${this.bucket}/${I}`}}var PY={};jU(PY,{LocalStorage:()=>qY});var{readFileSync:BG,writeFileSync:xG,unlinkSync:gG,existsSync:tE,mkdirSync:MY,readdirSync:wG}=(()=>({}));class qY{basePath;constructor(I){this.basePath=I;MY(I,{recursive:!0})}async upload(I,Y,G){let K=r0(this.basePath,I);MY(sE(K),{recursive:!0}),xG(K,Y)}async download(I){let Y=r0(this.basePath,I);if(!tE(Y))throw Error(`File not found in storage: ${I}`);return BG(Y)}async delete(I){let Y=r0(this.basePath,I);if(tE(Y))gG(Y)}async exists(I){return tE(r0(this.basePath,I))}async list(I){let Y=r0(this.basePath,I);if(!tE(Y))return[];let G=[];function K(L,W){for(let Z of wG(L,{withFileTypes:!0})){let z=W?`${W}/${Z.name}`:Z.name;if(Z.isDirectory())K(r0(L,Z.name),z);else G.push(`${I}/${z}`)}}return K(Y,""),G}async getUrl(I){return`file://${r0(this.basePath,I)}`}}var _Y=VU(()=>{YE()});var EX={};jU(EX,{createStorage:()=>yG});async function yG(I){switch(I.backend){case"s3":{let{S3Storage:Y}=await Promise.resolve().then(() => (CY(),DY));return new Y(I)}case"supabase":{let{SupabaseStorage:Y}=await Promise.resolve().then(() => SY);return new Y(I)}case"local":{let{LocalStorage:Y}=await Promise.resolve().then(() => (_Y(),PY));return new Y(I.localPath||"/tmp/gbrain-storage")}default:throw Error(`Unknown storage backend: ${I.backend}`)}}lE();dT();function dI(I,Y){let G=Y?.cosineThreshold??0.85,K=Y?.maxTypeRatio??0.6,L=Y?.maxPerPage??2,W=I;return W=eJ(W),W=iJ(W,G),W=UG(W,K),W=EG(W,L),W}function eJ(I){let Y=new Map;for(let K of I){let L=Y.get(K.slug)||[];L.push(K),Y.set(K.slug,L)}let G=[];for(let K of Y.values())K.sort((L,W)=>W.score-L.score),G.push(...K.slice(0,3));return G.sort((K,L)=>L.score-K.score)}function iJ(I,Y){let G=[];for(let K of I){let L=new Set(K.chunk_text.toLowerCase().split(/\s+/)),W=!1;for(let Z of G){let z=new Set(Z.chunk_text.toLowerCase().split(/\s+/)),q=new Set([...L].filter((F)=>z.has(F))),C=new Set([...L,...z]);if(q.size/C.size>Y){W=!0;break}}if(!W)G.push(K)}return G}function UG(I,Y){let G=Math.max(1,Math.ceil(I.length*Y)),K=new Map,L=[];for(let W of I){let Z=K.get(W.type)||0;if(ZbI(F))),Z=await Promise.all(W.map((F)=>I.searchVector(F,{limit:K*2}))),z=await I.searchKeyword(Y,{limit:K*2}),q=[...Z,z],C=XG(q);return dI(C).slice(0,K)}function XG(I){let Y=new Map;for(let G of I)for(let K=0;KK.score-G.score).map(({result:G,score:K})=>({...G,score:K}))}import IG from"@anthropic-ai/sdk";var YG=3,OG=3,oT=null;function ZG(){if(!oT)oT=new IG;return oT}async function oI(I){if((I.match(/\S+/g)||[]).lengthW.toLowerCase().trim()))].slice(0,YG).map((W)=>K.find((Z)=>Z.toLowerCase().trim()===W)||W)}catch{return[I]}}async function QG(I){let Y=await ZG().messages.create({model:"claude-haiku-4-5-20251001",max_tokens:300,tools:[{name:"expand_query",description:"Generate alternative phrasings of a search query to improve recall",input_schema:{type:"object",properties:{alternative_queries:{type:"array",items:{type:"string"},description:"2 alternative phrasings of the original query, each approaching the topic from a different angle"}},required:["alternative_queries"]}}],tool_choice:{type:"tool",name:"expand_query"},messages:[{role:"user",content:`Generate 2 alternative search queries that would find relevant results for this question. Each alternative should approach the topic from a different angle or use different terminology. -Original query: "${T}"`}]});for(let G of Y.content)if(G.type==="tool_use"&&G.name==="expand_query"){let L=G.input.alternative_queries;if(Array.isArray(L))return L.map(String).slice(0,2)}return[]}oX();class qE extends Error{code;suggestion;docs;constructor(T,Y,G,K){super(Y);this.code=T;this.suggestion=G;this.docs=K;this.name="OperationError"}toJSON(){return{error:this.code,message:this.message,suggestion:this.suggestion,docs:this.docs}}}var gG={name:"get_page",description:"Read a page by slug (supports optional fuzzy matching)",params:{slug:{type:"string",required:!0,description:"Page slug"},fuzzy:{type:"boolean",description:"Enable fuzzy slug resolution (default: false)"}},handler:async(T,Y)=>{let G=Y.slug,K=Y.fuzzy||!1,L=await T.engine.getPage(G),W;if(!L&&K){let z=await T.engine.resolveSlugs(G);if(z.length===1)L=await T.engine.getPage(z[0]),W=z[0];else if(z.length>1)return{error:"ambiguous_slug",candidates:z}}if(!L)throw new qE("page_not_found",`Page not found: ${G}`,"Check the slug or use fuzzy: true");let O=await T.engine.getTags(L.slug);return{...L,tags:O,...W?{resolved_slug:W}:{}}},cliHints:{name:"get",positional:["slug"]}},wG={name:"put_page",description:"Write/update a page (markdown with frontmatter). Chunks, embeds, and reconciles tags.",params:{slug:{type:"string",required:!0,description:"Page slug"},content:{type:"string",required:!0,description:"Full markdown content with YAML frontmatter"}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"put_page",slug:Y.slug};let G=await bX(T.engine,Y.slug,Y.content);return{slug:G.slug,status:G.status==="imported"?"created_or_updated":G.status,chunks:G.chunks}},cliHints:{name:"put",positional:["slug"],stdin:"content"}},yG={name:"delete_page",description:"Delete a page",params:{slug:{type:"string",required:!0}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"delete_page",slug:Y.slug};return await T.engine.deletePage(Y.slug),{status:"deleted"}},cliHints:{name:"delete",positional:["slug"]}},fG={name:"list_pages",description:"List pages with optional filters",params:{type:{type:"string",description:"Filter by page type"},tag:{type:"string",description:"Filter by tag"},limit:{type:"number",description:"Max results (default 50)"}},handler:async(T,Y)=>{return(await T.engine.listPages({type:Y.type,tag:Y.tag,limit:Y.limit||50})).map((K)=>({slug:K.slug,type:K.type,title:K.title,updated_at:K.updated_at}))},cliHints:{name:"list"}},cG={name:"search",description:"Keyword search using full-text search",params:{query:{type:"string",required:!0},limit:{type:"number",description:"Max results (default 20)"}},handler:async(T,Y)=>{return T.engine.searchKeyword(Y.query,{limit:Y.limit||20})},cliHints:{name:"search",positional:["query"]}},pG={name:"query",description:"Hybrid search with vector + keyword + multi-query expansion",params:{query:{type:"string",required:!0},limit:{type:"number",description:"Max results (default 20)"},expand:{type:"boolean",description:"Enable multi-query expansion (default: true)"}},handler:async(T,Y)=>{let G=Y.expand!==!1;return bT(T.engine,Y.query,{limit:Y.limit||20,expansion:G,expandFn:G?dT:void 0})},cliHints:{name:"query",positional:["query"]}},hG={name:"add_tag",description:"Add tag to page",params:{slug:{type:"string",required:!0},tag:{type:"string",required:!0}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"add_tag",slug:Y.slug,tag:Y.tag};return await T.engine.addTag(Y.slug,Y.tag),{status:"ok"}},cliHints:{name:"tag",positional:["slug","tag"]}},uG={name:"remove_tag",description:"Remove tag from page",params:{slug:{type:"string",required:!0},tag:{type:"string",required:!0}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"remove_tag",slug:Y.slug,tag:Y.tag};return await T.engine.removeTag(Y.slug,Y.tag),{status:"ok"}},cliHints:{name:"untag",positional:["slug","tag"]}},bG={name:"get_tags",description:"List tags for a page",params:{slug:{type:"string",required:!0}},handler:async(T,Y)=>{return T.engine.getTags(Y.slug)},cliHints:{name:"tags",positional:["slug"]}},dG={name:"add_link",description:"Create link between pages",params:{from:{type:"string",required:!0},to:{type:"string",required:!0},link_type:{type:"string",description:"Link type (e.g., invested_in, works_at)"},context:{type:"string",description:"Context for the link"}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"add_link",from:Y.from,to:Y.to};return await T.engine.addLink(Y.from,Y.to,Y.context||"",Y.link_type||""),{status:"ok"}},cliHints:{name:"link",positional:["from","to"]}},lG={name:"remove_link",description:"Remove link between pages",params:{from:{type:"string",required:!0},to:{type:"string",required:!0}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"remove_link",from:Y.from,to:Y.to};return await T.engine.removeLink(Y.from,Y.to),{status:"ok"}},cliHints:{name:"unlink",positional:["from","to"]}},oG={name:"get_links",description:"List outgoing links from a page",params:{slug:{type:"string",required:!0}},handler:async(T,Y)=>{return T.engine.getLinks(Y.slug)}},nG={name:"get_backlinks",description:"List incoming links to a page",params:{slug:{type:"string",required:!0}},handler:async(T,Y)=>{return T.engine.getBacklinks(Y.slug)},cliHints:{name:"backlinks",positional:["slug"]}},mG={name:"traverse_graph",description:"Traverse link graph from a page",params:{slug:{type:"string",required:!0},depth:{type:"number",description:"Max traversal depth (default 5)"}},handler:async(T,Y)=>{return T.engine.traverseGraph(Y.slug,Y.depth||5)},cliHints:{name:"graph",positional:["slug"]}},sG={name:"add_timeline_entry",description:"Add timeline entry to a page",params:{slug:{type:"string",required:!0},date:{type:"string",required:!0},summary:{type:"string",required:!0},detail:{type:"string"},source:{type:"string"}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"add_timeline_entry",slug:Y.slug};return await T.engine.addTimelineEntry(Y.slug,{date:Y.date,source:Y.source||"",summary:Y.summary,detail:Y.detail||""}),{status:"ok"}},cliHints:{name:"timeline-add",positional:["slug","date","summary"]}},rG={name:"get_timeline",description:"Get timeline entries for a page",params:{slug:{type:"string",required:!0}},handler:async(T,Y)=>{return T.engine.getTimeline(Y.slug)},cliHints:{name:"timeline",positional:["slug"]}},tG={name:"get_stats",description:"Brain statistics (page count, chunk count, etc.)",params:{},handler:async(T)=>{return T.engine.getStats()},cliHints:{name:"stats"}},aG={name:"get_health",description:"Brain health dashboard (embed coverage, stale pages, orphans)",params:{},handler:async(T)=>{return T.engine.getHealth()},cliHints:{name:"health"}},eG={name:"get_versions",description:"Page version history",params:{slug:{type:"string",required:!0}},handler:async(T,Y)=>{return T.engine.getVersions(Y.slug)},cliHints:{name:"history",positional:["slug"]}},iG={name:"revert_version",description:"Revert page to a previous version",params:{slug:{type:"string",required:!0},version_id:{type:"number",required:!0}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"revert_version",slug:Y.slug,version_id:Y.version_id};return await T.engine.createVersion(Y.slug),await T.engine.revertToVersion(Y.slug,Y.version_id),{status:"reverted"}},cliHints:{name:"revert",positional:["slug","version_id"]}},UV={name:"sync_brain",description:"Sync git repo to brain (incremental)",params:{repo:{type:"string",description:"Path to git repo (optional if configured)"},dry_run:{type:"boolean",description:"Preview changes without applying"},full:{type:"boolean",description:"Full re-sync (ignore checkpoint)"},no_pull:{type:"boolean",description:"Skip git pull"},no_embed:{type:"boolean",description:"Skip embedding generation"}},mutating:!0,handler:async(T,Y)=>{let{performSync:G}=await Promise.resolve().then(() => (WY(),FY));return G(T.engine,{repoPath:Y.repo,dryRun:T.dryRun||Y.dry_run||!1,noEmbed:Y.no_embed||!1,noPull:Y.no_pull||!1,full:Y.full||!1})},cliHints:{name:"sync"}},EV={name:"put_raw_data",description:"Store raw API response data for a page",params:{slug:{type:"string",required:!0},source:{type:"string",required:!0,description:"Data source (e.g., crustdata, happenstance)"},data:{type:"object",required:!0,description:"Raw data object"}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"put_raw_data",slug:Y.slug,source:Y.source};return await T.engine.putRawData(Y.slug,Y.source,Y.data),{status:"ok"}}},XV={name:"get_raw_data",description:"Retrieve raw data for a page",params:{slug:{type:"string",required:!0},source:{type:"string",description:"Filter by source"}},handler:async(T,Y)=>{return T.engine.getRawData(Y.slug,Y.source)}},IV={name:"resolve_slugs",description:"Fuzzy-resolve a partial slug to matching page slugs",params:{partial:{type:"string",required:!0}},handler:async(T,Y)=>{return T.engine.resolveSlugs(Y.partial)}},TV={name:"get_chunks",description:"Get content chunks for a page",params:{slug:{type:"string",required:!0}},handler:async(T,Y)=>{return T.engine.getChunks(Y.slug)}},YV={name:"log_ingest",description:"Log an ingestion event",params:{source_type:{type:"string",required:!0},source_ref:{type:"string",required:!0},pages_updated:{type:"array",required:!0,items:{type:"string"}},summary:{type:"string",required:!0}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"log_ingest"};return await T.engine.logIngest({source_type:Y.source_type,source_ref:Y.source_ref,pages_updated:Y.pages_updated,summary:Y.summary}),{status:"ok"}}},ZV={name:"get_ingest_log",description:"Get recent ingestion log entries",params:{limit:{type:"number",description:"Max entries (default 20)"}},handler:async(T,Y)=>{return T.engine.getIngestLog({limit:Y.limit||20})}},OV={name:"file_list",description:"List stored files",params:{slug:{type:"string",description:"Filter by page slug"}},handler:async(T,Y)=>{let G=eU(),K=Y.slug;if(K)return G`SELECT id, page_slug, filename, storage_path, mime_type, size_bytes, content_hash, created_at FROM files WHERE page_slug = ${K} ORDER BY filename`;return G`SELECT id, page_slug, filename, storage_path, mime_type, size_bytes, content_hash, created_at FROM files ORDER BY page_slug, filename LIMIT 100`}},QV={name:"file_upload",description:"Upload a file to storage",params:{path:{type:"string",required:!0,description:"Local file path"},page_slug:{type:"string",description:"Associate with page"}},mutating:!0,handler:async(T,Y)=>{if(T.dryRun)return{dry_run:!0,action:"file_upload",path:Y.path};let{readFileSync:G,statSync:K}=await import("fs"),{basename:L,extname:W}=await Promise.resolve().then(() => (TE(),TY)),{createHash:O}=await Promise.resolve().then(() => (DU(),PU)),z=Y.path,q=Y.page_slug||null,D=K(z),C=G(z),F=O("sha256").update(C).digest("hex"),R=L(z),M=q?`${q}/${R}`:`unsorted/${F.slice(0,8)}-${R}`,k={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".pdf":"application/pdf",".mp4":"video/mp4",".mp3":"audio/mpeg"}[W(z).toLowerCase()]||null,_=eU();if((await _`SELECT id FROM files WHERE content_hash = ${F} AND storage_path = ${M}`).length>0)return{status:"already_exists",storage_path:M};if(T.config.storage){let{createStorage:v}=await Promise.resolve().then(() => UI),B=await v(T.config.storage);try{await B.upload(M,C,k||void 0)}catch(g){throw new qE("storage_error",`Upload failed: ${g instanceof Error?g.message:String(g)}`)}}try{await _` +Original query: "${I}"`}]});for(let G of Y.content)if(G.type==="tool_use"&&G.name==="expand_query"){let L=G.input.alternative_queries;if(Array.isArray(L))return L.map(String).slice(0,2)}return[]}mT();class _E extends Error{code;suggestion;docs;constructor(I,Y,G,K){super(Y);this.code=I;this.suggestion=G;this.docs=K;this.name="OperationError"}toJSON(){return{error:this.code,message:this.message,suggestion:this.suggestion,docs:this.docs}}}var fG={name:"get_page",description:"Read a page by slug (supports optional fuzzy matching)",params:{slug:{type:"string",required:!0,description:"Page slug"},fuzzy:{type:"boolean",description:"Enable fuzzy slug resolution (default: false)"}},handler:async(I,Y)=>{let G=Y.slug,K=Y.fuzzy||!1,L=await I.engine.getPage(G),W;if(!L&&K){let z=await I.engine.resolveSlugs(G);if(z.length===1)L=await I.engine.getPage(z[0]),W=z[0];else if(z.length>1)return{error:"ambiguous_slug",candidates:z}}if(!L)throw new _E("page_not_found",`Page not found: ${G}`,"Check the slug or use fuzzy: true");let Z=await I.engine.getTags(L.slug);return{...L,tags:Z,...W?{resolved_slug:W}:{}}},cliHints:{name:"get",positional:["slug"]}},cG={name:"put_page",description:"Write/update a page (markdown with frontmatter). Chunks, embeds, and reconciles tags.",params:{slug:{type:"string",required:!0,description:"Page slug"},content:{type:"string",required:!0,description:"Full markdown content with YAML frontmatter"}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"put_page",slug:Y.slug};let G=await lT(I.engine,Y.slug,Y.content);return{slug:G.slug,status:G.status==="imported"?"created_or_updated":G.status,chunks:G.chunks}},cliHints:{name:"put",positional:["slug"],stdin:"content"}},pG={name:"delete_page",description:"Delete a page",params:{slug:{type:"string",required:!0}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"delete_page",slug:Y.slug};return await I.engine.deletePage(Y.slug),{status:"deleted"}},cliHints:{name:"delete",positional:["slug"]}},hG={name:"list_pages",description:"List pages with optional filters",params:{type:{type:"string",description:"Filter by page type"},tag:{type:"string",description:"Filter by tag"},limit:{type:"number",description:"Max results (default 50)"}},handler:async(I,Y)=>{return(await I.engine.listPages({type:Y.type,tag:Y.tag,limit:Y.limit||50})).map((K)=>({slug:K.slug,type:K.type,title:K.title,updated_at:K.updated_at}))},cliHints:{name:"list"}},uG={name:"search",description:"Keyword search using full-text search",params:{query:{type:"string",required:!0},limit:{type:"number",description:"Max results (default 20)"}},handler:async(I,Y)=>{return I.engine.searchKeyword(Y.query,{limit:Y.limit||20})},cliHints:{name:"search",positional:["query"]}},bG={name:"query",description:"Hybrid search with vector + keyword + multi-query expansion",params:{query:{type:"string",required:!0},limit:{type:"number",description:"Max results (default 20)"},expand:{type:"boolean",description:"Enable multi-query expansion (default: true)"}},handler:async(I,Y)=>{let G=Y.expand!==!1;return lI(I.engine,Y.query,{limit:Y.limit||20,expansion:G,expandFn:G?oI:void 0})},cliHints:{name:"query",positional:["query"]}},dG={name:"add_tag",description:"Add tag to page",params:{slug:{type:"string",required:!0},tag:{type:"string",required:!0}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"add_tag",slug:Y.slug,tag:Y.tag};return await I.engine.addTag(Y.slug,Y.tag),{status:"ok"}},cliHints:{name:"tag",positional:["slug","tag"]}},lG={name:"remove_tag",description:"Remove tag from page",params:{slug:{type:"string",required:!0},tag:{type:"string",required:!0}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"remove_tag",slug:Y.slug,tag:Y.tag};return await I.engine.removeTag(Y.slug,Y.tag),{status:"ok"}},cliHints:{name:"untag",positional:["slug","tag"]}},oG={name:"get_tags",description:"List tags for a page",params:{slug:{type:"string",required:!0}},handler:async(I,Y)=>{return I.engine.getTags(Y.slug)},cliHints:{name:"tags",positional:["slug"]}},nG={name:"add_link",description:"Create link between pages",params:{from:{type:"string",required:!0},to:{type:"string",required:!0},link_type:{type:"string",description:"Link type (e.g., invested_in, works_at)"},context:{type:"string",description:"Context for the link"}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"add_link",from:Y.from,to:Y.to};return await I.engine.addLink(Y.from,Y.to,Y.context||"",Y.link_type||""),{status:"ok"}},cliHints:{name:"link",positional:["from","to"]}},mG={name:"remove_link",description:"Remove link between pages",params:{from:{type:"string",required:!0},to:{type:"string",required:!0}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"remove_link",from:Y.from,to:Y.to};return await I.engine.removeLink(Y.from,Y.to),{status:"ok"}},cliHints:{name:"unlink",positional:["from","to"]}},sG={name:"get_links",description:"List outgoing links from a page",params:{slug:{type:"string",required:!0}},handler:async(I,Y)=>{return I.engine.getLinks(Y.slug)}},rG={name:"get_backlinks",description:"List incoming links to a page",params:{slug:{type:"string",required:!0}},handler:async(I,Y)=>{return I.engine.getBacklinks(Y.slug)},cliHints:{name:"backlinks",positional:["slug"]}},tG={name:"traverse_graph",description:"Traverse link graph from a page",params:{slug:{type:"string",required:!0},depth:{type:"number",description:"Max traversal depth (default 5)"}},handler:async(I,Y)=>{return I.engine.traverseGraph(Y.slug,Y.depth||5)},cliHints:{name:"graph",positional:["slug"]}},aG={name:"add_timeline_entry",description:"Add timeline entry to a page",params:{slug:{type:"string",required:!0},date:{type:"string",required:!0},summary:{type:"string",required:!0},detail:{type:"string"},source:{type:"string"}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"add_timeline_entry",slug:Y.slug};return await I.engine.addTimelineEntry(Y.slug,{date:Y.date,source:Y.source||"",summary:Y.summary,detail:Y.detail||""}),{status:"ok"}},cliHints:{name:"timeline-add",positional:["slug","date","summary"]}},eG={name:"get_timeline",description:"Get timeline entries for a page",params:{slug:{type:"string",required:!0}},handler:async(I,Y)=>{return I.engine.getTimeline(Y.slug)},cliHints:{name:"timeline",positional:["slug"]}},iG={name:"get_stats",description:"Brain statistics (page count, chunk count, etc.)",params:{},handler:async(I)=>{return I.engine.getStats()},cliHints:{name:"stats"}},UV={name:"get_health",description:"Brain health dashboard (embed coverage, stale pages, orphans)",params:{},handler:async(I)=>{return I.engine.getHealth()},cliHints:{name:"health"}},EV={name:"get_versions",description:"Page version history",params:{slug:{type:"string",required:!0}},handler:async(I,Y)=>{return I.engine.getVersions(Y.slug)},cliHints:{name:"history",positional:["slug"]}},TV={name:"revert_version",description:"Revert page to a previous version",params:{slug:{type:"string",required:!0},version_id:{type:"number",required:!0}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"revert_version",slug:Y.slug,version_id:Y.version_id};return await I.engine.createVersion(Y.slug),await I.engine.revertToVersion(Y.slug,Y.version_id),{status:"reverted"}},cliHints:{name:"revert",positional:["slug","version_id"]}},XV={name:"sync_brain",description:"Sync git repo to brain (incremental)",params:{repo:{type:"string",description:"Path to git repo (optional if configured)"},dry_run:{type:"boolean",description:"Preview changes without applying"},full:{type:"boolean",description:"Full re-sync (ignore checkpoint)"},no_pull:{type:"boolean",description:"Skip git pull"},no_embed:{type:"boolean",description:"Skip embedding generation"}},mutating:!0,handler:async(I,Y)=>{let{performSync:G}=await Promise.resolve().then(() => (WY(),FY));return G(I.engine,{repoPath:Y.repo,dryRun:I.dryRun||Y.dry_run||!1,noEmbed:Y.no_embed||!1,noPull:Y.no_pull||!1,full:Y.full||!1})},cliHints:{name:"sync"}},IV={name:"put_raw_data",description:"Store raw API response data for a page",params:{slug:{type:"string",required:!0},source:{type:"string",required:!0,description:"Data source (e.g., crustdata, happenstance)"},data:{type:"object",required:!0,description:"Raw data object"}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"put_raw_data",slug:Y.slug,source:Y.source};return await I.engine.putRawData(Y.slug,Y.source,Y.data),{status:"ok"}}},YV={name:"get_raw_data",description:"Retrieve raw data for a page",params:{slug:{type:"string",required:!0},source:{type:"string",description:"Filter by source"}},handler:async(I,Y)=>{return I.engine.getRawData(Y.slug,Y.source)}},OV={name:"resolve_slugs",description:"Fuzzy-resolve a partial slug to matching page slugs",params:{partial:{type:"string",required:!0}},handler:async(I,Y)=>{return I.engine.resolveSlugs(Y.partial)}},ZV={name:"get_chunks",description:"Get content chunks for a page",params:{slug:{type:"string",required:!0}},handler:async(I,Y)=>{return I.engine.getChunks(Y.slug)}},QV={name:"log_ingest",description:"Log an ingestion event",params:{source_type:{type:"string",required:!0},source_ref:{type:"string",required:!0},pages_updated:{type:"array",required:!0,items:{type:"string"}},summary:{type:"string",required:!0}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"log_ingest"};return await I.engine.logIngest({source_type:Y.source_type,source_ref:Y.source_ref,pages_updated:Y.pages_updated,summary:Y.summary}),{status:"ok"}}},JV={name:"get_ingest_log",description:"Get recent ingestion log entries",params:{limit:{type:"number",description:"Max entries (default 20)"}},handler:async(I,Y)=>{return I.engine.getIngestLog({limit:Y.limit||20})}},GV={name:"file_list",description:"List stored files",params:{slug:{type:"string",description:"Filter by page slug"}},handler:async(I,Y)=>{let G=eU(),K=Y.slug;if(K)return G`SELECT id, page_slug, filename, storage_path, mime_type, size_bytes, content_hash, created_at FROM files WHERE page_slug = ${K} ORDER BY filename`;return G`SELECT id, page_slug, filename, storage_path, mime_type, size_bytes, content_hash, created_at FROM files ORDER BY page_slug, filename LIMIT 100`}},VV={name:"file_upload",description:"Upload a file to storage",params:{path:{type:"string",required:!0,description:"Local file path"},page_slug:{type:"string",description:"Associate with page"}},mutating:!0,handler:async(I,Y)=>{if(I.dryRun)return{dry_run:!0,action:"file_upload",path:Y.path};let{readFileSync:G,statSync:K}=await import("fs"),{basename:L,extname:W}=await Promise.resolve().then(() => (YE(),OY)),{createHash:Z}=await Promise.resolve().then(() => (CU(),PU)),z=Y.path,q=Y.page_slug||null,C=K(z),D=G(z),F=Z("sha256").update(D).digest("hex"),R=L(z),M=q?`${q}/${R}`:`unsorted/${F.slice(0,8)}-${R}`,k={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".pdf":"application/pdf",".mp4":"video/mp4",".mp3":"audio/mpeg"}[W(z).toLowerCase()]||null,_=eU();if((await _`SELECT id FROM files WHERE content_hash = ${F} AND storage_path = ${M}`).length>0)return{status:"already_exists",storage_path:M};if(I.config.storage){let{createStorage:v}=await Promise.resolve().then(() => EX),B=await v(I.config.storage);try{await B.upload(M,D,k||void 0)}catch(g){throw new _E("storage_error",`Upload failed: ${g instanceof Error?g.message:String(g)}`)}}try{await _` INSERT INTO files (page_slug, filename, storage_path, mime_type, size_bytes, content_hash, metadata) - VALUES (${q}, ${R}, ${M}, ${k}, ${D.size}, ${F}, ${"{}"}::jsonb) + VALUES (${q}, ${R}, ${M}, ${k}, ${C.size}, ${F}, ${"{}"}::jsonb) ON CONFLICT (storage_path) DO UPDATE SET content_hash = EXCLUDED.content_hash, size_bytes = EXCLUDED.size_bytes, mime_type = EXCLUDED.mime_type - `}catch(v){if(T.config.storage)try{let{createStorage:B}=await Promise.resolve().then(() => UI);await(await B(T.config.storage)).delete(M)}catch{}throw v}return{status:"uploaded",storage_path:M,size_bytes:D.size}}},JV={name:"file_url",description:"Get a URL for a stored file",params:{storage_path:{type:"string",required:!0}},handler:async(T,Y)=>{let K=await eU()`SELECT storage_path, mime_type, size_bytes FROM files WHERE storage_path = ${Y.storage_path}`;if(K.length===0)throw new qE("storage_error",`File not found: ${Y.storage_path}`);return{storage_path:K[0].storage_path,url:`gbrain:files/${K[0].storage_path}`}}},kY=[gG,wG,yG,fG,cG,pG,hG,uG,bG,dG,lG,oG,nG,mG,sG,rG,tG,aG,eG,iG,UV,EV,XV,IV,TV,YV,ZV,OV,QV,JV],GV=Object.fromEntries(kY.map((T)=>[T.name,T]));tX();dE();var vY={name:"gbrain",version:"0.4.1",description:"Postgres-native personal knowledge brain with hybrid RAG search",type:"module",main:"src/core/index.ts",bin:{gbrain:"src/cli.ts"},exports:{".":"./src/core/index.ts","./engine":"./src/core/engine.ts","./types":"./src/core/types.ts","./operations":"./src/core/operations.ts"},scripts:{dev:"bun run src/cli.ts",build:"bun build --compile --outfile bin/gbrain src/cli.ts","build:all":"bun build --compile --target=bun-darwin-arm64 --outfile bin/gbrain-darwin-arm64 src/cli.ts && bun build --compile --target=bun-linux-x64 --outfile bin/gbrain-linux-x64 src/cli.ts","build:schema":"bash scripts/build-schema.sh","build:edge":"bun run build:schema && bun build src/edge-entry.ts --format=esm --outfile=supabase/functions/gbrain-mcp/gbrain-core.js --external=postgres --external=openai --external=fs --external=os --external=path --external=crypto --external=child_process --external=@aws-sdk/client-s3 --external=@anthropic-ai/sdk --external=gray-matter --minify",test:"bun test","test:e2e":"bun test test/e2e/","prepublish:clawhub":"bun run build:all","publish:clawhub":"clawhub package publish . --family bundle-plugin"},openclaw:{compat:{pluginApi:">=2026.4.0"}},dependencies:{"@anthropic-ai/sdk":"^0.30.0","@aws-sdk/client-s3":"^3.1028.0","@modelcontextprotocol/sdk":"^1.0.0","gray-matter":"^4.0.3",openai:"^4.0.0",pgvector:"^0.2.0",postgres:"^3.4.0"},devDependencies:{"@types/bun":"latest"},license:"MIT"};var AV=vY.version;export{GV as operationsByName,kY as operations,AV as VERSION,mE as PostgresEngine,qE as OperationError,tU as GBrainError}; + `}catch(v){if(I.config.storage)try{let{createStorage:B}=await Promise.resolve().then(() => EX);await(await B(I.config.storage)).delete(M)}catch{}throw v}return{status:"uploaded",storage_path:M,size_bytes:C.size}}},AV={name:"file_url",description:"Get a URL for a stored file",params:{storage_path:{type:"string",required:!0}},handler:async(I,Y)=>{let K=await eU()`SELECT storage_path, mime_type, size_bytes FROM files WHERE storage_path = ${Y.storage_path}`;if(K.length===0)throw new _E("storage_error",`File not found: ${Y.storage_path}`);return{storage_path:K[0].storage_path,url:`gbrain:files/${K[0].storage_path}`}}},kY=[fG,cG,pG,hG,uG,bG,dG,lG,oG,nG,mG,sG,rG,tG,aG,eG,iG,UV,EV,TV,XV,IV,YV,OV,ZV,QV,JV,GV,VV,AV],LV=Object.fromEntries(kY.map((I)=>[I.name,I]));aT();oE();var vY={name:"gbrain",version:"0.5.0",description:"Postgres-native personal knowledge brain with hybrid RAG search",type:"module",main:"src/core/index.ts",bin:{gbrain:"src/cli.ts"},exports:{".":"./src/core/index.ts","./engine":"./src/core/engine.ts","./types":"./src/core/types.ts","./operations":"./src/core/operations.ts"},scripts:{dev:"bun run src/cli.ts",build:"bun build --compile --outfile bin/gbrain src/cli.ts","build:all":"bun build --compile --target=bun-darwin-arm64 --outfile bin/gbrain-darwin-arm64 src/cli.ts && bun build --compile --target=bun-linux-x64 --outfile bin/gbrain-linux-x64 src/cli.ts","build:schema":"bash scripts/build-schema.sh","build:edge":"bun run build:schema && bun build src/edge-entry.ts --format=esm --outfile=supabase/functions/gbrain-mcp/gbrain-core.js --external=postgres --external=openai --external=fs --external=os --external=path --external=crypto --external=child_process --external=@aws-sdk/client-s3 --external=@anthropic-ai/sdk --external=gray-matter --minify",test:"bun test","test:e2e":"bun test test/e2e/","prepublish:clawhub":"bun run build:all","publish:clawhub":"clawhub package publish . --family bundle-plugin"},openclaw:{compat:{pluginApi:">=2026.4.0"}},dependencies:{"@anthropic-ai/sdk":"^0.30.0","@aws-sdk/client-s3":"^3.1028.0","@modelcontextprotocol/sdk":"^1.0.0","gray-matter":"^4.0.3",openai:"^4.0.0",pgvector:"^0.2.0",postgres:"^3.4.0"},devDependencies:{"@types/bun":"latest"},license:"MIT"};var KV=vY.version;export{LV as operationsByName,kY as operations,KV as VERSION,rE as PostgresEngine,_E as OperationError,aU as GBrainError};