diff --git a/package-lock.json b/package-lock.json index 70c5d3d..2c1373a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -811,7 +811,7 @@ }, "node_modules/aes-js": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", + "resolved": "https://registry.npmmirror.com/aes-js/-/aes-js-3.1.2.tgz", "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==", "license": "MIT" }, @@ -849,7 +849,7 @@ }, "node_modules/buffer": { "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "resolved": "https://registry.npmmirror.com/buffer/-/buffer-6.0.3.tgz", "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { @@ -887,7 +887,7 @@ }, "node_modules/elliptic": { "version": "6.6.1", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "resolved": "https://registry.npmmirror.com/elliptic/-/elliptic-6.6.1.tgz", "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", "license": "MIT", "dependencies": { @@ -1020,13 +1020,13 @@ }, "node_modules/js-chacha20": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/js-chacha20/-/js-chacha20-1.1.0.tgz", + "resolved": "https://registry.npmmirror.com/js-chacha20/-/js-chacha20-1.1.0.tgz", "integrity": "sha512-ML5/rujYI/iYydrkIdf+JtUyjmiTWd4UgxNkEmIQ/rltgHzgtzlYJnnMETxPTFGnivEWynZca4YXUoZlxVtjqA==", "license": "MIT" }, "node_modules/js-sha256": { "version": "0.11.0", - "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.11.0.tgz", + "resolved": "https://registry.npmmirror.com/js-sha256/-/js-sha256-0.11.0.tgz", "integrity": "sha512-6xNlKayMZvds9h1Y1VWc0fQHQ82BxTXizWPEtEeGvmOUYpBRy4gbWroHLpzowe6xiQhHpelCQiE7HEdznyBL9Q==", "license": "MIT" }, diff --git a/server/server.js b/server/server.js index 97e5883..08473d8 100644 --- a/server/server.js +++ b/server/server.js @@ -139,11 +139,9 @@ wss.on('connection', ( connection ) => { } // Update seen - clients[clientId].seen = getTime(); // Respond to ping requests - if ( message === 'ping' ) { @@ -154,7 +152,6 @@ wss.on('connection', ( connection ) => { logEvent('message', [ clientId, message ], 'debug'); // Receive client ecdh public key - if ( ! clients[clientId].shared && message.length < 2048 @@ -191,154 +188,13 @@ wss.on('connection', ( connection ) => { } // Receive encrypted message from client - if ( clients[clientId].shared && message.length <= ( 8 * 1024 * 1024 ) ) { - const decrypted = decryptMessage(message, clients[clientId].shared); - - logEvent('message-decrypted', [ clientId, decrypted ], 'debug'); - - if ( - ! isObject(decrypted) || - ! isString(decrypted.a) - ) { - return; - } - - // Join channel - - if ( - decrypted.a === 'j' && - isString(decrypted.p) && - ! clients[clientId].channel - ) { - - try { - - const channel = decrypted.p; - - // Set client channel - - clients[clientId].channel = channel; - - // Add client to channel - - if ( - ! channels[channel] - ) { - channels[channel] = [ clientId ]; - } else { - channels[channel].push(clientId); - } - - // Send channel client list (except themselves) to all clients in the channel - - const members = channels[channel]; - - for ( - const member of members - ) { - - const client = clients[member]; - - if ( - isClientInChannel(client, channel) - ) { - sendMessage(client.connection, encryptMessage({ - a: 'l', - p: members.filter(( value ) => { - return( - value !== member - ? true - : false - ); - }) - }, client.shared)); - } - - } - - } catch ( error ) { - logEvent('message-join', [ clientId, error ], 'error'); - } - - return; - - } - - // Message client - - if ( - decrypted.a === 'c' && - isString(decrypted.p) && - isString(decrypted.c) && - clients[clientId].channel - ) { - - try { - - const channel = clients[clientId].channel; - const client = clients[decrypted.c]; - - if ( - isClientInChannel(client, channel) - ) { - sendMessage(client.connection, encryptMessage({ - a: 'c', - p: decrypted.p, - c: clientId - }, client.shared)); - } - - } catch ( error ) { - logEvent('message-client', [ clientId, error ], 'error'); - } - - return; - - } - - // Message whole channel - - if ( - decrypted.a === 'w' && - isObject(decrypted.p) && - clients[clientId].channel - ) { - - try { - - const channel = clients[clientId].channel; - - for ( - const member in decrypted.p - ) { - - const client = clients[member]; - - if ( - isString(decrypted.p[member]) && - isClientInChannel(client, channel) - ) { - sendMessage(client.connection, encryptMessage({ - a: 'c', - p: decrypted.p[member], - c: clientId - }, client.shared)); - } - - } - - } catch ( error ) { - logEvent('message-channel', [ clientId, error ], 'error'); - } - - return; - - } + // 立即处理并清理,避免在回调中持有大对象引用 + processEncryptedMessage(clientId, message); } @@ -422,6 +278,173 @@ wss.on('connection', ( connection ) => { }); +// 将加密消息处理提取为独立函数,便于内存管理 +const processEncryptedMessage = (clientId, message) => { + let decrypted = null; + + try { + decrypted = decryptMessage(message, clients[clientId].shared); + + logEvent('message-decrypted', [ clientId, decrypted ], 'debug'); + + if ( + ! isObject(decrypted) || + ! isString(decrypted.a) + ) { + return; + } + + // 根据消息类型分发处理 + const action = decrypted.a; + + if (action === 'j') { + handleJoinChannel(clientId, decrypted); + } else if (action === 'c') { + handleClientMessage(clientId, decrypted); + } else if (action === 'w') { + handleChannelMessage(clientId, decrypted); + } + + } catch (error) { + logEvent('process-encrypted-message', [clientId, error], 'error'); + } finally { + // 确保解密对象被立即清理 + decrypted = null; + } +}; + +// 处理加入频道请求 +const handleJoinChannel = (clientId, decrypted) => { + if ( + ! isString(decrypted.p) || + clients[clientId].channel + ) { + return; + } + + try { + const channel = decrypted.p; + + // Set client channel + clients[clientId].channel = channel; + + // Add client to channel + if (! channels[channel]) { + channels[channel] = [ clientId ]; + } else { + channels[channel].push(clientId); + } + + // Send channel client list + broadcastMemberList(channel); + + } catch (error) { + logEvent('message-join', [ clientId, error ], 'error'); + } +}; + +// 处理客户端私聊消息 +const handleClientMessage = (clientId, decrypted) => { + if ( + ! isString(decrypted.p) || + ! isString(decrypted.c) || + ! clients[clientId].channel + ) { + return; + } + + try { + const channel = clients[clientId].channel; + const targetClient = clients[decrypted.c]; + + if (isClientInChannel(targetClient, channel)) { + // 创建临时消息对象,发送后立即清理 + const messageObj = { + a: 'c', + p: decrypted.p, + c: clientId + }; + + const encrypted = encryptMessage(messageObj, targetClient.shared); + sendMessage(targetClient.connection, encrypted); + + // 清理临时对象 + messageObj.p = null; + } + + } catch (error) { + logEvent('message-client', [ clientId, error ], 'error'); + } +}; + +// 处理频道广播消息 +const handleChannelMessage = (clientId, decrypted) => { + if ( + ! isObject(decrypted.p) || + ! clients[clientId].channel + ) { + return; + } + + try { + const channel = clients[clientId].channel; + + for (const member in decrypted.p) { + const targetClient = clients[member]; + + if ( + isString(decrypted.p[member]) && + isClientInChannel(targetClient, channel) + ) { + // 创建临时消息对象 + const messageObj = { + a: 'c', + p: decrypted.p[member], + c: clientId + }; + + const encrypted = encryptMessage(messageObj, targetClient.shared); + sendMessage(targetClient.connection, encrypted); + + // 清理临时对象 + messageObj.p = null; + } + } + + } catch (error) { + logEvent('message-channel', [ clientId, error ], 'error'); + } +}; + +// 广播成员列表 +const broadcastMemberList = (channel) => { + try { + const members = channels[channel]; + + for (const member of members) { + const client = clients[member]; + + if (isClientInChannel(client, channel)) { + // 创建过滤后的成员列表 + const filteredMembers = members.filter(value => value !== member); + + const listObj = { + a: 'l', + p: filteredMembers + }; + + const encrypted = encryptMessage(listObj, client.shared); + sendMessage(client.connection, encrypted); + + // 清理临时对象 + listObj.p = null; + } + } + } catch (error) { + logEvent('broadcast-member-list', error, 'error'); + } +}; + /* ================== HELPER FUNCTIONS ================== */ @@ -497,32 +520,24 @@ const sendMessage = ( connection, message ) => { } }; -// Encrypt message - +// Encrypt message - 简化内存优化 const encryptMessage = ( message, key ) => { let encrypted = ''; try { - message = Buffer.from(JSON.stringify(message), 'utf8'); + const messageBuffer = Buffer.from(JSON.stringify(message), 'utf8'); - if ( - ( message.length % 16 ) !== 0 - ) { - message = Buffer.from([ ...message, ...Buffer.alloc(16 - ( message.length % 16 )) ]); - } + const paddedBuffer = ( messageBuffer.length % 16 ) !== 0 + ? Buffer.concat([messageBuffer, Buffer.alloc(16 - ( messageBuffer.length % 16 ))]) + : messageBuffer; const iv = crypto.randomBytes(16); - const cipher = crypto.createCipheriv( - 'aes-256-cbc', - key, - iv - ); - + const cipher = crypto.createCipheriv('aes-256-cbc', key, iv); cipher.setAutoPadding(false); - encrypted = iv.toString('base64') + '|' + cipher.update(message, '', 'base64') + cipher.final('base64'); + encrypted = iv.toString('base64') + '|' + cipher.update(paddedBuffer, '', 'base64') + cipher.final('base64'); } catch ( error ) { logEvent('encryptMessage', error, 'error'); @@ -532,8 +547,7 @@ const encryptMessage = ( message, key ) => { }; -// Decrypt message - +// Decrypt message - 简化内存优化 const decryptMessage = ( message, key ) => { let decrypted = {}; @@ -549,7 +563,8 @@ const decryptMessage = ( message, key ) => { decipher.setAutoPadding(false); - decrypted = JSON.parse(( decipher.update(parts[1], 'base64', 'utf8') + decipher.final('utf8') ).replace(/\0+$/, '')); + const decryptedText = decipher.update(parts[1], 'base64', 'utf8') + decipher.final('utf8'); + decrypted = JSON.parse(decryptedText.replace(/\0+$/, '')); } catch ( error ) { logEvent('decryptMessage', error, 'error'); @@ -597,3 +612,57 @@ const isObject = ( value ) => { : false ); }; + +// =================== 内存监控 (测试用) =================== +let lastHeapUsed = 0; +let gcCounter = 0; +let lastClientCount = 0; + +setInterval(() => { + const memUsage = process.memoryUsage(); + const clientCount = Object.keys(clients).length; + const channelCount = Object.keys(channels).length; + + const currentHeap = Math.round(memUsage.heapUsed / 1024 / 1024); + const heapDiff = currentHeap - lastHeapUsed; + + console.log(`[MEMORY] RSS: ${Math.round(memUsage.rss / 1024 / 1024)}MB, Heap: ${currentHeap}MB/${Math.round(memUsage.heapTotal / 1024 / 1024)}MB (${heapDiff > 0 ? '+' : ''}${heapDiff}MB), External: ${Math.round(memUsage.external / 1024 / 1024)}MB, Clients: ${clientCount}, Channels: ${channelCount}`); + + // 检测到客户端数量变化时立即触发GC + if (clientCount !== lastClientCount && global.gc) { + global.gc(); + gcCounter++; + console.log(`[GC] Client change detected, triggered GC (#${gcCounter})`); + } + + lastHeapUsed = currentHeap; + lastClientCount = clientCount; +}, 1000); + +// 每30秒强制触发一次垃圾回收 +setInterval(() => { + if (global.gc) { + global.gc(); + gcCounter++; + console.log(`[GC] Periodic garbage collection triggered (#${gcCounter})`); + } +}, 30000); + +// 进程退出时的清理 +process.on('SIGINT', () => { + console.log('\n[CLEANUP] Server shutting down...'); + if (global.gc) { + global.gc(); + console.log('[CLEANUP] Final garbage collection performed'); + } + process.exit(0); +}); + +process.on('SIGTERM', () => { + console.log('\n[CLEANUP] Server terminating...'); + if (global.gc) { + global.gc(); + console.log('[CLEANUP] Final garbage collection performed'); + } + process.exit(0); +}); diff --git a/web/NodeCrypt.bundle.js b/web/NodeCrypt.bundle.js new file mode 100644 index 0000000..f66eb35 --- /dev/null +++ b/web/NodeCrypt.bundle.js @@ -0,0 +1,27 @@ +var Xa=Object.create;var Wr=Object.defineProperty;var $a=Object.getOwnPropertyDescriptor;var ja=Object.getOwnPropertyNames;var Va=Object.getPrototypeOf,Ya=Object.prototype.hasOwnProperty;var T=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Za=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of ja(e))!Ya.call(r,f)&&f!==t&&Wr(r,f,{get:()=>e[f],enumerable:!(a=$a(e,f))||a.enumerable});return r};var W0=(r,e,t)=>(t=r!=null?Xa(Va(r)):{},Za(e||!r||!r.__esModule?Wr(t,"default",{value:r,enumerable:!0}):t,r));var Lt=T(()=>{});var Tt=T(()=>{});var Xr=T((qc,Q0)=>{(function(){"use strict";var r="input is invalid type",e=typeof window=="object",t=e?window:{};t.JS_SHA256_NO_WINDOW&&(e=!1);var a=!e&&typeof self=="object",f=!t.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;f?t=global:a&&(t=self);var c=!t.JS_SHA256_NO_COMMON_JS&&typeof Q0=="object"&&Q0.exports,s=typeof define=="function"&&define.amd,b=!t.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",v="0123456789abcdef".split(""),_=[-2147483648,8388608,32768,128],m=[24,16,8,0],w=[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],F=["hex","array","digest","arrayBuffer"],B=[];(t.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),b&&(t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var P=function(E,q){return function(C){return new U(q,!0).update(C)[E]()}},N=function(E){var q=P("hex",E);f&&(q=D(q,E)),q.create=function(){return new U(E)},q.update=function(p){return q.create().update(p)};for(var C=0;C>>2]|=E[p]<>>2]|=R<>>2]|=(192|R>>>6)<>>2]|=(128|R&63)<=57344?(x[i>>>2]|=(224|R>>>12)<>>2]|=(128|R>>>6&63)<>>2]|=(128|R&63)<>>2]|=(240|R>>>18)<>>2]|=(128|R>>>12&63)<>>2]|=(128|R>>>6&63)<>>2]|=(128|R&63)<=64?(this.block=x[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,q=this.lastByteIndex;E[16]=this.block,E[q>>>2]|=_[q&3],this.block=E[16],q>=56&&(this.hashed||this.hash(),E[0]=this.block,E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0),E[14]=this.hBytes<<3|this.bytes>>>29,E[15]=this.bytes<<3,this.hash()}},U.prototype.hash=function(){var E=this.h0,q=this.h1,C=this.h2,R=this.h3,p=this.h4,i=this.h5,n=this.h6,x=this.h7,o=this.blocks,u,y,g,l,d,h,A,S,M,z,O;for(u=16;u<64;++u)d=o[u-15],y=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,d=o[u-2],g=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,o[u]=o[u-16]+y+o[u-7]+g<<0;for(O=q&C,u=0;u<64;u+=4)this.first?(this.is224?(S=300032,d=o[0]-1413257819,x=d-150054599<<0,R=d+24177077<<0):(S=704751109,d=o[0]-210244248,x=d-1521486534<<0,R=d+143694565<<0),this.first=!1):(y=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),g=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),S=E&q,l=S^E&C^O,A=p&i^~p&n,d=x+g+A+w[u]+o[u],h=y+l,x=R+d<<0,R=d+h<<0),y=(R>>>2|R<<30)^(R>>>13|R<<19)^(R>>>22|R<<10),g=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),M=R&E,l=M^R&q^S,A=x&p^~x&i,d=n+g+A+w[u+1]+o[u+1],h=y+l,n=C+d<<0,C=d+h<<0,y=(C>>>2|C<<30)^(C>>>13|C<<19)^(C>>>22|C<<10),g=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),z=C&R,l=z^C&E^M,A=n&x^~n&p,d=i+g+A+w[u+2]+o[u+2],h=y+l,i=q+d<<0,q=d+h<<0,y=(q>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),g=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),O=q&C,l=O^q&R^z,A=i&n^~i&x,d=p+g+A+w[u+3]+o[u+3],h=y+l,p=E+d<<0,E=d+h<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+E<<0,this.h1=this.h1+q<<0,this.h2=this.h2+C<<0,this.h3=this.h3+R<<0,this.h4=this.h4+p<<0,this.h5=this.h5+i<<0,this.h6=this.h6+n<<0,this.h7=this.h7+x<<0},U.prototype.hex=function(){this.finalize();var E=this.h0,q=this.h1,C=this.h2,R=this.h3,p=this.h4,i=this.h5,n=this.h6,x=this.h7,o=v[E>>>28&15]+v[E>>>24&15]+v[E>>>20&15]+v[E>>>16&15]+v[E>>>12&15]+v[E>>>8&15]+v[E>>>4&15]+v[E&15]+v[q>>>28&15]+v[q>>>24&15]+v[q>>>20&15]+v[q>>>16&15]+v[q>>>12&15]+v[q>>>8&15]+v[q>>>4&15]+v[q&15]+v[C>>>28&15]+v[C>>>24&15]+v[C>>>20&15]+v[C>>>16&15]+v[C>>>12&15]+v[C>>>8&15]+v[C>>>4&15]+v[C&15]+v[R>>>28&15]+v[R>>>24&15]+v[R>>>20&15]+v[R>>>16&15]+v[R>>>12&15]+v[R>>>8&15]+v[R>>>4&15]+v[R&15]+v[p>>>28&15]+v[p>>>24&15]+v[p>>>20&15]+v[p>>>16&15]+v[p>>>12&15]+v[p>>>8&15]+v[p>>>4&15]+v[p&15]+v[i>>>28&15]+v[i>>>24&15]+v[i>>>20&15]+v[i>>>16&15]+v[i>>>12&15]+v[i>>>8&15]+v[i>>>4&15]+v[i&15]+v[n>>>28&15]+v[n>>>24&15]+v[n>>>20&15]+v[n>>>16&15]+v[n>>>12&15]+v[n>>>8&15]+v[n>>>4&15]+v[n&15];return this.is224||(o+=v[x>>>28&15]+v[x>>>24&15]+v[x>>>20&15]+v[x>>>16&15]+v[x>>>12&15]+v[x>>>8&15]+v[x>>>4&15]+v[x&15]),o},U.prototype.toString=U.prototype.hex,U.prototype.digest=function(){this.finalize();var E=this.h0,q=this.h1,C=this.h2,R=this.h3,p=this.h4,i=this.h5,n=this.h6,x=this.h7,o=[E>>>24&255,E>>>16&255,E>>>8&255,E&255,q>>>24&255,q>>>16&255,q>>>8&255,q&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255,p>>>24&255,p>>>16&255,p>>>8&255,p&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255];return this.is224||o.push(x>>>24&255,x>>>16&255,x>>>8&255,x&255),o},U.prototype.array=U.prototype.digest,U.prototype.arrayBuffer=function(){this.finalize();var E=new ArrayBuffer(this.is224?28:32),q=new DataView(E);return q.setUint32(0,this.h0),q.setUint32(4,this.h1),q.setUint32(8,this.h2),q.setUint32(12,this.h3),q.setUint32(16,this.h4),q.setUint32(20,this.h5),q.setUint32(24,this.h6),this.is224||q.setUint32(28,this.h7),E};function Y(E,q,C){var R,p=typeof E;if(p==="string"){var i=[],n=E.length,x=0,o;for(R=0;R>>6,i[x++]=128|o&63):o<55296||o>=57344?(i[x++]=224|o>>>12,i[x++]=128|o>>>6&63,i[x++]=128|o&63):(o=65536+((o&1023)<<10|E.charCodeAt(++R)&1023),i[x++]=240|o>>>18,i[x++]=128|o>>>12&63,i[x++]=128|o>>>6&63,i[x++]=128|o&63);E=i}else if(p==="object"){if(E===null)throw new Error(r);if(b&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!b||!ArrayBuffer.isView(E)))throw new Error(r)}else throw new Error(r);E.length>64&&(E=new U(q,!0).update(E).array());var u=[],y=[];for(R=0;R<64;++R){var g=E[R]||0;u[R]=92^g,y[R]=54^g}U.call(this,q,C),this.update(y),this.oKeyPad=u,this.inner=!0,this.sharedMemory=C}Y.prototype=new U,Y.prototype.finalize=function(){if(U.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();U.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(E),U.prototype.finalize.call(this)}};var J=N();J.sha256=J,J.sha224=N(!0),J.sha256.hmac=$(),J.sha224.hmac=$(!0),c?Q0.exports=J:(t.sha256=J.sha256,t.sha224=J.sha224,s&&define(function(){return J}))})()});var $r=T((Cc,Ga)=>{Ga.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"}}});var Ge=T((jr,Dt)=>{(function(r,e){"use strict";function t(p,i){if(!p)throw new Error(i||"Assertion failed")}function a(p,i){p.super_=i;var n=function(){};n.prototype=i.prototype,p.prototype=new n,p.prototype.constructor=p}function f(p,i,n){if(f.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((i==="le"||i==="be")&&(n=i,i=10),this._init(p||0,i||10,n||"be"))}typeof r=="object"?r.exports=f:e.BN=f,f.BN=f,f.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=Tt().Buffer}catch{}f.isBN=function(i){return i instanceof f?!0:i!==null&&typeof i=="object"&&i.constructor.wordSize===f.wordSize&&Array.isArray(i.words)},f.max=function(i,n){return i.cmp(n)>0?i:n},f.min=function(i,n){return i.cmp(n)<0?i:n},f.prototype._init=function(i,n,x){if(typeof i=="number")return this._initNumber(i,n,x);if(typeof i=="object")return this._initArray(i,n,x);n==="hex"&&(n=16),t(n===(n|0)&&n>=2&&n<=36),i=i.toString().replace(/\s+/g,"");var o=0;i[0]==="-"&&(o++,this.negative=1),o=0;o-=3)y=i[o]|i[o-1]<<8|i[o-2]<<16,this.words[u]|=y<>>26-g&67108863,g+=24,g>=26&&(g-=26,u++);else if(x==="le")for(o=0,u=0;o>>26-g&67108863,g+=24,g>=26&&(g-=26,u++);return this.strip()};function s(p,i){var n=p.charCodeAt(i);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function b(p,i,n){var x=s(p,n);return n-1>=i&&(x|=s(p,n-1)<<4),x}f.prototype._parseHex=function(i,n,x){this.length=Math.ceil((i.length-n)/6),this.words=new Array(this.length);for(var o=0;o=n;o-=2)g=b(i,n,o)<=18?(u-=18,y+=1,this.words[y]|=g>>>26):u+=8;else{var l=i.length-n;for(o=l%2===0?n+1:n;o=18?(u-=18,y+=1,this.words[y]|=g>>>26):u+=8}this.strip()};function v(p,i,n,x){for(var o=0,u=Math.min(p.length,n),y=i;y=49?o+=g-49+10:g>=17?o+=g-17+10:o+=g}return o}f.prototype._parseBase=function(i,n,x){this.words=[0],this.length=1;for(var o=0,u=1;u<=67108863;u*=n)o++;o--,u=u/n|0;for(var y=i.length-x,g=y%o,l=Math.min(y,y-g)+x,d=0,h=x;h1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},f.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},f.prototype.inspect=function(){return(this.red?""};var _=["","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"],m=[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],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];f.prototype.toString=function(i,n){i=i||10,n=n|0||1;var x;if(i===16||i==="hex"){x="";for(var o=0,u=0,y=0;y>>24-o&16777215,o+=2,o>=26&&(o-=26,y--),u!==0||y!==this.length-1?x=_[6-l.length]+l+x:x=l+x}for(u!==0&&(x=u.toString(16)+x);x.length%n!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(i===(i|0)&&i>=2&&i<=36){var d=m[i],h=w[i];x="";var A=this.clone();for(A.negative=0;!A.isZero();){var S=A.modn(h).toString(i);A=A.idivn(h),A.isZero()?x=S+x:x=_[d-S.length]+S+x}for(this.isZero()&&(x="0"+x);x.length%n!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}t(!1,"Base should be between 2 and 36")},f.prototype.toNumber=function(){var i=this.words[0];return this.length===2?i+=this.words[1]*67108864:this.length===3&&this.words[2]===1?i+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-i:i},f.prototype.toJSON=function(){return this.toString(16)},f.prototype.toBuffer=function(i,n){return t(typeof c<"u"),this.toArrayLike(c,i,n)},f.prototype.toArray=function(i,n){return this.toArrayLike(Array,i,n)},f.prototype.toArrayLike=function(i,n,x){var o=this.byteLength(),u=x||Math.max(1,o);t(o<=u,"byte array longer than desired length"),t(u>0,"Requested array length <= 0"),this.strip();var y=n==="le",g=new i(u),l,d,h=this.clone();if(y){for(d=0;!h.isZero();d++)l=h.andln(255),h.iushrn(8),g[d]=l;for(;d=4096&&(x+=13,n>>>=13),n>=64&&(x+=7,n>>>=7),n>=8&&(x+=4,n>>>=4),n>=2&&(x+=2,n>>>=2),x+n},f.prototype._zeroBits=function(i){if(i===0)return 26;var n=i,x=0;return(n&8191)===0&&(x+=13,n>>>=13),(n&127)===0&&(x+=7,n>>>=7),(n&15)===0&&(x+=4,n>>>=4),(n&3)===0&&(x+=2,n>>>=2),(n&1)===0&&x++,x},f.prototype.bitLength=function(){var i=this.words[this.length-1],n=this._countBits(i);return(this.length-1)*26+n};function F(p){for(var i=new Array(p.bitLength()),n=0;n>>o}return i}f.prototype.zeroBits=function(){if(this.isZero())return 0;for(var i=0,n=0;ni.length?this.clone().ior(i):i.clone().ior(this)},f.prototype.uor=function(i){return this.length>i.length?this.clone().iuor(i):i.clone().iuor(this)},f.prototype.iuand=function(i){var n;this.length>i.length?n=i:n=this;for(var x=0;xi.length?this.clone().iand(i):i.clone().iand(this)},f.prototype.uand=function(i){return this.length>i.length?this.clone().iuand(i):i.clone().iuand(this)},f.prototype.iuxor=function(i){var n,x;this.length>i.length?(n=this,x=i):(n=i,x=this);for(var o=0;oi.length?this.clone().ixor(i):i.clone().ixor(this)},f.prototype.uxor=function(i){return this.length>i.length?this.clone().iuxor(i):i.clone().iuxor(this)},f.prototype.inotn=function(i){t(typeof i=="number"&&i>=0);var n=Math.ceil(i/26)|0,x=i%26;this._expand(n),x>0&&n--;for(var o=0;o0&&(this.words[o]=~this.words[o]&67108863>>26-x),this.strip()},f.prototype.notn=function(i){return this.clone().inotn(i)},f.prototype.setn=function(i,n){t(typeof i=="number"&&i>=0);var x=i/26|0,o=i%26;return this._expand(x+1),n?this.words[x]=this.words[x]|1<i.length?(x=this,o=i):(x=i,o=this);for(var u=0,y=0;y>>26;for(;u!==0&&y>>26;if(this.length=x.length,u!==0)this.words[this.length]=u,this.length++;else if(x!==this)for(;yi.length?this.clone().iadd(i):i.clone().iadd(this)},f.prototype.isub=function(i){if(i.negative!==0){i.negative=0;var n=this.iadd(i);return i.negative=1,n._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(i),this.negative=1,this._normSign();var x=this.cmp(i);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var o,u;x>0?(o=this,u=i):(o=i,u=this);for(var y=0,g=0;g>26,this.words[g]=n&67108863;for(;y!==0&&g>26,this.words[g]=n&67108863;if(y===0&&g>>26,A=l&67108863,S=Math.min(d,i.length-1),M=Math.max(0,d-p.length+1);M<=S;M++){var z=d-M|0;o=p.words[z]|0,u=i.words[M]|0,y=o*u+A,h+=y/67108864|0,A=y&67108863}n.words[d]=A|0,l=h|0}return l!==0?n.words[d]=l|0:n.length--,n.strip()}var P=function(i,n,x){var o=i.words,u=n.words,y=x.words,g=0,l,d,h,A=o[0]|0,S=A&8191,M=A>>>13,z=o[1]|0,O=z&8191,L=z>>>13,V=o[2]|0,K=V&8191,H=V>>>13,Br=o[3]|0,G=Br&8191,Q=Br>>>13,Fr=o[4]|0,ee=Fr&8191,te=Fr>>>13,Rr=o[5]|0,re=Rr&8191,fe=Rr>>>13,qr=o[6]|0,ae=qr&8191,ie=qr>>>13,Cr=o[7]|0,de=Cr&8191,ce=Cr>>>13,Pr=o[8]|0,ne=Pr&8191,xe=Pr>>>13,zr=o[9]|0,se=zr&8191,he=zr>>>13,Nr=u[0]|0,oe=Nr&8191,be=Nr>>>13,kr=u[1]|0,ue=kr&8191,le=kr>>>13,Or=u[2]|0,pe=Or&8191,ve=Or>>>13,Ur=u[3]|0,ye=Ur&8191,me=Ur>>>13,Lr=u[4]|0,ge=Lr&8191,we=Lr>>>13,Tr=u[5]|0,Me=Tr&8191,_e=Tr>>>13,Dr=u[6]|0,Se=Dr&8191,Ae=Dr>>>13,Kr=u[7]|0,Ie=Kr&8191,Ee=Kr>>>13,Hr=u[8]|0,Be=Hr&8191,Fe=Hr>>>13,Jr=u[9]|0,Re=Jr&8191,qe=Jr>>>13;x.negative=i.negative^n.negative,x.length=19,l=Math.imul(S,oe),d=Math.imul(S,be),d=d+Math.imul(M,oe)|0,h=Math.imul(M,be);var gt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(gt>>>26)|0,gt&=67108863,l=Math.imul(O,oe),d=Math.imul(O,be),d=d+Math.imul(L,oe)|0,h=Math.imul(L,be),l=l+Math.imul(S,ue)|0,d=d+Math.imul(S,le)|0,d=d+Math.imul(M,ue)|0,h=h+Math.imul(M,le)|0;var wt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(wt>>>26)|0,wt&=67108863,l=Math.imul(K,oe),d=Math.imul(K,be),d=d+Math.imul(H,oe)|0,h=Math.imul(H,be),l=l+Math.imul(O,ue)|0,d=d+Math.imul(O,le)|0,d=d+Math.imul(L,ue)|0,h=h+Math.imul(L,le)|0,l=l+Math.imul(S,pe)|0,d=d+Math.imul(S,ve)|0,d=d+Math.imul(M,pe)|0,h=h+Math.imul(M,ve)|0;var Mt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,l=Math.imul(G,oe),d=Math.imul(G,be),d=d+Math.imul(Q,oe)|0,h=Math.imul(Q,be),l=l+Math.imul(K,ue)|0,d=d+Math.imul(K,le)|0,d=d+Math.imul(H,ue)|0,h=h+Math.imul(H,le)|0,l=l+Math.imul(O,pe)|0,d=d+Math.imul(O,ve)|0,d=d+Math.imul(L,pe)|0,h=h+Math.imul(L,ve)|0,l=l+Math.imul(S,ye)|0,d=d+Math.imul(S,me)|0,d=d+Math.imul(M,ye)|0,h=h+Math.imul(M,me)|0;var _t=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(_t>>>26)|0,_t&=67108863,l=Math.imul(ee,oe),d=Math.imul(ee,be),d=d+Math.imul(te,oe)|0,h=Math.imul(te,be),l=l+Math.imul(G,ue)|0,d=d+Math.imul(G,le)|0,d=d+Math.imul(Q,ue)|0,h=h+Math.imul(Q,le)|0,l=l+Math.imul(K,pe)|0,d=d+Math.imul(K,ve)|0,d=d+Math.imul(H,pe)|0,h=h+Math.imul(H,ve)|0,l=l+Math.imul(O,ye)|0,d=d+Math.imul(O,me)|0,d=d+Math.imul(L,ye)|0,h=h+Math.imul(L,me)|0,l=l+Math.imul(S,ge)|0,d=d+Math.imul(S,we)|0,d=d+Math.imul(M,ge)|0,h=h+Math.imul(M,we)|0;var St=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(St>>>26)|0,St&=67108863,l=Math.imul(re,oe),d=Math.imul(re,be),d=d+Math.imul(fe,oe)|0,h=Math.imul(fe,be),l=l+Math.imul(ee,ue)|0,d=d+Math.imul(ee,le)|0,d=d+Math.imul(te,ue)|0,h=h+Math.imul(te,le)|0,l=l+Math.imul(G,pe)|0,d=d+Math.imul(G,ve)|0,d=d+Math.imul(Q,pe)|0,h=h+Math.imul(Q,ve)|0,l=l+Math.imul(K,ye)|0,d=d+Math.imul(K,me)|0,d=d+Math.imul(H,ye)|0,h=h+Math.imul(H,me)|0,l=l+Math.imul(O,ge)|0,d=d+Math.imul(O,we)|0,d=d+Math.imul(L,ge)|0,h=h+Math.imul(L,we)|0,l=l+Math.imul(S,Me)|0,d=d+Math.imul(S,_e)|0,d=d+Math.imul(M,Me)|0,h=h+Math.imul(M,_e)|0;var At=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(At>>>26)|0,At&=67108863,l=Math.imul(ae,oe),d=Math.imul(ae,be),d=d+Math.imul(ie,oe)|0,h=Math.imul(ie,be),l=l+Math.imul(re,ue)|0,d=d+Math.imul(re,le)|0,d=d+Math.imul(fe,ue)|0,h=h+Math.imul(fe,le)|0,l=l+Math.imul(ee,pe)|0,d=d+Math.imul(ee,ve)|0,d=d+Math.imul(te,pe)|0,h=h+Math.imul(te,ve)|0,l=l+Math.imul(G,ye)|0,d=d+Math.imul(G,me)|0,d=d+Math.imul(Q,ye)|0,h=h+Math.imul(Q,me)|0,l=l+Math.imul(K,ge)|0,d=d+Math.imul(K,we)|0,d=d+Math.imul(H,ge)|0,h=h+Math.imul(H,we)|0,l=l+Math.imul(O,Me)|0,d=d+Math.imul(O,_e)|0,d=d+Math.imul(L,Me)|0,h=h+Math.imul(L,_e)|0,l=l+Math.imul(S,Se)|0,d=d+Math.imul(S,Ae)|0,d=d+Math.imul(M,Se)|0,h=h+Math.imul(M,Ae)|0;var It=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(It>>>26)|0,It&=67108863,l=Math.imul(de,oe),d=Math.imul(de,be),d=d+Math.imul(ce,oe)|0,h=Math.imul(ce,be),l=l+Math.imul(ae,ue)|0,d=d+Math.imul(ae,le)|0,d=d+Math.imul(ie,ue)|0,h=h+Math.imul(ie,le)|0,l=l+Math.imul(re,pe)|0,d=d+Math.imul(re,ve)|0,d=d+Math.imul(fe,pe)|0,h=h+Math.imul(fe,ve)|0,l=l+Math.imul(ee,ye)|0,d=d+Math.imul(ee,me)|0,d=d+Math.imul(te,ye)|0,h=h+Math.imul(te,me)|0,l=l+Math.imul(G,ge)|0,d=d+Math.imul(G,we)|0,d=d+Math.imul(Q,ge)|0,h=h+Math.imul(Q,we)|0,l=l+Math.imul(K,Me)|0,d=d+Math.imul(K,_e)|0,d=d+Math.imul(H,Me)|0,h=h+Math.imul(H,_e)|0,l=l+Math.imul(O,Se)|0,d=d+Math.imul(O,Ae)|0,d=d+Math.imul(L,Se)|0,h=h+Math.imul(L,Ae)|0,l=l+Math.imul(S,Ie)|0,d=d+Math.imul(S,Ee)|0,d=d+Math.imul(M,Ie)|0,h=h+Math.imul(M,Ee)|0;var Et=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Et>>>26)|0,Et&=67108863,l=Math.imul(ne,oe),d=Math.imul(ne,be),d=d+Math.imul(xe,oe)|0,h=Math.imul(xe,be),l=l+Math.imul(de,ue)|0,d=d+Math.imul(de,le)|0,d=d+Math.imul(ce,ue)|0,h=h+Math.imul(ce,le)|0,l=l+Math.imul(ae,pe)|0,d=d+Math.imul(ae,ve)|0,d=d+Math.imul(ie,pe)|0,h=h+Math.imul(ie,ve)|0,l=l+Math.imul(re,ye)|0,d=d+Math.imul(re,me)|0,d=d+Math.imul(fe,ye)|0,h=h+Math.imul(fe,me)|0,l=l+Math.imul(ee,ge)|0,d=d+Math.imul(ee,we)|0,d=d+Math.imul(te,ge)|0,h=h+Math.imul(te,we)|0,l=l+Math.imul(G,Me)|0,d=d+Math.imul(G,_e)|0,d=d+Math.imul(Q,Me)|0,h=h+Math.imul(Q,_e)|0,l=l+Math.imul(K,Se)|0,d=d+Math.imul(K,Ae)|0,d=d+Math.imul(H,Se)|0,h=h+Math.imul(H,Ae)|0,l=l+Math.imul(O,Ie)|0,d=d+Math.imul(O,Ee)|0,d=d+Math.imul(L,Ie)|0,h=h+Math.imul(L,Ee)|0,l=l+Math.imul(S,Be)|0,d=d+Math.imul(S,Fe)|0,d=d+Math.imul(M,Be)|0,h=h+Math.imul(M,Fe)|0;var Bt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,l=Math.imul(se,oe),d=Math.imul(se,be),d=d+Math.imul(he,oe)|0,h=Math.imul(he,be),l=l+Math.imul(ne,ue)|0,d=d+Math.imul(ne,le)|0,d=d+Math.imul(xe,ue)|0,h=h+Math.imul(xe,le)|0,l=l+Math.imul(de,pe)|0,d=d+Math.imul(de,ve)|0,d=d+Math.imul(ce,pe)|0,h=h+Math.imul(ce,ve)|0,l=l+Math.imul(ae,ye)|0,d=d+Math.imul(ae,me)|0,d=d+Math.imul(ie,ye)|0,h=h+Math.imul(ie,me)|0,l=l+Math.imul(re,ge)|0,d=d+Math.imul(re,we)|0,d=d+Math.imul(fe,ge)|0,h=h+Math.imul(fe,we)|0,l=l+Math.imul(ee,Me)|0,d=d+Math.imul(ee,_e)|0,d=d+Math.imul(te,Me)|0,h=h+Math.imul(te,_e)|0,l=l+Math.imul(G,Se)|0,d=d+Math.imul(G,Ae)|0,d=d+Math.imul(Q,Se)|0,h=h+Math.imul(Q,Ae)|0,l=l+Math.imul(K,Ie)|0,d=d+Math.imul(K,Ee)|0,d=d+Math.imul(H,Ie)|0,h=h+Math.imul(H,Ee)|0,l=l+Math.imul(O,Be)|0,d=d+Math.imul(O,Fe)|0,d=d+Math.imul(L,Be)|0,h=h+Math.imul(L,Fe)|0,l=l+Math.imul(S,Re)|0,d=d+Math.imul(S,qe)|0,d=d+Math.imul(M,Re)|0,h=h+Math.imul(M,qe)|0;var Ft=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,l=Math.imul(se,ue),d=Math.imul(se,le),d=d+Math.imul(he,ue)|0,h=Math.imul(he,le),l=l+Math.imul(ne,pe)|0,d=d+Math.imul(ne,ve)|0,d=d+Math.imul(xe,pe)|0,h=h+Math.imul(xe,ve)|0,l=l+Math.imul(de,ye)|0,d=d+Math.imul(de,me)|0,d=d+Math.imul(ce,ye)|0,h=h+Math.imul(ce,me)|0,l=l+Math.imul(ae,ge)|0,d=d+Math.imul(ae,we)|0,d=d+Math.imul(ie,ge)|0,h=h+Math.imul(ie,we)|0,l=l+Math.imul(re,Me)|0,d=d+Math.imul(re,_e)|0,d=d+Math.imul(fe,Me)|0,h=h+Math.imul(fe,_e)|0,l=l+Math.imul(ee,Se)|0,d=d+Math.imul(ee,Ae)|0,d=d+Math.imul(te,Se)|0,h=h+Math.imul(te,Ae)|0,l=l+Math.imul(G,Ie)|0,d=d+Math.imul(G,Ee)|0,d=d+Math.imul(Q,Ie)|0,h=h+Math.imul(Q,Ee)|0,l=l+Math.imul(K,Be)|0,d=d+Math.imul(K,Fe)|0,d=d+Math.imul(H,Be)|0,h=h+Math.imul(H,Fe)|0,l=l+Math.imul(O,Re)|0,d=d+Math.imul(O,qe)|0,d=d+Math.imul(L,Re)|0,h=h+Math.imul(L,qe)|0;var Rt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,l=Math.imul(se,pe),d=Math.imul(se,ve),d=d+Math.imul(he,pe)|0,h=Math.imul(he,ve),l=l+Math.imul(ne,ye)|0,d=d+Math.imul(ne,me)|0,d=d+Math.imul(xe,ye)|0,h=h+Math.imul(xe,me)|0,l=l+Math.imul(de,ge)|0,d=d+Math.imul(de,we)|0,d=d+Math.imul(ce,ge)|0,h=h+Math.imul(ce,we)|0,l=l+Math.imul(ae,Me)|0,d=d+Math.imul(ae,_e)|0,d=d+Math.imul(ie,Me)|0,h=h+Math.imul(ie,_e)|0,l=l+Math.imul(re,Se)|0,d=d+Math.imul(re,Ae)|0,d=d+Math.imul(fe,Se)|0,h=h+Math.imul(fe,Ae)|0,l=l+Math.imul(ee,Ie)|0,d=d+Math.imul(ee,Ee)|0,d=d+Math.imul(te,Ie)|0,h=h+Math.imul(te,Ee)|0,l=l+Math.imul(G,Be)|0,d=d+Math.imul(G,Fe)|0,d=d+Math.imul(Q,Be)|0,h=h+Math.imul(Q,Fe)|0,l=l+Math.imul(K,Re)|0,d=d+Math.imul(K,qe)|0,d=d+Math.imul(H,Re)|0,h=h+Math.imul(H,qe)|0;var qt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(qt>>>26)|0,qt&=67108863,l=Math.imul(se,ye),d=Math.imul(se,me),d=d+Math.imul(he,ye)|0,h=Math.imul(he,me),l=l+Math.imul(ne,ge)|0,d=d+Math.imul(ne,we)|0,d=d+Math.imul(xe,ge)|0,h=h+Math.imul(xe,we)|0,l=l+Math.imul(de,Me)|0,d=d+Math.imul(de,_e)|0,d=d+Math.imul(ce,Me)|0,h=h+Math.imul(ce,_e)|0,l=l+Math.imul(ae,Se)|0,d=d+Math.imul(ae,Ae)|0,d=d+Math.imul(ie,Se)|0,h=h+Math.imul(ie,Ae)|0,l=l+Math.imul(re,Ie)|0,d=d+Math.imul(re,Ee)|0,d=d+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ee)|0,l=l+Math.imul(ee,Be)|0,d=d+Math.imul(ee,Fe)|0,d=d+Math.imul(te,Be)|0,h=h+Math.imul(te,Fe)|0,l=l+Math.imul(G,Re)|0,d=d+Math.imul(G,qe)|0,d=d+Math.imul(Q,Re)|0,h=h+Math.imul(Q,qe)|0;var Ct=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,l=Math.imul(se,ge),d=Math.imul(se,we),d=d+Math.imul(he,ge)|0,h=Math.imul(he,we),l=l+Math.imul(ne,Me)|0,d=d+Math.imul(ne,_e)|0,d=d+Math.imul(xe,Me)|0,h=h+Math.imul(xe,_e)|0,l=l+Math.imul(de,Se)|0,d=d+Math.imul(de,Ae)|0,d=d+Math.imul(ce,Se)|0,h=h+Math.imul(ce,Ae)|0,l=l+Math.imul(ae,Ie)|0,d=d+Math.imul(ae,Ee)|0,d=d+Math.imul(ie,Ie)|0,h=h+Math.imul(ie,Ee)|0,l=l+Math.imul(re,Be)|0,d=d+Math.imul(re,Fe)|0,d=d+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Fe)|0,l=l+Math.imul(ee,Re)|0,d=d+Math.imul(ee,qe)|0,d=d+Math.imul(te,Re)|0,h=h+Math.imul(te,qe)|0;var Pt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,l=Math.imul(se,Me),d=Math.imul(se,_e),d=d+Math.imul(he,Me)|0,h=Math.imul(he,_e),l=l+Math.imul(ne,Se)|0,d=d+Math.imul(ne,Ae)|0,d=d+Math.imul(xe,Se)|0,h=h+Math.imul(xe,Ae)|0,l=l+Math.imul(de,Ie)|0,d=d+Math.imul(de,Ee)|0,d=d+Math.imul(ce,Ie)|0,h=h+Math.imul(ce,Ee)|0,l=l+Math.imul(ae,Be)|0,d=d+Math.imul(ae,Fe)|0,d=d+Math.imul(ie,Be)|0,h=h+Math.imul(ie,Fe)|0,l=l+Math.imul(re,Re)|0,d=d+Math.imul(re,qe)|0,d=d+Math.imul(fe,Re)|0,h=h+Math.imul(fe,qe)|0;var zt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(zt>>>26)|0,zt&=67108863,l=Math.imul(se,Se),d=Math.imul(se,Ae),d=d+Math.imul(he,Se)|0,h=Math.imul(he,Ae),l=l+Math.imul(ne,Ie)|0,d=d+Math.imul(ne,Ee)|0,d=d+Math.imul(xe,Ie)|0,h=h+Math.imul(xe,Ee)|0,l=l+Math.imul(de,Be)|0,d=d+Math.imul(de,Fe)|0,d=d+Math.imul(ce,Be)|0,h=h+Math.imul(ce,Fe)|0,l=l+Math.imul(ae,Re)|0,d=d+Math.imul(ae,qe)|0,d=d+Math.imul(ie,Re)|0,h=h+Math.imul(ie,qe)|0;var Nt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,l=Math.imul(se,Ie),d=Math.imul(se,Ee),d=d+Math.imul(he,Ie)|0,h=Math.imul(he,Ee),l=l+Math.imul(ne,Be)|0,d=d+Math.imul(ne,Fe)|0,d=d+Math.imul(xe,Be)|0,h=h+Math.imul(xe,Fe)|0,l=l+Math.imul(de,Re)|0,d=d+Math.imul(de,qe)|0,d=d+Math.imul(ce,Re)|0,h=h+Math.imul(ce,qe)|0;var kt=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(kt>>>26)|0,kt&=67108863,l=Math.imul(se,Be),d=Math.imul(se,Fe),d=d+Math.imul(he,Be)|0,h=Math.imul(he,Fe),l=l+Math.imul(ne,Re)|0,d=d+Math.imul(ne,qe)|0,d=d+Math.imul(xe,Re)|0,h=h+Math.imul(xe,qe)|0;var Ot=(g+l|0)+((d&8191)<<13)|0;g=(h+(d>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,l=Math.imul(se,Re),d=Math.imul(se,qe),d=d+Math.imul(he,Re)|0,h=Math.imul(he,qe);var Ut=(g+l|0)+((d&8191)<<13)|0;return g=(h+(d>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,y[0]=gt,y[1]=wt,y[2]=Mt,y[3]=_t,y[4]=St,y[5]=At,y[6]=It,y[7]=Et,y[8]=Bt,y[9]=Ft,y[10]=Rt,y[11]=qt,y[12]=Ct,y[13]=Pt,y[14]=zt,y[15]=Nt,y[16]=kt,y[17]=Ot,y[18]=Ut,g!==0&&(y[19]=g,x.length++),x};Math.imul||(P=B);function N(p,i,n){n.negative=i.negative^p.negative,n.length=p.length+i.length;for(var x=0,o=0,u=0;u>>26)|0,o+=y>>>26,y&=67108863}n.words[u]=g,x=y,y=o}return x!==0?n.words[u]=x:n.length--,n.strip()}function D(p,i,n){var x=new k;return x.mulp(p,i,n)}f.prototype.mulTo=function(i,n){var x,o=this.length+i.length;return this.length===10&&i.length===10?x=P(this,i,n):o<63?x=B(this,i,n):o<1024?x=N(this,i,n):x=D(this,i,n),x};function k(p,i){this.x=p,this.y=i}k.prototype.makeRBT=function(i){for(var n=new Array(i),x=f.prototype._countBits(i)-1,o=0;o>=1;return o},k.prototype.permute=function(i,n,x,o,u,y){for(var g=0;g>>1)u++;return 1<>>13,x[2*y+1]=u&8191,u=u>>>13;for(y=2*n;y>=26,n+=o/67108864|0,n+=u>>>26,this.words[x]=u&67108863}return n!==0&&(this.words[x]=n,this.length++),this.length=i===0?1:this.length,this},f.prototype.muln=function(i){return this.clone().imuln(i)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(i){var n=F(i);if(n.length===0)return new f(1);for(var x=this,o=0;o=0);var n=i%26,x=(i-n)/26,o=67108863>>>26-n<<26-n,u;if(n!==0){var y=0;for(u=0;u>>26-n}y&&(this.words[u]=y,this.length++)}if(x!==0){for(u=this.length-1;u>=0;u--)this.words[u+x]=this.words[u];for(u=0;u=0);var o;n?o=(n-n%26)/26:o=0;var u=i%26,y=Math.min((i-u)/26,this.length),g=67108863^67108863>>>u<y)for(this.length-=y,d=0;d=0&&(h!==0||d>=o);d--){var A=this.words[d]|0;this.words[d]=h<<26-u|A>>>u,h=A&g}return l&&h!==0&&(l.words[l.length++]=h),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(i,n,x){return t(this.negative===0),this.iushrn(i,n,x)},f.prototype.shln=function(i){return this.clone().ishln(i)},f.prototype.ushln=function(i){return this.clone().iushln(i)},f.prototype.shrn=function(i){return this.clone().ishrn(i)},f.prototype.ushrn=function(i){return this.clone().iushrn(i)},f.prototype.testn=function(i){t(typeof i=="number"&&i>=0);var n=i%26,x=(i-n)/26,o=1<=0);var n=i%26,x=(i-n)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(n!==0&&x++,this.length=Math.min(x,this.length),n!==0){var o=67108863^67108863>>>n<=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},f.prototype.isubn=function(i){if(t(typeof i=="number"),t(i<67108864),i<0)return this.iaddn(-i);if(this.negative!==0)return this.negative=0,this.iaddn(i),this.negative=1,this;if(this.words[0]-=i,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n>26)-(l/67108864|0),this.words[u+x]=y&67108863}for(;u>26,this.words[u+x]=y&67108863;if(g===0)return this.strip();for(t(g===-1),g=0,u=0;u>26,this.words[u]=y&67108863;return this.negative=1,this.strip()},f.prototype._wordDiv=function(i,n){var x=this.length-i.length,o=this.clone(),u=i,y=u.words[u.length-1]|0,g=this._countBits(y);x=26-g,x!==0&&(u=u.ushln(x),o.iushln(x),y=u.words[u.length-1]|0);var l=o.length-u.length,d;if(n!=="mod"){d=new f(null),d.length=l+1,d.words=new Array(d.length);for(var h=0;h=0;S--){var M=(o.words[u.length+S]|0)*67108864+(o.words[u.length+S-1]|0);for(M=Math.min(M/y|0,67108863),o._ishlnsubmul(u,M,S);o.negative!==0;)M--,o.negative=0,o._ishlnsubmul(u,1,S),o.isZero()||(o.negative^=1);d&&(d.words[S]=M)}return d&&d.strip(),o.strip(),n!=="div"&&x!==0&&o.iushrn(x),{div:d||null,mod:o}},f.prototype.divmod=function(i,n,x){if(t(!i.isZero()),this.isZero())return{div:new f(0),mod:new f(0)};var o,u,y;return this.negative!==0&&i.negative===0?(y=this.neg().divmod(i,n),n!=="mod"&&(o=y.div.neg()),n!=="div"&&(u=y.mod.neg(),x&&u.negative!==0&&u.iadd(i)),{div:o,mod:u}):this.negative===0&&i.negative!==0?(y=this.divmod(i.neg(),n),n!=="mod"&&(o=y.div.neg()),{div:o,mod:y.mod}):(this.negative&i.negative)!==0?(y=this.neg().divmod(i.neg(),n),n!=="div"&&(u=y.mod.neg(),x&&u.negative!==0&&u.isub(i)),{div:y.div,mod:u}):i.length>this.length||this.cmp(i)<0?{div:new f(0),mod:this}:i.length===1?n==="div"?{div:this.divn(i.words[0]),mod:null}:n==="mod"?{div:null,mod:new f(this.modn(i.words[0]))}:{div:this.divn(i.words[0]),mod:new f(this.modn(i.words[0]))}:this._wordDiv(i,n)},f.prototype.div=function(i){return this.divmod(i,"div",!1).div},f.prototype.mod=function(i){return this.divmod(i,"mod",!1).mod},f.prototype.umod=function(i){return this.divmod(i,"mod",!0).mod},f.prototype.divRound=function(i){var n=this.divmod(i);if(n.mod.isZero())return n.div;var x=n.div.negative!==0?n.mod.isub(i):n.mod,o=i.ushrn(1),u=i.andln(1),y=x.cmp(o);return y<0||u===1&&y===0?n.div:n.div.negative!==0?n.div.isubn(1):n.div.iaddn(1)},f.prototype.modn=function(i){t(i<=67108863);for(var n=(1<<26)%i,x=0,o=this.length-1;o>=0;o--)x=(n*x+(this.words[o]|0))%i;return x},f.prototype.idivn=function(i){t(i<=67108863);for(var n=0,x=this.length-1;x>=0;x--){var o=(this.words[x]|0)+n*67108864;this.words[x]=o/i|0,n=o%i}return this.strip()},f.prototype.divn=function(i){return this.clone().idivn(i)},f.prototype.egcd=function(i){t(i.negative===0),t(!i.isZero());var n=this,x=i.clone();n.negative!==0?n=n.umod(i):n=n.clone();for(var o=new f(1),u=new f(0),y=new f(0),g=new f(1),l=0;n.isEven()&&x.isEven();)n.iushrn(1),x.iushrn(1),++l;for(var d=x.clone(),h=n.clone();!n.isZero();){for(var A=0,S=1;(n.words[0]&S)===0&&A<26;++A,S<<=1);if(A>0)for(n.iushrn(A);A-- >0;)(o.isOdd()||u.isOdd())&&(o.iadd(d),u.isub(h)),o.iushrn(1),u.iushrn(1);for(var M=0,z=1;(x.words[0]&z)===0&&M<26;++M,z<<=1);if(M>0)for(x.iushrn(M);M-- >0;)(y.isOdd()||g.isOdd())&&(y.iadd(d),g.isub(h)),y.iushrn(1),g.iushrn(1);n.cmp(x)>=0?(n.isub(x),o.isub(y),u.isub(g)):(x.isub(n),y.isub(o),g.isub(u))}return{a:y,b:g,gcd:x.iushln(l)}},f.prototype._invmp=function(i){t(i.negative===0),t(!i.isZero());var n=this,x=i.clone();n.negative!==0?n=n.umod(i):n=n.clone();for(var o=new f(1),u=new f(0),y=x.clone();n.cmpn(1)>0&&x.cmpn(1)>0;){for(var g=0,l=1;(n.words[0]&l)===0&&g<26;++g,l<<=1);if(g>0)for(n.iushrn(g);g-- >0;)o.isOdd()&&o.iadd(y),o.iushrn(1);for(var d=0,h=1;(x.words[0]&h)===0&&d<26;++d,h<<=1);if(d>0)for(x.iushrn(d);d-- >0;)u.isOdd()&&u.iadd(y),u.iushrn(1);n.cmp(x)>=0?(n.isub(x),o.isub(u)):(x.isub(n),u.isub(o))}var A;return n.cmpn(1)===0?A=o:A=u,A.cmpn(0)<0&&A.iadd(i),A},f.prototype.gcd=function(i){if(this.isZero())return i.abs();if(i.isZero())return this.abs();var n=this.clone(),x=i.clone();n.negative=0,x.negative=0;for(var o=0;n.isEven()&&x.isEven();o++)n.iushrn(1),x.iushrn(1);do{for(;n.isEven();)n.iushrn(1);for(;x.isEven();)x.iushrn(1);var u=n.cmp(x);if(u<0){var y=n;n=x,x=y}else if(u===0||x.cmpn(1)===0)break;n.isub(x)}while(!0);return x.iushln(o)},f.prototype.invm=function(i){return this.egcd(i).a.umod(i)},f.prototype.isEven=function(){return(this.words[0]&1)===0},f.prototype.isOdd=function(){return(this.words[0]&1)===1},f.prototype.andln=function(i){return this.words[0]&i},f.prototype.bincn=function(i){t(typeof i=="number");var n=i%26,x=(i-n)/26,o=1<>>26,g&=67108863,this.words[y]=g}return u!==0&&(this.words[y]=u,this.length++),this},f.prototype.isZero=function(){return this.length===1&&this.words[0]===0},f.prototype.cmpn=function(i){var n=i<0;if(this.negative!==0&&!n)return-1;if(this.negative===0&&n)return 1;this.strip();var x;if(this.length>1)x=1;else{n&&(i=-i),t(i<=67108863,"Number is too big");var o=this.words[0]|0;x=o===i?0:oi.length)return 1;if(this.length=0;x--){var o=this.words[x]|0,u=i.words[x]|0;if(o!==u){ou&&(n=1);break}}return n},f.prototype.gtn=function(i){return this.cmpn(i)===1},f.prototype.gt=function(i){return this.cmp(i)===1},f.prototype.gten=function(i){return this.cmpn(i)>=0},f.prototype.gte=function(i){return this.cmp(i)>=0},f.prototype.ltn=function(i){return this.cmpn(i)===-1},f.prototype.lt=function(i){return this.cmp(i)===-1},f.prototype.lten=function(i){return this.cmpn(i)<=0},f.prototype.lte=function(i){return this.cmp(i)<=0},f.prototype.eqn=function(i){return this.cmpn(i)===0},f.prototype.eq=function(i){return this.cmp(i)===0},f.red=function(i){return new C(i)},f.prototype.toRed=function(i){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),i.convertTo(this)._forceRed(i)},f.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},f.prototype._forceRed=function(i){return this.red=i,this},f.prototype.forceRed=function(i){return t(!this.red,"Already a number in reduction context"),this._forceRed(i)},f.prototype.redAdd=function(i){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,i)},f.prototype.redIAdd=function(i){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,i)},f.prototype.redSub=function(i){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,i)},f.prototype.redISub=function(i){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,i)},f.prototype.redShl=function(i){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,i)},f.prototype.redMul=function(i){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.mul(this,i)},f.prototype.redIMul=function(i){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.imul(this,i)},f.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},f.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},f.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},f.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},f.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},f.prototype.redPow=function(i){return t(this.red&&!i.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,i)};var $={k256:null,p224:null,p192:null,p25519:null};function U(p,i){this.name=p,this.p=new f(i,16),this.n=this.p.bitLength(),this.k=new f(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var i=new f(null);return i.words=new Array(Math.ceil(this.n/13)),i},U.prototype.ireduce=function(i){var n=i,x;do this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),x=n.bitLength();while(x>this.n);var o=x0?n.isub(this.p):n.strip!==void 0?n.strip():n._strip(),n},U.prototype.split=function(i,n){i.iushrn(this.n,0,n)},U.prototype.imulK=function(i){return i.imul(this.k)};function Y(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}a(Y,U),Y.prototype.split=function(i,n){for(var x=4194303,o=Math.min(i.length,9),u=0;u>>22,y=g}y>>>=22,i.words[u-10]=y,y===0&&i.length>10?i.length-=10:i.length-=9},Y.prototype.imulK=function(i){i.words[i.length]=0,i.words[i.length+1]=0,i.length+=2;for(var n=0,x=0;x>>=26,i.words[x]=u,n=o}return n!==0&&(i.words[i.length++]=n),i},f._prime=function(i){if($[i])return $[i];var n;if(i==="k256")n=new Y;else if(i==="p224")n=new J;else if(i==="p192")n=new E;else if(i==="p25519")n=new q;else throw new Error("Unknown prime "+i);return $[i]=n,n};function C(p){if(typeof p=="string"){var i=f._prime(p);this.m=i.p,this.prime=i}else t(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}C.prototype._verify1=function(i){t(i.negative===0,"red works only with positives"),t(i.red,"red works only with red numbers")},C.prototype._verify2=function(i,n){t((i.negative|n.negative)===0,"red works only with positives"),t(i.red&&i.red===n.red,"red works only with red numbers")},C.prototype.imod=function(i){return this.prime?this.prime.ireduce(i)._forceRed(this):i.umod(this.m)._forceRed(this)},C.prototype.neg=function(i){return i.isZero()?i.clone():this.m.sub(i)._forceRed(this)},C.prototype.add=function(i,n){this._verify2(i,n);var x=i.add(n);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},C.prototype.iadd=function(i,n){this._verify2(i,n);var x=i.iadd(n);return x.cmp(this.m)>=0&&x.isub(this.m),x},C.prototype.sub=function(i,n){this._verify2(i,n);var x=i.sub(n);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},C.prototype.isub=function(i,n){this._verify2(i,n);var x=i.isub(n);return x.cmpn(0)<0&&x.iadd(this.m),x},C.prototype.shl=function(i,n){return this._verify1(i),this.imod(i.ushln(n))},C.prototype.imul=function(i,n){return this._verify2(i,n),this.imod(i.imul(n))},C.prototype.mul=function(i,n){return this._verify2(i,n),this.imod(i.mul(n))},C.prototype.isqr=function(i){return this.imul(i,i.clone())},C.prototype.sqr=function(i){return this.mul(i,i)},C.prototype.sqrt=function(i){if(i.isZero())return i.clone();var n=this.m.andln(3);if(t(n%2===1),n===3){var x=this.m.add(new f(1)).iushrn(2);return this.pow(i,x)}for(var o=this.m.subn(1),u=0;!o.isZero()&&o.andln(1)===0;)u++,o.iushrn(1);t(!o.isZero());var y=new f(1).toRed(this),g=y.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new f(2*d*d).toRed(this);this.pow(d,l).cmp(g)!==0;)d.redIAdd(g);for(var h=this.pow(d,o),A=this.pow(i,o.addn(1).iushrn(1)),S=this.pow(i,o),M=u;S.cmp(y)!==0;){for(var z=S,O=0;z.cmp(y)!==0;O++)z=z.redSqr();t(O=0;u--){for(var h=n.words[u],A=d-1;A>=0;A--){var S=h>>A&1;if(y!==o[0]&&(y=this.sqr(y)),S===0&&g===0){l=0;continue}g<<=1,g|=S,l++,!(l!==x&&(u!==0||A!==0))&&(y=this.mul(y,o[g]),l=0,g=0)}d=26}return y},C.prototype.convertTo=function(i){var n=i.umod(this.m);return n===i?n.clone():n},C.prototype.convertFrom=function(i){var n=i.clone();return n.red=null,n},f.mont=function(i){return new R(i)};function R(p){C.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new f(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)}a(R,C),R.prototype.convertTo=function(i){return this.imod(i.ushln(this.shift))},R.prototype.convertFrom=function(i){var n=this.imod(i.mul(this.rinv));return n.red=null,n},R.prototype.imul=function(i,n){if(i.isZero()||n.isZero())return i.words[0]=0,i.length=1,i;var x=i.imul(n),o=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=x.isub(o).iushrn(this.shift),y=u;return u.cmp(this.m)>=0?y=u.isub(this.m):u.cmpn(0)<0&&(y=u.iadd(this.m)),y._forceRed(this)},R.prototype.mul=function(i,n){if(i.isZero()||n.isZero())return new f(0)._forceRed(this);var x=i.mul(n),o=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=x.isub(o).iushrn(this.shift),y=u;return u.cmp(this.m)>=0?y=u.isub(this.m):u.cmpn(0)<0&&(y=u.iadd(this.m)),y._forceRed(this)},R.prototype.invm=function(i){var n=this.imod(i._invmp(this.m).mul(this.r2));return n._forceRed(this)}})(typeof Dt>"u"||Dt,jr)});var b0=T((Pc,Yr)=>{Yr.exports=Vr;function Vr(r,e){if(!r)throw new Error(e||"Assertion failed")}Vr.equal=function(e,t,a){if(e!=t)throw new Error(a||"Assertion failed: "+e+" != "+t)}});var Kt=T(Qr=>{"use strict";var et=Qr;function Qa(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r!="string"){for(var a=0;a>8,s=f&255;c?t.push(c,s):t.push(s)}return t}et.toArray=Qa;function Zr(r){return r.length===1?"0"+r:r}et.zero2=Zr;function Gr(r){for(var e="",t=0;t{"use strict";var $e=ef,ei=Ge(),ti=b0(),tt=Kt();$e.assert=ti;$e.toArray=tt.toArray;$e.zero2=tt.zero2;$e.toHex=tt.toHex;$e.encode=tt.encode;function ri(r,e,t){var a=new Array(Math.max(r.bitLength(),t)+1),f;for(f=0;f(c>>1)-1?b=(c>>1)-v:b=v,s.isubn(b)):b=0,a[f]=b,s.iushrn(1)}return a}$e.getNAF=ri;function fi(r,e){var t=[[],[]];r=r.clone(),e=e.clone();for(var a=0,f=0,c;r.cmpn(-a)>0||e.cmpn(-f)>0;){var s=r.andln(3)+a&3,b=e.andln(3)+f&3;s===3&&(s=-1),b===3&&(b=-1);var v;(s&1)===0?v=0:(c=r.andln(7)+a&7,(c===3||c===5)&&b===2?v=-s:v=s),t[0].push(v);var _;(b&1)===0?_=0:(c=e.andln(7)+f&7,(c===3||c===5)&&s===2?_=-b:_=b),t[1].push(_),2*a===v+1&&(a=1-a),2*f===_+1&&(f=1-f),r.iushrn(1),e.iushrn(1)}return t}$e.getJSF=fi;function ai(r,e,t){var a="_"+e;r.prototype[e]=function(){return this[a]!==void 0?this[a]:this[a]=t.call(this)}}$e.cachedProperty=ai;function ii(r){return typeof r=="string"?$e.toArray(r,"hex"):r}$e.parseBytes=ii;function di(r){return new ei(r,"hex","le")}$e.intFromLE=di});var Xt=T((kc,Wt)=>{var Ht;Wt.exports=function(e){return Ht||(Ht=new u0(null)),Ht.generate(e)};function u0(r){this.rand=r}Wt.exports.Rand=u0;u0.prototype.generate=function(e){return this._rand(e)};u0.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),a=0;a{"use strict";var M0=Ge(),X0=Ke(),rt=X0.getNAF,ci=X0.getJSF,ft=X0.assert;function l0(r,e){this.type=r,this.p=new M0(e.p,16),this.red=e.prime?M0.red(e.prime):M0.mont(this.p),this.zero=new M0(0).toRed(this.red),this.one=new M0(1).toRed(this.red),this.two=new M0(2).toRed(this.red),this.n=e.n&&new M0(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}tf.exports=l0;l0.prototype.point=function(){throw new Error("Not implemented")};l0.prototype.validate=function(){throw new Error("Not implemented")};l0.prototype._fixedNafMul=function(e,t){ft(e.precomputed);var a=e._getDoubles(),f=rt(t,1,this._bitLength),c=(1<=b;_--)v=(v<<1)+f[_];s.push(v)}for(var m=this.jpoint(null,null,null),w=this.jpoint(null,null,null),F=c;F>0;F--){for(b=0;b=0;v--){for(var _=0;v>=0&&s[v]===0;v--)_++;if(v>=0&&_++,b=b.dblp(_),v<0)break;var m=s[v];ft(m!==0),e.type==="affine"?m>0?b=b.mixedAdd(c[m-1>>1]):b=b.mixedAdd(c[-m-1>>1].neg()):m>0?b=b.add(c[m-1>>1]):b=b.add(c[-m-1>>1].neg())}return e.type==="affine"?b.toP():b};l0.prototype._wnafMulAdd=function(e,t,a,f,c){var s=this._wnafT1,b=this._wnafT2,v=this._wnafT3,_=0,m,w,F;for(m=0;m=1;m-=2){var P=m-1,N=m;if(s[P]!==1||s[N]!==1){v[P]=rt(a[P],s[P],this._bitLength),v[N]=rt(a[N],s[N],this._bitLength),_=Math.max(v[P].length,_),_=Math.max(v[N].length,_);continue}var D=[t[P],null,null,t[N]];t[P].y.cmp(t[N].y)===0?(D[1]=t[P].add(t[N]),D[2]=t[P].toJ().mixedAdd(t[N].neg())):t[P].y.cmp(t[N].y.redNeg())===0?(D[1]=t[P].toJ().mixedAdd(t[N]),D[2]=t[P].add(t[N].neg())):(D[1]=t[P].toJ().mixedAdd(t[N]),D[2]=t[P].toJ().mixedAdd(t[N].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],$=ci(a[P],a[N]);for(_=Math.max($[0].length,_),v[P]=new Array(_),v[N]=new Array(_),w=0;w<_;w++){var U=$[0][w]|0,Y=$[1][w]|0;v[P][w]=k[(U+1)*3+(Y+1)],v[N][w]=0,b[P]=D}}var J=this.jpoint(null,null,null),E=this._wnafT4;for(m=_;m>=0;m--){for(var q=0;m>=0;){var C=!0;for(w=0;w=0&&q++,J=J.dblp(q),m<0)break;for(w=0;w0?F=b[w][R-1>>1]:R<0&&(F=b[w][-R-1>>1].neg()),F.type==="affine"?J=J.mixedAdd(F):J=J.add(F))}}for(m=0;m=Math.ceil((e.bitLength()+1)/t.step):!1};He.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var a=[this],f=this,c=0;c{typeof Object.create=="function"?$t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:$t.exports=function(e,t){if(t){e.super_=t;var a=function(){};a.prototype=t.prototype,e.prototype=new a,e.prototype.constructor=e}}});var ff=T((Lc,rf)=>{"use strict";var ni=Ke(),Z=Ge(),jt=j0(),R0=$0(),xi=ni.assert;function Je(r){R0.call(this,"short",r),this.a=new Z(r.a,16).toRed(this.red),this.b=new Z(r.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(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}jt(Je,R0);rf.exports=Je;Je.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,a;if(e.beta)t=new Z(e.beta,16).toRed(this.red);else{var f=this._getEndoRoots(this.p);t=f[0].cmp(f[1])<0?f[0]:f[1],t=t.toRed(this.red)}if(e.lambda)a=new Z(e.lambda,16);else{var c=this._getEndoRoots(this.n);this.g.mul(c[0]).x.cmp(this.g.x.redMul(t))===0?a=c[0]:(a=c[1],xi(this.g.mul(a).x.cmp(this.g.x.redMul(t))===0))}var s;return e.basis?s=e.basis.map(function(b){return{a:new Z(b.a,16),b:new Z(b.b,16)}}):s=this._getEndoBasis(a),{beta:t,lambda:a,basis:s}}};Je.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Z.mont(e),a=new Z(2).toRed(t).redInvm(),f=a.redNeg(),c=new Z(3).toRed(t).redNeg().redSqrt().redMul(a),s=f.redAdd(c).fromRed(),b=f.redSub(c).fromRed();return[s,b]};Je.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),a=e,f=this.n.clone(),c=new Z(1),s=new Z(0),b=new Z(0),v=new Z(1),_,m,w,F,B,P,N,D=0,k,$;a.cmpn(0)!==0;){var U=f.div(a);k=f.sub(U.mul(a)),$=b.sub(U.mul(c));var Y=v.sub(U.mul(s));if(!w&&k.cmp(t)<0)_=N.neg(),m=c,w=k.neg(),F=$;else if(w&&++D===2)break;N=k,f=a,a=k,b=c,c=$,v=s,s=Y}B=k.neg(),P=$;var J=w.sqr().add(F.sqr()),E=B.sqr().add(P.sqr());return E.cmp(J)>=0&&(B=_,P=m),w.negative&&(w=w.neg(),F=F.neg()),B.negative&&(B=B.neg(),P=P.neg()),[{a:w,b:F},{a:B,b:P}]};Je.prototype._endoSplit=function(e){var t=this.endo.basis,a=t[0],f=t[1],c=f.b.mul(e).divRound(this.n),s=a.b.neg().mul(e).divRound(this.n),b=c.mul(a.a),v=s.mul(f.a),_=c.mul(a.b),m=s.mul(f.b),w=e.sub(b).sub(v),F=_.add(m).neg();return{k1:w,k2:F}};Je.prototype.pointFromX=function(e,t){e=new Z(e,16),e.red||(e=e.toRed(this.red));var a=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var c=f.fromRed().isOdd();return(t&&!c||!t&&c)&&(f=f.redNeg()),this.point(e,f)};Je.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,a=e.y,f=this.a.redMul(t),c=t.redSqr().redMul(t).redIAdd(f).redIAdd(this.b);return a.redSqr().redISub(c).cmpn(0)===0};Je.prototype._endoWnafMulAdd=function(e,t,a){for(var f=this._endoWnafT1,c=this._endoWnafT2,s=0;s":""};Ce.prototype.isInfinity=function(){return this.inf};Ce.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var a=t.redSqr().redISub(this.x).redISub(e.x),f=t.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)};Ce.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,a=this.x.redSqr(),f=e.redInvm(),c=a.redAdd(a).redIAdd(a).redIAdd(t).redMul(f),s=c.redSqr().redISub(this.x.redAdd(this.x)),b=c.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,b)};Ce.prototype.getX=function(){return this.x.fromRed()};Ce.prototype.getY=function(){return this.y.fromRed()};Ce.prototype.mul=function(e){return e=new Z(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ce.prototype.mulAdd=function(e,t,a){var f=[this,t],c=[e,a];return this.curve.endo?this.curve._endoWnafMulAdd(f,c):this.curve._wnafMulAdd(1,f,c,2)};Ce.prototype.jmulAdd=function(e,t,a){var f=[this,t],c=[e,a];return this.curve.endo?this.curve._endoWnafMulAdd(f,c,!0):this.curve._wnafMulAdd(1,f,c,2,!0)};Ce.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ce.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var a=this.precomputed,f=function(c){return c.neg()};t.precomputed={naf:a.naf&&{wnd:a.naf.wnd,points:a.naf.points.map(f)},doubles:a.doubles&&{step:a.doubles.step,points:a.doubles.points.map(f)}}}return t};Ce.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function ke(r,e,t,a){R0.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&a===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Z(0)):(this.x=new Z(e,16),this.y=new Z(t,16),this.z=new Z(a,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}jt(ke,R0.BasePoint);Je.prototype.jpoint=function(e,t,a){return new ke(this,e,t,a)};ke.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),a=this.x.redMul(t),f=this.y.redMul(t).redMul(e);return this.curve.point(a,f)};ke.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};ke.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),a=this.z.redSqr(),f=this.x.redMul(t),c=e.x.redMul(a),s=this.y.redMul(t.redMul(e.z)),b=e.y.redMul(a.redMul(this.z)),v=f.redSub(c),_=s.redSub(b);if(v.cmpn(0)===0)return _.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=v.redSqr(),w=m.redMul(v),F=f.redMul(m),B=_.redSqr().redIAdd(w).redISub(F).redISub(F),P=_.redMul(F.redISub(B)).redISub(s.redMul(w)),N=this.z.redMul(e.z).redMul(v);return this.curve.jpoint(B,P,N)};ke.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),a=this.x,f=e.x.redMul(t),c=this.y,s=e.y.redMul(t).redMul(this.z),b=a.redSub(f),v=c.redSub(s);if(b.cmpn(0)===0)return v.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var _=b.redSqr(),m=_.redMul(b),w=a.redMul(_),F=v.redSqr().redIAdd(m).redISub(w).redISub(w),B=v.redMul(w.redISub(F)).redISub(c.redMul(m)),P=this.z.redMul(b);return this.curve.jpoint(F,B,P)};ke.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var a=this;for(t=0;t=0)return!1;if(a.redIAdd(c),this.x.cmp(a)===0)return!0}};ke.prototype.inspect=function(){return this.isInfinity()?"":""};ke.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var cf=T((Tc,df)=>{"use strict";var q0=Ge(),af=j0(),at=$0(),si=Ke();function C0(r){at.call(this,"mont",r),this.a=new q0(r.a,16).toRed(this.red),this.b=new q0(r.b,16).toRed(this.red),this.i4=new q0(4).toRed(this.red).redInvm(),this.two=new q0(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}af(C0,at);df.exports=C0;C0.prototype.validate=function(e){var t=e.normalize().x,a=t.redSqr(),f=a.redMul(t).redAdd(a.redMul(this.a)).redAdd(t),c=f.redSqrt();return c.redSqr().cmp(f)===0};function Pe(r,e,t){at.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new q0(e,16),this.z=new q0(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}af(Pe,at.BasePoint);C0.prototype.decodePoint=function(e,t){return this.point(si.toArray(e,t),1)};C0.prototype.point=function(e,t){return new Pe(this,e,t)};C0.prototype.pointFromJSON=function(e){return Pe.fromJSON(this,e)};Pe.prototype.precompute=function(){};Pe.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Pe.fromJSON=function(e,t){return new Pe(e,t[0],t[1]||e.one)};Pe.prototype.inspect=function(){return this.isInfinity()?"":""};Pe.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Pe.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),a=this.x.redSub(this.z),f=a.redSqr(),c=t.redSub(f),s=t.redMul(f),b=c.redMul(f.redAdd(this.curve.a24.redMul(c)));return this.curve.point(s,b)};Pe.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Pe.prototype.diffAdd=function(e,t){var a=this.x.redAdd(this.z),f=this.x.redSub(this.z),c=e.x.redAdd(e.z),s=e.x.redSub(e.z),b=s.redMul(a),v=c.redMul(f),_=t.z.redMul(b.redAdd(v).redSqr()),m=t.x.redMul(b.redISub(v).redSqr());return this.curve.point(_,m)};Pe.prototype.mul=function(e){for(var t=e.clone(),a=this,f=this.curve.point(null,null),c=this,s=[];t.cmpn(0)!==0;t.iushrn(1))s.push(t.andln(1));for(var b=s.length-1;b>=0;b--)s[b]===0?(a=a.diffAdd(f,c),f=f.dbl()):(f=a.diffAdd(f,c),a=a.dbl());return f};Pe.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Pe.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Pe.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Pe.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Pe.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var sf=T((Dc,xf)=>{"use strict";var hi=Ke(),n0=Ge(),nf=j0(),it=$0(),oi=hi.assert;function Qe(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,it.call(this,"edwards",r),this.a=new n0(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n0(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n0(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),oi(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}nf(Qe,it);xf.exports=Qe;Qe.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Qe.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Qe.prototype.jpoint=function(e,t,a,f){return this.point(e,t,a,f)};Qe.prototype.pointFromX=function(e,t){e=new n0(e,16),e.red||(e=e.toRed(this.red));var a=e.redSqr(),f=this.c2.redSub(this.a.redMul(a)),c=this.one.redSub(this.c2.redMul(this.d).redMul(a)),s=f.redMul(c.redInvm()),b=s.redSqrt();if(b.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");var v=b.fromRed().isOdd();return(t&&!v||!t&&v)&&(b=b.redNeg()),this.point(e,b)};Qe.prototype.pointFromY=function(e,t){e=new n0(e,16),e.red||(e=e.toRed(this.red));var a=e.redSqr(),f=a.redSub(this.c2),c=a.redMul(this.d).redMul(this.c2).redSub(this.a),s=f.redMul(c.redInvm());if(s.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var b=s.redSqrt();if(b.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");return b.fromRed().isOdd()!==t&&(b=b.redNeg()),this.point(b,e)};Qe.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),a=e.y.redSqr(),f=t.redMul(this.a).redAdd(a),c=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(a)));return f.cmp(c)===0};function j(r,e,t,a,f){it.BasePoint.call(this,r,"projective"),e===null&&t===null&&a===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n0(e,16),this.y=new n0(t,16),this.z=a?new n0(a,16):this.curve.one,this.t=f&&new n0(f,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}nf(j,it.BasePoint);Qe.prototype.pointFromJSON=function(e){return j.fromJSON(this,e)};Qe.prototype.point=function(e,t,a,f){return new j(this,e,t,a,f)};j.fromJSON=function(e,t){return new j(e,t[0],t[1],t[2])};j.prototype.inspect=function(){return this.isInfinity()?"":""};j.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};j.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),a=this.z.redSqr();a=a.redIAdd(a);var f=this.curve._mulA(e),c=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),s=f.redAdd(t),b=s.redSub(a),v=f.redSub(t),_=c.redMul(b),m=s.redMul(v),w=c.redMul(v),F=b.redMul(s);return this.curve.point(_,m,F,w)};j.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),a=this.y.redSqr(),f,c,s,b,v,_;if(this.curve.twisted){b=this.curve._mulA(t);var m=b.redAdd(a);this.zOne?(f=e.redSub(t).redSub(a).redMul(m.redSub(this.curve.two)),c=m.redMul(b.redSub(a)),s=m.redSqr().redSub(m).redSub(m)):(v=this.z.redSqr(),_=m.redSub(v).redISub(v),f=e.redSub(t).redISub(a).redMul(_),c=m.redMul(b.redSub(a)),s=m.redMul(_))}else b=t.redAdd(a),v=this.curve._mulC(this.z).redSqr(),_=b.redSub(v).redSub(v),f=this.curve._mulC(e.redISub(b)).redMul(_),c=this.curve._mulC(b).redMul(t.redISub(a)),s=b.redMul(_);return this.curve.point(f,c,s)};j.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};j.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),a=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),f=this.t.redMul(this.curve.dd).redMul(e.t),c=this.z.redMul(e.z.redAdd(e.z)),s=a.redSub(t),b=c.redSub(f),v=c.redAdd(f),_=a.redAdd(t),m=s.redMul(b),w=v.redMul(_),F=s.redMul(_),B=b.redMul(v);return this.curve.point(m,w,B,F)};j.prototype._projAdd=function(e){var t=this.z.redMul(e.z),a=t.redSqr(),f=this.x.redMul(e.x),c=this.y.redMul(e.y),s=this.curve.d.redMul(f).redMul(c),b=a.redSub(s),v=a.redAdd(s),_=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(f).redISub(c),m=t.redMul(b).redMul(_),w,F;return this.curve.twisted?(w=t.redMul(v).redMul(c.redSub(this.curve._mulA(f))),F=b.redMul(v)):(w=t.redMul(v).redMul(c.redSub(f)),F=this.curve._mulC(b).redMul(v)),this.curve.point(m,w,F)};j.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};j.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};j.prototype.mulAdd=function(e,t,a){return this.curve._wnafMulAdd(1,[this,t],[e,a],2,!1)};j.prototype.jmulAdd=function(e,t,a){return this.curve._wnafMulAdd(1,[this,t],[e,a],2,!0)};j.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};j.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};j.prototype.getX=function(){return this.normalize(),this.x.fromRed()};j.prototype.getY=function(){return this.normalize(),this.y.fromRed()};j.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};j.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var a=e.clone(),f=this.curve.redN.redMul(this.z);;){if(a.iadd(this.curve.n),a.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(f),this.x.cmp(t)===0)return!0}};j.prototype.toP=j.prototype.normalize;j.prototype.mixedAdd=j.prototype.add});var Vt=T(hf=>{"use strict";var dt=hf;dt.base=$0();dt.short=ff();dt.mont=cf();dt.edwards=sf()});var je=T(W=>{"use strict";var bi=b0(),ui=j0();W.inherits=ui;function li(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function pi(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),f=0;f>6|192,t[a++]=c&63|128):li(r,f)?(c=65536+((c&1023)<<10)+(r.charCodeAt(++f)&1023),t[a++]=c>>18|240,t[a++]=c>>12&63|128,t[a++]=c>>6&63|128,t[a++]=c&63|128):(t[a++]=c>>12|224,t[a++]=c>>6&63|128,t[a++]=c&63|128)}else for(f=0;f>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}W.htonl=of;function yi(r,e){for(var t="",a=0;a>>0}return c}W.join32=mi;function gi(r,e){for(var t=new Array(r.length*4),a=0,f=0;a>>24,t[f+1]=c>>>16&255,t[f+2]=c>>>8&255,t[f+3]=c&255):(t[f+3]=c>>>24,t[f+2]=c>>>16&255,t[f+1]=c>>>8&255,t[f]=c&255)}return t}W.split32=gi;function wi(r,e){return r>>>e|r<<32-e}W.rotr32=wi;function Mi(r,e){return r<>>32-e}W.rotl32=Mi;function _i(r,e){return r+e>>>0}W.sum32=_i;function Si(r,e,t){return r+e+t>>>0}W.sum32_3=Si;function Ai(r,e,t,a){return r+e+t+a>>>0}W.sum32_4=Ai;function Ii(r,e,t,a,f){return r+e+t+a+f>>>0}W.sum32_5=Ii;function Ei(r,e,t,a){var f=r[e],c=r[e+1],s=a+c>>>0,b=(s>>0,r[e+1]=s}W.sum64=Ei;function Bi(r,e,t,a){var f=e+a>>>0,c=(f>>0}W.sum64_hi=Bi;function Fi(r,e,t,a){var f=e+a;return f>>>0}W.sum64_lo=Fi;function Ri(r,e,t,a,f,c,s,b){var v=0,_=e;_=_+a>>>0,v+=_>>0,v+=_>>0,v+=_>>0}W.sum64_4_hi=Ri;function qi(r,e,t,a,f,c,s,b){var v=e+a+c+b;return v>>>0}W.sum64_4_lo=qi;function Ci(r,e,t,a,f,c,s,b,v,_){var m=0,w=e;w=w+a>>>0,m+=w>>0,m+=w>>0,m+=w>>0,m+=w<_?1:0;var F=r+t+f+s+v+m;return F>>>0}W.sum64_5_hi=Ci;function Pi(r,e,t,a,f,c,s,b,v,_){var m=e+a+c+b+_;return m>>>0}W.sum64_5_lo=Pi;function zi(r,e,t){var a=e<<32-t|r>>>t;return a>>>0}W.rotr64_hi=zi;function Ni(r,e,t){var a=r<<32-t|e>>>t;return a>>>0}W.rotr64_lo=Ni;function ki(r,e,t){return r>>>t}W.shr64_hi=ki;function Oi(r,e,t){var a=r<<32-t|e>>>t;return a>>>0}W.shr64_lo=Oi});var P0=T(pf=>{"use strict";var lf=je(),Ui=b0();function ct(){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}pf.BlockHash=ct;ct.prototype.update=function(e,t){if(e=lf.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var a=e.length%this._delta8;this.pending=e.slice(e.length-a,e.length),this.pending.length===0&&(this.pending=null),e=lf.join32(e,0,e.length-a,this.endian);for(var f=0;f>>24&255,f[c++]=e>>>16&255,f[c++]=e>>>8&255,f[c++]=e&255}else for(f[c++]=e&255,f[c++]=e>>>8&255,f[c++]=e>>>16&255,f[c++]=e>>>24&255,f[c++]=0,f[c++]=0,f[c++]=0,f[c++]=0,s=8;s{"use strict";var Li=je(),e0=Li.rotr32;function Ti(r,e,t,a){if(r===0)return vf(e,t,a);if(r===1||r===3)return mf(e,t,a);if(r===2)return yf(e,t,a)}x0.ft_1=Ti;function vf(r,e,t){return r&e^~r&t}x0.ch32=vf;function yf(r,e,t){return r&e^r&t^e&t}x0.maj32=yf;function mf(r,e,t){return r^e^t}x0.p32=mf;function Di(r){return e0(r,2)^e0(r,13)^e0(r,22)}x0.s0_256=Di;function Ki(r){return e0(r,6)^e0(r,11)^e0(r,25)}x0.s1_256=Ki;function Hi(r){return e0(r,7)^e0(r,18)^r>>>3}x0.g0_256=Hi;function Ji(r){return e0(r,17)^e0(r,19)^r>>>10}x0.g1_256=Ji});var Mf=T((Xc,wf)=>{"use strict";var z0=je(),Wi=P0(),Xi=Yt(),Zt=z0.rotl32,V0=z0.sum32,$i=z0.sum32_5,ji=Xi.ft_1,gf=Wi.BlockHash,Vi=[1518500249,1859775393,2400959708,3395469782];function t0(){if(!(this instanceof t0))return new t0;gf.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}z0.inherits(t0,gf);wf.exports=t0;t0.blockSize=512;t0.outSize=160;t0.hmacStrength=80;t0.padLength=64;t0.prototype._update=function(e,t){for(var a=this.W,f=0;f<16;f++)a[f]=e[t+f];for(;f{"use strict";var N0=je(),Yi=P0(),k0=Yt(),Zi=b0(),Ve=N0.sum32,Gi=N0.sum32_4,Qi=N0.sum32_5,ed=k0.ch32,td=k0.maj32,rd=k0.s0_256,fd=k0.s1_256,ad=k0.g0_256,id=k0.g1_256,_f=Yi.BlockHash,dd=[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 r0(){if(!(this instanceof r0))return new r0;_f.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=dd,this.W=new Array(64)}N0.inherits(r0,_f);Sf.exports=r0;r0.blockSize=512;r0.outSize=256;r0.hmacStrength=192;r0.padLength=64;r0.prototype._update=function(e,t){for(var a=this.W,f=0;f<16;f++)a[f]=e[t+f];for(;f{"use strict";var Qt=je(),Af=Gt();function s0(){if(!(this instanceof s0))return new s0;Af.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Qt.inherits(s0,Af);If.exports=s0;s0.blockSize=512;s0.outSize=224;s0.hmacStrength=192;s0.padLength=64;s0.prototype._digest=function(e){return e==="hex"?Qt.toHex32(this.h.slice(0,7),"big"):Qt.split32(this.h.slice(0,7),"big")}});var rr=T((Vc,qf)=>{"use strict";var Le=je(),cd=P0(),nd=b0(),f0=Le.rotr64_hi,a0=Le.rotr64_lo,Bf=Le.shr64_hi,Ff=Le.shr64_lo,p0=Le.sum64,er=Le.sum64_hi,tr=Le.sum64_lo,xd=Le.sum64_4_hi,sd=Le.sum64_4_lo,hd=Le.sum64_5_hi,od=Le.sum64_5_lo,Rf=cd.BlockHash,bd=[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 Ye(){if(!(this instanceof Ye))return new Ye;Rf.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=bd,this.W=new Array(160)}Le.inherits(Ye,Rf);qf.exports=Ye;Ye.blockSize=1024;Ye.outSize=512;Ye.hmacStrength=192;Ye.padLength=128;Ye.prototype._prepareBlock=function(e,t){for(var a=this.W,f=0;f<32;f++)a[f]=e[t+f];for(;f{"use strict";var fr=je(),Cf=rr();function h0(){if(!(this instanceof h0))return new h0;Cf.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}fr.inherits(h0,Cf);Pf.exports=h0;h0.blockSize=1024;h0.outSize=384;h0.hmacStrength=192;h0.padLength=128;h0.prototype._digest=function(e){return e==="hex"?fr.toHex32(this.h.slice(0,12),"big"):fr.split32(this.h.slice(0,12),"big")}});var Nf=T(O0=>{"use strict";O0.sha1=Mf();O0.sha224=Ef();O0.sha256=Gt();O0.sha384=zf();O0.sha512=rr()});var Df=T(Tf=>{"use strict";var _0=je(),Id=P0(),nt=_0.rotl32,kf=_0.sum32,Y0=_0.sum32_3,Of=_0.sum32_4,Lf=Id.BlockHash;function i0(){if(!(this instanceof i0))return new i0;Lf.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}_0.inherits(i0,Lf);Tf.ripemd160=i0;i0.blockSize=512;i0.outSize=160;i0.hmacStrength=192;i0.padLength=64;i0.prototype._update=function(e,t){for(var a=this.h[0],f=this.h[1],c=this.h[2],s=this.h[3],b=this.h[4],v=a,_=f,m=c,w=s,F=b,B=0;B<80;B++){var P=kf(nt(Of(a,Uf(B,f,c,s),e[Fd[B]+t],Ed(B)),qd[B]),b);a=b,b=s,s=nt(c,10),c=f,f=P,P=kf(nt(Of(v,Uf(79-B,_,m,w),e[Rd[B]+t],Bd(B)),Cd[B]),F),v=F,F=w,w=nt(m,10),m=_,_=P}P=Y0(this.h[1],c,w),this.h[1]=Y0(this.h[2],s,F),this.h[2]=Y0(this.h[3],b,v),this.h[3]=Y0(this.h[4],a,_),this.h[4]=Y0(this.h[0],f,m),this.h[0]=P};i0.prototype._digest=function(e){return e==="hex"?_0.toHex32(this.h,"little"):_0.split32(this.h,"little")};function Uf(r,e,t,a){return r<=15?e^t^a:r<=31?e&t|~e&a:r<=47?(e|~t)^a:r<=63?e&a|t&~a:e^(t|~a)}function Ed(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function Bd(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var Fd=[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],Rd=[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],qd=[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],Cd=[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]});var Hf=T((Qc,Kf)=>{"use strict";var Pd=je(),zd=b0();function U0(r,e,t){if(!(this instanceof U0))return new U0(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(Pd.toArray(e,t))}Kf.exports=U0;U0.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),zd(e.length<=this.blockSize);for(var t=e.length;t{var Oe=Jf;Oe.utils=je();Oe.common=P0();Oe.sha=Nf();Oe.ripemd=Df();Oe.hmac=Hf();Oe.sha1=Oe.sha.sha1;Oe.sha256=Oe.sha.sha256;Oe.sha224=Oe.sha.sha224;Oe.sha384=Oe.sha.sha384;Oe.sha512=Oe.sha.sha512;Oe.ripemd160=Oe.ripemd.ripemd160});var Xf=T((tn,Wf)=>{Wf.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"]]}}});var st=T(Vf=>{"use strict";var ir=Vf,v0=xt(),ar=Vt(),Nd=Ke(),$f=Nd.assert;function jf(r){r.type==="short"?this.curve=new ar.short(r):r.type==="edwards"?this.curve=new ar.edwards(r):this.curve=new ar.mont(r),this.g=this.curve.g,this.n=this.curve.n,this.hash=r.hash,$f(this.g.validate(),"Invalid curve"),$f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}ir.PresetCurve=jf;function y0(r,e){Object.defineProperty(ir,r,{configurable:!0,enumerable:!0,get:function(){var t=new jf(e);return Object.defineProperty(ir,r,{configurable:!0,enumerable:!0,value:t}),t}})}y0("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:v0.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});y0("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:v0.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});y0("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:v0.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});y0("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:v0.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"]});y0("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:v0.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"]});y0("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:v0.sha256,gRed:!1,g:["9"]});y0("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:v0.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var dr;try{dr=Xf()}catch{dr=void 0}y0("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:v0.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",dr]})});var Gf=T((fn,Zf)=>{"use strict";var kd=xt(),S0=Kt(),Yf=b0();function m0(r){if(!(this instanceof m0))return new m0(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=S0.toArray(r.entropy,r.entropyEnc||"hex"),t=S0.toArray(r.nonce,r.nonceEnc||"hex"),a=S0.toArray(r.pers,r.persEnc||"hex");Yf(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,a)}Zf.exports=m0;m0.prototype._init=function(e,t,a){var f=e.concat(t).concat(a);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var c=0;c=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(a||[])),this._reseed=1};m0.prototype.generate=function(e,t,a,f){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(f=a,a=t,t=null),a&&(a=S0.toArray(a,f||"hex"),this._update(a));for(var c=[];c.length{"use strict";var Od=Ge(),Ud=Ke(),cr=Ud.assert;function Ue(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}Qf.exports=Ue;Ue.fromPublic=function(e,t,a){return t instanceof Ue?t:new Ue(e,{pub:t,pubEnc:a})};Ue.fromPrivate=function(e,t,a){return t instanceof Ue?t:new Ue(e,{priv:t,privEnc:a})};Ue.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Ue.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub};Ue.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Ue.prototype._importPrivate=function(e,t){this.priv=new Od(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)};Ue.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?cr(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&cr(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)};Ue.prototype.derive=function(e){return e.validate()||cr(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Ue.prototype.sign=function(e,t,a){return this.ec.sign(e,this,t,a)};Ue.prototype.verify=function(e,t,a){return this.ec.verify(e,t,this,void 0,a)};Ue.prototype.inspect=function(){return""}});var fa=T((dn,ra)=>{"use strict";var ht=Ge(),sr=Ke(),Ld=sr.assert;function ot(r,e){if(r instanceof ot)return r;this._importDER(r,e)||(Ld(r.r&&r.s,"Signature without r or s"),this.r=new ht(r.r,16),this.s=new ht(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}ra.exports=ot;function Td(){this.place=0}function nr(r,e){var t=r[e.place++];if(!(t&128))return t;var a=t&15;if(a===0||a>4||r[e.place]===0)return!1;for(var f=0,c=0,s=e.place;c>>=0;return f<=127?!1:(e.place=s,f)}function ta(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}ot.prototype.toDER=function(e){var t=this.r.toArray(),a=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),a[0]&128&&(a=[0].concat(a)),t=ta(t),a=ta(a);!a[0]&&!(a[1]&128);)a=a.slice(1);var f=[2];xr(f,t.length),f=f.concat(t),f.push(2),xr(f,a.length);var c=f.concat(a),s=[48];return xr(s,c.length),s=s.concat(c),sr.encode(s,e)}});var da=T((cn,ia)=>{"use strict";var Ze=Ge(),aa=Gf(),Dd=Ke(),hr=st(),Kd=Xt(),A0=Dd.assert,or=ea(),bt=fa();function We(r){if(!(this instanceof We))return new We(r);typeof r=="string"&&(A0(Object.prototype.hasOwnProperty.call(hr,r),"Unknown curve "+r),r=hr[r]),r instanceof hr.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}ia.exports=We;We.prototype.keyPair=function(e){return new or(this,e)};We.prototype.keyFromPrivate=function(e,t){return or.fromPrivate(this,e,t)};We.prototype.keyFromPublic=function(e,t){return or.fromPublic(this,e,t)};We.prototype.genKeyPair=function(e){e||(e={});for(var t=new aa({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Kd(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),a=this.n.byteLength(),f=this.n.sub(new Ze(2));;){var c=new Ze(t.generate(a));if(!(c.cmp(f)>0))return c.iaddn(1),this.keyFromPrivate(c)}};We.prototype._truncateToN=function(e,t,a){var f;if(Ze.isBN(e)||typeof e=="number")e=new Ze(e,16),f=e.byteLength();else if(typeof e=="object")f=e.length,e=new Ze(e,16);else{var c=e.toString();f=c.length+1>>>1,e=new Ze(c,16)}typeof a!="number"&&(a=f*8);var s=a-this.n.bitLength();return s>0&&(e=e.ushrn(s)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};We.prototype.sign=function(e,t,a,f){if(typeof a=="object"&&(f=a,a=null),f||(f={}),typeof e!="string"&&typeof e!="number"&&!Ze.isBN(e)){A0(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),A0(e.length>>>0===e.length);for(var c=0;c=0)){var B=this.g.mul(F);if(!B.isInfinity()){var P=B.getX(),N=P.umod(this.n);if(N.cmpn(0)!==0){var D=F.invm(this.n).mul(N.mul(t.getPrivate()).iadd(e));if(D=D.umod(this.n),D.cmpn(0)!==0){var k=(B.getY().isOdd()?1:0)|(P.cmp(N)!==0?2:0);return f.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),k^=1),new bt({r:N,s:D,recoveryParam:k})}}}}}};We.prototype.verify=function(e,t,a,f,c){c||(c={}),e=this._truncateToN(e,!1,c.msgBitLength),a=this.keyFromPublic(a,f),t=new bt(t,"hex");var s=t.r,b=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||b.cmpn(1)<0||b.cmp(this.n)>=0)return!1;var v=b.invm(this.n),_=v.mul(e).umod(this.n),m=v.mul(s).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(_,a.getPublic(),m),w.isInfinity()?!1:w.eqXToP(s)):(w=this.g.mulAdd(_,a.getPublic(),m),w.isInfinity()?!1:w.getX().umod(this.n).cmp(s)===0)};We.prototype.recoverPubKey=function(r,e,t,a){A0((3&t)===t,"The recovery param is more than two bits"),e=new bt(e,a);var f=this.n,c=new Ze(r),s=e.r,b=e.s,v=t&1,_=t>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&_)throw new Error("Unable to find sencond key candinate");_?s=this.curve.pointFromX(s.add(this.curve.n),v):s=this.curve.pointFromX(s,v);var m=e.r.invm(f),w=f.sub(c).mul(m).umod(f),F=b.mul(m).umod(f);return this.g.mulAdd(w,s,F)};We.prototype.getKeyRecoveryParam=function(r,e,t,a){if(e=new bt(e,a),e.recoveryParam!==null)return e.recoveryParam;for(var f=0;f<4;f++){var c;try{c=this.recoverPubKey(r,e,f)}catch{continue}if(c.eq(t))return f}throw new Error("Unable to find valid recovery factor")}});var sa=T((nn,xa)=>{"use strict";var Z0=Ke(),na=Z0.assert,ca=Z0.parseBytes,L0=Z0.cachedProperty;function ze(r,e){this.eddsa=r,this._secret=ca(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=ca(e.pub)}ze.fromPublic=function(e,t){return t instanceof ze?t:new ze(e,{pub:t})};ze.fromSecret=function(e,t){return t instanceof ze?t:new ze(e,{secret:t})};ze.prototype.secret=function(){return this._secret};L0(ze,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});L0(ze,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});L0(ze,"privBytes",function(){var e=this.eddsa,t=this.hash(),a=e.encodingLength-1,f=t.slice(0,e.encodingLength);return f[0]&=248,f[a]&=127,f[a]|=64,f});L0(ze,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});L0(ze,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});L0(ze,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});ze.prototype.sign=function(e){return na(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};ze.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)};ze.prototype.getSecret=function(e){return na(this._secret,"KeyPair is public only"),Z0.encode(this.secret(),e)};ze.prototype.getPublic=function(e){return Z0.encode(this.pubBytes(),e)};xa.exports=ze});var ba=T((xn,oa)=>{"use strict";var Hd=Ge(),ut=Ke(),ha=ut.assert,lt=ut.cachedProperty,Jd=ut.parseBytes;function I0(r,e){this.eddsa=r,typeof e!="object"&&(e=Jd(e)),Array.isArray(e)&&(ha(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),ha(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof Hd&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}lt(I0,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});lt(I0,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});lt(I0,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});lt(I0,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});I0.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};I0.prototype.toHex=function(){return ut.encode(this.toBytes(),"hex").toUpperCase()};oa.exports=I0});var ya=T((sn,va)=>{"use strict";var Wd=xt(),Xd=st(),T0=Ke(),$d=T0.assert,la=T0.parseBytes,pa=sa(),ua=ba();function Te(r){if($d(r==="ed25519","only tested with ed25519 so far"),!(this instanceof Te))return new Te(r);r=Xd[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=Wd.sha512}va.exports=Te;Te.prototype.sign=function(e,t){e=la(e);var a=this.keyFromSecret(t),f=this.hashInt(a.messagePrefix(),e),c=this.g.mul(f),s=this.encodePoint(c),b=this.hashInt(s,a.pubBytes(),e).mul(a.priv()),v=f.add(b).umod(this.curve.n);return this.makeSignature({R:c,S:v,Rencoded:s})};Te.prototype.verify=function(e,t,a){if(e=la(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var f=this.keyFromPublic(a),c=this.hashInt(t.Rencoded(),f.pubBytes(),e),s=this.g.mul(t.S()),b=t.R().add(f.pub().mul(c));return b.eq(s)};Te.prototype.hashInt=function(){for(var e=this.hash(),t=0;t{"use strict";var E0=ma;E0.version=$r().version;E0.utils=Ke();E0.rand=Xt();E0.curve=Vt();E0.curves=st();E0.ec=da();E0.eddsa=ya()});var Ma=T((br,wa)=>{(function(r){"use strict";function e(d){return parseInt(d)===d}function t(d){if(!e(d.length))return!1;for(var h=0;h255)return!1;return!0}function a(d,h){if(d.buffer&&d.name==="Uint8Array")return h&&(d.slice?d=d.slice():d=Array.prototype.slice.call(d)),d;if(Array.isArray(d)){if(!t(d))throw new Error("Array contains invalid value: "+d);return new Uint8Array(d)}if(e(d.length)&&t(d))return new Uint8Array(d);throw new Error("unsupported array-like object")}function f(d){return new Uint8Array(d)}function c(d,h,A,S,M){(S!=null||M!=null)&&(d.slice?d=d.slice(S,M):d=Array.prototype.slice.call(d,S,M)),h.set(d,A)}var s=function(){function d(A){var S=[],M=0;for(A=encodeURI(A);M191&&z<224?(S.push(String.fromCharCode((z&31)<<6|A[M+1]&63)),M+=2):(S.push(String.fromCharCode((z&15)<<12|(A[M+1]&63)<<6|A[M+2]&63)),M+=3)}return S.join("")}return{toBytes:d,fromBytes:h}}(),b=function(){function d(S){for(var M=[],z=0;z>4]+h[O&15])}return M.join("")}return{toBytes:d,fromBytes:A}}(),v={16:10,24:12,32:14},_=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],m=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],w=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],F=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],B=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],P=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],N=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],D=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],k=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],$=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],U=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Y=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],J=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],E=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],q=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function C(d){for(var h=[],A=0;A>2,this._Ke[z][h%4]=M[h],this._Kd[d-z][h%4]=M[h];for(var O=0,L=S,V;L>16&255]<<24^m[V>>8&255]<<16^m[V&255]<<8^m[V>>24&255]^_[O]<<24,O+=1,S!=8)for(var h=1;h>8&255]<<8^m[V>>16&255]<<16^m[V>>24&255]<<24;for(var h=S/2+1;h>2,H=L%4,this._Ke[K][H]=M[h],this._Kd[d-K][H]=M[h++],L++}for(var K=1;K>24&255]^J[V>>16&255]^E[V>>8&255]^q[V&255]},R.prototype.encrypt=function(d){if(d.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var h=this._Ke.length-1,A=[0,0,0,0],S=C(d),M=0;M<4;M++)S[M]^=this._Ke[0][M];for(var z=1;z>24&255]^B[S[(M+1)%4]>>16&255]^P[S[(M+2)%4]>>8&255]^N[S[(M+3)%4]&255]^this._Ke[z][M];S=A.slice()}for(var O=f(16),L,M=0;M<4;M++)L=this._Ke[h][M],O[4*M]=(m[S[M]>>24&255]^L>>24)&255,O[4*M+1]=(m[S[(M+1)%4]>>16&255]^L>>16)&255,O[4*M+2]=(m[S[(M+2)%4]>>8&255]^L>>8)&255,O[4*M+3]=(m[S[(M+3)%4]&255]^L)&255;return O},R.prototype.decrypt=function(d){if(d.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var h=this._Kd.length-1,A=[0,0,0,0],S=C(d),M=0;M<4;M++)S[M]^=this._Kd[0][M];for(var z=1;z>24&255]^k[S[(M+3)%4]>>16&255]^$[S[(M+2)%4]>>8&255]^U[S[(M+1)%4]&255]^this._Kd[z][M];S=A.slice()}for(var O=f(16),L,M=0;M<4;M++)L=this._Kd[h][M],O[4*M]=(w[S[M]>>24&255]^L>>24)&255,O[4*M+1]=(w[S[(M+3)%4]>>16&255]^L>>16)&255,O[4*M+2]=(w[S[(M+2)%4]>>8&255]^L>>8)&255,O[4*M+3]=(w[S[(M+1)%4]&255]^L)&255;return O};var p=function(d){if(!(this instanceof p))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new R(d)};p.prototype.encrypt=function(d){if(d=a(d),d.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var h=f(d.length),A=f(16),S=0;SNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var h=15;h>=0;--h)this._counter[h]=d%256,d=parseInt(d/256)},o.prototype.setBytes=function(d){if(d=a(d,!0),d.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=d},o.prototype.increment=function(){for(var d=15;d>=0;d--)if(this._counter[d]===255)this._counter[d]=0;else{this._counter[d]++;break}};var u=function(d,h){if(!(this instanceof u))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",h instanceof o||(h=new o(h)),this._counter=h,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new R(d)};u.prototype.encrypt=function(d){for(var h=a(d,!0),A=0;A16)throw new Error("PKCS#7 padding byte out of range");for(var A=d.length-h,S=0;S{"use strict";var g0=function(r,e,t){if(typeof t>"u"&&(t=0),!(r instanceof Uint8Array)||r.length!==32)throw new Error("Key should be 32 byte array!");if(!(e instanceof Uint8Array)||e.length!==12)throw new Error("Nonce should be 12 byte array!");this._rounds=20,this._sigma=[1634760805,857760878,2036477234,1797285236],this._param=[this._sigma[0],this._sigma[1],this._sigma[2],this._sigma[3],this._get32(r,0),this._get32(r,4),this._get32(r,8),this._get32(r,12),this._get32(r,16),this._get32(r,20),this._get32(r,24),this._get32(r,28),t,this._get32(e,0),this._get32(e,4),this._get32(e,8)],this._keystream=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this._byteCounter=0};g0.prototype._chacha=function(){var r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0,t=0;for(e=0;e<16;e++)r[e]=this._param[e];for(e=0;e>>8&255,this._keystream[t++]=r[e]>>>16&255,this._keystream[t++]=r[e]>>>24&255};g0.prototype._quarterround=function(r,e,t,a,f){r[f]=this._rotl(r[f]^(r[e]+=r[t]),16),r[t]=this._rotl(r[t]^(r[a]+=r[f]),12),r[f]=this._rotl(r[f]^(r[e]+=r[t]),8),r[t]=this._rotl(r[t]^(r[a]+=r[f]),7),r[e]>>>=0,r[t]>>>=0,r[a]>>>=0,r[f]>>>=0};g0.prototype._get32=function(r,e){return r[e++]^r[e++]<<8^r[e++]<<16^r[e]<<24};g0.prototype._rotl=function(r,e){return r<>>32-e};g0.prototype.encrypt=function(r){return this._update(r)};g0.prototype.decrypt=function(r){return this._update(r)};g0.prototype._update=function(r){if(!(r instanceof Uint8Array)||r.length===0)throw new Error("Data should be type of bytes (Uint8Array) and not empty!");for(var e=new Uint8Array(r.length),t=0;t{"use strict";vt.byteLength=Vd;vt.toByteArray=Zd;vt.fromByteArray=ec;var d0=[],Xe=[],jd=typeof Uint8Array<"u"?Uint8Array:Array,ur="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(B0=0,Sa=ur.length;B00)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var a=t===e?0:4-t%4;return[t,a]}function Vd(r){var e=Aa(r),t=e[0],a=e[1];return(t+a)*3/4-a}function Yd(r,e,t){return(e+t)*3/4-t}function Zd(r){var e,t=Aa(r),a=t[0],f=t[1],c=new jd(Yd(r,a,f)),s=0,b=f>0?a-4:a,v;for(v=0;v>16&255,c[s++]=e>>8&255,c[s++]=e&255;return f===2&&(e=Xe[r.charCodeAt(v)]<<2|Xe[r.charCodeAt(v+1)]>>4,c[s++]=e&255),f===1&&(e=Xe[r.charCodeAt(v)]<<10|Xe[r.charCodeAt(v+1)]<<4|Xe[r.charCodeAt(v+2)]>>2,c[s++]=e>>8&255,c[s++]=e&255),c}function Gd(r){return d0[r>>18&63]+d0[r>>12&63]+d0[r>>6&63]+d0[r&63]}function Qd(r,e,t){for(var a,f=[],c=e;cb?b:s+c));return a===1?(e=r[t-1],f.push(d0[e>>2]+d0[e<<4&63]+"==")):a===2&&(e=(r[t-2]<<8)+r[t-1],f.push(d0[e>>10]+d0[e>>4&63]+d0[e<<2&63]+"=")),f.join("")}});var Ea=T(lr=>{lr.read=function(r,e,t,a,f){var c,s,b=f*8-a-1,v=(1<>1,m=-7,w=t?f-1:0,F=t?-1:1,B=r[e+w];for(w+=F,c=B&(1<<-m)-1,B>>=-m,m+=b;m>0;c=c*256+r[e+w],w+=F,m-=8);for(s=c&(1<<-m)-1,c>>=-m,m+=a;m>0;s=s*256+r[e+w],w+=F,m-=8);if(c===0)c=1-_;else{if(c===v)return s?NaN:(B?-1:1)*(1/0);s=s+Math.pow(2,a),c=c-_}return(B?-1:1)*s*Math.pow(2,c-a)};lr.write=function(r,e,t,a,f,c){var s,b,v,_=c*8-f-1,m=(1<<_)-1,w=m>>1,F=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=a?0:c-1,P=a?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(b=isNaN(e)?1:0,s=m):(s=Math.floor(Math.log(e)/Math.LN2),e*(v=Math.pow(2,-s))<1&&(s--,v*=2),s+w>=1?e+=F/v:e+=F*Math.pow(2,1-w),e*v>=2&&(s++,v/=2),s+w>=m?(b=0,s=m):s+w>=1?(b=(e*v-1)*Math.pow(2,f),s=s+w):(b=e*Math.pow(2,w-1)*Math.pow(2,f),s=0));f>=8;r[t+B]=b&255,B+=P,b/=256,f-=8);for(s=s<0;r[t+B]=s&255,B+=P,s/=256,_-=8);r[t+B-P]|=N*128}});var Ja=T(J0=>{"use strict";var pr=Ia(),K0=Ea(),Ba=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;J0.Buffer=I;J0.SlowBuffer=dc;J0.INSPECT_MAX_BYTES=50;var yt=2147483647;J0.kMaxLength=yt;I.TYPED_ARRAY_SUPPORT=tc();!I.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function tc(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(I.prototype,"parent",{enumerable:!0,get:function(){if(I.isBuffer(this))return this.buffer}});Object.defineProperty(I.prototype,"offset",{enumerable:!0,get:function(){if(I.isBuffer(this))return this.byteOffset}});function o0(r){if(r>yt)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,I.prototype),e}function I(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return gr(r)}return Ca(r,e,t)}I.poolSize=8192;function Ca(r,e,t){if(typeof r=="string")return fc(r,e);if(ArrayBuffer.isView(r))return ac(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(c0(r,ArrayBuffer)||r&&c0(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(c0(r,SharedArrayBuffer)||r&&c0(r.buffer,SharedArrayBuffer)))return yr(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let a=r.valueOf&&r.valueOf();if(a!=null&&a!==r)return I.from(a,e,t);let f=ic(r);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return I.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}I.from=function(r,e,t){return Ca(r,e,t)};Object.setPrototypeOf(I.prototype,Uint8Array.prototype);Object.setPrototypeOf(I,Uint8Array);function Pa(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function rc(r,e,t){return Pa(r),r<=0?o0(r):e!==void 0?typeof t=="string"?o0(r).fill(e,t):o0(r).fill(e):o0(r)}I.alloc=function(r,e,t){return rc(r,e,t)};function gr(r){return Pa(r),o0(r<0?0:wr(r)|0)}I.allocUnsafe=function(r){return gr(r)};I.allocUnsafeSlow=function(r){return gr(r)};function fc(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!I.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=za(r,e)|0,a=o0(t),f=a.write(r,e);return f!==t&&(a=a.slice(0,f)),a}function vr(r){let e=r.length<0?0:wr(r.length)|0,t=o0(e);for(let a=0;a=yt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+yt.toString(16)+" bytes");return r|0}function dc(r){return+r!=r&&(r=0),I.alloc(+r)}I.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==I.prototype};I.compare=function(e,t){if(c0(e,Uint8Array)&&(e=I.from(e,e.offset,e.byteLength)),c0(t,Uint8Array)&&(t=I.from(t,t.offset,t.byteLength)),!I.isBuffer(e)||!I.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let a=e.length,f=t.length;for(let c=0,s=Math.min(a,f);cf.length?(I.isBuffer(s)||(s=I.from(s)),s.copy(f,c)):Uint8Array.prototype.set.call(f,s,c);else if(I.isBuffer(s))s.copy(f,c);else throw new TypeError('"list" argument must be an Array of Buffers');c+=s.length}return f};function za(r,e){if(I.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||c0(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,a=arguments.length>2&&arguments[2]===!0;if(!a&&t===0)return 0;let f=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return mr(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ha(r).length;default:if(f)return a?-1:mr(r).length;e=(""+e).toLowerCase(),f=!0}}I.byteLength=za;function cc(r,e,t){let a=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return vc(this,e,t);case"utf8":case"utf-8":return ka(this,e,t);case"ascii":return lc(this,e,t);case"latin1":case"binary":return pc(this,e,t);case"base64":return bc(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yc(this,e,t);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),a=!0}}I.prototype._isBuffer=!0;function F0(r,e,t){let a=r[e];r[e]=r[t],r[t]=a}I.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tt&&(e+=" ... "),""};Ba&&(I.prototype[Ba]=I.prototype.inspect);I.prototype.compare=function(e,t,a,f,c){if(c0(e,Uint8Array)&&(e=I.from(e,e.offset,e.byteLength)),!I.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),a===void 0&&(a=e?e.length:0),f===void 0&&(f=0),c===void 0&&(c=this.length),t<0||a>e.length||f<0||c>this.length)throw new RangeError("out of range index");if(f>=c&&t>=a)return 0;if(f>=c)return-1;if(t>=a)return 1;if(t>>>=0,a>>>=0,f>>>=0,c>>>=0,this===e)return 0;let s=c-f,b=a-t,v=Math.min(s,b),_=this.slice(f,c),m=e.slice(t,a);for(let w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,_r(t)&&(t=f?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(f)return-1;t=r.length-1}else if(t<0)if(f)t=0;else return-1;if(typeof e=="string"&&(e=I.from(e,a)),I.isBuffer(e))return e.length===0?-1:Fa(r,e,t,a,f);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Fa(r,[e],t,a,f);throw new TypeError("val must be string, number or Buffer")}function Fa(r,e,t,a,f){let c=1,s=r.length,b=e.length;if(a!==void 0&&(a=String(a).toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(r.length<2||e.length<2)return-1;c=2,s/=2,b/=2,t/=2}function v(m,w){return c===1?m[w]:m.readUInt16BE(w*c)}let _;if(f){let m=-1;for(_=t;_s&&(t=s-b),_=t;_>=0;_--){let m=!0;for(let w=0;wf&&(a=f)):a=f;let c=e.length;a>c/2&&(a=c/2);let s;for(s=0;s>>0,isFinite(a)?(a=a>>>0,f===void 0&&(f="utf8")):(f=a,a=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let c=this.length-t;if((a===void 0||a>c)&&(a=c),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let s=!1;for(;;)switch(f){case"hex":return nc(this,e,t,a);case"utf8":case"utf-8":return xc(this,e,t,a);case"ascii":case"latin1":case"binary":return sc(this,e,t,a);case"base64":return hc(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oc(this,e,t,a);default:if(s)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),s=!0}};I.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function bc(r,e,t){return e===0&&t===r.length?pr.fromByteArray(r):pr.fromByteArray(r.slice(e,t))}function ka(r,e,t){t=Math.min(r.length,t);let a=[],f=e;for(;f239?4:c>223?3:c>191?2:1;if(f+b<=t){let v,_,m,w;switch(b){case 1:c<128&&(s=c);break;case 2:v=r[f+1],(v&192)===128&&(w=(c&31)<<6|v&63,w>127&&(s=w));break;case 3:v=r[f+1],_=r[f+2],(v&192)===128&&(_&192)===128&&(w=(c&15)<<12|(v&63)<<6|_&63,w>2047&&(w<55296||w>57343)&&(s=w));break;case 4:v=r[f+1],_=r[f+2],m=r[f+3],(v&192)===128&&(_&192)===128&&(m&192)===128&&(w=(c&15)<<18|(v&63)<<12|(_&63)<<6|m&63,w>65535&&w<1114112&&(s=w))}}s===null?(s=65533,b=1):s>65535&&(s-=65536,a.push(s>>>10&1023|55296),s=56320|s&1023),a.push(s),f+=b}return uc(a)}var Ra=4096;function uc(r){let e=r.length;if(e<=Ra)return String.fromCharCode.apply(String,r);let t="",a=0;for(;aa)&&(t=a);let f="";for(let c=e;ca&&(e=a),t<0?(t+=a,t<0&&(t=0)):t>a&&(t=a),tt)throw new RangeError("Trying to access beyond buffer length")}I.prototype.readUintLE=I.prototype.readUIntLE=function(e,t,a){e=e>>>0,t=t>>>0,a||Ne(e,t,this.length);let f=this[e],c=1,s=0;for(;++s>>0,t=t>>>0,a||Ne(e,t,this.length);let f=this[e+--t],c=1;for(;t>0&&(c*=256);)f+=this[e+--t]*c;return f};I.prototype.readUint8=I.prototype.readUInt8=function(e,t){return e=e>>>0,t||Ne(e,1,this.length),this[e]};I.prototype.readUint16LE=I.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||Ne(e,2,this.length),this[e]|this[e+1]<<8};I.prototype.readUint16BE=I.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||Ne(e,2,this.length),this[e]<<8|this[e+1]};I.prototype.readUint32LE=I.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||Ne(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};I.prototype.readUint32BE=I.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||Ne(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};I.prototype.readBigUInt64LE=w0(function(e){e=e>>>0,H0(e,"offset");let t=this[e],a=this[e+7];(t===void 0||a===void 0)&&G0(e,this.length-8);let f=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,c=this[++e]+this[++e]*2**8+this[++e]*2**16+a*2**24;return BigInt(f)+(BigInt(c)<>>0,H0(e,"offset");let t=this[e],a=this[e+7];(t===void 0||a===void 0)&&G0(e,this.length-8);let f=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],c=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+a;return(BigInt(f)<>>0,t=t>>>0,a||Ne(e,t,this.length);let f=this[e],c=1,s=0;for(;++s=c&&(f-=Math.pow(2,8*t)),f};I.prototype.readIntBE=function(e,t,a){e=e>>>0,t=t>>>0,a||Ne(e,t,this.length);let f=t,c=1,s=this[e+--f];for(;f>0&&(c*=256);)s+=this[e+--f]*c;return c*=128,s>=c&&(s-=Math.pow(2,8*t)),s};I.prototype.readInt8=function(e,t){return e=e>>>0,t||Ne(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};I.prototype.readInt16LE=function(e,t){e=e>>>0,t||Ne(e,2,this.length);let a=this[e]|this[e+1]<<8;return a&32768?a|4294901760:a};I.prototype.readInt16BE=function(e,t){e=e>>>0,t||Ne(e,2,this.length);let a=this[e+1]|this[e]<<8;return a&32768?a|4294901760:a};I.prototype.readInt32LE=function(e,t){return e=e>>>0,t||Ne(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};I.prototype.readInt32BE=function(e,t){return e=e>>>0,t||Ne(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};I.prototype.readBigInt64LE=w0(function(e){e=e>>>0,H0(e,"offset");let t=this[e],a=this[e+7];(t===void 0||a===void 0)&&G0(e,this.length-8);let f=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(a<<24);return(BigInt(f)<>>0,H0(e,"offset");let t=this[e],a=this[e+7];(t===void 0||a===void 0)&&G0(e,this.length-8);let f=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(f)<>>0,t||Ne(e,4,this.length),K0.read(this,e,!0,23,4)};I.prototype.readFloatBE=function(e,t){return e=e>>>0,t||Ne(e,4,this.length),K0.read(this,e,!1,23,4)};I.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||Ne(e,8,this.length),K0.read(this,e,!0,52,8)};I.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||Ne(e,8,this.length),K0.read(this,e,!1,52,8)};function De(r,e,t,a,f,c){if(!I.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>f||er.length)throw new RangeError("Index out of range")}I.prototype.writeUintLE=I.prototype.writeUIntLE=function(e,t,a,f){if(e=+e,t=t>>>0,a=a>>>0,!f){let b=Math.pow(2,8*a)-1;De(this,e,t,a,b,0)}let c=1,s=0;for(this[t]=e&255;++s>>0,a=a>>>0,!f){let b=Math.pow(2,8*a)-1;De(this,e,t,a,b,0)}let c=a-1,s=1;for(this[t+c]=e&255;--c>=0&&(s*=256);)this[t+c]=e/s&255;return t+a};I.prototype.writeUint8=I.prototype.writeUInt8=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,1,255,0),this[t]=e&255,t+1};I.prototype.writeUint16LE=I.prototype.writeUInt16LE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};I.prototype.writeUint16BE=I.prototype.writeUInt16BE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};I.prototype.writeUint32LE=I.prototype.writeUInt32LE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};I.prototype.writeUint32BE=I.prototype.writeUInt32BE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Oa(r,e,t,a,f){Ka(e,a,f,r,t,7);let c=Number(e&BigInt(4294967295));r[t++]=c,c=c>>8,r[t++]=c,c=c>>8,r[t++]=c,c=c>>8,r[t++]=c;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,t}function Ua(r,e,t,a,f){Ka(e,a,f,r,t,7);let c=Number(e&BigInt(4294967295));r[t+7]=c,c=c>>8,r[t+6]=c,c=c>>8,r[t+5]=c,c=c>>8,r[t+4]=c;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=s,s=s>>8,r[t+2]=s,s=s>>8,r[t+1]=s,s=s>>8,r[t]=s,t+8}I.prototype.writeBigUInt64LE=w0(function(e,t=0){return Oa(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});I.prototype.writeBigUInt64BE=w0(function(e,t=0){return Ua(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});I.prototype.writeIntLE=function(e,t,a,f){if(e=+e,t=t>>>0,!f){let v=Math.pow(2,8*a-1);De(this,e,t,a,v-1,-v)}let c=0,s=1,b=0;for(this[t]=e&255;++c>0)-b&255;return t+a};I.prototype.writeIntBE=function(e,t,a,f){if(e=+e,t=t>>>0,!f){let v=Math.pow(2,8*a-1);De(this,e,t,a,v-1,-v)}let c=a-1,s=1,b=0;for(this[t+c]=e&255;--c>=0&&(s*=256);)e<0&&b===0&&this[t+c+1]!==0&&(b=1),this[t+c]=(e/s>>0)-b&255;return t+a};I.prototype.writeInt8=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};I.prototype.writeInt16LE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};I.prototype.writeInt16BE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};I.prototype.writeInt32LE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};I.prototype.writeInt32BE=function(e,t,a){return e=+e,t=t>>>0,a||De(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};I.prototype.writeBigInt64LE=w0(function(e,t=0){return Oa(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});I.prototype.writeBigInt64BE=w0(function(e,t=0){return Ua(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function La(r,e,t,a,f,c){if(t+a>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ta(r,e,t,a,f){return e=+e,t=t>>>0,f||La(r,e,t,4,34028234663852886e22,-34028234663852886e22),K0.write(r,e,t,a,23,4),t+4}I.prototype.writeFloatLE=function(e,t,a){return Ta(this,e,t,!0,a)};I.prototype.writeFloatBE=function(e,t,a){return Ta(this,e,t,!1,a)};function Da(r,e,t,a,f){return e=+e,t=t>>>0,f||La(r,e,t,8,17976931348623157e292,-17976931348623157e292),K0.write(r,e,t,a,52,8),t+8}I.prototype.writeDoubleLE=function(e,t,a){return Da(this,e,t,!0,a)};I.prototype.writeDoubleBE=function(e,t,a){return Da(this,e,t,!1,a)};I.prototype.copy=function(e,t,a,f){if(!I.isBuffer(e))throw new TypeError("argument should be a Buffer");if(a||(a=0),!f&&f!==0&&(f=this.length),t>=e.length&&(t=e.length),t||(t=0),f>0&&f=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),e.length-t>>0,a=a===void 0?this.length:a>>>0,e||(e=0);let c;if(typeof e=="number")for(c=t;c2**32?f=qa(String(t)):typeof t=="bigint"&&(f=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(f=qa(f)),f+="n"),a+=` It must be ${e}. Received ${f}`,a},RangeError);function qa(r){let e="",t=r.length,a=r[0]==="-"?1:0;for(;t>=a+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function mc(r,e,t){H0(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&G0(e,r.length-(t+1))}function Ka(r,e,t,a,f,c){if(r>t||r3?e===0||e===BigInt(0)?b=`>= 0${s} and < 2${s} ** ${(c+1)*8}${s}`:b=`>= -(2${s} ** ${(c+1)*8-1}${s}) and < 2 ** ${(c+1)*8-1}${s}`:b=`>= ${e}${s} and <= ${t}${s}`,new D0.ERR_OUT_OF_RANGE("value",b,r)}mc(a,f,c)}function H0(r,e){if(typeof r!="number")throw new D0.ERR_INVALID_ARG_TYPE(e,"number",r)}function G0(r,e,t){throw Math.floor(r)!==r?(H0(r,t),new D0.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new D0.ERR_BUFFER_OUT_OF_BOUNDS:new D0.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var gc=/[^+/0-9A-Za-z-_]/g;function wc(r){if(r=r.split("=")[0],r=r.trim().replace(gc,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function mr(r,e){e=e||1/0;let t,a=r.length,f=null,c=[];for(let s=0;s55295&&t<57344){if(!f){if(t>56319){(e-=3)>-1&&c.push(239,191,189);continue}else if(s+1===a){(e-=3)>-1&&c.push(239,191,189);continue}f=t;continue}if(t<56320){(e-=3)>-1&&c.push(239,191,189),f=t;continue}t=(f-55296<<10|t-56320)+65536}else f&&(e-=3)>-1&&c.push(239,191,189);if(f=null,t<128){if((e-=1)<0)break;c.push(t)}else if(t<2048){if((e-=2)<0)break;c.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;c.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;c.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return c}function Mc(r){let e=[];for(let t=0;t>8,f=t%256,c.push(f),c.push(a);return c}function Ha(r){return pr.toByteArray(wc(r))}function mt(r,e,t,a){let f;for(f=0;f=e.length||f>=r.length);++f)e[f+t]=r[f];return f}function c0(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function _r(r){return r!==r}var Sc=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let a=t*16;for(let f=0;f<16;++f)e[a+f]=r[t]+r[f]}return e}();function w0(r){return typeof BigInt>"u"?Ac:r}function Ac(){throw new Error("BigInt not supported")}});var Sr=W0(Xr()),Wa=W0(ga()),Ar=W0(Ma()),Ir=W0(_a());var X=W0(Ja());window.Buffer=X.Buffer;var Er=class{constructor(e={},t={}){this.config={rsaPublic:e.rsaPublic||"",wsAddress:e.wsAddress||"",reconnectDelay:e.reconnectDelay||3e3,pingInterval:e.pingInterval||2e4,debug:e.debug||!1},this.callbacks={onServerClosed:t.onServerClosed||null,onServerSecured:t.onServerSecured||null,onClientSecured:t.onClientSecured||null,onClientList:t.onClientList||null,onClientMessage:t.onClientMessage||null},this.SERVER_KEY_STORAGE="nodecrypt_server_key";try{this.clientEc=new Wa.ec("curve25519")}catch(a){this.logEvent("constructor",a,"error")}this.serverKeys=null,this.serverShared=null,this.credentials=null,this.connection=null,this.reconnect=null,this.ping=null,this.channel={},this.setCredentials=this.setCredentials.bind(this),this.connect=this.connect.bind(this),this.destruct=this.destruct.bind(this),this.onOpen=this.onOpen.bind(this),this.onMessage=this.onMessage.bind(this),this.onError=this.onError.bind(this),this.onClose=this.onClose.bind(this),this.logEvent=this.logEvent.bind(this),this.isOpen=this.isOpen.bind(this),this.isClosed=this.isClosed.bind(this),this.startReconnect=this.startReconnect.bind(this),this.stopReconnect=this.stopReconnect.bind(this),this.startPing=this.startPing.bind(this),this.stopPing=this.stopPing.bind(this),this.disconnect=this.disconnect.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendChannelMessage=this.sendChannelMessage.bind(this),this.encryptServerMessage=this.encryptServerMessage.bind(this),this.decryptServerMessage=this.decryptServerMessage.bind(this),this.encryptClientMessage=this.encryptClientMessage.bind(this),this.decryptClientMessage=this.decryptClientMessage.bind(this)}setCredentials(e,t,a){this.logEvent("setCredentials");try{this.credentials={username:e,channel:(0,Sr.sha256)(t),password:(0,Sr.sha256)(a)}}catch(f){return this.logEvent("setCredentials",f,"error"),!1}return!0}connect(){if(!this.credentials)return!1;this.logEvent("connect",this.config.wsAddress),this.stopReconnect(),this.stopPing(),this.serverKeys=null,this.serverShared=null,this.channel={};try{this.connection=new WebSocket(this.config.wsAddress),this.connection.onopen=this.onOpen,this.connection.onmessage=this.onMessage,this.connection.onerror=this.onError,this.connection.onclose=this.onClose}catch(e){return this.logEvent("connect",e,"error"),!1}return!0}destruct(){this.logEvent("destruct"),this.stopReconnect(),this.stopPing(),this.reconnect=null,this.ping=null,this.config={rsaPublic:"",wsAddress:"",reconnectDelay:3e3,pingInterval:15e3,debug:!1},this.callbacks.onServerClosed=null,this.callbacks.onServerSecured=null,this.callbacks.onClientSecured=null,this.callbacks.onClientList=null,this.callbacks.onClientMessage=null,this.clientEc=null,this.serverKeys=null,this.serverShared=null,this.credentials=null,this.connection.onopen=null,this.connection.onmessage=null,this.connection.onerror=null,this.connection.onclose=null;try{this.connection.removeAllListeners()}catch(e){this.logEvent("destruct",e,"error")}try{this.connection.close()}catch(e){this.logEvent("destruct",e,"error")}return this.connection=null,this.channel={},!0}async onOpen(){this.logEvent("onOpen"),this.startPing();try{this.serverKeys=await crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-384"},!1,["deriveKey","deriveBits"]),this.serverShared=null,this.sendMessage(X.Buffer.from(await crypto.subtle.exportKey("raw",this.serverKeys.publicKey)).toString("hex"))}catch(e){this.logEvent("onOpen",e,"error")}}async onMessage(e){if(!e||!this.isString(e.data)||e.data==="pong")return;this.logEvent("onMessage",e.data);try{let a=JSON.parse(e.data);if(a.type==="server-key"&&!await this.handleServerKey(a.key))return}catch{}if(!this.serverShared){let a=e.data.split("|");if(!a[0]||!a[1])return;try{if(await crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},await crypto.subtle.importKey("spki",X.Buffer.from(this.config.rsaPublic,"base64"),{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]),X.Buffer.from(a[1],"base64"),X.Buffer.from(a[0],"hex"))===!0&&(this.serverShared=X.Buffer.from(await crypto.subtle.deriveBits({name:"ECDH",namedCurve:"P-384",public:await crypto.subtle.importKey("raw",X.Buffer.from(a[0],"hex"),{name:"ECDH",namedCurve:"P-384"},!0,[])},this.serverKeys.privateKey,384)).slice(8,40),this.sendMessage(this.encryptServerMessage({a:"j",p:this.credentials.channel},this.serverShared)),this.callbacks.onServerSecured))try{this.callbacks.onServerSecured()}catch(f){this.logEvent("onMessage-server-secured-callback",f,"error")}}catch(f){this.logEvent("onMessage",f,"error")}return}let t=this.decryptServerMessage(e.data,this.serverShared);if(this.logEvent("onMessage-server-decrypted",t),!(!this.isObject(t)||!this.isString(t.a))){if(t.a==="l"&&this.isArray(t.p)){try{for(let f in this.channel)t.p.indexOf(f)<0&&delete this.channel[f];let a={};for(let f of t.p)this.channel[f]||(this.channel[f]={username:null,keys:this.clientEc.genKeyPair(),shared:null},a[f]=this.channel[f].keys.getPublic("hex"));Object.keys(a).length>0&&this.sendMessage(this.encryptServerMessage({a:"w",p:a},this.serverShared))}catch(a){this.logEvent("onMessage-list",a,"error")}if(this.callbacks.onClientList){let a=[];for(let f in this.channel)this.channel[f].shared&&this.channel[f].username&&a.push({clientId:f,username:this.channel[f].username});try{this.callbacks.onClientList(a)}catch(f){this.logEvent("onMessage-client-list-callback",f,"error")}}return}if(!(!this.isString(t.p)||!this.isString(t.c))){if(t.a==="c"&&(!this.channel[t.c]||!this.channel[t.c].shared)){try{this.channel[t.c]||(this.channel[t.c]={username:null,keys:this.clientEc.genKeyPair(),shared:null},this.sendMessage(this.encryptServerMessage({a:"c",p:this.channel[t.c].keys.getPublic("hex"),c:t.c},this.serverShared))),this.channel[t.c].shared=X.Buffer.from(this.xorHex(this.channel[t.c].keys.derive(this.clientEc.keyFromPublic(t.p,"hex").getPublic()).toString("hex").padEnd(64,"8").substr(0,64),this.credentials.password),"hex"),this.sendMessage(this.encryptServerMessage({a:"c",p:this.encryptClientMessage({a:"u",p:this.credentials.username},this.channel[t.c].shared),c:t.c},this.serverShared))}catch(a){this.logEvent("onMessage-client",a,"error")}return}if(t.a==="c"&&this.channel[t.c]&&this.channel[t.c].shared){let a=this.decryptClientMessage(t.p,this.channel[t.c].shared);if(this.logEvent("onMessage-client-decrypted",a),!this.isObject(a)||!this.isString(a.a))return;if(a.a==="u"&&this.isString(a.p)&&a.p.match(/\S+/)&&!this.channel[t.c].username){if(this.channel[t.c].username=a.p.replace(/^\s+/,"").replace(/\s+$/,""),this.callbacks.onClientSecured)try{this.callbacks.onClientSecured({clientId:t.c,username:this.channel[t.c].username})}catch(f){this.logEvent("onMessage-client-secured-callback",f,"error")}return}if(!this.channel[t.c].username)return;if(a.a==="m"&&this.isString(a.t)&&this.isString(a.d)){if(this.callbacks.onClientMessage)try{this.callbacks.onClientMessage({clientId:t.c,username:this.channel[t.c].username,type:a.t,data:a.d})}catch(f){this.logEvent("onMessage-client-message-callback",f,"error")}return}}}}}async onError(e){if(this.logEvent("onError",e,"error"),this.disconnect(),this.credentials&&this.startReconnect(),this.callbacks.onServerClosed)try{this.callbacks.onServerClosed()}catch(t){this.logEvent("onError-server-closed-callback",t,"error")}}async onClose(e){if(this.logEvent("onClose",e),this.disconnect(),this.credentials&&this.startReconnect(),this.callbacks.onServerClosed)try{this.callbacks.onServerClosed()}catch(t){this.logEvent("onClose-server-closed-callback",t,"error")}}logEvent(e,t,a){if(this.config.debug){let f=new Date,c=f.getFullYear()+"-"+("0"+(f.getMonth()+1)).slice(-2)+"-"+("0"+f.getDate()).slice(-2)+" "+("0"+f.getHours()).slice(-2)+":"+("0"+f.getMinutes()).slice(-2)+":"+("0"+f.getSeconds()).slice(-2);console.log("["+c+"]",a?a.toUpperCase():"INFO",e+(t?":":""),t||"")}}isOpen(){return!!(this.connection&&this.connection.readyState&&this.connection.readyState===WebSocket.OPEN)}isClosed(){return!this.connection||!this.connection.readyState||this.connection.readyState===WebSocket.CLOSED}startReconnect(){this.stopReconnect(),this.logEvent("startReconnect"),this.reconnect=setTimeout(()=>{this.reconnect=null,this.connect()},this.config.reconnectDelay)}stopReconnect(){this.reconnect&&(this.logEvent("stopReconnect"),clearTimeout(this.reconnect),this.reconnect=null)}startPing(){this.stopPing(),this.logEvent("startPing"),this.ping=setInterval(()=>{this.sendMessage("ping")},this.config.pingInterval)}stopPing(){this.ping&&(this.logEvent("stopPing"),clearInterval(this.ping),this.ping=null)}disconnect(){if(this.stopReconnect(),this.stopPing(),!this.isClosed())try{this.logEvent("disconnect"),this.connection.close()}catch(e){this.logEvent("disconnect",e,"error")}}sendMessage(e){try{if(this.isOpen())return this.connection.send(e),!0}catch(t){this.logEvent("sendMessage",t,"error")}return!1}sendChannelMessage(e,t){if(this.serverShared)try{let a={};for(let f in this.channel)if(this.channel[f].shared&&this.channel[f].username&&(a[f]=this.encryptClientMessage({a:"m",t:e,d:t},this.channel[f].shared),a[f].length===0))return!1;if(Object.keys(a).length>0){let f=this.encryptServerMessage({a:"w",p:a},this.serverShared);if(!this.isOpen()||f.length===0||f.length>8*1024*1024)return!1;this.connection.send(f)}return!0}catch(a){this.logEvent("sendChannelMessage",a,"error")}return!1}encryptServerMessage(e,t){let a="";try{e=X.Buffer.from(JSON.stringify(e),"utf8"),e.length%16!==0&&(e=X.Buffer.from([...e,...X.Buffer.alloc(16-e.length%16)]));let f=X.Buffer.from(crypto.getRandomValues(new Uint8Array(16))),c=new Ar.ModeOfOperation.cbc(t,f);a=f.toString("base64")+"|"+X.Buffer.from(c.encrypt(e)).toString("base64")}catch(f){this.logEvent("encryptServerMessage",f,"error")}return a}decryptServerMessage(e,t){let a={};try{let f=e.split("|"),c=new Ar.ModeOfOperation.cbc(t,X.Buffer.from(f[0],"base64"));a=JSON.parse(X.Buffer.from(c.decrypt(X.Buffer.from(f[1],"base64"))).toString("utf8").replace(/\0+$/,""))}catch(f){this.logEvent("decryptServerMessage",f,"error")}return a}encryptClientMessage(e,t){let a="";try{e=X.Buffer.from(JSON.stringify(e),"utf8"),e.length%16!==0&&(e=X.Buffer.from([...e,...X.Buffer.alloc(16-e.length%16)]));let f=X.Buffer.from(crypto.getRandomValues(new Uint8Array(12))),c=X.Buffer.from(crypto.getRandomValues(new Uint8Array(4))),s=new Ir.default(t,f,c.reduce((b,v)=>b*v));a=f.toString("base64")+"|"+c.toString("base64")+"|"+X.Buffer.from(s.encrypt(e)).toString("base64")}catch(f){this.logEvent("encryptClientMessage",f,"error")}return a}decryptClientMessage(e,t){let a={};try{let f=e.split("|"),c=new Ir.default(t,X.Buffer.from(f[0],"base64"),X.Buffer.from(f[1],"base64").reduce((s,b)=>s*b));a=JSON.parse(X.Buffer.from(c.decrypt(X.Buffer.from(f[2],"base64"))).toString("utf8").replace(/\0+$/,""))}catch(f){this.logEvent("decryptClientMessage",f,"error")}return a}xorHex(e,t){let a="",f=Math.min(e.length,t.length);for(let c=0;c. See LICENSE.txt. *) + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + +buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) +*/ diff --git a/web/NodeCrypt2.js b/web/NodeCrypt2.js deleted file mode 100644 index 986adf0..0000000 --- a/web/NodeCrypt2.js +++ /dev/null @@ -1,21 +0,0 @@ -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,(function(r){var n=e[i][1][r];return o(n||r)}),p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i0){throw new Error("Invalid string. Length must be a multiple of 4")}var validLen=b64.indexOf("=");if(validLen===-1)validLen=len;var placeHoldersLen=validLen===len?0:4-validLen%4;return[validLen,placeHoldersLen]}function byteLength(b64){var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp;var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];var arr=new Arr(_byteLength(b64,validLen,placeHoldersLen));var curByte=0;var len=placeHoldersLen>0?validLen-4:validLen;var i;for(i=0;i>16&255;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}if(placeHoldersLen===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[curByte++]=tmp&255}if(placeHoldersLen===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=")}return parts.join("")}},{}],2:[function(require,module,exports){},{}],3:[function(require,module,exports){(function(Buffer){(function(){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -"use strict";var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;exports.kMaxLength=K_MAX_LENGTH;Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport();if(!Buffer.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42}catch(e){return false}}Object.defineProperty(Buffer.prototype,"parent",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.buffer}});Object.defineProperty(Buffer.prototype,"offset",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.byteOffset}});function createBuffer(length){if(length>K_MAX_LENGTH){throw new RangeError('The value "'+length+'" is invalid for option "size"')}var buf=new Uint8Array(length);buf.__proto__=Buffer.prototype;return buf}function Buffer(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new TypeError('The "string" argument must be of type string. Received type number')}return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}if(typeof Symbol!=="undefined"&&Symbol.species!=null&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;function from(value,encodingOrOffset,length){if(typeof value==="string"){return fromString(value,encodingOrOffset)}if(ArrayBuffer.isView(value)){return fromArrayLike(value)}if(value==null){throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer)){return fromArrayBuffer(value,encodingOrOffset,length)}if(typeof value==="number"){throw new TypeError('The "value" argument must not be of type number. Received type number')}var valueOf=value.valueOf&&value.valueOf();if(valueOf!=null&&valueOf!==value){return Buffer.from(valueOf,encodingOrOffset,length)}var b=fromObject(value);if(b)return b;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof value[Symbol.toPrimitive]==="function"){return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be of type number')}else if(size<0){throw new RangeError('The value "'+size+'" is invalid for option "size"')}}function alloc(size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}return createBuffer(size)}Buffer.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};function allocUnsafe(size){assertSize(size);return createBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){return allocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)};function fromString(string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}var length=byteLength(string,encoding)|0;var buf=createBuffer(length);var actual=buf.write(string,encoding);if(actual!==length){buf=buf.slice(0,actual)}return buf}function fromArrayLike(array){var length=array.length<0?0:checked(array.length)|0;var buf=createBuffer(length);for(var i=0;i=K_MAX_LENGTH){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+K_MAX_LENGTH.toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return b!=null&&b._isBuffer===true&&b!==Buffer.prototype};Buffer.compare=function compare(a,b){if(isInstance(a,Uint8Array))a=Buffer.from(a,a.offset,a.byteLength);if(isInstance(b,Uint8Array))b=Buffer.from(b,b.offset,b.byteLength);if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array')}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i2&&arguments[2]===true;if(!mustMatch&&len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase){return mustMatch?-1:utf8ToBytes(string).length}encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;imax)str+=" ... ";return""};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)){target=Buffer.from(target,target.offset,target.byteLength)}if(!Buffer.isBuffer(target)){throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. '+"Received type "+typeof target)}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(numberIsNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;jremaining){length=remaining}}var strLen=string.length;if(length>strLen/2){length=strLen/2}for(var i=0;i>>0;if(isFinite(length)){length=length>>>0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);this[offset]=value&255;return offset+1};Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255;return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,4,34028234663852886e22,-34028234663852886e22)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,8,17976931348623157e292,-17976931348623157e292)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("Index out of range");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;--i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}if(val.length===1){var code=val.charCodeAt(0);if(encoding==="utf8"&&code<128||encoding==="latin1"){val=code}}}else if(typeof val==="number"){val=val&255}if(start<0||this.length>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!==obj}}).call(this)}).call(this,require("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:4}],4:[function(require,module,exports){ -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],5:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex1){for(var i=1;i0){this.sendMessage(this.encryptServerMessage({a:"w",p:payloads},this.serverShared))}}catch(error){this.logEvent("onMessage-list",error,"error")}if(this.callbacks.onClientList){let clients=[];for(const clientId in this.channel){if(this.channel[clientId].shared&&this.channel[clientId].username){clients.push({clientId:clientId,username:this.channel[clientId].username})}}try{this.callbacks.onClientList(clients)}catch(error){this.logEvent("onMessage-client-list-callback",error,"error")}}return}if(!this.isString(serverDecrypted.p)||!this.isString(serverDecrypted.c)){return}if(serverDecrypted.a==="c"&&(!this.channel[serverDecrypted.c]||!this.channel[serverDecrypted.c].shared)){try{if(!this.channel[serverDecrypted.c]){this.channel[serverDecrypted.c]={username:null,keys:this.clientEc.genKeyPair(),shared:null};this.sendMessage(this.encryptServerMessage({a:"c",p:this.channel[serverDecrypted.c].keys.getPublic("hex"),c:serverDecrypted.c},this.serverShared))}this.channel[serverDecrypted.c].shared=Buffer.from(this.xorHex(this.channel[serverDecrypted.c].keys.derive(this.clientEc.keyFromPublic(serverDecrypted.p,"hex").getPublic()).toString("hex").padEnd(64,"8").substr(0,64),this.credentials.password),"hex");this.sendMessage(this.encryptServerMessage({a:"c",p:this.encryptClientMessage({a:"u",p:this.credentials.username},this.channel[serverDecrypted.c].shared),c:serverDecrypted.c},this.serverShared))}catch(error){this.logEvent("onMessage-client",error,"error")}return}if(serverDecrypted.a==="c"&&this.channel[serverDecrypted.c]&&this.channel[serverDecrypted.c].shared){const clientDecrypted=this.decryptClientMessage(serverDecrypted.p,this.channel[serverDecrypted.c].shared);this.logEvent("onMessage-client-decrypted",clientDecrypted);if(!this.isObject(clientDecrypted)||!this.isString(clientDecrypted.a)){return}if(clientDecrypted.a==="u"&&this.isString(clientDecrypted.p)&&clientDecrypted.p.match(/\S+/)&&!this.channel[serverDecrypted.c].username){this.channel[serverDecrypted.c].username=clientDecrypted.p.replace(/^\s+/,"").replace(/\s+$/,"");if(this.callbacks.onClientSecured){try{this.callbacks.onClientSecured({clientId:serverDecrypted.c,username:this.channel[serverDecrypted.c].username})}catch(error){this.logEvent("onMessage-client-secured-callback",error,"error")}}return}if(!this.channel[serverDecrypted.c].username){return}if(clientDecrypted.a==="m"&&this.isString(clientDecrypted.t)&&this.isString(clientDecrypted.d)){if(this.callbacks.onClientMessage){try{this.callbacks.onClientMessage({clientId:serverDecrypted.c,username:this.channel[serverDecrypted.c].username,type:clientDecrypted.t,data:clientDecrypted.d})}catch(error){this.logEvent("onMessage-client-message-callback",error,"error")}}return}}}async onError(event){this.logEvent("onError",event,"error");this.disconnect();if(this.credentials){this.startReconnect()}if(this.callbacks.onServerClosed){try{this.callbacks.onServerClosed()}catch(error){this.logEvent("onError-server-closed-callback",error,"error")}}}async onClose(event){this.logEvent("onClose",event);this.disconnect();if(this.credentials){this.startReconnect()}if(this.callbacks.onServerClosed){try{this.callbacks.onServerClosed()}catch(error){this.logEvent("onClose-server-closed-callback",error,"error")}}}logEvent(source,message,level){if(this.config.debug){const date=new Date,dateString=date.getFullYear()+"-"+("0"+(date.getMonth()+1)).slice(-2)+"-"+("0"+date.getDate()).slice(-2)+" "+("0"+date.getHours()).slice(-2)+":"+("0"+date.getMinutes()).slice(-2)+":"+("0"+date.getSeconds()).slice(-2);console.log("["+dateString+"]",level?level.toUpperCase():"INFO",source+(message?":":""),message?message:"")}}isOpen(){return this.connection&&this.connection.readyState&&this.connection.readyState===WebSocket.OPEN?true:false}isClosed(){return!this.connection||!this.connection.readyState||this.connection.readyState===WebSocket.CLOSED?true:false}startReconnect(){this.stopReconnect();this.logEvent("startReconnect");this.reconnect=setTimeout((()=>{this.reconnect=null;this.connect()}),this.config.reconnectDelay)}stopReconnect(){if(this.reconnect){this.logEvent("stopReconnect");clearTimeout(this.reconnect);this.reconnect=null}}startPing(){this.stopPing();this.logEvent("startPing");this.ping=setInterval((()=>{this.sendMessage("ping")}),this.config.pingInterval)}stopPing(){if(this.ping){this.logEvent("stopPing");clearInterval(this.ping);this.ping=null}}disconnect(){this.stopReconnect();this.stopPing();if(!this.isClosed()){try{this.logEvent("disconnect");this.connection.close()}catch(error){this.logEvent("disconnect",error,"error")}}}sendMessage(message){try{if(this.isOpen()){this.connection.send(message);return true}}catch(error){this.logEvent("sendMessage",error,"error")}return false}sendChannelMessage(type,data){if(this.serverShared){try{let payloads={};for(const clientId in this.channel){if(this.channel[clientId].shared&&this.channel[clientId].username){payloads[clientId]=this.encryptClientMessage({a:"m",t:type,d:data},this.channel[clientId].shared);if(payloads[clientId].length===0){return false}}}if(Object.keys(payloads).length>0){const payload=this.encryptServerMessage({a:"w",p:payloads},this.serverShared);if(!this.isOpen()||payload.length===0||payload.length>8*1024*1024){return false}this.connection.send(payload)}return true}catch(error){this.logEvent("sendChannelMessage",error,"error")}}return false}encryptServerMessage(message,key){let encrypted="";try{message=Buffer.from(JSON.stringify(message),"utf8");if(message.length%16!==0){message=Buffer.from([...message,...Buffer.alloc(16-message.length%16)])}const iv=Buffer.from(crypto.getRandomValues(new Uint8Array(16)));const cipher=new aes.ModeOfOperation.cbc(key,iv);encrypted=iv.toString("base64")+"|"+Buffer.from(cipher.encrypt(message)).toString("base64")}catch(error){this.logEvent("encryptServerMessage",error,"error")}return encrypted}decryptServerMessage(message,key){let decrypted={};try{const parts=message.split("|");const decipher=new aes.ModeOfOperation.cbc(key,Buffer.from(parts[0],"base64"));decrypted=JSON.parse(Buffer.from(decipher.decrypt(Buffer.from(parts[1],"base64"))).toString("utf8").replace(/\0+$/,""))}catch(error){this.logEvent("decryptServerMessage",error,"error")}return decrypted}encryptClientMessage(message,key){let encrypted="";try{message=Buffer.from(JSON.stringify(message),"utf8");if(message.length%16!==0){message=Buffer.from([...message,...Buffer.alloc(16-message.length%16)])}const iv=Buffer.from(crypto.getRandomValues(new Uint8Array(12)));const counter=Buffer.from(crypto.getRandomValues(new Uint8Array(4)));const cipher=new chacha(key,iv,counter.reduce(((a,b)=>a*b)));encrypted=iv.toString("base64")+"|"+counter.toString("base64")+"|"+Buffer.from(cipher.encrypt(message)).toString("base64")}catch(error){this.logEvent("encryptClientMessage",error,"error")}return encrypted}decryptClientMessage(message,key){let decrypted={};try{const parts=message.split("|");const decipher=new chacha(key,Buffer.from(parts[0],"base64"),Buffer.from(parts[1],"base64").reduce(((a,b)=>a*b)));decrypted=JSON.parse(Buffer.from(decipher.decrypt(Buffer.from(parts[2],"base64"))).toString("utf8").replace(/\0+$/,""))}catch(error){this.logEvent("decryptClientMessage",error,"error")}return decrypted}xorHex(a,b){let result="",hexLength=Math.min(a.length,b.length);for(let i=0;i. See LICENSE.txt. */ -(function(root){"use strict";function checkInt(value){return parseInt(value)===value}function checkInts(arrayish){if(!checkInt(arrayish.length)){return false}for(var i=0;i255){return false}}return true}function coerceArray(arg,copy){if(arg.buffer&&arg.name==="Uint8Array"){if(copy){if(arg.slice){arg=arg.slice()}else{arg=Array.prototype.slice.call(arg)}}return arg}if(Array.isArray(arg)){if(!checkInts(arg)){throw new Error("Array contains invalid value: "+arg)}return new Uint8Array(arg)}if(checkInt(arg.length)&&checkInts(arg)){return new Uint8Array(arg)}throw new Error("unsupported array-like object")}function createArray(length){return new Uint8Array(length)}function copyArray(sourceArray,targetArray,targetStart,sourceStart,sourceEnd){if(sourceStart!=null||sourceEnd!=null){if(sourceArray.slice){sourceArray=sourceArray.slice(sourceStart,sourceEnd)}else{sourceArray=Array.prototype.slice.call(sourceArray,sourceStart,sourceEnd)}}targetArray.set(sourceArray,targetStart)}var convertUtf8=function(){function toBytes(text){var result=[],i=0;text=encodeURI(text);while(i191&&c<224){result.push(String.fromCharCode((c&31)<<6|bytes[i+1]&63));i+=2}else{result.push(String.fromCharCode((c&15)<<12|(bytes[i+1]&63)<<6|bytes[i+2]&63));i+=3}}return result.join("")}return{toBytes:toBytes,fromBytes:fromBytes}}();var convertHex=function(){function toBytes(text){var result=[];for(var i=0;i>4]+Hex[v&15])}return result.join("")}return{toBytes:toBytes,fromBytes:fromBytes}}();var numberOfRounds={16:10,24:12,32:14};var rcon=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145];var S=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22];var Si=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125];var T1=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986];var T2=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766];var T3=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126];var T4=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436];var T5=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890];var T6=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935];var T7=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600];var T8=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480];var U1=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795];var U2=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855];var U3=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150];var U4=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function convertToInt32(bytes){var result=[];for(var i=0;i>2;this._Ke[index][i%4]=tk[i];this._Kd[rounds-index][i%4]=tk[i]}var rconpointer=0;var t=KC,tt;while(t>16&255]<<24^S[tt>>8&255]<<16^S[tt&255]<<8^S[tt>>24&255]^rcon[rconpointer]<<24;rconpointer+=1;if(KC!=8){for(var i=1;i>8&255]<<8^S[tt>>16&255]<<16^S[tt>>24&255]<<24;for(var i=KC/2+1;i>2;c=t%4;this._Ke[r][c]=tk[i];this._Kd[rounds-r][c]=tk[i++];t++}}for(var r=1;r>24&255]^U2[tt>>16&255]^U3[tt>>8&255]^U4[tt&255]}}};AES.prototype.encrypt=function(plaintext){if(plaintext.length!=16){throw new Error("invalid plaintext size (must be 16 bytes)")}var rounds=this._Ke.length-1;var a=[0,0,0,0];var t=convertToInt32(plaintext);for(var i=0;i<4;i++){t[i]^=this._Ke[0][i]}for(var r=1;r>24&255]^T2[t[(i+1)%4]>>16&255]^T3[t[(i+2)%4]>>8&255]^T4[t[(i+3)%4]&255]^this._Ke[r][i]}t=a.slice()}var result=createArray(16),tt;for(var i=0;i<4;i++){tt=this._Ke[rounds][i];result[4*i]=(S[t[i]>>24&255]^tt>>24)&255;result[4*i+1]=(S[t[(i+1)%4]>>16&255]^tt>>16)&255;result[4*i+2]=(S[t[(i+2)%4]>>8&255]^tt>>8)&255;result[4*i+3]=(S[t[(i+3)%4]&255]^tt)&255}return result};AES.prototype.decrypt=function(ciphertext){if(ciphertext.length!=16){throw new Error("invalid ciphertext size (must be 16 bytes)")}var rounds=this._Kd.length-1;var a=[0,0,0,0];var t=convertToInt32(ciphertext);for(var i=0;i<4;i++){t[i]^=this._Kd[0][i]}for(var r=1;r>24&255]^T6[t[(i+3)%4]>>16&255]^T7[t[(i+2)%4]>>8&255]^T8[t[(i+1)%4]&255]^this._Kd[r][i]}t=a.slice()}var result=createArray(16),tt;for(var i=0;i<4;i++){tt=this._Kd[rounds][i];result[4*i]=(Si[t[i]>>24&255]^tt>>24)&255;result[4*i+1]=(Si[t[(i+3)%4]>>16&255]^tt>>16)&255;result[4*i+2]=(Si[t[(i+2)%4]>>8&255]^tt>>8)&255;result[4*i+3]=(Si[t[(i+1)%4]&255]^tt)&255}return result};var ModeOfOperationECB=function(key){if(!(this instanceof ModeOfOperationECB)){throw Error("AES must be instanitated with `new`")}this.description="Electronic Code Block";this.name="ecb";this._aes=new AES(key)};ModeOfOperationECB.prototype.encrypt=function(plaintext){plaintext=coerceArray(plaintext);if(plaintext.length%16!==0){throw new Error("invalid plaintext size (must be multiple of 16 bytes)")}var ciphertext=createArray(plaintext.length);var block=createArray(16);for(var i=0;iNumber.MAX_SAFE_INTEGER){throw new Error("integer value out of safe range")}for(var index=15;index>=0;--index){this._counter[index]=value%256;value=parseInt(value/256)}};Counter.prototype.setBytes=function(bytes){bytes=coerceArray(bytes,true);if(bytes.length!=16){throw new Error("invalid counter bytes size (must be 16 bytes)")}this._counter=bytes};Counter.prototype.increment=function(){for(var i=15;i>=0;i--){if(this._counter[i]===255){this._counter[i]=0}else{this._counter[i]++;break}}};var ModeOfOperationCTR=function(key,counter){if(!(this instanceof ModeOfOperationCTR)){throw Error("AES must be instanitated with `new`")}this.description="Counter";this.name="ctr";if(!(counter instanceof Counter)){counter=new Counter(counter)}this._counter=counter;this._remainingCounter=null;this._remainingCounterIndex=16;this._aes=new AES(key)};ModeOfOperationCTR.prototype.encrypt=function(plaintext){var encrypted=coerceArray(plaintext,true);for(var i=0;i16){throw new Error("PKCS#7 padding byte out of range")}var length=data.length-padder;for(var i=0;i0)return left;return right};BN.min=function min(left,right){if(left.cmp(right)<0)return left;return right};BN.prototype._init=function init(number,base,endian){if(typeof number==="number"){return this._initNumber(number,base,endian)}if(typeof number==="object"){return this._initArray(number,base,endian)}if(base==="hex"){base=16}assert(base===(base|0)&&base>=2&&base<=36);number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-"){start++;this.negative=1}if(start=0;i-=3){w=number[i]|number[i-1]<<8|number[i-2]<<16;this.words[j]|=w<>>26-off&67108863;off+=24;if(off>=26){off-=26;j++}}}else if(endian==="le"){for(i=0,j=0;i>>26-off&67108863;off+=24;if(off>=26){off-=26;j++}}}return this.strip()};function parseHex4Bits(string,index){var c=string.charCodeAt(index);if(c>=65&&c<=70){return c-55}else if(c>=97&&c<=102){return c-87}else{return c-48&15}}function parseHexByte(string,lowerBound,index){var r=parseHex4Bits(string,index);if(index-1>=lowerBound){r|=parseHex4Bits(string,index-1)<<4}return r}BN.prototype._parseHex=function _parseHex(number,start,endian){this.length=Math.ceil((number.length-start)/6);this.words=new Array(this.length);for(var i=0;i=start;i-=2){w=parseHexByte(number,start,i)<=18){off-=18;j+=1;this.words[j]|=w>>>26}else{off+=8}}}else{var parseLength=number.length-start;for(i=parseLength%2===0?start+1:start;i=18){off-=18;j+=1;this.words[j]|=w>>>26}else{off+=8}}}this.strip()};function parseBase(str,start,end,mul){var r=0;var len=Math.min(str.length,end);for(var i=start;i=49){r+=c-49+10}else if(c>=17){r+=c-17+10}else{r+=c}}return r}BN.prototype._parseBase=function _parseBase(number,base,start){this.words=[0];this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base){limbLen++}limbLen--;limbPow=limbPow/base|0;var total=number.length-start;var mod=total%limbLen;var end=Math.min(total,total-mod)+start;var word=0;for(var i=start;i1&&this.words[this.length-1]===0){this.length--}return this._normSign()};BN.prototype._normSign=function _normSign(){if(this.length===1&&this.words[0]===0){this.negative=0}return this};BN.prototype.inspect=function inspect(){return(this.red?""};var zeros=["","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"];var groupSizes=[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];var groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(base,padding){base=base||10;padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0;var carry=0;for(var i=0;i>>24-off&16777215;off+=2;if(off>=26){off-=26;i--}if(carry!==0||i!==this.length-1){out=zeros[6-word.length]+word+out}else{out=word+out}}if(carry!==0){out=carry.toString(16)+out}while(out.length%padding!==0){out="0"+out}if(this.negative!==0){out="-"+out}return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base];var groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);c=c.idivn(groupBase);if(!c.isZero()){out=zeros[groupSize-r.length]+r+out}else{out=r+out}}if(this.isZero()){out="0"+out}while(out.length%padding!==0){out="0"+out}if(this.negative!==0){out="-"+out}return out}assert(false,"Base should be between 2 and 36")};BN.prototype.toNumber=function toNumber(){var ret=this.words[0];if(this.length===2){ret+=this.words[1]*67108864}else if(this.length===3&&this.words[2]===1){ret+=4503599627370496+this.words[1]*67108864}else if(this.length>2){assert(false,"Number can only safely store up to 53 bits")}return this.negative!==0?-ret:ret};BN.prototype.toJSON=function toJSON(){return this.toString(16)};BN.prototype.toBuffer=function toBuffer(endian,length){assert(typeof Buffer!=="undefined");return this.toArrayLike(Buffer,endian,length)};BN.prototype.toArray=function toArray(endian,length){return this.toArrayLike(Array,endian,length)};BN.prototype.toArrayLike=function toArrayLike(ArrayType,endian,length){var byteLength=this.byteLength();var reqLength=length||Math.max(1,byteLength);assert(byteLength<=reqLength,"byte array longer than desired length");assert(reqLength>0,"Requested array length <= 0");this.strip();var littleEndian=endian==="le";var res=new ArrayType(reqLength);var b,i;var q=this.clone();if(!littleEndian){for(i=0;i=4096){r+=13;t>>>=13}if(t>=64){r+=7;t>>>=7}if(t>=8){r+=4;t>>>=4}if(t>=2){r+=2;t>>>=2}return r+t}}BN.prototype._zeroBits=function _zeroBits(w){if(w===0)return 26;var t=w;var r=0;if((t&8191)===0){r+=13;t>>>=13}if((t&127)===0){r+=7;t>>>=7}if((t&15)===0){r+=4;t>>>=4}if((t&3)===0){r+=2;t>>>=2}if((t&1)===0){r++}return r};BN.prototype.bitLength=function bitLength(){var w=this.words[this.length-1];var hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=new Array(num.bitLength());for(var bit=0;bit>>wbit}return w}BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;var r=0;for(var i=0;inum.length)return this.clone().ior(num);return num.clone().ior(this)};BN.prototype.uor=function uor(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)};BN.prototype.iuand=function iuand(num){var b;if(this.length>num.length){b=num}else{b=this}for(var i=0;inum.length)return this.clone().iand(num);return num.clone().iand(this)};BN.prototype.uand=function uand(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)};BN.prototype.iuxor=function iuxor(num){var a;var b;if(this.length>num.length){a=this;b=num}else{a=num;b=this}for(var i=0;inum.length)return this.clone().ixor(num);return num.clone().ixor(this)};BN.prototype.uxor=function uxor(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)};BN.prototype.inotn=function inotn(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0;var bitsLeft=width%26;this._expand(bytesNeeded);if(bitsLeft>0){bytesNeeded--}for(var i=0;i0){this.words[i]=~this.words[i]&67108863>>26-bitsLeft}return this.strip()};BN.prototype.notn=function notn(width){return this.clone().inotn(width)};BN.prototype.setn=function setn(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0;var wbit=bit%26;this._expand(off+1);if(val){this.words[off]=this.words[off]|1<num.length){a=this;b=num}else{a=num;b=this}var carry=0;for(var i=0;i>>26}for(;carry!==0&&i>>26}this.length=a.length;if(carry!==0){this.words[this.length]=carry;this.length++}else if(a!==this){for(;inum.length)return this.clone().iadd(num);return num.clone().iadd(this)};BN.prototype.isub=function isub(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);num.negative=1;return r._normSign()}else if(this.negative!==0){this.negative=0;this.iadd(num);this.negative=1;return this._normSign()}var cmp=this.cmp(num);if(cmp===0){this.negative=0;this.length=1;this.words[0]=0;return this}var a,b;if(cmp>0){a=this;b=num}else{a=num;b=this}var carry=0;for(var i=0;i>26;this.words[i]=r&67108863}for(;carry!==0&&i>26;this.words[i]=r&67108863}if(carry===0&&i>>26;var rword=carry&67108863;var maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self.length+1);j<=maxJ;j++){var i=k-j|0;a=self.words[i]|0;b=num.words[j]|0;r=a*b+rword;ncarry+=r/67108864|0;rword=r&67108863}out.words[k]=rword|0;carry=ncarry|0}if(carry!==0){out.words[k]=carry|0}else{out.length--}return out.strip()}var comb10MulTo=function comb10MulTo(self,num,out){var a=self.words;var b=num.words;var o=out.words;var c=0;var lo;var mid;var hi;var a0=a[0]|0;var al0=a0&8191;var ah0=a0>>>13;var a1=a[1]|0;var al1=a1&8191;var ah1=a1>>>13;var a2=a[2]|0;var al2=a2&8191;var ah2=a2>>>13;var a3=a[3]|0;var al3=a3&8191;var ah3=a3>>>13;var a4=a[4]|0;var al4=a4&8191;var ah4=a4>>>13;var a5=a[5]|0;var al5=a5&8191;var ah5=a5>>>13;var a6=a[6]|0;var al6=a6&8191;var ah6=a6>>>13;var a7=a[7]|0;var al7=a7&8191;var ah7=a7>>>13;var a8=a[8]|0;var al8=a8&8191;var ah8=a8>>>13;var a9=a[9]|0;var al9=a9&8191;var ah9=a9>>>13;var b0=b[0]|0;var bl0=b0&8191;var bh0=b0>>>13;var b1=b[1]|0;var bl1=b1&8191;var bh1=b1>>>13;var b2=b[2]|0;var bl2=b2&8191;var bh2=b2>>>13;var b3=b[3]|0;var bl3=b3&8191;var bh3=b3>>>13;var b4=b[4]|0;var bl4=b4&8191;var bh4=b4>>>13;var b5=b[5]|0;var bl5=b5&8191;var bh5=b5>>>13;var b6=b[6]|0;var bl6=b6&8191;var bh6=b6>>>13;var b7=b[7]|0;var bl7=b7&8191;var bh7=b7>>>13;var b8=b[8]|0;var bl8=b8&8191;var bh8=b8>>>13;var b9=b[9]|0;var bl9=b9&8191;var bh9=b9>>>13;out.negative=self.negative^num.negative;out.length=19;lo=Math.imul(al0,bl0);mid=Math.imul(al0,bh0);mid=mid+Math.imul(ah0,bl0)|0;hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0;w0&=67108863;lo=Math.imul(al1,bl0);mid=Math.imul(al1,bh0);mid=mid+Math.imul(ah1,bl0)|0;hi=Math.imul(ah1,bh0);lo=lo+Math.imul(al0,bl1)|0;mid=mid+Math.imul(al0,bh1)|0;mid=mid+Math.imul(ah0,bl1)|0;hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0;w1&=67108863;lo=Math.imul(al2,bl0);mid=Math.imul(al2,bh0);mid=mid+Math.imul(ah2,bl0)|0;hi=Math.imul(ah2,bh0);lo=lo+Math.imul(al1,bl1)|0;mid=mid+Math.imul(al1,bh1)|0;mid=mid+Math.imul(ah1,bl1)|0;hi=hi+Math.imul(ah1,bh1)|0;lo=lo+Math.imul(al0,bl2)|0;mid=mid+Math.imul(al0,bh2)|0;mid=mid+Math.imul(ah0,bl2)|0;hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0;w2&=67108863;lo=Math.imul(al3,bl0);mid=Math.imul(al3,bh0);mid=mid+Math.imul(ah3,bl0)|0;hi=Math.imul(ah3,bh0);lo=lo+Math.imul(al2,bl1)|0;mid=mid+Math.imul(al2,bh1)|0;mid=mid+Math.imul(ah2,bl1)|0;hi=hi+Math.imul(ah2,bh1)|0;lo=lo+Math.imul(al1,bl2)|0;mid=mid+Math.imul(al1,bh2)|0;mid=mid+Math.imul(ah1,bl2)|0;hi=hi+Math.imul(ah1,bh2)|0;lo=lo+Math.imul(al0,bl3)|0;mid=mid+Math.imul(al0,bh3)|0;mid=mid+Math.imul(ah0,bl3)|0;hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0;w3&=67108863;lo=Math.imul(al4,bl0);mid=Math.imul(al4,bh0);mid=mid+Math.imul(ah4,bl0)|0;hi=Math.imul(ah4,bh0);lo=lo+Math.imul(al3,bl1)|0;mid=mid+Math.imul(al3,bh1)|0;mid=mid+Math.imul(ah3,bl1)|0;hi=hi+Math.imul(ah3,bh1)|0;lo=lo+Math.imul(al2,bl2)|0;mid=mid+Math.imul(al2,bh2)|0;mid=mid+Math.imul(ah2,bl2)|0;hi=hi+Math.imul(ah2,bh2)|0;lo=lo+Math.imul(al1,bl3)|0;mid=mid+Math.imul(al1,bh3)|0;mid=mid+Math.imul(ah1,bl3)|0;hi=hi+Math.imul(ah1,bh3)|0;lo=lo+Math.imul(al0,bl4)|0;mid=mid+Math.imul(al0,bh4)|0;mid=mid+Math.imul(ah0,bl4)|0;hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0;w4&=67108863;lo=Math.imul(al5,bl0);mid=Math.imul(al5,bh0);mid=mid+Math.imul(ah5,bl0)|0;hi=Math.imul(ah5,bh0);lo=lo+Math.imul(al4,bl1)|0;mid=mid+Math.imul(al4,bh1)|0;mid=mid+Math.imul(ah4,bl1)|0;hi=hi+Math.imul(ah4,bh1)|0;lo=lo+Math.imul(al3,bl2)|0;mid=mid+Math.imul(al3,bh2)|0;mid=mid+Math.imul(ah3,bl2)|0;hi=hi+Math.imul(ah3,bh2)|0;lo=lo+Math.imul(al2,bl3)|0;mid=mid+Math.imul(al2,bh3)|0;mid=mid+Math.imul(ah2,bl3)|0;hi=hi+Math.imul(ah2,bh3)|0;lo=lo+Math.imul(al1,bl4)|0;mid=mid+Math.imul(al1,bh4)|0;mid=mid+Math.imul(ah1,bl4)|0;hi=hi+Math.imul(ah1,bh4)|0;lo=lo+Math.imul(al0,bl5)|0;mid=mid+Math.imul(al0,bh5)|0;mid=mid+Math.imul(ah0,bl5)|0;hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0;w5&=67108863;lo=Math.imul(al6,bl0);mid=Math.imul(al6,bh0);mid=mid+Math.imul(ah6,bl0)|0;hi=Math.imul(ah6,bh0);lo=lo+Math.imul(al5,bl1)|0;mid=mid+Math.imul(al5,bh1)|0;mid=mid+Math.imul(ah5,bl1)|0;hi=hi+Math.imul(ah5,bh1)|0;lo=lo+Math.imul(al4,bl2)|0;mid=mid+Math.imul(al4,bh2)|0;mid=mid+Math.imul(ah4,bl2)|0;hi=hi+Math.imul(ah4,bh2)|0;lo=lo+Math.imul(al3,bl3)|0;mid=mid+Math.imul(al3,bh3)|0;mid=mid+Math.imul(ah3,bl3)|0;hi=hi+Math.imul(ah3,bh3)|0;lo=lo+Math.imul(al2,bl4)|0;mid=mid+Math.imul(al2,bh4)|0;mid=mid+Math.imul(ah2,bl4)|0;hi=hi+Math.imul(ah2,bh4)|0;lo=lo+Math.imul(al1,bl5)|0;mid=mid+Math.imul(al1,bh5)|0;mid=mid+Math.imul(ah1,bl5)|0;hi=hi+Math.imul(ah1,bh5)|0;lo=lo+Math.imul(al0,bl6)|0;mid=mid+Math.imul(al0,bh6)|0;mid=mid+Math.imul(ah0,bl6)|0;hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0;w6&=67108863;lo=Math.imul(al7,bl0);mid=Math.imul(al7,bh0);mid=mid+Math.imul(ah7,bl0)|0;hi=Math.imul(ah7,bh0);lo=lo+Math.imul(al6,bl1)|0;mid=mid+Math.imul(al6,bh1)|0;mid=mid+Math.imul(ah6,bl1)|0;hi=hi+Math.imul(ah6,bh1)|0;lo=lo+Math.imul(al5,bl2)|0;mid=mid+Math.imul(al5,bh2)|0;mid=mid+Math.imul(ah5,bl2)|0;hi=hi+Math.imul(ah5,bh2)|0;lo=lo+Math.imul(al4,bl3)|0;mid=mid+Math.imul(al4,bh3)|0;mid=mid+Math.imul(ah4,bl3)|0;hi=hi+Math.imul(ah4,bh3)|0;lo=lo+Math.imul(al3,bl4)|0;mid=mid+Math.imul(al3,bh4)|0;mid=mid+Math.imul(ah3,bl4)|0;hi=hi+Math.imul(ah3,bh4)|0;lo=lo+Math.imul(al2,bl5)|0;mid=mid+Math.imul(al2,bh5)|0;mid=mid+Math.imul(ah2,bl5)|0;hi=hi+Math.imul(ah2,bh5)|0;lo=lo+Math.imul(al1,bl6)|0;mid=mid+Math.imul(al1,bh6)|0;mid=mid+Math.imul(ah1,bl6)|0;hi=hi+Math.imul(ah1,bh6)|0;lo=lo+Math.imul(al0,bl7)|0;mid=mid+Math.imul(al0,bh7)|0;mid=mid+Math.imul(ah0,bl7)|0;hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0;w7&=67108863;lo=Math.imul(al8,bl0);mid=Math.imul(al8,bh0);mid=mid+Math.imul(ah8,bl0)|0;hi=Math.imul(ah8,bh0);lo=lo+Math.imul(al7,bl1)|0;mid=mid+Math.imul(al7,bh1)|0;mid=mid+Math.imul(ah7,bl1)|0;hi=hi+Math.imul(ah7,bh1)|0;lo=lo+Math.imul(al6,bl2)|0;mid=mid+Math.imul(al6,bh2)|0;mid=mid+Math.imul(ah6,bl2)|0;hi=hi+Math.imul(ah6,bh2)|0;lo=lo+Math.imul(al5,bl3)|0;mid=mid+Math.imul(al5,bh3)|0;mid=mid+Math.imul(ah5,bl3)|0;hi=hi+Math.imul(ah5,bh3)|0;lo=lo+Math.imul(al4,bl4)|0;mid=mid+Math.imul(al4,bh4)|0;mid=mid+Math.imul(ah4,bl4)|0;hi=hi+Math.imul(ah4,bh4)|0;lo=lo+Math.imul(al3,bl5)|0;mid=mid+Math.imul(al3,bh5)|0;mid=mid+Math.imul(ah3,bl5)|0;hi=hi+Math.imul(ah3,bh5)|0;lo=lo+Math.imul(al2,bl6)|0;mid=mid+Math.imul(al2,bh6)|0;mid=mid+Math.imul(ah2,bl6)|0;hi=hi+Math.imul(ah2,bh6)|0;lo=lo+Math.imul(al1,bl7)|0;mid=mid+Math.imul(al1,bh7)|0;mid=mid+Math.imul(ah1,bl7)|0;hi=hi+Math.imul(ah1,bh7)|0;lo=lo+Math.imul(al0,bl8)|0;mid=mid+Math.imul(al0,bh8)|0;mid=mid+Math.imul(ah0,bl8)|0;hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0;w8&=67108863;lo=Math.imul(al9,bl0);mid=Math.imul(al9,bh0);mid=mid+Math.imul(ah9,bl0)|0;hi=Math.imul(ah9,bh0);lo=lo+Math.imul(al8,bl1)|0;mid=mid+Math.imul(al8,bh1)|0;mid=mid+Math.imul(ah8,bl1)|0;hi=hi+Math.imul(ah8,bh1)|0;lo=lo+Math.imul(al7,bl2)|0;mid=mid+Math.imul(al7,bh2)|0;mid=mid+Math.imul(ah7,bl2)|0;hi=hi+Math.imul(ah7,bh2)|0;lo=lo+Math.imul(al6,bl3)|0;mid=mid+Math.imul(al6,bh3)|0;mid=mid+Math.imul(ah6,bl3)|0;hi=hi+Math.imul(ah6,bh3)|0;lo=lo+Math.imul(al5,bl4)|0;mid=mid+Math.imul(al5,bh4)|0;mid=mid+Math.imul(ah5,bl4)|0;hi=hi+Math.imul(ah5,bh4)|0;lo=lo+Math.imul(al4,bl5)|0;mid=mid+Math.imul(al4,bh5)|0;mid=mid+Math.imul(ah4,bl5)|0;hi=hi+Math.imul(ah4,bh5)|0;lo=lo+Math.imul(al3,bl6)|0;mid=mid+Math.imul(al3,bh6)|0;mid=mid+Math.imul(ah3,bl6)|0;hi=hi+Math.imul(ah3,bh6)|0;lo=lo+Math.imul(al2,bl7)|0;mid=mid+Math.imul(al2,bh7)|0;mid=mid+Math.imul(ah2,bl7)|0;hi=hi+Math.imul(ah2,bh7)|0;lo=lo+Math.imul(al1,bl8)|0;mid=mid+Math.imul(al1,bh8)|0;mid=mid+Math.imul(ah1,bl8)|0;hi=hi+Math.imul(ah1,bh8)|0;lo=lo+Math.imul(al0,bl9)|0;mid=mid+Math.imul(al0,bh9)|0;mid=mid+Math.imul(ah0,bl9)|0;hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0;w9&=67108863;lo=Math.imul(al9,bl1);mid=Math.imul(al9,bh1);mid=mid+Math.imul(ah9,bl1)|0;hi=Math.imul(ah9,bh1);lo=lo+Math.imul(al8,bl2)|0;mid=mid+Math.imul(al8,bh2)|0;mid=mid+Math.imul(ah8,bl2)|0;hi=hi+Math.imul(ah8,bh2)|0;lo=lo+Math.imul(al7,bl3)|0;mid=mid+Math.imul(al7,bh3)|0;mid=mid+Math.imul(ah7,bl3)|0;hi=hi+Math.imul(ah7,bh3)|0;lo=lo+Math.imul(al6,bl4)|0;mid=mid+Math.imul(al6,bh4)|0;mid=mid+Math.imul(ah6,bl4)|0;hi=hi+Math.imul(ah6,bh4)|0;lo=lo+Math.imul(al5,bl5)|0;mid=mid+Math.imul(al5,bh5)|0;mid=mid+Math.imul(ah5,bl5)|0;hi=hi+Math.imul(ah5,bh5)|0;lo=lo+Math.imul(al4,bl6)|0;mid=mid+Math.imul(al4,bh6)|0;mid=mid+Math.imul(ah4,bl6)|0;hi=hi+Math.imul(ah4,bh6)|0;lo=lo+Math.imul(al3,bl7)|0;mid=mid+Math.imul(al3,bh7)|0;mid=mid+Math.imul(ah3,bl7)|0;hi=hi+Math.imul(ah3,bh7)|0;lo=lo+Math.imul(al2,bl8)|0;mid=mid+Math.imul(al2,bh8)|0;mid=mid+Math.imul(ah2,bl8)|0;hi=hi+Math.imul(ah2,bh8)|0;lo=lo+Math.imul(al1,bl9)|0;mid=mid+Math.imul(al1,bh9)|0;mid=mid+Math.imul(ah1,bl9)|0;hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0;w10&=67108863;lo=Math.imul(al9,bl2);mid=Math.imul(al9,bh2);mid=mid+Math.imul(ah9,bl2)|0;hi=Math.imul(ah9,bh2);lo=lo+Math.imul(al8,bl3)|0;mid=mid+Math.imul(al8,bh3)|0;mid=mid+Math.imul(ah8,bl3)|0;hi=hi+Math.imul(ah8,bh3)|0;lo=lo+Math.imul(al7,bl4)|0;mid=mid+Math.imul(al7,bh4)|0;mid=mid+Math.imul(ah7,bl4)|0;hi=hi+Math.imul(ah7,bh4)|0;lo=lo+Math.imul(al6,bl5)|0;mid=mid+Math.imul(al6,bh5)|0;mid=mid+Math.imul(ah6,bl5)|0;hi=hi+Math.imul(ah6,bh5)|0;lo=lo+Math.imul(al5,bl6)|0;mid=mid+Math.imul(al5,bh6)|0;mid=mid+Math.imul(ah5,bl6)|0;hi=hi+Math.imul(ah5,bh6)|0;lo=lo+Math.imul(al4,bl7)|0;mid=mid+Math.imul(al4,bh7)|0;mid=mid+Math.imul(ah4,bl7)|0;hi=hi+Math.imul(ah4,bh7)|0;lo=lo+Math.imul(al3,bl8)|0;mid=mid+Math.imul(al3,bh8)|0;mid=mid+Math.imul(ah3,bl8)|0;hi=hi+Math.imul(ah3,bh8)|0;lo=lo+Math.imul(al2,bl9)|0;mid=mid+Math.imul(al2,bh9)|0;mid=mid+Math.imul(ah2,bl9)|0;hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0;w11&=67108863;lo=Math.imul(al9,bl3);mid=Math.imul(al9,bh3);mid=mid+Math.imul(ah9,bl3)|0;hi=Math.imul(ah9,bh3);lo=lo+Math.imul(al8,bl4)|0;mid=mid+Math.imul(al8,bh4)|0;mid=mid+Math.imul(ah8,bl4)|0;hi=hi+Math.imul(ah8,bh4)|0;lo=lo+Math.imul(al7,bl5)|0;mid=mid+Math.imul(al7,bh5)|0;mid=mid+Math.imul(ah7,bl5)|0;hi=hi+Math.imul(ah7,bh5)|0;lo=lo+Math.imul(al6,bl6)|0;mid=mid+Math.imul(al6,bh6)|0;mid=mid+Math.imul(ah6,bl6)|0;hi=hi+Math.imul(ah6,bh6)|0;lo=lo+Math.imul(al5,bl7)|0;mid=mid+Math.imul(al5,bh7)|0;mid=mid+Math.imul(ah5,bl7)|0;hi=hi+Math.imul(ah5,bh7)|0;lo=lo+Math.imul(al4,bl8)|0;mid=mid+Math.imul(al4,bh8)|0;mid=mid+Math.imul(ah4,bl8)|0;hi=hi+Math.imul(ah4,bh8)|0;lo=lo+Math.imul(al3,bl9)|0;mid=mid+Math.imul(al3,bh9)|0;mid=mid+Math.imul(ah3,bl9)|0;hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0;w12&=67108863;lo=Math.imul(al9,bl4);mid=Math.imul(al9,bh4);mid=mid+Math.imul(ah9,bl4)|0;hi=Math.imul(ah9,bh4);lo=lo+Math.imul(al8,bl5)|0;mid=mid+Math.imul(al8,bh5)|0;mid=mid+Math.imul(ah8,bl5)|0;hi=hi+Math.imul(ah8,bh5)|0;lo=lo+Math.imul(al7,bl6)|0;mid=mid+Math.imul(al7,bh6)|0;mid=mid+Math.imul(ah7,bl6)|0;hi=hi+Math.imul(ah7,bh6)|0;lo=lo+Math.imul(al6,bl7)|0;mid=mid+Math.imul(al6,bh7)|0;mid=mid+Math.imul(ah6,bl7)|0;hi=hi+Math.imul(ah6,bh7)|0;lo=lo+Math.imul(al5,bl8)|0;mid=mid+Math.imul(al5,bh8)|0;mid=mid+Math.imul(ah5,bl8)|0;hi=hi+Math.imul(ah5,bh8)|0;lo=lo+Math.imul(al4,bl9)|0;mid=mid+Math.imul(al4,bh9)|0;mid=mid+Math.imul(ah4,bl9)|0;hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0;w13&=67108863;lo=Math.imul(al9,bl5);mid=Math.imul(al9,bh5);mid=mid+Math.imul(ah9,bl5)|0;hi=Math.imul(ah9,bh5);lo=lo+Math.imul(al8,bl6)|0;mid=mid+Math.imul(al8,bh6)|0;mid=mid+Math.imul(ah8,bl6)|0;hi=hi+Math.imul(ah8,bh6)|0;lo=lo+Math.imul(al7,bl7)|0;mid=mid+Math.imul(al7,bh7)|0;mid=mid+Math.imul(ah7,bl7)|0;hi=hi+Math.imul(ah7,bh7)|0;lo=lo+Math.imul(al6,bl8)|0;mid=mid+Math.imul(al6,bh8)|0;mid=mid+Math.imul(ah6,bl8)|0;hi=hi+Math.imul(ah6,bh8)|0;lo=lo+Math.imul(al5,bl9)|0;mid=mid+Math.imul(al5,bh9)|0;mid=mid+Math.imul(ah5,bl9)|0;hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0;w14&=67108863;lo=Math.imul(al9,bl6);mid=Math.imul(al9,bh6);mid=mid+Math.imul(ah9,bl6)|0;hi=Math.imul(ah9,bh6);lo=lo+Math.imul(al8,bl7)|0;mid=mid+Math.imul(al8,bh7)|0;mid=mid+Math.imul(ah8,bl7)|0;hi=hi+Math.imul(ah8,bh7)|0;lo=lo+Math.imul(al7,bl8)|0;mid=mid+Math.imul(al7,bh8)|0;mid=mid+Math.imul(ah7,bl8)|0;hi=hi+Math.imul(ah7,bh8)|0;lo=lo+Math.imul(al6,bl9)|0;mid=mid+Math.imul(al6,bh9)|0;mid=mid+Math.imul(ah6,bl9)|0;hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0;w15&=67108863;lo=Math.imul(al9,bl7);mid=Math.imul(al9,bh7);mid=mid+Math.imul(ah9,bl7)|0;hi=Math.imul(ah9,bh7);lo=lo+Math.imul(al8,bl8)|0;mid=mid+Math.imul(al8,bh8)|0;mid=mid+Math.imul(ah8,bl8)|0;hi=hi+Math.imul(ah8,bh8)|0;lo=lo+Math.imul(al7,bl9)|0;mid=mid+Math.imul(al7,bh9)|0;mid=mid+Math.imul(ah7,bl9)|0;hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0;w16&=67108863;lo=Math.imul(al9,bl8);mid=Math.imul(al9,bh8);mid=mid+Math.imul(ah9,bl8)|0;hi=Math.imul(ah9,bh8);lo=lo+Math.imul(al8,bl9)|0;mid=mid+Math.imul(al8,bh9)|0;mid=mid+Math.imul(ah8,bl9)|0;hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0;w17&=67108863;lo=Math.imul(al9,bl9);mid=Math.imul(al9,bh9);mid=mid+Math.imul(ah9,bl9)|0;hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w18>>>26)|0;w18&=67108863;o[0]=w0;o[1]=w1;o[2]=w2;o[3]=w3;o[4]=w4;o[5]=w5;o[6]=w6;o[7]=w7;o[8]=w8;o[9]=w9;o[10]=w10;o[11]=w11;o[12]=w12;o[13]=w13;o[14]=w14;o[15]=w15;o[16]=w16;o[17]=w17;o[18]=w18;if(c!==0){o[19]=c;out.length++}return out};if(!Math.imul){comb10MulTo=smallMulTo}function bigMulTo(self,num,out){out.negative=num.negative^self.negative;out.length=self.length+num.length;var carry=0;var hncarry=0;for(var k=0;k>>26)|0;hncarry+=ncarry>>>26;ncarry&=67108863}out.words[k]=rword;carry=ncarry;ncarry=hncarry}if(carry!==0){out.words[k]=carry}else{out.length--}return out.strip()}function jumboMulTo(self,num,out){var fftm=new FFTM;return fftm.mulp(self,num,out)}BN.prototype.mulTo=function mulTo(num,out){var res;var len=this.length+num.length;if(this.length===10&&num.length===10){res=comb10MulTo(this,num,out)}else if(len<63){res=smallMulTo(this,num,out)}else if(len<1024){res=bigMulTo(this,num,out)}else{res=jumboMulTo(this,num,out)}return res};function FFTM(x,y){this.x=x;this.y=y}FFTM.prototype.makeRBT=function makeRBT(N){var t=new Array(N);var l=BN.prototype._countBits(N)-1;for(var i=0;i>=1}return rb};FFTM.prototype.permute=function permute(rbt,rws,iws,rtws,itws,N){for(var i=0;i>>1){i++}return 1<>>13;rws[2*i+1]=carry&8191;carry=carry>>>13}for(i=2*len;i>=26;carry+=w/67108864|0;carry+=lo>>>26;this.words[i]=lo&67108863}if(carry!==0){this.words[i]=carry;this.length++}this.length=num===0?1:this.length;return this};BN.prototype.muln=function muln(num){return this.clone().imuln(num)};BN.prototype.sqr=function sqr(){return this.mul(this)};BN.prototype.isqr=function isqr(){return this.imul(this.clone())};BN.prototype.pow=function pow(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i=0;i=0);var r=bits%26;var s=(bits-r)/26;var carryMask=67108863>>>26-r<<26-r;var i;if(r!==0){var carry=0;for(i=0;i>>26-r}if(carry){this.words[i]=carry;this.length++}}if(s!==0){for(i=this.length-1;i>=0;i--){this.words[i+s]=this.words[i]}for(i=0;i=0);var h;if(hint){h=(hint-hint%26)/26}else{h=0}var r=bits%26;var s=Math.min((bits-r)/26,this.length);var mask=67108863^67108863>>>r<s){this.length-=s;for(i=0;i=0&&(carry!==0||i>=h);i--){var word=this.words[i]|0;this.words[i]=carry<<26-r|word>>>r;carry=word&mask}if(maskedWords&&carry!==0){maskedWords.words[maskedWords.length++]=carry}if(this.length===0){this.words[0]=0;this.length=1}return this.strip()};BN.prototype.ishrn=function ishrn(bits,hint,extended){assert(this.negative===0);return this.iushrn(bits,hint,extended)};BN.prototype.shln=function shln(bits){return this.clone().ishln(bits)};BN.prototype.ushln=function ushln(bits){return this.clone().iushln(bits)};BN.prototype.shrn=function shrn(bits){return this.clone().ishrn(bits)};BN.prototype.ushrn=function ushrn(bits){return this.clone().iushrn(bits)};BN.prototype.testn=function testn(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26;var s=(bit-r)/26;var q=1<=0);var r=bits%26;var s=(bits-r)/26;assert(this.negative===0,"imaskn works only with positive numbers");if(this.length<=s){return this}if(r!==0){s++}this.length=Math.min(s,this.length);if(r!==0){var mask=67108863^67108863>>>r<=67108864;i++){this.words[i]-=67108864;if(i===this.length-1){this.words[i+1]=1}else{this.words[i+1]++}}this.length=Math.max(this.length,i+1);return this};BN.prototype.isubn=function isubn(num){assert(typeof num==="number");assert(num<67108864);if(num<0)return this.iaddn(-num);if(this.negative!==0){this.negative=0;this.iaddn(num);this.negative=1;return this}this.words[0]-=num;if(this.length===1&&this.words[0]<0){this.words[0]=-this.words[0];this.negative=1}else{for(var i=0;i>26)-(right/67108864|0);this.words[i+shift]=w&67108863}for(;i>26;this.words[i+shift]=w&67108863}if(carry===0)return this.strip();assert(carry===-1);carry=0;for(i=0;i>26;this.words[i]=w&67108863}this.negative=1;return this.strip()};BN.prototype._wordDiv=function _wordDiv(num,mode){var shift=this.length-num.length;var a=this.clone();var b=num;var bhi=b.words[b.length-1]|0;var bhiBits=this._countBits(bhi);shift=26-bhiBits;if(shift!==0){b=b.ushln(shift);a.iushln(shift);bhi=b.words[b.length-1]|0}var m=a.length-b.length;var q;if(mode!=="mod"){q=new BN(null);q.length=m+1;q.words=new Array(q.length);for(var i=0;i=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863);a._ishlnsubmul(b,qj,j);while(a.negative!==0){qj--;a.negative=0;a._ishlnsubmul(b,1,j);if(!a.isZero()){a.negative^=1}}if(q){q.words[j]=qj}}if(q){q.strip()}a.strip();if(mode!=="div"&&shift!==0){a.iushrn(shift)}return{div:q||null,mod:a}};BN.prototype.divmod=function divmod(num,mode,positive){assert(!num.isZero());if(this.isZero()){return{div:new BN(0),mod:new BN(0)}}var div,mod,res;if(this.negative!==0&&num.negative===0){res=this.neg().divmod(num,mode);if(mode!=="mod"){div=res.div.neg()}if(mode!=="div"){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.iadd(num)}}return{div:div,mod:mod}}if(this.negative===0&&num.negative!==0){res=this.divmod(num.neg(),mode);if(mode!=="mod"){div=res.div.neg()}return{div:div,mod:res.mod}}if((this.negative&num.negative)!==0){res=this.neg().divmod(num.neg(),mode);if(mode!=="div"){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.isub(num)}}return{div:res.div,mod:mod}}if(num.length>this.length||this.cmp(num)<0){return{div:new BN(0),mod:this}}if(num.length===1){if(mode==="div"){return{div:this.divn(num.words[0]),mod:null}}if(mode==="mod"){return{div:null,mod:new BN(this.modn(num.words[0]))}}return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}}return this._wordDiv(num,mode)};BN.prototype.div=function div(num){return this.divmod(num,"div",false).div};BN.prototype.mod=function mod(num){return this.divmod(num,"mod",false).mod};BN.prototype.umod=function umod(num){return this.divmod(num,"mod",true).mod};BN.prototype.divRound=function divRound(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod;var half=num.ushrn(1);var r2=num.andln(1);var cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)};BN.prototype.modn=function modn(num){assert(num<=67108863);var p=(1<<26)%num;var acc=0;for(var i=this.length-1;i>=0;i--){acc=(p*acc+(this.words[i]|0))%num}return acc};BN.prototype.idivn=function idivn(num){assert(num<=67108863);var carry=0;for(var i=this.length-1;i>=0;i--){var w=(this.words[i]|0)+carry*67108864;this.words[i]=w/num|0;carry=w%num}return this.strip()};BN.prototype.divn=function divn(num){return this.clone().idivn(num)};BN.prototype.egcd=function egcd(p){assert(p.negative===0);assert(!p.isZero());var x=this;var y=p.clone();if(x.negative!==0){x=x.umod(p)}else{x=x.clone()}var A=new BN(1);var B=new BN(0);var C=new BN(0);var D=new BN(1);var g=0;while(x.isEven()&&y.isEven()){x.iushrn(1);y.iushrn(1);++g}var yp=y.clone();var xp=x.clone();while(!x.isZero()){for(var i=0,im=1;(x.words[0]&im)===0&&i<26;++i,im<<=1);if(i>0){x.iushrn(i);while(i-- >0){if(A.isOdd()||B.isOdd()){A.iadd(yp);B.isub(xp)}A.iushrn(1);B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd()){C.iadd(yp);D.isub(xp)}C.iushrn(1);D.iushrn(1)}}if(x.cmp(y)>=0){x.isub(y);A.isub(C);B.isub(D)}else{y.isub(x);C.isub(A);D.isub(B)}}return{a:C,b:D,gcd:y.iushln(g)}};BN.prototype._invmp=function _invmp(p){assert(p.negative===0);assert(!p.isZero());var a=this;var b=p.clone();if(a.negative!==0){a=a.umod(p)}else{a=a.clone()}var x1=new BN(1);var x2=new BN(0);var delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i=0,im=1;(a.words[0]&im)===0&&i<26;++i,im<<=1);if(i>0){a.iushrn(i);while(i-- >0){if(x1.isOdd()){x1.iadd(delta)}x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd()){x2.iadd(delta)}x2.iushrn(1)}}if(a.cmp(b)>=0){a.isub(b);x1.isub(x2)}else{b.isub(a);x2.isub(x1)}}var res;if(a.cmpn(1)===0){res=x1}else{res=x2}if(res.cmpn(0)<0){res.iadd(p)}return res};BN.prototype.gcd=function gcd(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone();var b=num.clone();a.negative=0;b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++){a.iushrn(1);b.iushrn(1)}do{while(a.isEven()){a.iushrn(1)}while(b.isEven()){b.iushrn(1)}var r=a.cmp(b);if(r<0){var t=a;a=b;b=t}else if(r===0||b.cmpn(1)===0){break}a.isub(b)}while(true);return b.iushln(shift)};BN.prototype.invm=function invm(num){return this.egcd(num).a.umod(num)};BN.prototype.isEven=function isEven(){return(this.words[0]&1)===0};BN.prototype.isOdd=function isOdd(){return(this.words[0]&1)===1};BN.prototype.andln=function andln(num){return this.words[0]&num};BN.prototype.bincn=function bincn(bit){assert(typeof bit==="number");var r=bit%26;var s=(bit-r)/26;var q=1<>>26;w&=67108863;this.words[i]=w}if(carry!==0){this.words[i]=carry;this.length++}return this};BN.prototype.isZero=function isZero(){return this.length===1&&this.words[0]===0};BN.prototype.cmpn=function cmpn(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1){res=1}else{if(negative){num=-num}assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:wnum.length)return 1;if(this.length=0;i--){var a=this.words[i]|0;var b=num.words[i]|0;if(a===b)continue;if(ab){res=1}break}return res};BN.prototype.gtn=function gtn(num){return this.cmpn(num)===1};BN.prototype.gt=function gt(num){return this.cmp(num)===1};BN.prototype.gten=function gten(num){return this.cmpn(num)>=0};BN.prototype.gte=function gte(num){return this.cmp(num)>=0};BN.prototype.ltn=function ltn(num){return this.cmpn(num)===-1};BN.prototype.lt=function lt(num){return this.cmp(num)===-1};BN.prototype.lten=function lten(num){return this.cmpn(num)<=0};BN.prototype.lte=function lte(num){return this.cmp(num)<=0};BN.prototype.eqn=function eqn(num){return this.cmpn(num)===0};BN.prototype.eq=function eq(num){return this.cmp(num)===0};BN.red=function red(num){return new Red(num)};BN.prototype.toRed=function toRed(ctx){assert(!this.red,"Already a number in reduction context");assert(this.negative===0,"red works only with positives");return ctx.convertTo(this)._forceRed(ctx)};BN.prototype.fromRed=function fromRed(){assert(this.red,"fromRed works only with numbers in reduction context");return this.red.convertFrom(this)};BN.prototype._forceRed=function _forceRed(ctx){this.red=ctx;return this};BN.prototype.forceRed=function forceRed(ctx){assert(!this.red,"Already a number in reduction context");return this._forceRed(ctx)};BN.prototype.redAdd=function redAdd(num){assert(this.red,"redAdd works only with red numbers");return this.red.add(this,num)};BN.prototype.redIAdd=function redIAdd(num){assert(this.red,"redIAdd works only with red numbers");return this.red.iadd(this,num)};BN.prototype.redSub=function redSub(num){assert(this.red,"redSub works only with red numbers");return this.red.sub(this,num)};BN.prototype.redISub=function redISub(num){assert(this.red,"redISub works only with red numbers");return this.red.isub(this,num)};BN.prototype.redShl=function redShl(num){assert(this.red,"redShl works only with red numbers");return this.red.shl(this,num)};BN.prototype.redMul=function redMul(num){assert(this.red,"redMul works only with red numbers");this.red._verify2(this,num);return this.red.mul(this,num)};BN.prototype.redIMul=function redIMul(num){assert(this.red,"redMul works only with red numbers");this.red._verify2(this,num);return this.red.imul(this,num)};BN.prototype.redSqr=function redSqr(){assert(this.red,"redSqr works only with red numbers");this.red._verify1(this);return this.red.sqr(this)};BN.prototype.redISqr=function redISqr(){assert(this.red,"redISqr works only with red numbers");this.red._verify1(this);return this.red.isqr(this)};BN.prototype.redSqrt=function redSqrt(){assert(this.red,"redSqrt works only with red numbers");this.red._verify1(this);return this.red.sqrt(this)};BN.prototype.redInvm=function redInvm(){assert(this.red,"redInvm works only with red numbers");this.red._verify1(this);return this.red.invm(this)};BN.prototype.redNeg=function redNeg(){assert(this.red,"redNeg works only with red numbers");this.red._verify1(this);return this.red.neg(this)};BN.prototype.redPow=function redPow(num){assert(this.red&&!num.red,"redPow(normalNum)");this.red._verify1(this);return this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name;this.p=new BN(p,16);this.n=this.p.bitLength();this.k=new BN(1).iushln(this.n).isub(this.p);this.tmp=this._tmp()}MPrime.prototype._tmp=function _tmp(){var tmp=new BN(null);tmp.words=new Array(Math.ceil(this.n/13));return tmp};MPrime.prototype.ireduce=function ireduce(num){var r=num;var rlen;do{this.split(r,this.tmp);r=this.imulK(r);r=r.iadd(this.tmp);rlen=r.bitLength()}while(rlen>this.n);var cmp=rlen0){r.isub(this.p)}else{if(r.strip!==undefined){r.strip()}else{r._strip()}}return r};MPrime.prototype.split=function split(input,out){input.iushrn(this.n,0,out)};MPrime.prototype.imulK=function imulK(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits(K256,MPrime);K256.prototype.split=function split(input,output){var mask=4194303;var outLen=Math.min(input.length,9);for(var i=0;i>>22;prev=next}prev>>>=22;input.words[i-10]=prev;if(prev===0&&input.length>10){input.length-=10}else{input.length-=9}};K256.prototype.imulK=function imulK(num){num.words[num.length]=0;num.words[num.length+1]=0;num.length+=2;var lo=0;for(var i=0;i>>=26;num.words[i]=lo;carry=hi}if(carry!==0){num.words[num.length++]=carry}return num};BN._prime=function prime(name){if(primes[name])return primes[name];var prime;if(name==="k256"){prime=new K256}else if(name==="p224"){prime=new P224}else if(name==="p192"){prime=new P192}else if(name==="p25519"){prime=new P25519}else{throw new Error("Unknown prime "+name)}primes[name]=prime;return prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p;this.prime=prime}else{assert(m.gtn(1),"modulus must be greater than 1");this.m=m;this.prime=null}}Red.prototype._verify1=function _verify1(a){assert(a.negative===0,"red works only with positives");assert(a.red,"red works only with red numbers")};Red.prototype._verify2=function _verify2(a,b){assert((a.negative|b.negative)===0,"red works only with positives");assert(a.red&&a.red===b.red,"red works only with red numbers")};Red.prototype.imod=function imod(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this)};Red.prototype.neg=function neg(a){if(a.isZero()){return a.clone()}return this.m.sub(a)._forceRed(this)};Red.prototype.add=function add(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0){res.isub(this.m)}return res._forceRed(this)};Red.prototype.iadd=function iadd(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0){res.isub(this.m)}return res};Red.prototype.sub=function sub(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0){res.iadd(this.m)}return res._forceRed(this)};Red.prototype.isub=function isub(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0){res.iadd(this.m)}return res};Red.prototype.shl=function shl(a,num){this._verify1(a);return this.imod(a.ushln(num))};Red.prototype.imul=function imul(a,b){this._verify2(a,b);return this.imod(a.imul(b))};Red.prototype.mul=function mul(a,b){this._verify2(a,b);return this.imod(a.mul(b))};Red.prototype.isqr=function isqr(a){return this.imul(a,a.clone())};Red.prototype.sqr=function sqr(a){return this.mul(a,a)};Red.prototype.sqrt=function sqrt(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);assert(mod3%2===1);if(mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1);var s=0;while(!q.isZero()&&q.andln(1)===0){s++;q.iushrn(1)}assert(!q.isZero());var one=new BN(1).toRed(this);var nOne=one.redNeg();var lpow=this.m.subn(1).iushrn(1);var z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0){z.redIAdd(nOne)}var c=this.pow(z,q);var r=this.pow(a,q.addn(1).iushrn(1));var t=this.pow(a,q);var m=s;while(t.cmp(one)!==0){var tmp=t;for(var i=0;tmp.cmp(one)!==0;i++){tmp=tmp.redSqr()}assert(i=0;i--){var word=num.words[i];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0]){res=this.sqr(res)}if(bit===0&¤t===0){currentLen=0;continue}current<<=1;current|=bit;currentLen++;if(currentLen!==windowSize&&(i!==0||j!==0))continue;res=this.mul(res,wnd[current]);currentLen=0;current=0}start=26}return res};Red.prototype.convertTo=function convertTo(num){var r=num.umod(this.m);return r===num?r.clone():r};Red.prototype.convertFrom=function convertFrom(num){var res=num.clone();res.red=null;return res};BN.mont=function mont(num){return new Mont(num)};function Mont(m){Red.call(this,m);this.shift=this.m.bitLength();if(this.shift%26!==0){this.shift+=26-this.shift%26}this.r=new BN(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)}inherits(Mont,Red);Mont.prototype.convertTo=function convertTo(num){return this.imod(num.ushln(this.shift))};Mont.prototype.convertFrom=function convertFrom(num){var r=this.imod(num.mul(this.rinv));r.red=null;return r};Mont.prototype.imul=function imul(a,b){if(a.isZero()||b.isZero()){a.words[0]=0;a.length=1;return a}var t=a.imul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m)}else if(u.cmpn(0)<0){res=u.iadd(this.m)}return res._forceRed(this)};Mont.prototype.mul=function mul(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m)}else if(u.cmpn(0)<0){res=u.iadd(this.m)}return res._forceRed(this)};Mont.prototype.invm=function invm(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module==="undefined"||module,this)},{buffer:2}],9:[function(require,module,exports){var r;module.exports=function rand(len){if(!r)r=new Rand(null);return r.generate(len)};function Rand(rand){this.rand=rand}module.exports.Rand=Rand;Rand.prototype.generate=function generate(len){return this._rand(len)};Rand.prototype._rand=function _rand(n){if(this.rand.getBytes)return this.rand.getBytes(n);var res=new Uint8Array(n);for(var i=0;i0){this.redN=null}else{this._maxwellTrick=true;this.redN=this.n.toRed(this.red)}}module.exports=BaseCurve;BaseCurve.prototype.point=function point(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function _fixedNafMul(p,k){assert(p.precomputed);var doubles=p._getDoubles();var naf=getNAF(k,1,this._bitLength);var I=(1<=j;l--)nafW=(nafW<<1)+naf[l];repr.push(nafW)}var a=this.jpoint(null,null,null);var b=this.jpoint(null,null,null);for(var i=I;i>0;i--){for(j=0;j=0;i--){for(var l=0;i>=0&&naf[i]===0;i--)l++;if(i>=0)l++;acc=acc.dblp(l);if(i<0)break;var z=naf[i];assert(z!==0);if(p.type==="affine"){if(z>0)acc=acc.mixedAdd(wnd[z-1>>1]);else acc=acc.mixedAdd(wnd[-z-1>>1].neg())}else{if(z>0)acc=acc.add(wnd[z-1>>1]);else acc=acc.add(wnd[-z-1>>1].neg())}}return p.type==="affine"?acc.toP():acc};BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(defW,points,coeffs,len,jacobianResult){var wndWidth=this._wnafT1;var wnd=this._wnafT2;var naf=this._wnafT3;var max=0;var i;var j;var p;for(i=0;i=1;i-=2){var a=i-1;var b=i;if(wndWidth[a]!==1||wndWidth[b]!==1){naf[a]=getNAF(coeffs[a],wndWidth[a],this._bitLength);naf[b]=getNAF(coeffs[b],wndWidth[b],this._bitLength);max=Math.max(naf[a].length,max);max=Math.max(naf[b].length,max);continue}var comb=[points[a],null,null,points[b]];if(points[a].y.cmp(points[b].y)===0){comb[1]=points[a].add(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg())}else if(points[a].y.cmp(points[b].y.redNeg())===0){comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].add(points[b].neg())}else{comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg())}var index=[-3,-1,-5,-7,0,7,5,1,3];var jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max);naf[a]=new Array(max);naf[b]=new Array(max);for(j=0;j=0;i--){var k=0;while(i>=0){var zero=true;for(j=0;j=0)k++;acc=acc.dblp(k);if(i<0)break;for(j=0;j0)p=wnd[j][z-1>>1];else if(z<0)p=wnd[j][-z-1>>1].neg();if(p.type==="affine")acc=acc.mixedAdd(p);else acc=acc.add(p)}}for(i=0;i=Math.ceil((k.bitLength()+1)/doubles.step)};BasePoint.prototype._getDoubles=function _getDoubles(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var doubles=[this];var acc=this;for(var i=0;i";return""};Point.prototype.isInfinity=function isInfinity(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point.prototype._extDbl=function _extDbl(){var a=this.x.redSqr();var b=this.y.redSqr();var c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a);var e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);var g=d.redAdd(b);var f=g.redSub(c);var h=d.redSub(b);var nx=e.redMul(f);var ny=g.redMul(h);var nt=e.redMul(h);var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)};Point.prototype._projDbl=function _projDbl(){var b=this.x.redAdd(this.y).redSqr();var c=this.x.redSqr();var d=this.y.redSqr();var nx;var ny;var nz;var e;var h;var j;if(this.curve.twisted){e=this.curve._mulA(c);var f=e.redAdd(d);if(this.zOne){nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));ny=f.redMul(e.redSub(d));nz=f.redSqr().redSub(f).redSub(f)}else{h=this.z.redSqr();j=f.redSub(h).redISub(h);nx=b.redSub(c).redISub(d).redMul(j);ny=f.redMul(e.redSub(d));nz=f.redMul(j)}}else{e=c.redAdd(d);h=this.curve._mulC(this.z).redSqr();j=e.redSub(h).redSub(h);nx=this.curve._mulC(b.redISub(e)).redMul(j);ny=this.curve._mulC(e).redMul(c.redISub(d));nz=e.redMul(j)}return this.curve.point(nx,ny,nz)};Point.prototype.dbl=function dbl(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()};Point.prototype._extAdd=function _extAdd(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x));var b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));var c=this.t.redMul(this.curve.dd).redMul(p.t);var d=this.z.redMul(p.z.redAdd(p.z));var e=b.redSub(a);var f=d.redSub(c);var g=d.redAdd(c);var h=b.redAdd(a);var nx=e.redMul(f);var ny=g.redMul(h);var nt=e.redMul(h);var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)};Point.prototype._projAdd=function _projAdd(p){var a=this.z.redMul(p.z);var b=a.redSqr();var c=this.x.redMul(p.x);var d=this.y.redMul(p.y);var e=this.curve.d.redMul(c).redMul(d);var f=b.redSub(e);var g=b.redAdd(e);var tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);var nx=a.redMul(f).redMul(tmp);var ny;var nz;if(this.curve.twisted){ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));nz=f.redMul(g)}else{ny=a.redMul(g).redMul(d.redSub(c));nz=this.curve._mulC(f).redMul(g)}return this.curve.point(nx,ny,nz)};Point.prototype.add=function add(p){if(this.isInfinity())return p;if(p.isInfinity())return this;if(this.curve.extended)return this._extAdd(p);else return this._projAdd(p)};Point.prototype.mul=function mul(k){if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else return this.curve._wnafMul(this,k)};Point.prototype.mulAdd=function mulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,false)};Point.prototype.jmulAdd=function jmulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,true)};Point.prototype.normalize=function normalize(){if(this.zOne)return this;var zi=this.z.redInvm();this.x=this.x.redMul(zi);this.y=this.y.redMul(zi);if(this.t)this.t=this.t.redMul(zi);this.z=this.curve.one;this.zOne=true;return this};Point.prototype.neg=function neg(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function getX(){this.normalize();return this.x.fromRed()};Point.prototype.getY=function getY(){this.normalize();return this.y.fromRed()};Point.prototype.eq=function eq(other){return this===other||this.getX().cmp(other.getX())===0&&this.getY().cmp(other.getY())===0};Point.prototype.eqXToP=function eqXToP(x){var rx=x.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(rx)===0)return true;var xc=x.clone();var t=this.curve.redN.redMul(this.z);for(;;){xc.iadd(this.curve.n);if(xc.cmp(this.curve.p)>=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add},{"../utils":24,"./base":11,"bn.js":8,inherits:39}],13:[function(require,module,exports){"use strict";var curve=exports;curve.base=require("./base");curve.short=require("./short");curve.mont=require("./mont");curve.edwards=require("./edwards")},{"./base":11,"./edwards":12,"./mont":14,"./short":15}],14:[function(require,module,exports){"use strict";var BN=require("bn.js");var inherits=require("inherits");var Base=require("./base");var utils=require("../utils");function MontCurve(conf){Base.call(this,"mont",conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.b,16).toRed(this.red);this.i4=new BN(4).toRed(this.red).redInvm();this.two=new BN(2).toRed(this.red);this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits(MontCurve,Base);module.exports=MontCurve;MontCurve.prototype.validate=function validate(point){var x=point.normalize().x;var x2=x.redSqr();var rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);var y=rhs.redSqrt();return y.redSqr().cmp(rhs)===0};function Point(curve,x,z){Base.BasePoint.call(this,curve,"projective");if(x===null&&z===null){this.x=this.curve.one;this.z=this.curve.zero}else{this.x=new BN(x,16);this.z=new BN(z,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}inherits(Point,Base.BasePoint);MontCurve.prototype.decodePoint=function decodePoint(bytes,enc){return this.point(utils.toArray(bytes,enc),1)};MontCurve.prototype.point=function point(x,z){return new Point(this,x,z)};MontCurve.prototype.pointFromJSON=function pointFromJSON(obj){return Point.fromJSON(this,obj)};Point.prototype.precompute=function precompute(){};Point.prototype._encode=function _encode(){return this.getX().toArray("be",this.curve.p.byteLength())};Point.fromJSON=function fromJSON(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)};Point.prototype.inspect=function inspect(){if(this.isInfinity())return"";return""};Point.prototype.isInfinity=function isInfinity(){return this.z.cmpn(0)===0};Point.prototype.dbl=function dbl(){var a=this.x.redAdd(this.z);var aa=a.redSqr();var b=this.x.redSub(this.z);var bb=b.redSqr();var c=aa.redSub(bb);var nx=aa.redMul(bb);var nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)};Point.prototype.add=function add(){throw new Error("Not supported on Montgomery curve")};Point.prototype.diffAdd=function diffAdd(p,diff){var a=this.x.redAdd(this.z);var b=this.x.redSub(this.z);var c=p.x.redAdd(p.z);var d=p.x.redSub(p.z);var da=d.redMul(a);var cb=c.redMul(b);var nx=diff.z.redMul(da.redAdd(cb).redSqr());var nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)};Point.prototype.mul=function mul(k){var t=k.clone();var a=this;var b=this.curve.point(null,null);var c=this;for(var bits=[];t.cmpn(0)!==0;t.iushrn(1))bits.push(t.andln(1));for(var i=bits.length-1;i>=0;i--){if(bits[i]===0){a=a.diffAdd(b,c);b=b.dbl()}else{b=a.diffAdd(b,c);a=a.dbl()}}return b};Point.prototype.mulAdd=function mulAdd(){throw new Error("Not supported on Montgomery curve")};Point.prototype.jumlAdd=function jumlAdd(){throw new Error("Not supported on Montgomery curve")};Point.prototype.eq=function eq(other){return this.getX().cmp(other.getX())===0};Point.prototype.normalize=function normalize(){this.x=this.x.redMul(this.z.redInvm());this.z=this.curve.one;return this};Point.prototype.getX=function getX(){this.normalize();return this.x.fromRed()}},{"../utils":24,"./base":11,"bn.js":8,inherits:39}],15:[function(require,module,exports){"use strict";var utils=require("../utils");var BN=require("bn.js");var inherits=require("inherits");var Base=require("./base");var assert=utils.assert;function ShortCurve(conf){Base.call(this,"short",conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.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(conf);this._endoWnafT1=new Array(4);this._endoWnafT2=new Array(4)}inherits(ShortCurve,Base);module.exports=ShortCurve;ShortCurve.prototype._getEndomorphism=function _getEndomorphism(conf){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var beta;var lambda;if(conf.beta){beta=new BN(conf.beta,16).toRed(this.red)}else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1];beta=beta.toRed(this.red)}if(conf.lambda){lambda=new BN(conf.lambda,16)}else{var lambdas=this._getEndoRoots(this.n);if(this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))===0){lambda=lambdas[0]}else{lambda=lambdas[1];assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))===0)}}var basis;if(conf.basis){basis=conf.basis.map((function(vec){return{a:new BN(vec.a,16),b:new BN(vec.b,16)}}))}else{basis=this._getEndoBasis(lambda)}return{beta:beta,lambda:lambda,basis:basis}};ShortCurve.prototype._getEndoRoots=function _getEndoRoots(num){var red=num===this.p?this.red:BN.mont(num);var tinv=new BN(2).toRed(red).redInvm();var ntinv=tinv.redNeg();var s=new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);var l1=ntinv.redAdd(s).fromRed();var l2=ntinv.redSub(s).fromRed();return[l1,l2]};ShortCurve.prototype._getEndoBasis=function _getEndoBasis(lambda){var aprxSqrt=this.n.ushrn(Math.floor(this.n.bitLength()/2));var u=lambda;var v=this.n.clone();var x1=new BN(1);var y1=new BN(0);var x2=new BN(0);var y2=new BN(1);var a0;var b0;var a1;var b1;var a2;var b2;var prevR;var i=0;var r;var x;while(u.cmpn(0)!==0){var q=v.div(u);r=v.sub(q.mul(u));x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0){a0=prevR.neg();b0=x1;a1=r.neg();b1=x}else if(a1&&++i===2){break}prevR=r;v=u;u=r;x2=x1;x1=x;y2=y1;y1=y}a2=r.neg();b2=x;var len1=a1.sqr().add(b1.sqr());var len2=a2.sqr().add(b2.sqr());if(len2.cmp(len1)>=0){a2=a0;b2=b0}if(a1.negative){a1=a1.neg();b1=b1.neg()}if(a2.negative){a2=a2.neg();b2=b2.neg()}return[{a:a1,b:b1},{a:a2,b:b2}]};ShortCurve.prototype._endoSplit=function _endoSplit(k){var basis=this.endo.basis;var v1=basis[0];var v2=basis[1];var c1=v2.b.mul(k).divRound(this.n);var c2=v1.b.neg().mul(k).divRound(this.n);var p1=c1.mul(v1.a);var p2=c2.mul(v2.a);var q1=c1.mul(v1.b);var q2=c2.mul(v2.b);var k1=k.sub(p1).sub(p2);var k2=q1.add(q2).neg();return{k1:k1,k2:k2}};ShortCurve.prototype.pointFromX=function pointFromX(x,odd){x=new BN(x,16);if(!x.red)x=x.toRed(this.red);var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);var y=y2.redSqrt();if(y.redSqr().redSub(y2).cmp(this.zero)!==0)throw new Error("invalid point");var isOdd=y.fromRed().isOdd();if(odd&&!isOdd||!odd&&isOdd)y=y.redNeg();return this.point(x,y)};ShortCurve.prototype.validate=function validate(point){if(point.inf)return true;var x=point.x;var y=point.y;var ax=this.a.redMul(x);var rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return y.redSqr().redISub(rhs).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function _endoWnafMulAdd(points,coeffs,jacobianResult){var npoints=this._endoWnafT1;var ncoeffs=this._endoWnafT2;for(var i=0;i";return""};Point.prototype.isInfinity=function isInfinity(){return this.inf};Point.prototype.add=function add(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(this.x.cmp(p.x)===0)return this.curve.point(null,null);var c=this.y.redSub(p.y);if(c.cmpn(0)!==0)c=c.redMul(this.x.redSub(p.x).redInvm());var nx=c.redSqr().redISub(this.x).redISub(p.x);var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)};Point.prototype.dbl=function dbl(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(ys1.cmpn(0)===0)return this.curve.point(null,null);var a=this.curve.a;var x2=this.x.redSqr();var dyinv=ys1.redInvm();var c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);var nx=c.redSqr().redISub(this.x.redAdd(this.x));var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)};Point.prototype.getX=function getX(){return this.x.fromRed()};Point.prototype.getY=function getY(){return this.y.fromRed()};Point.prototype.mul=function mul(k){k=new BN(k,16);if(this.isInfinity())return this;else if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[k]);else return this.curve._wnafMul(this,k)};Point.prototype.mulAdd=function mulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs);else return this.curve._wnafMulAdd(1,points,coeffs,2)};Point.prototype.jmulAdd=function jmulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs,true);else return this.curve._wnafMulAdd(1,points,coeffs,2,true)};Point.prototype.eq=function eq(p){return this===p||this.inf===p.inf&&(this.inf||this.x.cmp(p.x)===0&&this.y.cmp(p.y)===0)};Point.prototype.neg=function neg(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed;var negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}}}return res};Point.prototype.toJ=function toJ(){if(this.inf)return this.curve.jpoint(null,null,null);var res=this.curve.jpoint(this.x,this.y,this.curve.one);return res};function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,"jacobian");if(x===null&&y===null&&z===null){this.x=this.curve.one;this.y=this.curve.one;this.z=new BN(0)}else{this.x=new BN(x,16);this.y=new BN(y,16);this.z=new BN(z,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}inherits(JPoint,Base.BasePoint);ShortCurve.prototype.jpoint=function jpoint(x,y,z){return new JPoint(this,x,y,z)};JPoint.prototype.toP=function toP(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm();var zinv2=zinv.redSqr();var ax=this.x.redMul(zinv2);var ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)};JPoint.prototype.neg=function neg(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function add(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr();var z2=this.z.redSqr();var u1=this.x.redMul(pz2);var u2=p.x.redMul(z2);var s1=this.y.redMul(pz2.redMul(p.z));var s2=p.y.redMul(z2.redMul(this.z));var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl()}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.mixedAdd=function mixedAdd(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr();var u1=this.x;var u2=p.x.redMul(z2);var s1=this.y;var s2=p.y.redMul(z2).redMul(this.z);var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl()}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.dblp=function dblp(pow){if(pow===0)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();var i;if(this.curve.zeroA||this.curve.threeA){var r=this;for(i=0;i=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true}};JPoint.prototype.inspect=function inspect(){if(this.isInfinity())return"";return""};JPoint.prototype.isInfinity=function isInfinity(){return this.z.cmpn(0)===0}},{"../utils":24,"./base":11,"bn.js":8,inherits:39}],16:[function(require,module,exports){"use strict";var curves=exports;var hash=require("hash.js");var curve=require("./curve");var utils=require("./utils");var assert=utils.assert;function PresetCurve(options){if(options.type==="short")this.curve=new curve.short(options);else if(options.type==="edwards")this.curve=new curve.edwards(options);else this.curve=new curve.mont(options);this.g=this.curve.g;this.n=this.curve.n;this.hash=options.hash;assert(this.g.validate(),"Invalid curve");assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}curves.PresetCurve=PresetCurve;function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:true,enumerable:true,get:function(){var curve=new PresetCurve(options);Object.defineProperty(curves,name,{configurable:true,enumerable:true,value:curve});return curve}})}defineCurve("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:hash.sha256,gRed:false,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});defineCurve("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:hash.sha256,gRed:false,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});defineCurve("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:hash.sha256,gRed:false,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});defineCurve("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:hash.sha384,gRed:false,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"]});defineCurve("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:hash.sha512,gRed:false,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"]});defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:false,g:["9"]});defineCurve("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:hash.sha256,gRed:false,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require("./precomputed/secp256k1")}catch(e){pre=undefined}defineCurve("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:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:false,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})},{"./curve":13,"./precomputed/secp256k1":23,"./utils":24,"hash.js":26}],17:[function(require,module,exports){"use strict";var BN=require("bn.js");var HmacDRBG=require("hmac-drbg");var utils=require("../utils");var curves=require("../curves");var rand=require("brorand");var assert=utils.assert;var KeyPair=require("./key");var Signature=require("./signature");function EC(options){if(!(this instanceof EC))return new EC(options);if(typeof options==="string"){assert(Object.prototype.hasOwnProperty.call(curves,options),"Unknown curve "+options);options=curves[options]}if(options instanceof curves.PresetCurve)options={curve:options};this.curve=options.curve.curve;this.n=this.curve.n;this.nh=this.n.ushrn(1);this.g=this.curve.g;this.g=options.curve.g;this.g.precompute(options.curve.n.bitLength()+1);this.hash=options.hash||options.curve.hash}module.exports=EC;EC.prototype.keyPair=function keyPair(options){return new KeyPair(this,options)};EC.prototype.keyFromPrivate=function keyFromPrivate(priv,enc){return KeyPair.fromPrivate(this,priv,enc)};EC.prototype.keyFromPublic=function keyFromPublic(pub,enc){return KeyPair.fromPublic(this,pub,enc)};EC.prototype.genKeyPair=function genKeyPair(options){if(!options)options={};var drbg=new HmacDRBG({hash:this.hash,pers:options.pers,persEnc:options.persEnc||"utf8",entropy:options.entropy||rand(this.hash.hmacStrength),entropyEnc:options.entropy&&options.entropyEnc||"utf8",nonce:this.n.toArray()});var bytes=this.n.byteLength();var ns2=this.n.sub(new BN(2));for(;;){var priv=new BN(drbg.generate(bytes));if(priv.cmp(ns2)>0)continue;priv.iaddn(1);return this.keyFromPrivate(priv)}};EC.prototype._truncateToN=function _truncateToN(msg,truncOnly,bitLength){var byteLength;if(BN.isBN(msg)||typeof msg==="number"){msg=new BN(msg,16);byteLength=msg.byteLength()}else if(typeof msg==="object"){byteLength=msg.length;msg=new BN(msg,16)}else{var str=msg.toString();byteLength=str.length+1>>>1;msg=new BN(str,16)}if(typeof bitLength!=="number"){bitLength=byteLength*8}var delta=bitLength-this.n.bitLength();if(delta>0)msg=msg.ushrn(delta);if(!truncOnly&&msg.cmp(this.n)>=0)return msg.sub(this.n);else return msg};EC.prototype.sign=function sign(msg,key,enc,options){if(typeof enc==="object"){options=enc;enc=null}if(!options)options={};if(typeof msg!=="string"&&typeof msg!=="number"&&!BN.isBN(msg)){assert(typeof msg==="object"&&msg&&typeof msg.length==="number","Expected message to be an array-like, a hex string, or a BN instance");assert(msg.length>>>0===msg.length);for(var i=0;i=0)continue;var kp=this.g.mul(k);if(kp.isInfinity())continue;var kpX=kp.getX();var r=kpX.umod(this.n);if(r.cmpn(0)===0)continue;var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));s=s.umod(this.n);if(s.cmpn(0)===0)continue;var recoveryParam=(kp.getY().isOdd()?1:0)|(kpX.cmp(r)!==0?2:0);if(options.canonical&&s.cmp(this.nh)>0){s=this.n.sub(s);recoveryParam^=1}return new Signature({r:r,s:s,recoveryParam:recoveryParam})}};EC.prototype.verify=function verify(msg,signature,key,enc,options){if(!options)options={};msg=this._truncateToN(msg,false,options.msgBitLength);key=this.keyFromPublic(key,enc);signature=new Signature(signature,"hex");var r=signature.r;var s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return false;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return false;var sinv=s.invm(this.n);var u1=sinv.mul(msg).umod(this.n);var u2=sinv.mul(r).umod(this.n);var p;if(!this.curve._maxwellTrick){p=this.g.mulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;return p.getX().umod(this.n).cmp(r)===0}p=this.g.jmulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;return p.eqXToP(r)};EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits");signature=new Signature(signature,enc);var n=this.n;var e=new BN(msg);var r=signature.r;var s=signature.s;var isYOdd=j&1;var isSecondKey=j>>1;if(r.cmp(this.curve.p.umod(this.curve.n))>=0&&isSecondKey)throw new Error("Unable to find sencond key candinate");if(isSecondKey)r=this.curve.pointFromX(r.add(this.curve.n),isYOdd);else r=this.curve.pointFromX(r,isYOdd);var rInv=signature.r.invm(n);var s1=n.sub(e).mul(rInv).umod(n);var s2=s.mul(rInv).umod(n);return this.g.mulAdd(s1,r,s2)};EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){signature=new Signature(signature,enc);if(signature.recoveryParam!==null)return signature.recoveryParam;for(var i=0;i<4;i++){var Qprime;try{Qprime=this.recoverPubKey(e,signature,i)}catch(e){continue}if(Qprime.eq(Q))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":16,"../utils":24,"./key":18,"./signature":19,"bn.js":8,brorand:9,"hmac-drbg":38}],18:[function(require,module,exports){"use strict";var BN=require("bn.js");var utils=require("../utils");var assert=utils.assert;function KeyPair(ec,options){this.ec=ec;this.priv=null;this.pub=null;if(options.priv)this._importPrivate(options.priv,options.privEnc);if(options.pub)this._importPublic(options.pub,options.pubEnc)}module.exports=KeyPair;KeyPair.fromPublic=function fromPublic(ec,pub,enc){if(pub instanceof KeyPair)return pub;return new KeyPair(ec,{pub:pub,pubEnc:enc})};KeyPair.fromPrivate=function fromPrivate(ec,priv,enc){if(priv instanceof KeyPair)return priv;return new KeyPair(ec,{priv:priv,privEnc:enc})};KeyPair.prototype.validate=function validate(){var pub=this.getPublic();if(pub.isInfinity())return{result:false,reason:"Invalid public key"};if(!pub.validate())return{result:false,reason:"Public key is not a point"};if(!pub.mul(this.ec.curve.n).isInfinity())return{result:false,reason:"Public key * N != O"};return{result:true,reason:null}};KeyPair.prototype.getPublic=function getPublic(compact,enc){if(typeof compact==="string"){enc=compact;compact=null}if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!enc)return this.pub;return this.pub.encode(enc,compact)};KeyPair.prototype.getPrivate=function getPrivate(enc){if(enc==="hex")return this.priv.toString(16,2);else return this.priv};KeyPair.prototype._importPrivate=function _importPrivate(key,enc){this.priv=new BN(key,enc||16);this.priv=this.priv.umod(this.ec.curve.n)};KeyPair.prototype._importPublic=function _importPublic(key,enc){if(key.x||key.y){if(this.ec.curve.type==="mont"){assert(key.x,"Need x coordinate")}else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards"){assert(key.x&&key.y,"Need both x and y coordinate")}this.pub=this.ec.curve.point(key.x,key.y);return}this.pub=this.ec.curve.decodePoint(key,enc)};KeyPair.prototype.derive=function derive(pub){if(!pub.validate()){assert(pub.validate(),"public point not validated")}return pub.mul(this.priv).getX()};KeyPair.prototype.sign=function sign(msg,enc,options){return this.ec.sign(msg,this,enc,options)};KeyPair.prototype.verify=function verify(msg,signature,options){return this.ec.verify(msg,signature,this,undefined,options)};KeyPair.prototype.inspect=function inspect(){return""}},{"../utils":24,"bn.js":8}],19:[function(require,module,exports){"use strict";var BN=require("bn.js");var utils=require("../utils");var assert=utils.assert;function Signature(options,enc){if(options instanceof Signature)return options;if(this._importDER(options,enc))return;assert(options.r&&options.s,"Signature without r or s");this.r=new BN(options.r,16);this.s=new BN(options.s,16);if(options.recoveryParam===undefined)this.recoveryParam=null;else this.recoveryParam=options.recoveryParam}module.exports=Signature;function Position(){this.place=0}function getLength(buf,p){var initial=buf[p.place++];if(!(initial&128)){return initial}var octetLen=initial&15;if(octetLen===0||octetLen>4){return false}if(buf[p.place]===0){return false}var val=0;for(var i=0,off=p.place;i>>=0}if(val<=127){return false}p.place=off;return val}function rmPadding(buf){var i=0;var len=buf.length-1;while(!buf[i]&&!(buf[i+1]&128)&&i>>3);arr.push(octets|128);while(--octets){arr.push(len>>>(octets<<3)&255)}arr.push(len)}Signature.prototype.toDER=function toDER(enc){var r=this.r.toArray();var s=this.s.toArray();if(r[0]&128)r=[0].concat(r);if(s[0]&128)s=[0].concat(s);r=rmPadding(r);s=rmPadding(s);while(!s[0]&&!(s[1]&128)){s=s.slice(1)}var arr=[2];constructLength(arr,r.length);arr=arr.concat(r);arr.push(2);constructLength(arr,s.length);var backHalf=arr.concat(s);var res=[48];constructLength(res,backHalf.length);res=res.concat(backHalf);return utils.encode(res,enc)}},{"../utils":24,"bn.js":8}],20:[function(require,module,exports){"use strict";var hash=require("hash.js");var curves=require("../curves");var utils=require("../utils");var assert=utils.assert;var parseBytes=utils.parseBytes;var KeyPair=require("./key");var Signature=require("./signature");function EDDSA(curve){assert(curve==="ed25519","only tested with ed25519 so far");if(!(this instanceof EDDSA))return new EDDSA(curve);curve=curves[curve].curve;this.curve=curve;this.g=curve.g;this.g.precompute(curve.n.bitLength()+1);this.pointClass=curve.point().constructor;this.encodingLength=Math.ceil(curve.n.bitLength()/8);this.hash=hash.sha512}module.exports=EDDSA;EDDSA.prototype.sign=function sign(message,secret){message=parseBytes(message);var key=this.keyFromSecret(secret);var r=this.hashInt(key.messagePrefix(),message);var R=this.g.mul(r);var Rencoded=this.encodePoint(R);var s_=this.hashInt(Rencoded,key.pubBytes(),message).mul(key.priv());var S=r.add(s_).umod(this.curve.n);return this.makeSignature({R:R,S:S,Rencoded:Rencoded})};EDDSA.prototype.verify=function verify(message,sig,pub){message=parseBytes(message);sig=this.makeSignature(sig);if(sig.S().gte(sig.eddsa.curve.n)||sig.S().isNeg()){return false}var key=this.keyFromPublic(pub);var h=this.hashInt(sig.Rencoded(),key.pubBytes(),message);var SG=this.g.mul(sig.S());var RplusAh=sig.R().add(key.pub().mul(h));return RplusAh.eq(SG)};EDDSA.prototype.hashInt=function hashInt(){var hash=this.hash();for(var i=0;i(ws>>1)-1)z=(ws>>1)-mod;else z=mod;k.isubn(z)}else{z=0}naf[i]=z;k.iushrn(1)}return naf}utils.getNAF=getNAF;function getJSF(k1,k2){var jsf=[[],[]];k1=k1.clone();k2=k2.clone();var d1=0;var d2=0;var m8;while(k1.cmpn(-d1)>0||k2.cmpn(-d2)>0){var m14=k1.andln(3)+d1&3;var m24=k2.andln(3)+d2&3;if(m14===3)m14=-1;if(m24===3)m24=-1;var u1;if((m14&1)===0){u1=0}else{m8=k1.andln(7)+d1&7;if((m8===3||m8===5)&&m24===2)u1=-m14;else u1=m14}jsf[0].push(u1);var u2;if((m24&1)===0){u2=0}else{m8=k2.andln(7)+d2&7;if((m8===3||m8===5)&&m14===2)u2=-m24;else u2=m24}jsf[1].push(u2);if(2*d1===u1+1)d1=1-d1;if(2*d2===u2+1)d2=1-d2;k1.iushrn(1);k2.iushrn(1)}return jsf}utils.getJSF=getJSF;function cachedProperty(obj,name,computer){var key="_"+name;obj.prototype[name]=function cachedProperty(){return this[key]!==undefined?this[key]:this[key]=computer.call(this)}}utils.cachedProperty=cachedProperty;function parseBytes(bytes){return typeof bytes==="string"?utils.toArray(bytes,"hex"):bytes}utils.parseBytes=parseBytes;function intFromLE(bytes){return new BN(bytes,"hex","le")}utils.intFromLE=intFromLE},{"bn.js":8,"minimalistic-assert":42,"minimalistic-crypto-utils":43}],25:[function(require,module,exports){module.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"}}},{}],26:[function(require,module,exports){var hash=exports;hash.utils=require("./hash/utils");hash.common=require("./hash/common");hash.sha=require("./hash/sha");hash.ripemd=require("./hash/ripemd");hash.hmac=require("./hash/hmac");hash.sha1=hash.sha.sha1;hash.sha256=hash.sha.sha256;hash.sha224=hash.sha.sha224;hash.sha384=hash.sha.sha384;hash.sha512=hash.sha.sha512;hash.ripemd160=hash.ripemd.ripemd160},{"./hash/common":27,"./hash/hmac":28,"./hash/ripemd":29,"./hash/sha":30,"./hash/utils":37}],27:[function(require,module,exports){"use strict";var utils=require("./utils");var assert=require("minimalistic-assert");function BlockHash(){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}exports.BlockHash=BlockHash;BlockHash.prototype.update=function update(msg,enc){msg=utils.toArray(msg,enc);if(!this.pending)this.pending=msg;else this.pending=this.pending.concat(msg);this.pendingTotal+=msg.length;if(this.pending.length>=this._delta8){msg=this.pending;var r=msg.length%this._delta8;this.pending=msg.slice(msg.length-r,msg.length);if(this.pending.length===0)this.pending=null;msg=utils.join32(msg,0,msg.length-r,this.endian);for(var i=0;i>>24&255;res[i++]=len>>>16&255;res[i++]=len>>>8&255;res[i++]=len&255}else{res[i++]=len&255;res[i++]=len>>>8&255;res[i++]=len>>>16&255;res[i++]=len>>>24&255;res[i++]=0;res[i++]=0;res[i++]=0;res[i++]=0;for(t=8;tthis.blockSize)key=(new this.Hash).update(key).digest();assert(key.length<=this.blockSize);for(var i=key.length;i>>3}exports.g0_256=g0_256;function g1_256(x){return rotr32(x,17)^rotr32(x,19)^x>>>10}exports.g1_256=g1_256},{"../utils":37}],37:[function(require,module,exports){"use strict";var assert=require("minimalistic-assert");var inherits=require("inherits");exports.inherits=inherits;function isSurrogatePair(msg,i){if((msg.charCodeAt(i)&64512)!==55296){return false}if(i<0||i+1>=msg.length){return false}return(msg.charCodeAt(i+1)&64512)===56320}function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg==="string"){if(!enc){var p=0;for(var i=0;i>6|192;res[p++]=c&63|128}else if(isSurrogatePair(msg,i)){c=65536+((c&1023)<<10)+(msg.charCodeAt(++i)&1023);res[p++]=c>>18|240;res[p++]=c>>12&63|128;res[p++]=c>>6&63|128;res[p++]=c&63|128}else{res[p++]=c>>12|224;res[p++]=c>>6&63|128;res[p++]=c&63|128}}}else if(enc==="hex"){msg=msg.replace(/[^a-z0-9]+/gi,"");if(msg.length%2!==0)msg="0"+msg;for(i=0;i>>24|w>>>8&65280|w<<8&16711680|(w&255)<<24;return res>>>0}exports.htonl=htonl;function toHex32(msg,endian){var res="";for(var i=0;i>>0}return res}exports.join32=join32;function split32(msg,endian){var res=new Array(msg.length*4);for(var i=0,k=0;i>>24;res[k+1]=m>>>16&255;res[k+2]=m>>>8&255;res[k+3]=m&255}else{res[k+3]=m>>>24;res[k+2]=m>>>16&255;res[k+1]=m>>>8&255;res[k]=m&255}}return res}exports.split32=split32;function rotr32(w,b){return w>>>b|w<<32-b}exports.rotr32=rotr32;function rotl32(w,b){return w<>>32-b}exports.rotl32=rotl32;function sum32(a,b){return a+b>>>0}exports.sum32=sum32;function sum32_3(a,b,c){return a+b+c>>>0}exports.sum32_3=sum32_3;function sum32_4(a,b,c,d){return a+b+c+d>>>0}exports.sum32_4=sum32_4;function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0}exports.sum32_5=sum32_5;function sum64(buf,pos,ah,al){var bh=buf[pos];var bl=buf[pos+1];var lo=al+bl>>>0;var hi=(lo>>0;buf[pos+1]=lo}exports.sum64=sum64;function sum64_hi(ah,al,bh,bl){var lo=al+bl>>>0;var hi=(lo>>0}exports.sum64_hi=sum64_hi;function sum64_lo(ah,al,bh,bl){var lo=al+bl;return lo>>>0}exports.sum64_lo=sum64_lo;function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0}exports.sum64_4_hi=sum64_4_hi;function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){var lo=al+bl+cl+dl;return lo>>>0}exports.sum64_4_lo=sum64_4_lo;function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0}exports.sum64_5_hi=sum64_5_hi;function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var lo=al+bl+cl+dl+el;return lo>>>0}exports.sum64_5_lo=sum64_5_lo;function rotr64_hi(ah,al,num){var r=al<<32-num|ah>>>num;return r>>>0}exports.rotr64_hi=rotr64_hi;function rotr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.rotr64_lo=rotr64_lo;function shr64_hi(ah,al,num){return ah>>>num}exports.shr64_hi=shr64_hi;function shr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.shr64_lo=shr64_lo},{inherits:39,"minimalistic-assert":42}],38:[function(require,module,exports){"use strict";var hash=require("hash.js");var utils=require("minimalistic-crypto-utils");var assert=require("minimalistic-assert");function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash;this.predResist=!!options.predResist;this.outLen=this.hash.outSize;this.minEntropy=options.minEntropy||this.hash.hmacStrength;this._reseed=null;this.reseedInterval=null;this.K=null;this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc||"hex");var nonce=utils.toArray(options.nonce,options.nonceEnc||"hex");var pers=utils.toArray(options.pers,options.persEnc||"hex");assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits");this._init(entropy,nonce,pers)}module.exports=HmacDRBG;HmacDRBG.prototype._init=function init(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8);this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits");this._update(entropy.concat(add||[]));this._reseed=1};HmacDRBG.prototype.generate=function generate(len,enc,add,addEnc){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");if(typeof enc!=="string"){addEnc=add;add=enc;enc=null}if(add){add=utils.toArray(add,addEnc||"hex");this._update(add)}var temp=[];while(temp.length>>8&255;this._keystream[b++]=mix[i]>>>16&255;this._keystream[b++]=mix[i]>>>24&255}};JSChaCha20.prototype._quarterround=function(output,a,b,c,d){output[d]=this._rotl(output[d]^(output[a]+=output[b]),16);output[b]=this._rotl(output[b]^(output[c]+=output[d]),12);output[d]=this._rotl(output[d]^(output[a]+=output[b]),8);output[b]=this._rotl(output[b]^(output[c]+=output[d]),7);output[a]>>>=0;output[b]>>>=0;output[c]>>>=0;output[d]>>>=0};JSChaCha20.prototype._get32=function(data,index){return data[index++]^data[index++]<<8^data[index++]<<16^data[index]<<24};JSChaCha20.prototype._rotl=function(data,shift){return data<>>32-shift};JSChaCha20.prototype.encrypt=function(data){return this._update(data)};JSChaCha20.prototype.decrypt=function(data){return this._update(data)};JSChaCha20.prototype._update=function(data){if(!(data instanceof Uint8Array)||data.length===0){throw new Error("Data should be type of bytes (Uint8Array) and not empty!")}var output=new Uint8Array(data.length);for(var i=0;i>2]|=message[index]<>2]|=code<>2]|=(192|code>>6)<>2]|=(128|code&63)<=57344){blocks[i>>2]|=(224|code>>12)<>2]|=(128|code>>6&63)<>2]|=(128|code&63)<>2]|=(240|code>>18)<>2]|=(128|code>>12&63)<>2]|=(128|code>>6&63)<>2]|=(128|code&63)<=64){this.block=blocks[16];this.start=i-64;this.hash();this.hashed=true}else{this.start=i}}if(this.bytes>4294967295){this.hBytes+=this.bytes/4294967296<<0;this.bytes=this.bytes%4294967296}return this};Sha256.prototype.finalize=function(){if(this.finalized){return}this.finalized=true;var blocks=this.blocks,i=this.lastByteIndex;blocks[16]=this.block;blocks[i>>2]|=EXTRA[i&3];this.block=blocks[16];if(i>=56){if(!this.hashed){this.hash()}blocks[0]=this.block;blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0}blocks[14]=this.hBytes<<3|this.bytes>>>29;blocks[15]=this.bytes<<3;this.hash()};Sha256.prototype.hash=function(){var a=this.h0,b=this.h1,c=this.h2,d=this.h3,e=this.h4,f=this.h5,g=this.h6,h=this.h7,blocks=this.blocks,j,s0,s1,maj,t1,t2,ch,ab,da,cd,bc;for(j=16;j<64;++j){t1=blocks[j-15];s0=(t1>>>7|t1<<25)^(t1>>>18|t1<<14)^t1>>>3;t1=blocks[j-2];s1=(t1>>>17|t1<<15)^(t1>>>19|t1<<13)^t1>>>10;blocks[j]=blocks[j-16]+s0+blocks[j-7]+s1<<0}bc=b&c;for(j=0;j<64;j+=4){if(this.first){if(this.is224){ab=300032;t1=blocks[0]-1413257819;h=t1-150054599<<0;d=t1+24177077<<0}else{ab=704751109;t1=blocks[0]-210244248;h=t1-1521486534<<0;d=t1+143694565<<0}this.first=false}else{s0=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10);s1=(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7);ab=a&b;maj=ab^a&c^bc;ch=e&f^~e&g;t1=h+s1+ch+K[j]+blocks[j];t2=s0+maj;h=d+t1<<0;d=t1+t2<<0}s0=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10);s1=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7);da=d&a;maj=da^d&b^ab;ch=h&e^~h&f;t1=g+s1+ch+K[j+1]+blocks[j+1];t2=s0+maj;g=c+t1<<0;c=t1+t2<<0;s0=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10);s1=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7);cd=c&d;maj=cd^c&a^da;ch=g&h^~g&e;t1=f+s1+ch+K[j+2]+blocks[j+2];t2=s0+maj;f=b+t1<<0;b=t1+t2<<0;s0=(b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10);s1=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7);bc=b&c;maj=bc^b&d^cd;ch=f&g^~f&h;t1=e+s1+ch+K[j+3]+blocks[j+3];t2=s0+maj;e=a+t1<<0;a=t1+t2<<0}this.h0=this.h0+a<<0;this.h1=this.h1+b<<0;this.h2=this.h2+c<<0;this.h3=this.h3+d<<0;this.h4=this.h4+e<<0;this.h5=this.h5+f<<0;this.h6=this.h6+g<<0;this.h7=this.h7+h<<0};Sha256.prototype.hex=function(){this.finalize();var h0=this.h0,h1=this.h1,h2=this.h2,h3=this.h3,h4=this.h4,h5=this.h5,h6=this.h6,h7=this.h7;var hex=HEX_CHARS[h0>>28&15]+HEX_CHARS[h0>>24&15]+HEX_CHARS[h0>>20&15]+HEX_CHARS[h0>>16&15]+HEX_CHARS[h0>>12&15]+HEX_CHARS[h0>>8&15]+HEX_CHARS[h0>>4&15]+HEX_CHARS[h0&15]+HEX_CHARS[h1>>28&15]+HEX_CHARS[h1>>24&15]+HEX_CHARS[h1>>20&15]+HEX_CHARS[h1>>16&15]+HEX_CHARS[h1>>12&15]+HEX_CHARS[h1>>8&15]+HEX_CHARS[h1>>4&15]+HEX_CHARS[h1&15]+HEX_CHARS[h2>>28&15]+HEX_CHARS[h2>>24&15]+HEX_CHARS[h2>>20&15]+HEX_CHARS[h2>>16&15]+HEX_CHARS[h2>>12&15]+HEX_CHARS[h2>>8&15]+HEX_CHARS[h2>>4&15]+HEX_CHARS[h2&15]+HEX_CHARS[h3>>28&15]+HEX_CHARS[h3>>24&15]+HEX_CHARS[h3>>20&15]+HEX_CHARS[h3>>16&15]+HEX_CHARS[h3>>12&15]+HEX_CHARS[h3>>8&15]+HEX_CHARS[h3>>4&15]+HEX_CHARS[h3&15]+HEX_CHARS[h4>>28&15]+HEX_CHARS[h4>>24&15]+HEX_CHARS[h4>>20&15]+HEX_CHARS[h4>>16&15]+HEX_CHARS[h4>>12&15]+HEX_CHARS[h4>>8&15]+HEX_CHARS[h4>>4&15]+HEX_CHARS[h4&15]+HEX_CHARS[h5>>28&15]+HEX_CHARS[h5>>24&15]+HEX_CHARS[h5>>20&15]+HEX_CHARS[h5>>16&15]+HEX_CHARS[h5>>12&15]+HEX_CHARS[h5>>8&15]+HEX_CHARS[h5>>4&15]+HEX_CHARS[h5&15]+HEX_CHARS[h6>>28&15]+HEX_CHARS[h6>>24&15]+HEX_CHARS[h6>>20&15]+HEX_CHARS[h6>>16&15]+HEX_CHARS[h6>>12&15]+HEX_CHARS[h6>>8&15]+HEX_CHARS[h6>>4&15]+HEX_CHARS[h6&15];if(!this.is224){hex+=HEX_CHARS[h7>>28&15]+HEX_CHARS[h7>>24&15]+HEX_CHARS[h7>>20&15]+HEX_CHARS[h7>>16&15]+HEX_CHARS[h7>>12&15]+HEX_CHARS[h7>>8&15]+HEX_CHARS[h7>>4&15]+HEX_CHARS[h7&15]}return hex};Sha256.prototype.toString=Sha256.prototype.hex;Sha256.prototype.digest=function(){this.finalize();var h0=this.h0,h1=this.h1,h2=this.h2,h3=this.h3,h4=this.h4,h5=this.h5,h6=this.h6,h7=this.h7;var arr=[h0>>24&255,h0>>16&255,h0>>8&255,h0&255,h1>>24&255,h1>>16&255,h1>>8&255,h1&255,h2>>24&255,h2>>16&255,h2>>8&255,h2&255,h3>>24&255,h3>>16&255,h3>>8&255,h3&255,h4>>24&255,h4>>16&255,h4>>8&255,h4&255,h5>>24&255,h5>>16&255,h5>>8&255,h5&255,h6>>24&255,h6>>16&255,h6>>8&255,h6&255];if(!this.is224){arr.push(h7>>24&255,h7>>16&255,h7>>8&255,h7&255)}return arr};Sha256.prototype.array=Sha256.prototype.digest;Sha256.prototype.arrayBuffer=function(){this.finalize();var buffer=new ArrayBuffer(this.is224?28:32);var dataView=new DataView(buffer);dataView.setUint32(0,this.h0);dataView.setUint32(4,this.h1);dataView.setUint32(8,this.h2);dataView.setUint32(12,this.h3);dataView.setUint32(16,this.h4);dataView.setUint32(20,this.h5);dataView.setUint32(24,this.h6);if(!this.is224){dataView.setUint32(28,this.h7)}return buffer};function HmacSha256(key,is224,sharedMemory){var i,type=typeof key;if(type==="string"){var bytes=[],length=key.length,index=0,code;for(i=0;i>6;bytes[index++]=128|code&63}else if(code<55296||code>=57344){bytes[index++]=224|code>>12;bytes[index++]=128|code>>6&63;bytes[index++]=128|code&63}else{code=65536+((code&1023)<<10|key.charCodeAt(++i)&1023);bytes[index++]=240|code>>18;bytes[index++]=128|code>>12&63;bytes[index++]=128|code>>6&63;bytes[index++]=128|code&63}}key=bytes}else{if(type==="object"){if(key===null){throw new Error(ERROR)}else if(ARRAY_BUFFER&&key.constructor===ArrayBuffer){key=new Uint8Array(key)}else if(!Array.isArray(key)){if(!ARRAY_BUFFER||!ArrayBuffer.isView(key)){throw new Error(ERROR)}}}else{throw new Error(ERROR)}}if(key.length>64){key=new Sha256(is224,true).update(key).array()}var oKeyPad=[],iKeyPad=[];for(i=0;i<64;++i){var b=key[i]||0;oKeyPad[i]=92^b;iKeyPad[i]=54^b}Sha256.call(this,is224,sharedMemory);this.update(iKeyPad);this.oKeyPad=oKeyPad;this.inner=true;this.sharedMemory=sharedMemory}HmacSha256.prototype=new Sha256;HmacSha256.prototype.finalize=function(){Sha256.prototype.finalize.call(this);if(this.inner){this.inner=false;var innerHash=this.array();Sha256.call(this,this.is224,this.sharedMemory);this.update(this.oKeyPad);this.update(innerHash);Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports;exports.sha224=createMethod(true);exports.sha256.hmac=createHmacMethod();exports.sha224.hmac=createHmacMethod(true);if(COMMON_JS){module.exports=exports}else{root.sha256=exports.sha256;root.sha224=exports.sha224;if(AMD){define((function(){return exports}))}}})()}).call(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{_process:5}],42:[function(require,module,exports){module.exports=assert;function assert(val,msg){if(!val)throw new Error(msg||"Assertion failed")}assert.equal=function assertEqual(l,r,msg){if(l!=r)throw new Error(msg||"Assertion failed: "+l+" != "+r)}},{}],43:[function(require,module,exports){"use strict";var utils=exports;function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg!=="string"){for(var i=0;i>8;var lo=c&255;if(hi)res.push(hi,lo);else res.push(lo)}}return res}utils.toArray=toArray;function zero2(word){if(word.length===1)return"0"+word;else return word}utils.zero2=zero2;function toHex(msg){var res="";for(var i=0;i - + \ No newline at end of file diff --git a/web/main.js b/web/main.js index 26a6069..4205c42 100644 --- a/web/main.js +++ b/web/main.js @@ -10,7 +10,7 @@ import { openSettingsPanel, closeSettingsPanel, initSettings, notifyMessage } fr import { escapeHTML, textToHTML } from './util.string.js'; import { $, $$, $id, on, off, addClass, removeClass } from './util.dom.js'; -import './NodeCrypt.js'; +// import './NodeCrypt.js'; // === 核心功能模块导入 === import { @@ -49,7 +49,7 @@ import { * debug: 是否开启调试模式 */ window.config = { - wsAddress: '/ws', + wsAddress: 'ws://127.0.0.1:8088', debug: true };