From b23734a582f3f028004541edebe5091300a3dce9 Mon Sep 17 00:00:00 2001 From: yimingWOW <94727727+yimingWOW@users.noreply.github.com> Date: Sat, 11 Jan 2025 15:28:16 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20yimingWO?= =?UTF-8?q?W/fall@82bbb7746789453bae770df557903007cf958d6c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/events-CXH2uRM3.js | 1 - assets/index-5Gr8TjuG.js | 1 + assets/index-CcnsKYy9.js | 1 - assets/index-DMvpfBi2.js | 6 -- assets/index-dFR7CGs6.js | 8 -- assets/index-tHDsgEDA.css | 1 + assets/util-1Y60FSNK.js | 10 --- assets/vendor-C_X21sW7.js | 146 +++++++++++++++++++++++++++++++++++++ assets/vendor-CuhqgDVu.css | 1 + index.html | 16 ++++ 10 files changed, 165 insertions(+), 26 deletions(-) delete mode 100644 assets/events-CXH2uRM3.js create mode 100644 assets/index-5Gr8TjuG.js delete mode 100644 assets/index-CcnsKYy9.js delete mode 100644 assets/index-DMvpfBi2.js delete mode 100644 assets/index-dFR7CGs6.js create mode 100644 assets/index-tHDsgEDA.css delete mode 100644 assets/util-1Y60FSNK.js create mode 100644 assets/vendor-C_X21sW7.js create mode 100644 assets/vendor-CuhqgDVu.css create mode 100644 index.html diff --git a/assets/events-CXH2uRM3.js b/assets/events-CXH2uRM3.js deleted file mode 100644 index a71b5f6..0000000 --- a/assets/events-CXH2uRM3.js +++ /dev/null @@ -1 +0,0 @@ -var p={exports:{}},a=typeof Reflect=="object"?Reflect:null,d=a&&typeof a.apply=="function"?a.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},l;a&&typeof a.ownKeys=="function"?l=a.ownKeys:Object.getOwnPropertySymbols?l=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:l=function(e){return Object.getOwnPropertyNames(e)};function C(t){console&&console.warn&&console.warn(t)}var m=Number.isNaN||function(e){return e!==e};function o(){o.init.call(this)}p.exports=o;p.exports.once=M;o.EventEmitter=o;o.prototype._events=void 0;o.prototype._eventsCount=0;o.prototype._maxListeners=void 0;var L=10;function v(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return L},set:function(t){if(typeof t!="number"||t<0||m(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");L=t}});o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};o.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||m(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function y(t){return t._maxListeners===void 0?o.defaultMaxListeners:t._maxListeners}o.prototype.getMaxListeners=function(){return y(this)};o.prototype.emit=function(e){for(var n=[],r=1;r0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,x=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,C(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function j(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=j.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():R(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?N(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;r{for(const t of n)if(t.type==="childList")for(const r of t.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function a(n){const t={};return n.integrity&&(t.integrity=n.integrity),n.referrerPolicy&&(t.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?t.credentials="include":n.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function i(n){if(n.ep)return;n.ep=!0;const t=a(n);fetch(n.href,t)}})();const Be="3DNfsn8oRdET1qob8PsoKuWkZ78r6qTCWfMZskUmpJgL",Te={name:"fall",version:"0.1.0",spec:"0.1.0",description:"Created with Anchor"},Le=[{name:"borrow",discriminator:[228,253,131,202,207,116,89,18],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lending_pool_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_a",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrow_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[102]}]}},{name:"collateral_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[104]}]}},{name:"borrower_borrow_block_height_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[106]}]}},{name:"borrower",signer:!0},{name:"borrower_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"borrower"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_a",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"borrower"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_b",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"account",path:"borrower"},{kind:"const",value:[103]}]}},{name:"borrower_borrow_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"borrow_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_collateral_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"collateral_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_borrow_block_height_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"borrower_borrow_block_height_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"borrow_amount",type:"u64"}]},{name:"create_amm",discriminator:[242,91,21,170,5,68,125,64],accounts:[{name:"amm",writable:!0,pda:{seeds:[{kind:"arg",path:"id"}]}},{name:"admin"},{name:"payer",writable:!0,signer:!0},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"id",type:"pubkey"}]},{name:"create_pool",discriminator:[233,146,209,142,207,104,64,188],accounts:[{name:"amm",pda:{seeds:[{kind:"account",path:"amm.id",account:"Amm"}]}},{name:"mint_a"},{name:"mint_b"},{name:"pool",writable:!0,pda:{seeds:[{kind:"account",path:"amm"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"amm"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"},{kind:"const",value:[97]}]}},{name:"pool_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"pool_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"fee",type:"u16"}]},{name:"deposit_collateral",discriminator:[156,131,142,116,146,247,162,120],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lending_pool_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_b",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"collateral_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[104]}]}},{name:"borrower_borrow_block_height_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[106]}]}},{name:"borrower",signer:!0},{name:"borrower_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"borrower"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_b",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"account",path:"borrower"},{kind:"const",value:[103]}]}},{name:"borrower_collateral_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"collateral_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_borrow_block_height_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"borrower_borrow_block_height_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"amount",type:"u64"}]},{name:"deposit_liquidity",discriminator:[245,99,59,25,151,71,233,249],accounts:[{name:"pool",writable:!0,pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"},{kind:"const",value:[97]}]}},{name:"mint_a",relations:["pool"]},{name:"mint_b",relations:["pool"]},{name:"depositor",docs:["The account paying for all rents"],signer:!0},{name:"liquidity_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[98]}]}},{name:"pool_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"pool_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"depositor_account_liquidity",writable:!0,pda:{seeds:[{kind:"account",path:"depositor"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"liquidity_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"depositor_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"depositor"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"depositor_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"depositor"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",docs:["The account paying for all rents"],writable:!0,signer:!0},{name:"token_program",docs:["Solana ecosystem accounts"],address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"amount_a",type:"u64"},{name:"amount_b",type:"u64"}]},{name:"init_lending_pool_1",discriminator:[111,87,89,249,229,194,59,237],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"mint_a"},{name:"mint_b"},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lending_pool_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lending_pool_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[]},{name:"init_lending_pool_2",discriminator:[70,160,247,111,154,255,24,219],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lending_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[101]}]}},{name:"borrow_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[102]}]}},{name:"collateral_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[104]}]}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[]},{name:"init_lending_pool_3",discriminator:[226,110,186,213,63,178,83,62],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lender_lending_block_height_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[105]}]}},{name:"borrower_borrow_block_height_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[106]}]}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[]},{name:"lend",discriminator:[89,34,75,168,122,47,185,45],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lending_pool_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_a",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lending_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[101]}]}},{name:"lender_lending_block_height_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[105]}]}},{name:"lender",signer:!0},{name:"lender_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"lender"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_a",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lender_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"account",path:"lender"},{kind:"const",value:[103]}]}},{name:"lender_lend_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"lender_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"lending_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lender_lending_block_height_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"lender_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"lender_lending_block_height_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",docs:["The account paying for all rents"],writable:!0,signer:!0},{name:"token_program",docs:["Solana ecosystem accounts"],address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"user_lending_amount",type:"u64"}]},{name:"liquidate",discriminator:[223,179,226,125,48,46,39,74],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"},{kind:"const",value:[97]}]}},{name:"mint_a",relations:["pool"]},{name:"mint_b",relations:["pool"]},{name:"pool_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"pool_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"borrow_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[102]}]}},{name:"collateral_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[104]}]}},{name:"trader",signer:!0},{name:"trader_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"trader"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower"},{name:"borrower_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"account",path:"borrower"},{kind:"const",value:[103]}]}},{name:"borrower_borrow_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"borrow_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_collateral_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"collateral_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[]},{name:"price",discriminator:[129,85,239,229,61,225,218,20],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"},{kind:"const",value:[97]}]}},{name:"mint_a",relations:["pool"]},{name:"mint_b",relations:["pool"]},{name:"pool_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"pool_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"token_program",docs:["Solana ecosystem accounts"],address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[],returns:{defined:{name:"PriceResult"}}},{name:"redeem",discriminator:[184,12,86,149,70,196,97,225],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"},{kind:"const",value:[97]}]}},{name:"mint_a"},{name:"mint_b"},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lending_pool_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"pool.mint_a",account:"Pool"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lending_pool_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lending_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[101]}]}},{name:"borrow_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[102]}]}},{name:"lender_lending_block_height_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[105]}]}},{name:"lender",signer:!0},{name:"lender_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"lender"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lender_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"lender"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lender_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"account",path:"lender"},{kind:"const",value:[103]}]}},{name:"lender_lending_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"lender_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"lending_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lender_lending_block_height_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"lender_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"lender_lending_block_height_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[]},{name:"repay",discriminator:[234,103,67,82,208,234,219,166],accounts:[{name:"mint_a"},{name:"mint_b"},{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"},{kind:"const",value:[97]}]}},{name:"lending_pool_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[100]}]}},{name:"lending_pool_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"lending_pool_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"lending_pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrow_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[102]}]}},{name:"collateral_receipt_token_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[104]}]}},{name:"borrower_borrow_block_height_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[106]}]}},{name:"borrower",signer:!0},{name:"borrower_token_a",writable:!0,pda:{seeds:[{kind:"account",path:"borrower"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_token_b",writable:!0,pda:{seeds:[{kind:"account",path:"borrower"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_authority",pda:{seeds:[{kind:"account",path:"pool"},{kind:"account",path:"borrower"},{kind:"const",value:[103]}]}},{name:"borrower_borrow_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"borrow_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_collateral_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"collateral_receipt_token_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"borrower_borrow_block_height_receipt_token",writable:!0,pda:{seeds:[{kind:"account",path:"borrower_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"borrower_borrow_block_height_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[]},{name:"swap_exact_tokens_for_tokens",discriminator:[249,86,253,50,177,221,73,162],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"},{kind:"const",value:[97]}]}},{name:"mint_a",relations:["pool"]},{name:"mint_b",relations:["pool"]},{name:"pool_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"pool_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"trader",signer:!0},{name:"trader_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"trader"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"trader_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"trader"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",writable:!0,signer:!0},{name:"token_program",address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"swap_a",type:"bool"},{name:"input_amount",type:"u64"},{name:"min_output_amount",type:"u64"}]},{name:"withdraw_liquidity",discriminator:[149,158,33,185,47,243,253,31],accounts:[{name:"pool",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"pool.mint_a",account:"Pool"},{kind:"account",path:"pool.mint_b",account:"Pool"}]}},{name:"pool_authority",pda:{seeds:[{kind:"account",path:"pool.amm",account:"Pool"},{kind:"account",path:"mint_a"},{kind:"account",path:"mint_b"},{kind:"const",value:[97]}]}},{name:"depositor",signer:!0},{name:"liquidity_mint",writable:!0,pda:{seeds:[{kind:"account",path:"pool"},{kind:"const",value:[98]}]}},{name:"mint_a",writable:!0,relations:["pool"]},{name:"mint_b",writable:!0,relations:["pool"]},{name:"pool_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"pool_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"pool_authority"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"depositor_account_liquidity",writable:!0,pda:{seeds:[{kind:"account",path:"depositor"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"liquidity_mint"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"depositor_account_a",writable:!0,pda:{seeds:[{kind:"account",path:"depositor"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_a"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"depositor_account_b",writable:!0,pda:{seeds:[{kind:"account",path:"depositor"},{kind:"const",value:[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{kind:"account",path:"mint_b"}],program:{kind:"const",value:[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{name:"payer",docs:["The account paying for all rents"],writable:!0,signer:!0},{name:"token_program",docs:["Solana ecosystem accounts"],address:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{name:"associated_token_program",address:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{name:"system_program",address:"11111111111111111111111111111111"}],args:[{name:"amount",type:"u64"}]}],Ee=[{name:"Amm",discriminator:[143,245,200,17,74,214,196,135]},{name:"Pool",discriminator:[241,154,109,4,17,177,109,188]}],Ie=[{code:6e3,name:"CalculationError",msg:"Calculation error"},{code:6001,name:"CalculationError1",msg:"Calculation error"},{code:6002,name:"InvalidFee",msg:"Invalid fee"}],Ce=[{name:"Amm",type:{kind:"struct",fields:[{name:"id",docs:["The primary key of the AMM"],type:"pubkey"},{name:"admin",docs:["Account that has admin authority over the AMM"],type:"pubkey"}]}},{name:"Pool",type:{kind:"struct",fields:[{name:"amm",docs:["Primary key of the AMM"],type:"pubkey"},{name:"mint_a",docs:["Mint of token A"],type:"pubkey"},{name:"mint_b",docs:["Mint of token B"],type:"pubkey"},{name:"fee",docs:["The LP fee taken on each trade, in basis points"],type:"u16"},{name:"token_a_amount",docs:["借贷池中token a的数量"],type:"u64"},{name:"token_b_amount",docs:["借贷池中token b的数量"],type:"u64"},{name:"min_collateral_ratio",docs:["最小抵押率 (基点表示,20000 = 200%)"],type:"u64"},{name:"borrow_interest_accumulator_block_height",docs:["记录上次借贷池interest_step更新时的区块高度"],type:"u64"},{name:"borrow_interest_accumulator",docs:["借款累计利息,随着区块高度增加而增加,但是增加幅度与资金借出量正相关"],type:"u64"},{name:"share_lending_block_height",docs:["共享借贷累加器区块高度"],type:"u64"},{name:"share_lending_accumulator",docs:["共享借贷累加器,资金借出量的时间积分"],type:"u64"}]}},{name:"PriceResult",type:{kind:"struct",fields:[{name:"token_a_amount",type:"u64"},{name:"token_b_amount",type:"u64"}]}}],Re=[{name:"AUTHORITY_SEED",type:"bytes",value:"[97]"},{name:"BASE_RATE",type:"u64",value:"10000"},{name:"BORROWER_AUTHORITY_SEED",type:"bytes",value:"[103]"},{name:"BORROWER_BORROW_BLOCK_HEIGHT_TOKEN_SEED",type:"bytes",value:"[106]"},{name:"BORROW_TOKEN_SEED",type:"bytes",value:"[102]"},{name:"COLLATERAL_TOKEN_SEED",type:"bytes",value:"[104]"},{name:"LENDER_LENDING_BLOCK_HEIGHT_TOKEN_SEED",type:"bytes",value:"[105]"},{name:"LENDING_AUTHORITY_SEED",type:"bytes",value:"[100]"},{name:"LENDING_TOKEN_SEED",type:"bytes",value:"[101]"},{name:"LIQUIDITY_SEED",type:"bytes",value:"[98]"},{name:"MINIMUM_LIQUIDITY",type:"u64",value:"100"},{name:"MIN_COLLATERAL_RATIO_BASE",type:"u64",value:"10000"}],j={address:Be,metadata:Te,instructions:Le,accounts:Ee,errors:Ie,types:Ce,constants:Re};async function De(o,s,a){try{const i=new C(s,o,{preflightCommitment:"confirmed"}),n=new R(j,i),[t]=p.findProgramAddressSync([a.toBuffer()],n.programId);return await n.methods.createAmm(a).accounts({amm:t,admin:i.wallet.publicKey,payer:i.wallet.publicKey,systemProgram:T.programId}).rpc()}catch(i){throw console.error("Error details:",i),i}}const Fe=()=>{const o=I(),{connection:s}=P(),[a,i]=k.useState(""),[n,t]=k.useState("500"),[r,m]=k.useState(!1),[l,g]=k.useState(""),u=async c=>{if(c.preventDefault(),i(""),m(!0),!o){i("Please connect your wallet first"),m(!1);return}const d=Number(n);if(d<1||d>1e4){i("Fee must be between 1 and 10000"),m(!1);return}try{const h=p.unique(),b=await De(o,s,h);console.log(`Transaction URL: https://explorer.solana.com/tx/${b}`),g(h.toString()),t("500")}catch(h){console.error("Error creating AMM:",h),i(h instanceof Error?h.message:"Failed to create AMM. Please try again.")}finally{m(!1)}};return e.jsxs("div",{className:"create-amm-container",children:[a&&e.jsx("div",{className:"error-message",children:a}),l&&e.jsxs("div",{className:"success-message",children:["AMM created successfully! ID: ",l]}),e.jsx("form",{onSubmit:u,className:"form",children:e.jsx("button",{type:"submit",className:"submit-button",disabled:r||!o,children:r?"Creating...":"Create AMM"})})]})},Me=async(o,s)=>{console.log("Getting AMM accounts connection:",s);const a=new C(s,o,{preflightCommitment:"confirmed"}),n=await new R(j,a).account.amm.all();for(const t of n)console.log("AMM Account Details:",{publicKey:t.publicKey.toString(),id:t.account.id.toString(),admin:t.account.admin.toString()});return n.map(t=>({pubkey:t.publicKey.toString(),ammid:t.account.id.toString()}))},me=k.createContext(void 0),qe=({children:o})=>{const[s,a]=k.useState(null);return e.jsx(me.Provider,{value:{amm:s,setAmm:a},children:o})},ie=()=>{const o=k.useContext(me);if(!o)throw new Error("useAmm must be used within an AmmProvider");return o},Ke=()=>{const o=I(),{connection:s}=P(),[a,i]=k.useState([]),[n,t]=k.useState(!1),[r,m]=k.useState(""),{setAmm:l}=ie(),g=async()=>{if(o){t(!0);try{const c=await Me(o,s);i(c),c.length>0&&l(c[0])}catch(c){console.error("Error fetching AMMs:",c),m(c instanceof Error?c.message:"Failed to fetch AMMs")}finally{t(!1)}}};k.useEffect(()=>{g()},[o,s]);const u=c=>{l(c)};return e.jsxs("div",{className:"create-amm-container",children:[e.jsx("h2",{children:"Existing AMMs"}),r&&e.jsx("div",{className:"error-message",children:r}),n?e.jsx("div",{children:"Loading AMMs..."}):a.length===0?e.jsx("div",{className:"form-group",children:e.jsx("p",{children:"No AMMs found"})}):e.jsx("div",{className:"form-group",children:a.map(c=>e.jsxs("div",{className:"amm-item",onClick:()=>u(c),children:[e.jsxs("div",{className:"amm-details",children:[e.jsx("span",{className:"amm-label",children:"AMM Pubkey:"}),e.jsx("span",{className:"amm-value",children:c.pubkey})]}),e.jsxs("div",{className:"amm-details",children:[e.jsx("span",{className:"amm-label",children:"AMM ID:"}),e.jsxs("span",{className:"amm-value",children:[c.ammid," bps"]})]})]},c.pubkey))})]})};var de;const Oe=(de=j.constants.find(o=>o.name==="BASE_RATE"))==null?void 0:de.value,F="a",ue="b",M="d",$="e",q="f",U="g",O="h",oe="i",X="j";async function We(o,s,a,i,n,t){try{console.log("Step 1: Creating provider");const r=new C(s,o,{commitment:"confirmed",preflightCommitment:"confirmed"}),m=new R(j,r),[l]=p.findProgramAddressSync([a.toBuffer(),i.toBuffer(),n.toBuffer()],m.programId),[g]=p.findProgramAddressSync([a.toBuffer(),i.toBuffer(),n.toBuffer(),f.from(F)],m.programId),[u]=p.findProgramAddressSync([a.toBuffer(),i.toBuffer(),n.toBuffer(),f.from(ue)],m.programId),c=await _.token.associatedAddress({mint:i,owner:g}),d=await _.token.associatedAddress({mint:n,owner:g}),[h]=p.findProgramAddressSync([l.toBuffer(),f.from(M)],m.programId),[b]=p.findProgramAddressSync([l.toBuffer(),f.from($)],m.programId),[w]=p.findProgramAddressSync([l.toBuffer(),f.from(q)],m.programId),[y]=p.findProgramAddressSync([l.toBuffer(),f.from(O)],m.programId),x=await _.token.associatedAddress({mint:i,owner:h}),v=await _.token.associatedAddress({mint:n,owner:h}),[A]=p.findProgramAddressSync([l.toBuffer(),f.from(oe)],m.programId),[N]=p.findProgramAddressSync([l.toBuffer(),f.from(X)],m.programId),S=Z.setComputeUnitLimit({units:1e6});console.log("Step 1: Creating pool...");let K="";await z(s,l)?console.log("Pool already exists, skipping..."):(K=await m.methods.createPool(t).accounts({amm:a,mintA:i,mintB:n,pool:l,poolAuthority:g,mintLiquidity:u,poolAccountA:c,poolAccountB:d,payer:r.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).preInstructions([S]).rpc({commitment:"confirmed"}),await s.confirmTransaction(K,"confirmed"),console.log("Transaction signature:",K)),console.log("Step 2: Initializing lending pool...");let W="";await z(s,x)?console.log("Lending pool 1 already initialized, skipping..."):(W=await m.methods.initLendingPool1().accounts({pool:l,mintA:i,mintB:n,lendingPoolAuthority:h,lendingPoolTokenA:x,lendingPoolTokenB:v,payer:r.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId,rent:Q}).rpc(),await s.confirmTransaction(W,"confirmed")),console.log("Step 3: Initializing lending pool...");let G="";await z(s,b)?console.log("Lending pool 2 already initialized, skipping..."):(G=await m.methods.initLendingPool2().accounts({pool:l,lendingPoolAuthority:h,lendingReceiptTokenMint:b,borrowReceiptTokenMint:w,collateralReceiptTokenMint:y,payer:r.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId,rent:Q}).rpc(),await s.confirmTransaction(G,"confirmed")),console.log("Step 4: Initializing lending pool...");let V="";return await z(s,A)?console.log("Lending pool 3 already initialized, skipping..."):(V=await m.methods.initLendingPool3().accounts({pool:l,lendingPoolAuthority:h,lenderLendingBlockHeightMint:A,borrowerBorrowBlockHeightMint:N,payer:r.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId,rent:Q}).rpc(),await s.confirmTransaction(V,"confirmed")),{tx:K,initTx1:W,initTx2:G,initTx3:V}}catch(r){console.error("Error",r)}return{tx:"",initTx1:"",initTx2:"",initTx3:""}}async function z(o,s){return await o.getAccountInfo(s)!==null}const Ge=()=>{const o=I(),{connection:s}=P(),{amm:a}=ie(),[i,n]=k.useState(""),[t,r]=k.useState(!1),[m,l]=k.useState(""),[g,u]=k.useState({mintA:"",mintB:"",fee:"500"}),c=async d=>{if(d.preventDefault(),n(""),l(""),r(!0),!o){n("Please connect your wallet first"),r(!1);return}if(!a){n("Please select an AMM first"),r(!1);return}try{const h=new p(a.pubkey),b=new p(g.mintA),w=new p(g.mintB),y=await We(o,s,h,b,w,Number(g.fee));console.log(`Transaction URL: https://explorer.solana.com/tx/${y}`),l(y.toString()),u({mintA:"",mintB:"",fee:"500"})}catch(h){console.error("Error creating pool:",h),n(h instanceof Error?h.message:"Failed to create pool")}finally{r(!1)}};return e.jsx("div",{children:e.jsxs("div",{className:"create-amm-container",children:[e.jsx("h2",{children:"Create Pool"}),i&&e.jsx("div",{className:"error-message",children:i}),m&&e.jsxs("div",{className:"success-message",children:["Pool created successfully!",e.jsx("a",{href:`https://explorer.solana.com/tx/${m}`,target:"_blank",rel:"noopener noreferrer",children:"View transaction"})]}),e.jsxs("form",{onSubmit:c,className:"form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"AMM Pubkey:"}),e.jsx("input",{type:"text",value:a?a.pubkey:"",readOnly:!0,disabled:!0})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Token A Mint Address:"}),e.jsx("input",{type:"text",value:g.mintA,onChange:d=>u({...g,mintA:d.target.value}),placeholder:"Enter token A mint address",required:!0,disabled:t})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Token B Mint Address:"}),e.jsx("input",{type:"text",value:g.mintB,onChange:d=>u({...g,mintB:d.target.value}),placeholder:"Enter token B mint address",required:!0,disabled:t})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Fee (in basis points, 1-10000, default: 500 or 5%):"}),e.jsx("input",{type:"text",value:g.fee,onChange:d=>u({...g,fee:d.target.value}),placeholder:"500",required:!0,disabled:t})]}),e.jsx("button",{type:"submit",className:"submit-button",disabled:t||!o,children:t?"Creating...":"Create Pool"})]})]})})};async function ce(o,s){try{const a=new C(s,o,{preflightCommitment:"confirmed"});return(await new R(j,a).account.pool.all()).map(t=>({pubkey:t.publicKey.toString(),amm:t.account.amm.toString(),mintA:t.account.mintA.toString(),mintB:t.account.mintB.toString(),fee:t.account.fee.toString(),minCollateralRatio:t.account.minCollateralRatio.toString(),tokenAAmount:t.account.tokenAAmount.toString(),tokenBAmount:t.account.tokenBAmount.toString()}))}catch(a){throw console.error("Error fetching pool accounts:",a),a}}async function ne(o,s,a){try{const i=new p(s.pubkey),n=new p(s.mintA),t=new p(s.mintB),[r]=p.findProgramAddressSync([new p(s.amm).toBuffer(),new p(s.mintA).toBuffer(),new p(s.mintB).toBuffer(),f.from(F)],new p(j.address)),m=await B(new p(s.mintA),r,!0),l=await B(new p(s.mintB),r,!0),[g]=p.findProgramAddressSync([i.toBuffer(),a.toBuffer(),f.from(U)],new p(j.address)),u=await D(o,m),c=await D(o,l),d=Number(u.amount),h=Number(c.amount),b=h/d,w=d/h,[y]=p.findProgramAddressSync([i.toBuffer(),f.from(M)],new p(j.address)),[x]=p.findProgramAddressSync([i.toBuffer(),f.from($)],new p(j.address)),[v]=p.findProgramAddressSync([i.toBuffer(),f.from(q)],new p(j.address)),[A]=p.findProgramAddressSync([i.toBuffer(),f.from(O)],new p(j.address)),N=await B(n,y,!0),S=await B(t,y,!0),K=await D(o,N),W=await D(o,S),G=await te(o,x),V=await te(o,v),ge=await te(o,A);console.log("walletPublicKey",a);const he=await H(n,a,!0),ke=await B(t,a,!0),fe=await D(o,he),be=await D(o,ke),we=await re(o,g,x),ye=await re(o,g,v),_e=await re(o,g,A);return{pool:{aToB:b,bToA:w,tokenAAmount:d,tokenBAmount:h},lendingPool:{tokenAAmount:Number(K.amount),tokenBAmount:Number(W.amount),lendingReceiptSupply:Number(G.supply),borrowReceiptSupply:Number(V.supply),collateralReceiptSupply:Number(ge.supply),addresses:{lendingReceipt:x.toString(),borrowReceipt:v.toString(),collateralReceipt:A.toString()}},userAssets:{tokenAAmount:fe.amount.toString(),tokenBAmount:be.amount.toString(),lendingReceiptAmount:we.toString(),borrowReceiptAmount:ye.toString(),collateralReceiptAmount:_e.toString()}}}catch(i){throw console.error("Error getting lending pool details:",i),i}}async function re(o,s,a){try{const i=await B(a,s,!0),n=await D(o,i);return Number(n.amount)}catch(i){return console.log("getUserTokenAmount",i),0}}async function He(o,s,a,i,n,t,r,m,l){try{const g=new C(s,o,{preflightCommitment:"confirmed"}),u=new R(j,g),[c]=p.findProgramAddressSync([i.toBuffer(),n.toBuffer(),t.toBuffer(),f.from(F)],u.programId),d=await B(n,c,!0),h=await B(t,c,!0),b=await B(n,o.publicKey,!0),w=await B(t,o.publicKey,!0);return await u.methods.swapExactTokensForTokens(r,new Y.BN(m),new Y.BN(l)).accounts({amm:i,pool:a,poolAuthority:c,trader:o.publicKey,mintA:n,mintB:t,poolAccountA:d,poolAccountB:h,traderAccountA:b,traderAccountB:w,payer:o.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).rpc()}catch(g){throw console.error("Error in swap:",g),g}}const Ue=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),[n,t]=k.useState(!1),[r,m]=k.useState(""),[l,g]=k.useState(!0),[u,c]=k.useState({inputAmount:"",minOutputAmount:""}),d=async h=>{h.preventDefault(),m(""),t(!0);try{const b=parseFloat(u.inputAmount),w=parseFloat(u.minOutputAmount),y=await He(a,i,new p(o.pubkey),new p(o.amm),new p(o.mintA),new p(o.mintB),l,b,w);s(y),c({inputAmount:"",minOutputAmount:""})}catch(b){console.error("Error in swap:",b),m(b instanceof Error?b.message:"Failed to swap")}finally{t(!1)}};return e.jsxs("form",{onSubmit:d,className:"swap-form",children:[r&&e.jsx("div",{className:"error-message",children:r}),e.jsx("div",{className:"form-group",children:e.jsxs("div",{className:"swap-direction",children:[e.jsx("button",{type:"button",className:`direction-button ${l?"active":""}`,onClick:()=>g(!0),children:"A → B"}),e.jsx("button",{type:"button",className:`direction-button ${l?"":"active"}`,onClick:()=>g(!1),children:"B → A"})]})}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Input Amount:"}),e.jsx("input",{type:"number",step:"any",value:u.inputAmount,onChange:h=>c({...u,inputAmount:h.target.value}),placeholder:`Enter amount for token ${l?"A":"B"}`,required:!0,disabled:n})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Minimum Output Amount:"}),e.jsx("input",{type:"number",step:"any",value:u.minOutputAmount,onChange:h=>c({...u,minOutputAmount:h.target.value}),placeholder:`Minimum amount of token ${l?"B":"A"}`,required:!0,disabled:n})]}),e.jsx("button",{type:"submit",className:"submit-button",disabled:n||!a,children:n?"Swapping...":"Swap"})]})};async function Ve(o,s,a,i,n,t,r,m){try{const l=new C(s,o,{preflightCommitment:"confirmed"}),g=new R(j,l),[u]=p.findProgramAddressSync([i.toBuffer(),n.toBuffer(),t.toBuffer(),f.from(F)],g.programId),[c]=p.findProgramAddressSync([a.toBuffer(),f.from(ue)],g.programId),d=await B(n,u,!0),h=await B(t,u,!0),b=await B(n,o.publicKey,!0),w=await B(t,o.publicKey,!0),y=await B(c,o.publicKey,!0);return await g.methods.depositLiquidity(new Y.BN(r),new Y.BN(m)).accounts({pool:a,poolAuthority:u,mintA:n,mintB:t,depositor:o.publicKey,mintLiquidity:c,poolAccountA:d,poolAccountB:h,depositorAccountLiquidity:y,depositorAccountA:b,depositorAccountB:w,payer:o.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).rpc({skipPreflight:!1,maxRetries:3,commitment:"confirmed"})}catch(l){throw console.error("Error in depositLiquidity:",l),l}}const Qe=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),[n,t]=k.useState(!1),[r,m]=k.useState(""),[l,g]=k.useState({amountA:"",amountB:""}),u=async c=>{c.preventDefault(),m(""),t(!0);try{const d=parseFloat(l.amountA),h=parseFloat(l.amountB),b=await Ve(a,i,new p(o.pubkey),new p(o.amm),new p(o.mintA),new p(o.mintB),d,h);s(b),g({amountA:"",amountB:""})}catch(d){console.error("Error depositing liquidity:",d),m(d instanceof Error?d.message:"Failed to deposit liquidity")}finally{t(!1)}};return e.jsxs("form",{onSubmit:u,className:"deposit-form",children:[r&&e.jsx("div",{className:"error-message",children:r}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Amount Token A:"}),e.jsx("input",{type:"number",step:"any",value:l.amountA,onChange:c=>g({...l,amountA:c.target.value}),placeholder:"Enter amount for token A",required:!0,disabled:n})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Amount Token B:"}),e.jsx("input",{type:"number",step:"any",value:l.amountB,onChange:c=>g({...l,amountB:c.target.value}),placeholder:"Enter amount for token B",required:!0,disabled:n})]}),e.jsx("button",{type:"submit",className:"submit-button",disabled:n||!a,children:n?"Depositing...":"Confirm Deposit"})]})};async function Ze(o,s,a,i,n){try{const t=new C(s,o,{commitment:"confirmed",preflightCommitment:"confirmed"}),r=new R(j,t),[m]=p.findProgramAddressSync([a.toBuffer(),f.from(M)],r.programId),[l]=p.findProgramAddressSync([a.toBuffer(),f.from($)],r.programId),[g]=p.findProgramAddressSync([a.toBuffer(),f.from(q)],r.programId),[u]=p.findProgramAddressSync([a.toBuffer(),f.from(O)],r.programId),c=await _.token.associatedAddress({mint:i,owner:m}),d=await _.token.associatedAddress({mint:n,owner:m}),[h]=p.findProgramAddressSync([a.toBuffer(),f.from(oe)],r.programId),[b]=p.findProgramAddressSync([a.toBuffer(),f.from(X)],r.programId),w=Z.setComputeUnitLimit({units:1e6});console.log("Step 1: Initializing lending pool...");let y="";await se(s,c)?console.log("Lending pool 1 already initialized, skipping..."):(y=await r.methods.initLendingPool1().accounts({pool:a,mintA:i,mintB:n,lendingPoolAuthority:m,lendingPoolTokenA:c,lendingPoolTokenB:d,payer:t.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId,rent:Q}).preInstructions([w]).rpc({commitment:"confirmed"}),await s.confirmTransaction(y,"confirmed")),console.log("Step 2: Initializing lending pool...");let x="";await se(s,u)?console.log("Lending pool 2 already initialized, skipping..."):(x=await r.methods.initLendingPool2().accounts({pool:a,lendingPoolAuthority:m,lendingReceiptTokenMint:l,borrowReceiptTokenMint:g,collateralReceiptTokenMint:u,payer:t.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId,rent:Q}).preInstructions([w]).rpc({commitment:"confirmed"}),await s.confirmTransaction(x,"confirmed")),console.log("Step 3: Initializing lending pool...");let v="";return await se(s,h)?console.log("Lending pool 3 already initialized, skipping..."):(v=await r.methods.initLendingPool3().accounts({pool:a,lendingPoolAuthority:m,lenderLendingBlockHeightMint:h,borrowerBorrowBlockHeightMint:b,payer:t.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId,rent:Q}).preInstructions([w]).rpc({commitment:"confirmed"}),await s.confirmTransaction(v,"confirmed")),{initTx1:y,initTx2:x,initTx3:v}}catch(t){console.error("Error",t)}return{initTx1:"",initTx2:"",initTx3:""}}async function se(o,s){return await o.getAccountInfo(s)!==null}const Je=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),{amm:n}=ie(),[t,r]=k.useState(""),[m,l]=k.useState(!1),g=async()=>{if(r(""),l(!0),!a){r("Please connect your wallet first"),l(!1);return}if(!n){r("Please select an AMM first"),l(!1);return}try{const u=new p(o.pubkey),c=new p(o.mintA),d=new p(o.mintB),h=await Ze(a,i,u,c,d);console.log(`Transaction URL: https://explorer.solana.com/tx/${h}`),s&&s(h.toString())}catch(u){console.error("Error initializing pool:",u),r(u instanceof Error?u.message:"Failed to initialize pool")}finally{l(!1)}};return e.jsxs("div",{className:"init-pool-container",children:[t&&e.jsx("div",{className:"error-message",children:t}),e.jsx("button",{onClick:g,className:"submit-button",disabled:m||!a,children:m?"Initializing...":"Initialize Pool"})]})},$e=({pool:o,onTxSuccess:s})=>{const{connection:a}=P(),{publicKey:i}=J(),[n,t]=k.useState("none"),[r,m]=k.useState(null),[l,g]=k.useState(!1),u=async()=>{try{g(!0);const c=await ne(a,{pubkey:o.pubkey.toString(),amm:o.amm.toString(),mintA:o.mintA.toString(),mintB:o.mintB.toString()},i||new p(""));m(c)}catch(c){console.error("Error fetching pool prices:",c)}finally{g(!1)}};return k.useEffect(()=>{u()},[o,a,i]),e.jsxs("div",{className:"pool-item",children:[e.jsx("div",{className:"pool-header",children:e.jsx("h3",{children:"Pool Details"})}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"AMM Pubkey:"}),e.jsx("span",{className:"pool-value",title:o.amm.toString(),children:o.amm.toString()})]}),e.jsxs("div",{className:"pool-info",children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Pool Pubkey:"}),e.jsx("span",{className:"pool-value",title:o.pubkey.toString(),children:o.pubkey.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token A mint addr:"}),e.jsx("span",{className:"pool-value",title:o.mintA.toString(),children:o.mintA.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token B mint addr:"}),e.jsx("span",{className:"pool-value",title:o.mintB.toString(),children:o.mintB.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Fee:"}),e.jsx("span",{className:"pool-value",title:o.fee.toString(),children:o.fee})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Min Collateral Ratio:"}),e.jsx("span",{className:"pool-value",title:o.minCollateralRatio.toString(),children:o.minCollateralRatio})]})]}),e.jsx("div",{className:"pool-actions",children:e.jsx("button",{className:"action-button",onClick:()=>t(n==="initPool"?"none":"initPool"),children:n==="initPool"?"Hide Init Pool":"Init Pool"})}),n==="initPool"&&e.jsx("div",{className:"form-container",children:e.jsx(Je,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})}),e.jsxs("div",{className:"pool-price-info",children:[e.jsx("h4",{children:"Pool Liquidity & Prices"}),l?e.jsx("div",{className:"loading-prices",children:"Loading prices..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token A Reserve:"}),e.jsx("span",{className:"pool-value",children:r.pool.tokenAAmount.toFixed(6)})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token B Reserve:"}),e.jsx("span",{className:"pool-value",children:r.pool.tokenBAmount.toFixed(6)})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Price (A → B):"}),e.jsxs("span",{className:"pool-value",children:["1 A = ",r.pool.aToB.toFixed(6)," B"]})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Price (B → A):"}),e.jsxs("span",{className:"pool-value",children:["1 B = ",r.pool.bToA.toFixed(6)," A"]})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load prices"})]}),e.jsxs("div",{className:"pool-actions",children:[e.jsx("button",{className:"action-button",onClick:()=>t(n==="deposit"?"none":"deposit"),children:n==="deposit"?"Hide Deposit":"Deposit"}),e.jsx("button",{className:"action-button",onClick:()=>t(n==="swap"?"none":"swap"),children:n==="swap"?"Hide Swap":"Swap"})]}),n==="deposit"&&e.jsx("div",{className:"form-container",children:e.jsx(Qe,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})}),n==="swap"&&e.jsx("div",{className:"form-container",children:e.jsx(Ue,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})}),e.jsxs("div",{className:"lending-pool-info",children:[e.jsx("h4",{children:"Lending Pool"}),l?e.jsx("div",{className:"loading-lending-pool-details",children:"Loading lending pool details..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Lending Pool tokenAAmount:"}),e.jsx("span",{className:"pool-value",children:r.lendingPool.tokenAAmount.toFixed(6)})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Lending Pool tokenBAmount:"}),e.jsx("span",{className:"pool-value",children:r.lendingPool.tokenBAmount.toFixed(6)})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load lending pool details"})]})]})},Xe=()=>{const o=I(),{connection:s}=P(),[a,i]=k.useState([]),[n,t]=k.useState(!1),[r,m]=k.useState(""),[l,g]=k.useState(""),u=async()=>{if(o){t(!0);try{const d=await ce(o,s);i(d)}catch(d){console.error("Error fetching pools:",d),m(d instanceof Error?d.message:"Failed to fetch pools")}finally{t(!1)}}};k.useEffect(()=>{u()},[o,s]);const c=d=>{g(d),u()};return e.jsxs("div",{className:"pool-list-container",children:[e.jsx("h2",{children:"Liquidity Pools"}),r&&e.jsx("div",{className:"error-message",children:r}),l&&e.jsxs("div",{className:"success-message",children:["Transaction successful!",e.jsx("a",{href:`https://explorer.solana.com/tx/${l}`,target:"_blank",rel:"noopener noreferrer",children:"View on Explorer"})]}),n?e.jsx("div",{className:"loading",children:"Loading pools..."}):a.length===0?e.jsx("div",{className:"empty-state",children:e.jsx("p",{children:"No pools found"})}):e.jsx("div",{className:"pool-list",children:a.map(d=>e.jsx($e,{pool:d,onTxSuccess:c},d.pubkey.toString()))})]})};async function ze(o,s,a,i){try{console.log("Executing liquidate...");const n=new C(s,o,{preflightCommitment:"confirmed"}),t=new R(j,n),r=await t.account.pool.fetch(a),m=r.mintA,l=r.mintB,[g]=p.findProgramAddressSync([r.amm.toBuffer(),m.toBuffer(),l.toBuffer(),f.from(F)],t.programId),[u]=p.findProgramAddressSync([a.toBuffer(),f.from(M)],t.programId),[c]=p.findProgramAddressSync([a.toBuffer(),f.from(q)],t.programId),[d]=p.findProgramAddressSync([a.toBuffer(),f.from(O)],t.programId),[h]=p.findProgramAddressSync([a.toBuffer(),i.toBuffer(),f.from(U)],t.programId),b=await _.token.associatedAddress({mint:c,owner:h}),w=await _.token.associatedAddress({mint:d,owner:h}),y=H(l,n.wallet.publicKey,!0),x=Z.setComputeUnitLimit({units:2e8});console.log("Sending liquidate transaction...");const v=await t.methods.liquidate().accounts({pool:a,poolAuthority:g,mintA:m,mintB:l,lendingPoolAuthority:u,borrowReceiptTokenMint:c,collateralReceiptTokenMint:d,trader:n.wallet.publicKey,traderAccountB:y,borrower:i,borrowerBorrowReceiptToken:b,borrowerCollateralReceiptToken:w,payer:n.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).preInstructions([x]).rpc();return console.log("Liquidate transaction signature:",v),{tx:v,accounts:{poolKey:a,poolAuthority:g,lendingPoolAuthority:u,borrowReceiptTokenMint:c,collateralReceiptTokenMint:d,traderAccountB:y,borrowerBorrowReceiptToken:b,borrowerCollateralReceiptToken:w}}}catch(n){throw console.error("Error in liquidate:",n),n instanceof Error&&console.error("Error details:",{message:n.message,stack:n.stack}),n}}async function Ye(o,s,a){try{const i=new C(a,o,{preflightCommitment:"confirmed"}),n=new R(j,i),t=await n.account.pool.fetch(s),r=t.mintA,m=t.mintB,g=(await ne(a,{pubkey:s.toString(),amm:t.amm.toString(),mintA:r.toString(),mintB:m.toString()},o.publicKey)).pool.aToB,[u]=p.findProgramAddressSync([s.toBuffer(),f.from(q)],n.programId),[c]=p.findProgramAddressSync([s.toBuffer(),f.from(O)],n.programId),d=await a.getTokenLargestAccounts(u),h=[];for(const b of d.value){if(b.amount=="0")continue;const w=await D(a,b.address),y=w.owner,x=await eo(a,y,c);console.log("borrowReceiptToken amount",w.amount.toString()),console.log("collateralReceiptTokenAmount",x),console.log("Number(borrowTokenAccountInfo.amount) * 2*poolPrice",Number(w.amount)*2*g),x{const o=I(),{connection:s}=P(),[a,i]=k.useState(""),[n,t]=k.useState(!1),[r,m]=k.useState(""),[l,g]=k.useState(""),[u,c]=k.useState(""),[d,h]=k.useState([]),[b,w]=k.useState(!1),y=async v=>{if(v.preventDefault(),!o||!r){i("Please connect wallet and enter pool address");return}try{i(""),w(!0);const A=new p(r),N=await Ye(o,A,s);h(N)}catch(A){console.error("Error fetching pending liquidations:",A),i(A instanceof Error?A.message:"Failed to fetch pending liquidations"),h([])}finally{w(!1)}},x=async v=>{if(v.preventDefault(),i(""),t(!0),!o){i("Please connect your wallet first"),t(!1);return}let A,N;try{A=new p(r),N=new p(l)}catch{i("Invalid pool or borrower address"),t(!1);return}try{const S=await ze(o,s,A,N);console.log(`Transaction URL: https://explorer.solana.com/tx/${S.tx}`),c(S.tx),m(""),g("")}catch(S){console.error("Error liquidating position:",S),i(S instanceof Error?S.message:"Failed to liquidate. Please try again.")}finally{t(!1)}};return e.jsxs("div",{className:"liquidate-container",children:[a&&e.jsx("div",{className:"error-message",children:a}),u&&e.jsxs("div",{className:"success-message",children:["Liquidation successful!",e.jsx("a",{href:`https://explorer.solana.com/tx/${u}`,target:"_blank",rel:"noopener noreferrer",children:"View transaction"})]}),e.jsxs("div",{className:"search-form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"pool-address",children:"Pool Address:"}),e.jsxs("div",{className:"input-with-button",children:[e.jsx("input",{id:"pool-address",type:"text",value:r,onChange:v=>m(v.target.value),placeholder:"Enter pool address",className:"input-field"}),e.jsx("button",{onClick:y,disabled:b||!o||!r,className:"search-button",children:b?"Searching...":"Search"})]})]}),e.jsxs("div",{className:"pending-liquidations",children:[e.jsx("h3",{children:"Pending Liquidations"}),b?e.jsx("div",{className:"loading",children:"Loading pending liquidations..."}):d.length===0?e.jsx("p",{children:"No pending liquidations found"}):e.jsx("ul",{className:"liquidation-list",children:d.map((v,A)=>e.jsx("li",{className:"liquidation-item",onClick:()=>g(v.userAuthorityPda.toString()),children:e.jsxs("div",{children:["Borrower Authority PDA: ",v.userAuthorityPda.toString()]})},A))})]})]}),e.jsxs("form",{onSubmit:x,className:"liquidate-form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"borrower-address",children:"Note: The current demo does not yet support liquidation based on PDAs. The public key is not the same as the PDA. So the PDA above is useless now. U'd better to use another account to borrow and then liquidate that account with it's Public Key."}),e.jsx("label",{htmlFor:"borrower-address",children:"Borrower Address:"}),e.jsx("input",{id:"borrower-address",type:"text",value:l,onChange:v=>g(v.target.value),placeholder:"Enter borrower address",className:"input-field"})]}),e.jsx("button",{type:"submit",className:"submit-button",disabled:n||!o||!r||!l,children:n?"Liquidating...":"Liquidate Position"})]})]})};async function no(o,s,a,i){try{console.log("Executing lend...");const n=new C(s,o,{preflightCommitment:"confirmed"}),t=new R(j,n),r=await t.account.pool.fetch(a),m=r.mintA,l=r.mintB,[g]=p.findProgramAddressSync([r.amm.toBuffer(),m.toBuffer(),l.toBuffer(),f.from(F)],t.programId),[u]=p.findProgramAddressSync([a.toBuffer(),f.from(M)],t.programId),[c]=p.findProgramAddressSync([a.toBuffer(),f.from($)],t.programId),[d]=p.findProgramAddressSync([a.toBuffer(),f.from(q)],t.programId),[h]=p.findProgramAddressSync([a.toBuffer(),f.from(oe)],t.programId),b=H(m,u,!0),w=H(l,u,!0),y=await _.token.associatedAddress({mint:m,owner:n.wallet.publicKey}),[x]=p.findProgramAddressSync([a.toBuffer(),n.wallet.publicKey.toBuffer(),f.from(U)],t.programId),v=await _.token.associatedAddress({mint:c,owner:x}),A=await _.token.associatedAddress({mint:h,owner:x});return{tx:await t.methods.lend(new ee(i)).accounts({pool:a,lendingPoolAuthority:u,lendingPoolTokenA:b,lendingReceiptTokenMint:c,lenderLendingBlockHeightMint:h,lender:n.wallet.publicKey,lenderTokenA:y,lenderAuthority:x,lenderLendReceiptToken:v,lenderLendingBlockHeightReceiptToken:A,payer:n.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).rpc(),accounts:{poolAuthority:g,lendingPoolAuthority:u,lendingReceiptTokenMint:c,borrowReceiptTokenMint:d,lendingPoolTokenA:b,lendingPoolTokenB:w,lenderTokenA:y,lenderLendReceiptToken:v,lenderLendingBlockHeightReceiptToken:A}}}catch(n){throw console.error("Error in lend:",n),n instanceof Error&&console.error("Error details:",{message:n.message,stack:n.stack}),n}}const to=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),[n,t]=k.useState(""),[r,m]=k.useState(!1),[l,g]=k.useState(""),u=async c=>{if(c.preventDefault(),t(""),m(!0),!a){t("Please connect your wallet first"),m(!1);return}try{const d=parseFloat(l);if(isNaN(d)||d<=0)throw new Error("Invalid amount");const h=new p(o.pubkey),b=await no(a,i,h,new ee(d));console.log(`Transaction URL: https://explorer.solana.com/tx/${b.tx}`),g(""),s(b.tx)}catch(d){console.error("Error lending:",d),t(d instanceof Error?d.message:"Failed to lend")}finally{m(!1)}};return console.log(o),e.jsxs("div",{className:"form-wrapper",children:[e.jsx("h3",{children:"Lend Tokens"}),n&&e.jsx("div",{className:"error-message",children:n}),e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Amount to Lend:"}),e.jsx("input",{type:"number",value:l,onChange:c=>g(c.target.value),placeholder:"Enter amount to lend",required:!0,min:"0",step:"any",disabled:r})]}),e.jsxs("div",{className:"lendingPool-info-summary",children:[e.jsxs("div",{children:["Pool: ",o.pubkey.toString()]}),e.jsxs("div",{children:["Token A: ",o.mintA.toString()]}),e.jsxs("div",{children:["Token B: ",o.mintB.toString()]})]}),e.jsx("button",{type:"submit",className:"action-button",disabled:r||!a,children:r?"Processing...":"Confirm Lend"})]})]})};async function ao(o,s,a){try{const i=new C(s,o,{preflightCommitment:"confirmed"}),n=new R(j,i),t=await n.account.pool.fetch(a),r=t.mintA,m=t.mintB,[l]=p.findProgramAddressSync([t.amm.toBuffer(),r.toBuffer(),m.toBuffer(),f.from(F)],n.programId),[g]=p.findProgramAddressSync([a.toBuffer(),f.from(M)],n.programId),u=await _.token.associatedAddress({mint:r,owner:g}),c=await _.token.associatedAddress({mint:m,owner:g}),[d]=p.findProgramAddressSync([a.toBuffer(),f.from($)],n.programId),[h]=p.findProgramAddressSync([a.toBuffer(),f.from(q)],n.programId),[b]=p.findProgramAddressSync([a.toBuffer(),f.from(oe)],n.programId),w=await _.token.associatedAddress({mint:r,owner:i.wallet.publicKey}),y=await _.token.associatedAddress({mint:m,owner:i.wallet.publicKey}),[x]=p.findProgramAddressSync([a.toBuffer(),i.wallet.publicKey.toBuffer(),f.from(U)],n.programId),v=await _.token.associatedAddress({mint:d,owner:x}),A=await _.token.associatedAddress({mint:b,owner:x});console.log("Sending redeem transaction...");const N=await n.methods.redeem().accounts({pool:a,poolAuthority:l,mintA:r,mintB:m,lendingPoolAuthority:g,lendingPoolTokenA:u,lendingPoolTokenB:c,lendingReceiptTokenMint:d,borrowReceiptTokenMint:h,lenderLendingBlockHeightTokenMint:b,lender:i.wallet.publicKey,lenderTokenA:w,lenderTokenB:y,lenderLendingReceiptToken:v,lenderLendingBlockHeightReceiptToken:A,payer:i.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).rpc();return console.log("Redeem transaction signature:",N),N}catch(i){throw console.error("Error in redeem:",i),i}}const ro=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),[n,t]=k.useState(""),[r,m]=k.useState(!1),l=async g=>{if(g.preventDefault(),t(""),m(!0),!a){t("Please connect your wallet first"),m(!1);return}try{const u=new p(o.pubkey),c=await ao(a,i,u);console.log(`Transaction URL: https://explorer.solana.com/tx/${c}`),s(c)}catch(u){console.error("Error redeeming:",u),t(u instanceof Error?u.message:"Failed to redeem")}finally{m(!1)}};return e.jsxs("div",{className:"form-wrapper",children:[e.jsx("h3",{children:"Redeem Tokens"}),n&&e.jsx("div",{className:"error-message",children:n}),e.jsxs("form",{onSubmit:l,children:[e.jsxs("div",{className:"lending-pool-info-summary",children:[e.jsxs("div",{children:["Min Collateral Ratio: ",(o.minCollateralRatio/100).toFixed(2),"%"]}),e.jsxs("div",{children:["Base Rate: ",Oe,"%"]})]}),e.jsx("div",{className:"warning-message",children:"Note: This will redeem all your lending receipt tokens."}),e.jsx("button",{type:"submit",className:"action-button",disabled:r||!a,children:r?"Processing...":"Confirm Redeem"})]})]})},so=({pool:o,onTxSuccess:s})=>{const{connection:a}=P(),{publicKey:i}=J(),[n,t]=k.useState("none"),[r,m]=k.useState(null),[l,g]=k.useState(!1),u=async()=>{try{g(!0);const c=await ne(a,{pubkey:o.pubkey.toString(),amm:o.amm.toString(),mintA:o.mintA.toString(),mintB:o.mintB.toString()},i||new p(""));m(c)}catch(c){console.error("Error fetching pool prices:",c)}finally{g(!1)}};return k.useEffect(()=>{u()},[o,a,i]),e.jsxs("div",{className:"pool-item",children:[e.jsx("div",{className:"pool-header",children:e.jsx("h3",{children:"Pool Details"})}),e.jsxs("div",{className:"pool-info",children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Pool Pubkey:"}),e.jsx("span",{className:"pool-value",title:o.pubkey.toString(),children:o.pubkey.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token A mint addr:"}),e.jsx("span",{className:"pool-value",title:o.mintA.toString(),children:o.mintA.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token B mint addr:"}),e.jsx("span",{className:"pool-value",title:o.mintB.toString(),children:o.mintB.toString()})]})]}),e.jsxs("div",{className:"lending-pool-info",children:[e.jsx("h4",{children:"Lending Pool"}),l?e.jsx("div",{className:"loading-lending-pool-details",children:"Loading lending pool details..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Lending Pool tokenAAmount:"}),e.jsx("span",{className:"pool-value",children:r.lendingPool.tokenAAmount.toFixed(6)})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Lending Pool tokenBAmount:"}),e.jsx("span",{className:"pool-value",children:r.lendingPool.tokenBAmount.toFixed(6)})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load lending pool details"})]}),e.jsxs("div",{className:"user-assets-details",children:[e.jsx("h4",{children:"Your Assets"}),l?e.jsx("div",{className:"loading-lending-pool-details",children:"Loading lending pool details..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"tokenA Balance:"}),e.jsx("span",{className:"pool-value",children:r.userAssets.tokenAAmount})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"tokenB Balance:"}),e.jsx("span",{className:"pool-value",children:r.userAssets.tokenBAmount})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load lending pool details"})]}),e.jsxs("div",{className:"user-lending-details",children:[e.jsx("h4",{children:"Your lending details"}),l?e.jsx("div",{className:"loading-lending-pool-details",children:"Loading lending pool details..."}):r?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"lended tokenA amount:"}),e.jsx("span",{className:"pool-value",children:r.userAssets.lendingReceiptAmount})]})}):e.jsx("div",{className:"error-message",children:"Failed to load lending pool details"})]}),e.jsx("div",{className:"lending-pool-actions",children:e.jsxs("div",{className:"lending-pool-action-buttons",children:[e.jsx("button",{className:"lending-pool-action-button",onClick:()=>t(n==="lend"?"none":"lend"),children:n==="lend"?"Hide Lend":"Lend"}),e.jsx("button",{className:"lending-pool-action-button",onClick:()=>t(n==="redeem"?"none":"redeem"),children:n==="redeem"?"Hide Redeem":"Redeem"})]})}),e.jsx("div",{className:"lending-pool-actions",children:e.jsx("button",{className:"lending-pool-refresh-button",onClick:u,disabled:l,children:l?"Loading...":"🔄 Refresh"})}),n==="lend"&&e.jsx("div",{className:"form-container",children:e.jsx(to,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})}),n==="redeem"&&e.jsx("div",{className:"form-container",children:e.jsx(ro,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})})]})},io=()=>{const o=I(),{connection:s}=P(),[a,i]=k.useState([]),[n,t]=k.useState(!1),[r,m]=k.useState(""),[l,g]=k.useState(""),u=async()=>{if(o){t(!0);try{const d=await ce(o,s);i(d)}catch(d){console.error("Error fetching pools:",d),m(d instanceof Error?d.message:"Failed to fetch pools")}finally{t(!1)}}};k.useEffect(()=>{u()},[o,s]);const c=d=>{g(d),u()};return e.jsxs("div",{className:"pool-list-container",children:[e.jsx("h2",{children:"Liquidity Pools"}),r&&e.jsx("div",{className:"error-message",children:r}),l&&e.jsxs("div",{className:"success-message",children:["Transaction successful!",e.jsx("a",{href:`https://explorer.solana.com/tx/${l}`,target:"_blank",rel:"noopener noreferrer",children:"View on Explorer"})]}),n?e.jsx("div",{className:"loading",children:"Loading pools..."}):a.length===0?e.jsx("div",{className:"empty-state",children:e.jsx("p",{children:"No pools found"})}):e.jsx("div",{className:"pool-list",children:a.map(d=>e.jsx(so,{pool:d,onTxSuccess:c}))})]})};async function co(o,s,a,i,n,t){try{console.log("Executing borrow...");const r=new C(s,o,{preflightCommitment:"confirmed"}),m=new R(j,r),l=await m.account.pool.fetch(a);console.log("Pool info:",{amm:l.amm.toString(),mintA:l.mintA.toString(),mintB:l.mintB.toString()});const[g]=p.findProgramAddressSync([l.amm.toBuffer(),i.toBuffer(),n.toBuffer(),f.from(F)],m.programId),[u]=p.findProgramAddressSync([a.toBuffer(),f.from(M)],m.programId),[c]=p.findProgramAddressSync([a.toBuffer(),f.from(q)],m.programId),[d]=p.findProgramAddressSync([a.toBuffer(),f.from(O)],m.programId),[h]=p.findProgramAddressSync([a.toBuffer(),f.from(X)],m.programId),b=await _.token.associatedAddress({mint:i,owner:g}),w=await _.token.associatedAddress({mint:n,owner:g}),y=await _.token.associatedAddress({mint:i,owner:u}),x=await _.token.associatedAddress({mint:n,owner:u}),v=await _.token.associatedAddress({mint:i,owner:r.wallet.publicKey}),A=await _.token.associatedAddress({mint:n,owner:r.wallet.publicKey}),[N]=p.findProgramAddressSync([a.toBuffer(),r.wallet.publicKey.toBuffer(),f.from(U)],m.programId),S=await _.token.associatedAddress({mint:c,owner:N}),K=await _.token.associatedAddress({mint:d,owner:N}),W=await _.token.associatedAddress({mint:h,owner:N});console.log("Sending borrow transaction...");const G=Z.setComputeUnitLimit({units:1e6});return await m.methods.borrow(t).accounts({pool:a,poolAuthority:g,mintA:i,mintB:n,poolAccountA:b,poolAccountB:w,lendingPoolAuthority:u,lendingPoolTokenA:y,lendingPoolTokenB:x,borrowReceiptTokenMint:c,collateralReceiptTokenMint:d,borrowerBorrowBlockHeightTokenMint:h,borrower:r.wallet.publicKey,borrowerTokenA:v,borrowerTokenB:A,borrowerBorrowReceiptToken:S,borrowerCollateralReceiptToken:K,borrowerBorrowBlockHeightReceiptToken:W,payer:r.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).preInstructions([G]).rpc()}catch(r){throw console.error("Error in borrow:",r),r instanceof Error&&console.error("Error details:",{message:r.message,stack:r.stack}),r}}const lo=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),[n,t]=k.useState(""),[r,m]=k.useState(!1),[l,g]=k.useState(""),u=async d=>{if(d.preventDefault(),t(""),m(!0),!a){t("Please connect your wallet first"),m(!1);return}try{const h=parseFloat(l);if(isNaN(h)||h<=0)throw new Error("Invalid borrow amount");const b=new p(o.pubkey),w=new p(o.mintA),y=new p(o.mintB),x=await co(a,i,b,w,y,new ee(h));console.log(`Transaction URL: https://explorer.solana.com/tx/${x}`),g(""),s(x)}catch(h){console.error("Error borrowing:",h),t(h instanceof Error?h.message:"Failed to borrow")}finally{m(!1)}},c=(o.minCollateralRatio/100).toFixed(2);return e.jsxs("div",{className:"form-wrapper",children:[e.jsx("h3",{children:"Borrow Tokens"}),n&&e.jsx("div",{className:"error-message",children:n}),e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Amount to Borrow (Token A):"}),e.jsx("input",{type:"number",value:l,onChange:d=>g(d.target.value),placeholder:"Enter amount to borrow",required:!0,min:"0",step:"any",disabled:r})]}),e.jsxs("div",{className:"lending-pool-info-summary",children:[e.jsxs("div",{children:["Pool: ",o.pubkey.toString().slice(0,4),"...",o.pubkey.toString().slice(-4)]}),e.jsxs("div",{children:["Token A (Borrow): ",o.mintA.toString().slice(0,4),"...",o.mintA.toString().slice(-4)]}),e.jsxs("div",{children:["Token B (Collateral): ",o.mintB.toString().slice(0,4),"...",o.mintB.toString().slice(-4)]}),e.jsxs("div",{children:["Min Collateral Ratio: ",c,"%"]}),e.jsxs("div",{children:["Base Rate: ",(o.fee/100).toFixed(2),"%"]})]}),e.jsx("div",{className:"warning-message",children:"Note: Please ensure you provide sufficient collateral based on the minimum collateral ratio."}),e.jsx("button",{type:"submit",className:"action-button",disabled:r||!a,children:r?"Processing...":"Confirm Borrow"})]})]})};async function mo(o,s,a,i,n){try{console.log("Executing repay...");const t=new C(s,o,{preflightCommitment:"confirmed"}),r=new R(j,t),m=await r.account.pool.fetch(a),[l]=p.findProgramAddressSync([m.amm.toBuffer(),i.toBuffer(),n.toBuffer(),f.from(F)],r.programId),[g]=p.findProgramAddressSync([a.toBuffer(),f.from(M)],r.programId),[u]=p.findProgramAddressSync([a.toBuffer(),f.from(q)],r.programId),[c]=p.findProgramAddressSync([a.toBuffer(),f.from(O)],r.programId),d=await _.token.associatedAddress({mint:i,owner:g}),h=await _.token.associatedAddress({mint:n,owner:g}),b=await _.token.associatedAddress({mint:i,owner:t.wallet.publicKey}),w=await _.token.associatedAddress({mint:n,owner:t.wallet.publicKey}),[y]=p.findProgramAddressSync([a.toBuffer(),t.wallet.publicKey.toBuffer(),f.from(U)],r.programId),x=await _.token.associatedAddress({mint:u,owner:y}),v=await _.token.associatedAddress({mint:c,owner:y}),[A]=p.findProgramAddressSync([a.toBuffer(),f.from(X)],r.programId),N=await _.token.associatedAddress({mint:A,owner:y});console.log("Sending repay transaction...");const S=await r.methods.repay().accounts({mintA:i,mintB:n,pool:a,poolAuthority:l,lendingPoolAuthority:g,lendingPoolTokenA:d,lendingPoolTokenB:h,borrowReceiptTokenMint:u,collateralReceiptTokenMint:c,borrowerBorrowBlockHeightMint:A,borrower:t.wallet.publicKey,borrowerTokenA:b,borrowerTokenB:w,borrowerAuthority:y,borrowerBorrowReceiptToken:x,borrowerCollateralReceiptToken:v,borrowerBorrowBlockHeightReceiptToken:N,payer:t.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).rpc();return console.log("Repay transaction signature:",S),S}catch(t){throw console.error("Error in repay:",t),t}}const uo=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),[n,t]=k.useState(""),[r,m]=k.useState(!1),l=async g=>{if(g.preventDefault(),t(""),m(!0),!a){t("Please connect your wallet first"),m(!1);return}try{const u=new p(o.pubkey),c=new p(o.mintA),d=new p(o.mintB),h=await mo(a,i,u,c,d);console.log(`Transaction URL: https://explorer.solana.com/tx/${h}`),s(h)}catch(u){console.error("Error repaying:",u),t(u instanceof Error?u.message:"Failed to repay")}finally{m(!1)}};return e.jsxs("div",{className:"form-wrapper",children:[e.jsx("h3",{children:"Repay Loan"}),n&&e.jsx("div",{className:"error-message",children:n}),e.jsxs("form",{onSubmit:l,children:[e.jsx("div",{className:"form-group",children:e.jsx("div",{className:"info-message",children:"Repaying your loan will return your collateral proportionally."})}),e.jsx("button",{type:"submit",className:"action-button",disabled:r||!a,children:r?"Processing...":"Confirm Repay"})]})]})};async function po(o,s,a,i,n){try{console.log("Executing borrow...");const t=new C(s,o,{preflightCommitment:"confirmed"}),r=new R(j,t),[m]=p.findProgramAddressSync([a.toBuffer(),f.from(M)],r.programId),l=await H(i,m,!0),[g]=p.findProgramAddressSync([a.toBuffer(),f.from(O)],r.programId),[u]=p.findProgramAddressSync([a.toBuffer(),f.from(X)],r.programId),c=H(i,t.wallet.publicKey),[d]=p.findProgramAddressSync([a.toBuffer(),t.wallet.publicKey.toBuffer(),f.from(U)],r.programId),h=await H(g,d,!0),b=await _.token.associatedAddress({mint:u,owner:d});console.log("Sending borrow transaction...");const w=Z.setComputeUnitLimit({units:1e6});return{tx:await r.methods.depositCollateral(n).accounts({pool:a,lendingPoolAuthority:m,lendingPoolTokenB:l,collateralReceiptTokenMint:g,borrowerBorrowBlockHeightTokenMint:u,borrower:t.wallet.publicKey,borrowerTokenB:c,borrowerAuthority:d,borrowerCollateralReceiptToken:h,borrowerBorrowBlockHeightReceiptToken:b,payer:t.wallet.publicKey,tokenProgram:L,associatedTokenProgram:E,systemProgram:T.programId}).preInstructions([w]).rpc()}}catch(t){throw console.error("Error in borrow:",t),t instanceof Error&&console.error("Error details:",{message:t.message,stack:t.stack}),t}}const go=({pool:o,onSuccess:s})=>{const a=I(),{connection:i}=P(),[n,t]=k.useState(""),[r,m]=k.useState(!1),[l,g]=k.useState(""),u=async c=>{if(c.preventDefault(),t(""),m(!0),!a){t("Please connect your wallet first"),m(!1);return}try{const d=parseFloat(l);if(isNaN(d)||d<=0)throw new Error("Invalid amount");const h=new p(o.pubkey),b=new p(o.mintB),w=await po(a,i,h,b,new ee(d));console.log(`Transaction URL: https://explorer.solana.com/tx/${w.tx}`),g(""),s(w.tx)}catch(d){console.error("Error lending:",d),t(d instanceof Error?d.message:"Failed to lend")}finally{m(!1)}};return e.jsxs("div",{className:"form-wrapper",children:[e.jsx("h3",{children:"DepositCollateral Tokens"}),n&&e.jsx("div",{className:"error-message",children:n}),e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Amount to DepositCollateral:"}),e.jsx("input",{type:"number",value:l,onChange:c=>g(c.target.value),placeholder:"Enter amount of collateral to deposit",required:!0,min:"0",step:"any",disabled:r})]}),e.jsxs("div",{className:"lendingPool-info-summary",children:[e.jsxs("div",{children:["Pool: ",o.pubkey.toString()]}),e.jsxs("div",{children:["Token A: ",o.mintA.toString()]}),e.jsxs("div",{children:["Token B: ",o.mintB.toString()]})]}),e.jsx("button",{type:"submit",className:"action-button",disabled:r||!a,children:r?"Processing...":"Confirm DepositCollateral"})]})]})},ho=({pool:o,onTxSuccess:s})=>{const{connection:a}=P(),{publicKey:i}=J(),[n,t]=k.useState("none"),[r,m]=k.useState(null),[l,g]=k.useState(!1),u=async()=>{try{g(!0);const c=await ne(a,{pubkey:o.pubkey.toString(),amm:o.amm.toString(),mintA:o.mintA.toString(),mintB:o.mintB.toString()},i||new p(""));m(c)}catch(c){console.error("Error fetching pool prices:",c)}finally{g(!1)}};return k.useEffect(()=>{u()},[o,a,i]),e.jsxs("div",{className:"pool-item",children:[e.jsx("div",{className:"pool-header",children:e.jsx("h3",{children:"Pool Details"})}),e.jsxs("div",{className:"pool-info",children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Pool Pubkey:"}),e.jsx("span",{className:"pool-value",title:o.pubkey.toString(),children:o.pubkey.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token A mint addr:"}),e.jsx("span",{className:"pool-value",title:o.mintA.toString(),children:o.mintA.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Token B mint addr:"}),e.jsx("span",{className:"pool-value",title:o.mintB.toString(),children:o.mintB.toString()})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Min Collateral Ratio:"}),e.jsx("span",{className:"pool-value",title:o.minCollateralRatio.toString(),children:o.minCollateralRatio})]})]}),e.jsxs("div",{className:"pool-price-info",children:[e.jsx("h4",{children:"Prices"}),l?e.jsx("div",{className:"loading-prices",children:"Loading prices..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"TokenA Amount:"}),e.jsx("span",{className:"pool-value",children:r.pool.tokenAAmount.toFixed(6)})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"TokenB Amount:"}),e.jsx("span",{className:"pool-value",children:r.pool.tokenBAmount.toFixed(6)})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Price (A → B):"}),e.jsxs("span",{className:"pool-value",children:["1 A = ",r.pool.aToB.toFixed(6)," B"]})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Price (B → A):"}),e.jsxs("span",{className:"pool-value",children:["1 B = ",r.pool.bToA.toFixed(6)," A"]})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load prices"})]}),e.jsxs("div",{className:"lending-pool-info",children:[e.jsx("h4",{children:"Lending Pool"}),l?e.jsx("div",{className:"loading-lending-pool-details",children:"Loading lending pool details..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Lending Pool tokenAAmount:"}),e.jsx("span",{className:"pool-value",children:r.lendingPool.tokenAAmount.toFixed(6)})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"Lending Pool tokenBAmount:"}),e.jsx("span",{className:"pool-value",children:r.lendingPool.tokenBAmount.toFixed(6)})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load lending pool details"})]}),e.jsxs("div",{className:"user-assets-details",children:[e.jsx("h4",{children:"Your Assets"}),l?e.jsx("div",{className:"loading-lending-pool-details",children:"Loading lending pool details..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"tokenA Balance:"}),e.jsx("span",{className:"pool-value",children:r.userAssets.tokenAAmount})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"tokenB Balance:"}),e.jsx("span",{className:"pool-value",children:r.userAssets.tokenBAmount})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load lending pool details"})]}),e.jsxs("div",{className:"user-lending-details",children:[e.jsx("h4",{children:"Your borrowing details"}),l?e.jsx("div",{className:"loading-lending-pool-details",children:"Loading lending pool details..."}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"borrowed tokenB amount:"}),e.jsx("span",{className:"pool-value",children:r.userAssets.borrowReceiptAmount})]}),e.jsxs("div",{className:"pool-details",children:[e.jsx("span",{className:"pool-label",children:"collateral TokenA amount:"}),e.jsx("span",{className:"pool-value",children:r.userAssets.collateralReceiptAmount})]})]}):e.jsx("div",{className:"error-message",children:"Failed to load lending pool details"})]}),e.jsxs("div",{className:"lending-pool-actions",children:[e.jsxs("div",{className:"lending-pool-action-buttons",children:[e.jsx("button",{className:"lending-pool-action-button",onClick:()=>t(n==="depositCollateral"?"none":"depositCollateral"),children:n==="depositCollateral"?"Hide DepositCollateral":"DepositCollateral"}),e.jsx("button",{className:"lending-pool-action-button",onClick:()=>t(n==="borrow"?"none":"borrow"),children:n==="borrow"?"Hide Borrow":"Borrow"}),e.jsx("button",{className:"lending-pool-action-button",onClick:()=>t(n==="repay"?"none":"repay"),children:n==="repay"?"Hide Repay":"Repay"})]}),e.jsx("button",{className:"lending-pool-refresh-button",onClick:u,disabled:l,children:l?"Loading...":"🔄 Refresh"})]}),n==="borrow"&&e.jsx("div",{className:"form-container",children:e.jsx(lo,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})}),n==="repay"&&e.jsx("div",{className:"form-container",children:e.jsx(uo,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})}),n==="depositCollateral"&&e.jsx("div",{className:"form-container",children:e.jsx(go,{pool:o,onSuccess:c=>{s(c),t("none"),u()}})})]})},ko=()=>{const o=I(),{connection:s}=P(),[a,i]=k.useState([]),[n,t]=k.useState(!1),[r,m]=k.useState(""),[l,g]=k.useState(""),u=async()=>{if(o){t(!0);try{const d=await ce(o,s);i(d)}catch(d){console.error("Error fetching pools:",d),m(d instanceof Error?d.message:"Failed to fetch pools")}finally{t(!1)}}};k.useEffect(()=>{u()},[o,s]);const c=d=>{g(d),u()};return e.jsxs("div",{className:"pool-list-container",children:[e.jsx("h2",{children:"Liquidity Pools"}),r&&e.jsx("div",{className:"error-message",children:r}),l&&e.jsxs("div",{className:"success-message",children:["Transaction successful!",e.jsx("a",{href:`https://explorer.solana.com/tx/${l}`,target:"_blank",rel:"noopener noreferrer",children:"View on Explorer"})]}),n?e.jsx("div",{className:"loading",children:"Loading pools..."}):a.length===0?e.jsx("div",{className:"empty-state",children:e.jsx("p",{children:"No pools found"})}):e.jsx("div",{className:"pool-list",children:a.map(d=>e.jsx(ho,{pool:d,onTxSuccess:c}))})]})},le="GUXNPX5ci1Qj76MZe2aRJ33zK48VmT6gXVyR86CsF4T5",fo=()=>{const{publicKey:o}=J(),[s,a]=k.useState("amm");return e.jsx(qe,{children:e.jsxs("div",{className:"defi-dashboard",children:[e.jsxs("div",{className:"tabs",children:[(o==null?void 0:o.toBase58())==le&&e.jsx("button",{className:`tab ${s==="amm"?"active":""}`,onClick:()=>a("amm"),children:"AMM"}),e.jsx("button",{className:`tab ${s==="pool"?"active":""}`,onClick:()=>a("pool"),children:"Swap"}),e.jsx("button",{className:`tab ${s==="lenderPool"?"active":""}`,onClick:()=>a("lenderPool"),children:"Lend"}),e.jsx("button",{className:`tab ${s==="borrowerPool"?"active":""}`,onClick:()=>a("borrowerPool"),children:"Borrow"}),e.jsx("button",{className:`tab ${s==="liquidate"?"active":""}`,onClick:()=>a("liquidate"),children:"Liquidate"})]}),e.jsx("div",{className:"content",children:s==="amm"&&(o==null?void 0:o.toBase58())==le?e.jsxs("div",{children:[e.jsx(Ke,{}),e.jsx(Fe,{})]}):s==="pool"?e.jsxs("div",{children:[e.jsx(Xe,{}),e.jsx(Ge,{})]}):s==="lenderPool"?e.jsx("div",{children:e.jsx(io,{})}):s==="borrowerPool"?e.jsx("div",{children:e.jsx(ko,{})}):s==="liquidate"?e.jsx("div",{children:e.jsx(oo,{})}):e.jsx(bo,{})})]})})},bo=()=>e.jsx("div",{children:e.jsx("h3",{children:" Coming Soon..."})}),pe=k.createContext({network:"localnet",setNetwork:()=>{}}),wo=()=>k.useContext(pe),yo={"mainnet-beta":ae("mainnet-beta"),testnet:ae("testnet"),devnet:ae("devnet"),localnet:"http://127.0.0.1:8899"},_o=({onChange:o,value:s})=>e.jsx("div",{className:"solana-network-select-container",children:e.jsxs("select",{onChange:a=>o(a.target.value),value:s,className:"solana-network-select",children:[e.jsx("option",{value:"localnet",children:"Localnet"}),e.jsx("option",{value:"devnet",children:"Devnet"}),e.jsx("option",{value:"testnet",children:"Testnet"}),e.jsx("option",{value:"mainnet-beta",children:"Mainnet"})]})}),xo=({children:o})=>{const[s,a]=k.useState("localnet"),i=k.useMemo(()=>yo[s],[s]),n=k.useMemo(()=>[new xe],[]);return e.jsx(pe.Provider,{value:{network:s,setNetwork:a},children:e.jsx(ve,{endpoint:i,children:e.jsx(Ae,{wallets:n,autoConnect:!0,children:e.jsx(je,{children:o})})})})},vo=()=>{const{connected:o}=J(),{network:s,setNetwork:a}=wo();return e.jsxs("div",{className:"container",children:[e.jsx("nav",{className:"navbar",children:e.jsxs("div",{className:"navbar-content",children:[e.jsx(_o,{onChange:a,value:s}),e.jsx(Ne,{})]})}),e.jsx("main",{className:"main-content",children:o?e.jsx(fo,{}):e.jsx("div",{className:"connect-prompt",children:e.jsx("h2",{children:"Please connect your wallet to continue"})})})]})};typeof window<"u"&&(window.global=window,window.Buffer=f);Pe.createRoot(document.getElementById("root")).render(e.jsx(Se.StrictMode,{children:e.jsx(xo,{children:e.jsx(vo,{})})})); diff --git a/assets/index-CcnsKYy9.js b/assets/index-CcnsKYy9.js deleted file mode 100644 index 6b68964..0000000 --- a/assets/index-CcnsKYy9.js +++ /dev/null @@ -1 +0,0 @@ -import{e as Ce}from"./events-CXH2uRM3.js";import{u as tt,p as j,i as X}from"./util-1Y60FSNK.js";import{d as ut}from"./index-DMvpfBi2.js";var jt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function st(r){if(r.__esModule)return r;var l=r.default;if(typeof l=="function"){var f=function g(){return this instanceof g?Reflect.construct(l,arguments,this.constructor):l.apply(this,arguments)};f.prototype=l.prototype}else f={};return Object.defineProperty(f,"__esModule",{value:!0}),Object.keys(r).forEach(function(g){var w=Object.getOwnPropertyDescriptor(r,g);Object.defineProperty(f,g,w.get?w:{enumerable:!0,get:function(){return r[g]}})}),f}var ge,ke;function rt(){return ke||(ke=1,ge=Ce.EventEmitter),ge}const ae=st(ut);var _e,We;function dt(){if(We)return _e;We=1;function r(v,S){var p=Object.keys(v);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(v);S&&(b=b.filter(function(M){return Object.getOwnPropertyDescriptor(v,M).enumerable})),p.push.apply(p,b)}return p}function l(v){for(var S=1;S0?this.tail.next=b:this.head=b,this.tail=b,++this.length}},{key:"unshift",value:function(p){var b={data:p,next:this.head};this.length===0&&(this.tail=b),this.head=b,++this.length}},{key:"shift",value:function(){if(this.length!==0){var p=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,p}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(p){if(this.length===0)return"";for(var b=this.head,M=""+b.data;b=b.next;)M+=p+b.data;return M}},{key:"concat",value:function(p){if(this.length===0)return d.alloc(0);for(var b=d.allocUnsafe(p>>>0),M=this.head,T=0;M;)L(M.data,b,T),T+=M.data.length,M=M.next;return b}},{key:"consume",value:function(p,b){var M;return pm.length?m.length:p;if(A===m.length?T+=m:T+=m.slice(0,p),p-=A,p===0){A===m.length?(++M,b.next?this.head=b.next:this.head=this.tail=null):(this.head=b,b.data=m.slice(A));break}++M}return this.length-=M,T}},{key:"_getBuffer",value:function(p){var b=d.allocUnsafe(p),M=this.head,T=1;for(M.data.copy(b),p-=M.data.length;M=M.next;){var m=M.data,A=p>m.length?m.length:p;if(m.copy(b,b.length-p,0,A),p-=A,p===0){A===m.length?(++T,M.next?this.head=M.next:this.head=this.tail=null):(this.head=M,M.data=m.slice(A));break}++T}return this.length-=T,b}},{key:_,value:function(p,b){return y(this,l(l({},b),{},{depth:0,customInspect:!1}))}}]),v}(),_e}var be,Ue;function it(){if(Ue)return be;Ue=1;function r(h,o){var a=this,d=this._readableState&&this._readableState.destroyed,E=this._writableState&&this._writableState.destroyed;return d||E?(o?o(h):h&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,j.nextTick(w,this,h)):j.nextTick(w,this,h)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(h||null,function(y){!o&&y?a._writableState?a._writableState.errorEmitted?j.nextTick(f,a):(a._writableState.errorEmitted=!0,j.nextTick(l,a,y)):j.nextTick(l,a,y):o?(j.nextTick(f,a),o(y)):j.nextTick(f,a)}),this)}function l(h,o){w(h,o),f(h)}function f(h){h._writableState&&!h._writableState.emitClose||h._readableState&&!h._readableState.emitClose||h.emit("close")}function g(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function w(h,o){h.emit("error",o)}function u(h,o){var a=h._readableState,d=h._writableState;a&&a.autoDestroy||d&&d.autoDestroy?h.destroy(o):h.emit("error",o)}return be={destroy:r,undestroy:g,errorOrDestroy:u},be}var ve={},Fe;function J(){if(Fe)return ve;Fe=1;function r(o,a){o.prototype=Object.create(a.prototype),o.prototype.constructor=o,o.__proto__=a}var l={};function f(o,a,d){d||(d=Error);function E(_,L,v){return typeof a=="string"?a:a(_,L,v)}var y=function(_){r(L,_);function L(v,S,p){return _.call(this,E(v,S,p))||this}return L}(d);y.prototype.name=d.name,y.prototype.code=o,l[o]=y}function g(o,a){if(Array.isArray(o)){var d=o.length;return o=o.map(function(E){return String(E)}),d>2?"one of ".concat(a," ").concat(o.slice(0,d-1).join(", "),", or ")+o[d-1]:d===2?"one of ".concat(a," ").concat(o[0]," or ").concat(o[1]):"of ".concat(a," ").concat(o[0])}else return"of ".concat(a," ").concat(String(o))}function w(o,a,d){return o.substr(0,a.length)===a}function u(o,a,d){return(d===void 0||d>o.length)&&(d=o.length),o.substring(d-a.length,d)===a}function h(o,a,d){return typeof d!="number"&&(d=0),d+a.length>o.length?!1:o.indexOf(a,d)!==-1}return f("ERR_INVALID_OPT_VALUE",function(o,a){return'The value "'+a+'" is invalid for option "'+o+'"'},TypeError),f("ERR_INVALID_ARG_TYPE",function(o,a,d){var E;typeof a=="string"&&w(a,"not ")?(E="must not be",a=a.replace(/^not /,"")):E="must be";var y;if(u(o," argument"))y="The ".concat(o," ").concat(E," ").concat(g(a,"type"));else{var _=h(o,".")?"property":"argument";y='The "'.concat(o,'" ').concat(_," ").concat(E," ").concat(g(a,"type"))}return y+=". Received type ".concat(typeof d),y},TypeError),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),f("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),f("ERR_STREAM_PREMATURE_CLOSE","Premature close"),f("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" after a stream was destroyed"}),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),f("ERR_STREAM_WRITE_AFTER_END","write after end"),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_UNKNOWN_ENCODING",function(o){return"Unknown encoding: "+o},TypeError),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),ve.codes=l,ve}var ye,He;function nt(){if(He)return ye;He=1;var r=J().codes.ERR_INVALID_OPT_VALUE;function l(g,w,u){return g.highWaterMark!=null?g.highWaterMark:w?g[u]:null}function f(g,w,u,h){var o=l(w,h,u);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var a=h?u:"highWaterMark";throw new r(a,o)}return Math.floor(o)}return g.objectMode?16:16*1024}return ye={getHighWaterMark:f},ye}var we,Ge;function ht(){if(Ge)return we;Ge=1,we=r;function r(f,g){if(l("noDeprecation"))return f;var w=!1;function u(){if(!w){if(l("throwDeprecation"))throw new Error(g);l("traceDeprecation")?console.trace(g):console.warn(g),w=!0}return f.apply(this,arguments)}return u}function l(f){try{if(!globalThis.localStorage)return!1}catch{return!1}var g=globalThis.localStorage[f];return g==null?!1:String(g).toLowerCase()==="true"}return we}var Ee,Ve;function at(){if(Ve)return Ee;Ve=1,Ee=x;function r(n){var i=this;this.next=null,this.entry=null,this.finish=function(){de(i,n)}}var l;x.WritableState=N;var f={deprecate:ht()},g=rt(),w=ae.Buffer,u=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function h(n){return w.from(n)}function o(n){return w.isBuffer(n)||n instanceof u}var a=it(),d=nt(),E=d.getHighWaterMark,y=J().codes,_=y.ERR_INVALID_ARG_TYPE,L=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_MULTIPLE_CALLBACK,S=y.ERR_STREAM_CANNOT_PIPE,p=y.ERR_STREAM_DESTROYED,b=y.ERR_STREAM_NULL_VALUES,M=y.ERR_STREAM_WRITE_AFTER_END,T=y.ERR_UNKNOWN_ENCODING,m=a.errorOrDestroy;X(x,g);function A(){}function N(n,i,c){l=l||$(),n=n||{},typeof c!="boolean"&&(c=i instanceof l),this.objectMode=!!n.objectMode,c&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=E(this,n,"writableHighWaterMark",c),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var O=n.decodeStrings===!1;this.decodeStrings=!O,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(C){le(i,C)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=n.emitClose!==!1,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}N.prototype.getBuffer=function(){for(var i=this.bufferedRequest,c=[];i;)c.push(i),i=i.next;return c},function(){try{Object.defineProperty(N.prototype,"buffer",{get:f.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var B;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(B=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(i){return B.call(this,i)?!0:this!==x?!1:i&&i._writableState instanceof N}})):B=function(i){return i instanceof this};function x(n){l=l||$();var i=this instanceof l;if(!i&&!B.call(x,this))return new x(n);this._writableState=new N(n,this,i),this.writable=!0,n&&(typeof n.write=="function"&&(this._write=n.write),typeof n.writev=="function"&&(this._writev=n.writev),typeof n.destroy=="function"&&(this._destroy=n.destroy),typeof n.final=="function"&&(this._final=n.final)),g.call(this)}x.prototype.pipe=function(){m(this,new S)};function P(n,i){var c=new M;m(n,c),j.nextTick(i,c)}function W(n,i,c,O){var C;return c===null?C=new b:typeof c!="string"&&!i.objectMode&&(C=new _("chunk",["string","Buffer"],c)),C?(m(n,C),j.nextTick(O,C),!1):!0}x.prototype.write=function(n,i,c){var O=this._writableState,C=!1,e=!O.objectMode&&o(n);return e&&!w.isBuffer(n)&&(n=h(n)),typeof i=="function"&&(c=i,i=null),e?i="buffer":i||(i=O.defaultEncoding),typeof c!="function"&&(c=A),O.ending?P(this,c):(e||W(this,O,n,c))&&(O.pendingcb++,C=oe(this,O,e,n,i,c)),C},x.prototype.cork=function(){this._writableState.corked++},x.prototype.uncork=function(){var n=this._writableState;n.corked&&(n.corked--,!n.writing&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&G(this,n))},x.prototype.setDefaultEncoding=function(i){if(typeof i=="string"&&(i=i.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((i+"").toLowerCase())>-1))throw new T(i);return this._writableState.defaultEncoding=i,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Q(n,i,c){return!n.objectMode&&n.decodeStrings!==!1&&typeof i=="string"&&(i=w.from(i,c)),i}Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function oe(n,i,c,O,C,e){if(!c){var t=Q(i,O,C);O!==t&&(c=!0,C="buffer",O=t)}var s=i.objectMode?1:O.length;i.length+=s;var R=i.length */(function(r,l){var f=ae,g=f.Buffer;function w(h,o){for(var a in h)o[a]=h[a]}g.from&&g.alloc&&g.allocUnsafe&&g.allocUnsafeSlow?r.exports=f:(w(f,l),l.Buffer=u);function u(h,o,a){return g(h,o,a)}u.prototype=Object.create(g.prototype),w(g,u),u.from=function(h,o,a){if(typeof h=="number")throw new TypeError("Argument must not be a number");return g(h,o,a)},u.alloc=function(h,o,a){if(typeof h!="number")throw new TypeError("Argument must be a number");var d=g(h);return o!==void 0?typeof a=="string"?d.fill(o,a):d.fill(o):d.fill(0),d},u.allocUnsafe=function(h){if(typeof h!="number")throw new TypeError("Argument must be a number");return g(h)},u.allocUnsafeSlow=function(h){if(typeof h!="number")throw new TypeError("Argument must be a number");return f.SlowBuffer(h)}})(De,De.exports);var ct=De.exports,xe=ct.Buffer,Ke=xe.isEncoding||function(r){switch(r=""+r,r&&r.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function pt(r){if(!r)return"utf8";for(var l;;)switch(r){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return r;default:if(l)return;r=(""+r).toLowerCase(),l=!0}}function gt(r){var l=pt(r);if(typeof l!="string"&&(xe.isEncoding===Ke||!Ke(r)))throw new Error("Unknown encoding: "+r);return l||r}Pe.StringDecoder=z;function z(r){this.encoding=gt(r);var l;switch(this.encoding){case"utf16le":this.text=Et,this.end=Rt,l=4;break;case"utf8":this.fillLast=vt,l=4;break;case"base64":this.text=St,this.end=mt,l=3;break;default:this.write=Tt,this.end=Mt;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=xe.allocUnsafe(l)}z.prototype.write=function(r){if(r.length===0)return"";var l,f;if(this.lastNeed){if(l=this.fillLast(r),l===void 0)return"";f=this.lastNeed,this.lastNeed=0}else f=0;return f>5===6?2:r>>4===14?3:r>>3===30?4:r>>6===2?-1:-2}function _t(r,l,f){var g=l.length-1;if(g=0?(w>0&&(r.lastNeed=w-1),w):--g=0?(w>0&&(r.lastNeed=w-2),w):--g=0?(w>0&&(w===2?w=0:r.lastNeed=w-3),w):0))}function bt(r,l,f){if((l[0]&192)!==128)return r.lastNeed=0,"�";if(r.lastNeed>1&&l.length>1){if((l[1]&192)!==128)return r.lastNeed=1,"�";if(r.lastNeed>2&&l.length>2&&(l[2]&192)!==128)return r.lastNeed=2,"�"}}function vt(r){var l=this.lastTotal-this.lastNeed,f=bt(this,r);if(f!==void 0)return f;if(this.lastNeed<=r.length)return r.copy(this.lastChar,l,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);r.copy(this.lastChar,l,0,r.length),this.lastNeed-=r.length}function yt(r,l){var f=_t(this,r,l);if(!this.lastNeed)return r.toString("utf8",l);this.lastTotal=f;var g=r.length-(f-this.lastNeed);return r.copy(this.lastChar,0,g),r.toString("utf8",l,g)}function wt(r){var l=r&&r.length?this.write(r):"";return this.lastNeed?l+"�":l}function Et(r,l){if((r.length-l)%2===0){var f=r.toString("utf16le",l);if(f){var g=f.charCodeAt(f.length-1);if(g>=55296&&g<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=r[r.length-2],this.lastChar[1]=r[r.length-1],f.slice(0,-1)}return f}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=r[r.length-1],r.toString("utf16le",l,r.length-1)}function Rt(r){var l=r&&r.length?this.write(r):"";if(this.lastNeed){var f=this.lastTotal-this.lastNeed;return l+this.lastChar.toString("utf16le",0,f)}return l}function St(r,l){var f=(r.length-l)%3;return f===0?r.toString("base64",l):(this.lastNeed=3-f,this.lastTotal=3,f===1?this.lastChar[0]=r[r.length-1]:(this.lastChar[0]=r[r.length-2],this.lastChar[1]=r[r.length-1]),r.toString("base64",l,r.length-f))}function mt(r){var l=r&&r.length?this.write(r):"";return this.lastNeed?l+this.lastChar.toString("base64",0,3-this.lastNeed):l}function Tt(r){return r.toString(this.encoding)}function Mt(r){return r&&r.length?this.write(r):""}var me,$e;function je(){if($e)return me;$e=1;var r=J().codes.ERR_STREAM_PREMATURE_CLOSE;function l(u){var h=!1;return function(){if(!h){h=!0;for(var o=arguments.length,a=new Array(o),d=0;d0)if(typeof t!="string"&&!D.objectMode&&Object.getPrototypeOf(t)!==g.prototype&&(t=u(t)),R)D.endEmitted?A(e,new b):Q(e,D,t,!0);else if(D.ended)A(e,new S);else{if(D.destroyed)return!1;D.reading=!1,D.decoder&&!s?(t=D.decoder.write(t),D.objectMode||t.length!==0?Q(e,D,t,!1):G(e,D)):Q(e,D,t,!1)}else R||(D.reading=!1,G(e,D))}return!D.ended&&(D.length=H?e=H:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function ee(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=fe(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}P.prototype.read=function(e){a("read",e),e=parseInt(e,10);var t=this._readableState,s=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return a("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?c(this):U(this),null;if(e=ee(e,t),e===0&&t.ended)return t.length===0&&c(this),null;var R=t.needReadable;a("need readable",R),(t.length===0||t.length-e0?I=i(e,t):I=null,I===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),s!==e&&t.ended&&c(this)),I!==null&&this.emit("data",I),I};function le(e,t){if(a("onEofChunk"),!t.ended){if(t.decoder){var s=t.decoder.end();s&&s.length&&(t.buffer.push(s),t.length+=t.objectMode?1:s.length)}t.ended=!0,t.sync?U(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,te(e)))}}function U(e){var t=e._readableState;a("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(a("emitReadable",t.flowing),t.emittedReadable=!0,j.nextTick(te,e))}function te(e){var t=e._readableState;a("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,n(e)}function G(e,t){t.readingMore||(t.readingMore=!0,j.nextTick(re,e,t))}function re(e,t){for(;!t.reading&&!t.ended&&(t.length1&&C(R.pipes,e)!==-1)&&!Ie&&(a("false write response, pause",R.awaitDrain),R.awaitDrain++),s.pause())}function he(Y){a("onerror",Y),Z(),e.removeListener("error",he),l(e,"error")===0&&A(e,Y)}B(e,"error",he);function ce(){e.removeListener("finish",pe),Z()}e.once("close",ce);function pe(){a("onfinish"),e.removeListener("close",ce),Z()}e.once("finish",pe);function Z(){a("unpipe"),s.unpipe(e)}return e.emit("pipe",s),R.flowing||(a("pipe resume"),s.resume()),e};function ue(e){return function(){var s=e._readableState;a("pipeOnDrain",s.awaitDrain),s.awaitDrain&&s.awaitDrain--,s.awaitDrain===0&&l(e,"data")&&(s.flowing=!0,n(e))}}P.prototype.unpipe=function(e){var t=this._readableState,s={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,s),this);if(!e){var R=t.pipes,I=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var D=0;D0,R.flowing!==!1&&this.resume()):e==="readable"&&!R.endEmitted&&!R.readableListening&&(R.readableListening=R.needReadable=!0,R.flowing=!1,R.emittedReadable=!1,a("on readable",R.length,R.reading),R.length?U(this):R.reading||j.nextTick(F,this)),s},P.prototype.addListener=P.prototype.on,P.prototype.removeListener=function(e,t){var s=f.prototype.removeListener.call(this,e,t);return e==="readable"&&j.nextTick(ie,this),s},P.prototype.removeAllListeners=function(e){var t=f.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&j.nextTick(ie,this),t};function ie(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function F(e){a("readable nexttick read 0"),e.read(0)}P.prototype.resume=function(){var e=this._readableState;return e.flowing||(a("resume"),e.flowing=!e.readableListening,se(this,e)),e.paused=!1,this};function se(e,t){t.resumeScheduled||(t.resumeScheduled=!0,j.nextTick(de,e,t))}function de(e,t){a("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),n(e),t.flowing&&!t.reading&&e.read(0)}P.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function n(e){var t=e._readableState;for(a("flow",t.flowing);t.flowing&&e.read()!==null;);}P.prototype.wrap=function(e){var t=this,s=this._readableState,R=!1;e.on("end",function(){if(a("wrapped end"),s.decoder&&!s.ended){var q=s.decoder.end();q&&q.length&&t.push(q)}t.push(null)}),e.on("data",function(q){if(a("wrapped data"),s.decoder&&(q=s.decoder.write(q)),!(s.objectMode&&q==null)&&!(!s.objectMode&&(!q||!q.length))){var V=t.push(q);V||(R=!0,e.pause())}});for(var I in e)this[I]===void 0&&typeof e[I]=="function"&&(this[I]=function(V){return function(){return e[V].apply(e,arguments)}}(I));for(var D=0;D=t.length?(t.decoder?s=t.buffer.join(""):t.buffer.length===1?s=t.buffer.first():s=t.buffer.concat(t.length),t.buffer.clear()):s=t.buffer.consume(e,t.decoder),s}function c(e){var t=e._readableState;a("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,j.nextTick(O,t,e))}function O(e,t){if(a("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var s=t._writableState;(!s||s.autoDestroy&&s.finished)&&t.destroy()}}typeof Symbol=="function"&&(P.from=function(e,t){return m===void 0&&(m=At()),m(P,e,t)});function C(e,t){for(var s=0,R=e.length;s0;return o(M,m,A,function(N){p||(p=N),N&&b.forEach(a),!m&&(b.forEach(a),S(p))})});return L.reduce(d)}return Ne=y,Ne}var qt=k,qe=Ce.EventEmitter,Pt=X;Pt(k,qe);k.Readable=ot();k.Writable=at();k.Duplex=$();k.Transform=ft();k.PassThrough=Lt();k.finished=je();k.pipeline=Nt();k.Stream=k;function k(){qe.call(this)}k.prototype.pipe=function(r,l){var f=this;function g(E){r.writable&&r.write(E)===!1&&f.pause&&f.pause()}f.on("data",g);function w(){f.readable&&f.resume&&f.resume()}r.on("drain",w),!r._isStdio&&(!l||l.end!==!1)&&(f.on("end",h),f.on("close",o));var u=!1;function h(){u||(u=!0,r.end())}function o(){u||(u=!0,typeof r.destroy=="function"&&r.destroy())}function a(E){if(d(),qe.listenerCount(this,"error")===0)throw E}f.on("error",a),r.on("error",a);function d(){f.removeListener("data",g),r.removeListener("drain",w),f.removeListener("end",h),f.removeListener("close",o),f.removeListener("error",a),r.removeListener("error",a),f.removeListener("end",d),f.removeListener("close",d),r.removeListener("close",d)}return f.on("end",d),f.on("close",d),r.on("close",d),r.emit("pipe",f),r};export{qt as a,Pe as b,jt as c,ht as d,ae as r,ct as s}; diff --git a/assets/index-DMvpfBi2.js b/assets/index-DMvpfBi2.js deleted file mode 100644 index 2f9cd3e..0000000 --- a/assets/index-DMvpfBi2.js +++ /dev/null @@ -1,6 +0,0 @@ -var A={},G={};G.byteLength=kr;G.toByteArray=$r;G.fromByteArray=Dr;var L=[],x=[],Mr=typeof Uint8Array<"u"?Uint8Array:Array,z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var F=0,Nr=z.length;F0)throw new Error("Invalid string. Length must be a multiple of 4");var f=s.indexOf("=");f===-1&&(f=p);var B=f===p?0:4-f%4;return[f,B]}function kr(s){var p=pr(s),f=p[0],B=p[1];return(f+B)*3/4-B}function Pr(s,p,f){return(p+f)*3/4-f}function $r(s){var p,f=pr(s),B=f[0],w=f[1],c=new Mr(Pr(s,B,w)),l=0,d=w>0?B-4:B,E;for(E=0;E>16&255,c[l++]=p>>8&255,c[l++]=p&255;return w===2&&(p=x[s.charCodeAt(E)]<<2|x[s.charCodeAt(E+1)]>>4,c[l++]=p&255),w===1&&(p=x[s.charCodeAt(E)]<<10|x[s.charCodeAt(E+1)]<<4|x[s.charCodeAt(E+2)]>>2,c[l++]=p>>8&255,c[l++]=p&255),c}function Fr(s){return L[s>>18&63]+L[s>>12&63]+L[s>>6&63]+L[s&63]}function Or(s,p,f){for(var B,w=[],c=p;cd?d:l+c));return B===1?(p=s[f-1],w.push(L[p>>2]+L[p<<4&63]+"==")):B===2&&(p=(s[f-2]<<8)+s[f-1],w.push(L[p>>10]+L[p>>4&63]+L[p<<2&63]+"=")),w.join("")}var J={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */J.read=function(s,p,f,B,w){var c,l,d=w*8-B-1,E=(1<>1,o=-7,R=f?w-1:0,C=f?-1:1,_=s[p+R];for(R+=C,c=_&(1<<-o)-1,_>>=-o,o+=d;o>0;c=c*256+s[p+R],R+=C,o-=8);for(l=c&(1<<-o)-1,c>>=-o,o+=B;o>0;l=l*256+s[p+R],R+=C,o-=8);if(c===0)c=1-T;else{if(c===E)return l?NaN:(_?-1:1)*(1/0);l=l+Math.pow(2,B),c=c-T}return(_?-1:1)*l*Math.pow(2,c-B)};J.write=function(s,p,f,B,w,c){var l,d,E,T=c*8-w-1,o=(1<>1,C=w===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=B?0:c-1,N=B?1:-1,Y=p<0||p===0&&1/p<0?1:0;for(p=Math.abs(p),isNaN(p)||p===1/0?(d=isNaN(p)?1:0,l=o):(l=Math.floor(Math.log(p)/Math.LN2),p*(E=Math.pow(2,-l))<1&&(l--,E*=2),l+R>=1?p+=C/E:p+=C*Math.pow(2,1-R),p*E>=2&&(l++,E/=2),l+R>=o?(d=0,l=o):l+R>=1?(d=(p*E-1)*Math.pow(2,w),l=l+R):(d=p*Math.pow(2,R-1)*Math.pow(2,w),l=0));w>=8;s[f+_]=d&255,_+=N,d/=256,w-=8);for(l=l<0;s[f+_]=l&255,_+=N,l/=256,T-=8);s[f+_-N]|=Y*128};/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */(function(s){const p=G,f=J,B=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;s.Buffer=o,s.SlowBuffer=ar,s.INSPECT_MAX_BYTES=50;const w=2147483647;s.kMaxLength=w;const{Uint8Array:c,ArrayBuffer:l,SharedArrayBuffer:d}=globalThis;o.TYPED_ARRAY_SUPPORT=E(),!o.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 E(){try{const i=new c(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,c.prototype),Object.setPrototypeOf(i,r),i.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function T(i){if(i>w)throw new RangeError('The value "'+i+'" is invalid for option "size"');const r=new c(i);return Object.setPrototypeOf(r,o.prototype),r}function o(i,r,t){if(typeof i=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return N(i)}return R(i,r,t)}o.poolSize=8192;function R(i,r,t){if(typeof i=="string")return Y(i,r);if(l.isView(i))return sr(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(b(i,l)||i&&b(i.buffer,l)||typeof d<"u"&&(b(i,d)||i&&b(i.buffer,d)))return W(i,r,t);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const n=i.valueOf&&i.valueOf();if(n!=null&&n!==i)return o.from(n,r,t);const e=lr(i);if(e)return e;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return o.from(i[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}o.from=function(i,r,t){return R(i,r,t)},Object.setPrototypeOf(o.prototype,c.prototype),Object.setPrototypeOf(o,c);function C(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function _(i,r,t){return C(i),i<=0?T(i):r!==void 0?typeof t=="string"?T(i).fill(r,t):T(i).fill(r):T(i)}o.alloc=function(i,r,t){return _(i,r,t)};function N(i){return C(i),T(i<0?0:X(i)|0)}o.allocUnsafe=function(i){return N(i)},o.allocUnsafeSlow=function(i){return N(i)};function Y(i,r){if((typeof r!="string"||r==="")&&(r="utf8"),!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);const t=K(i,r)|0;let n=T(t);const e=n.write(i,r);return e!==t&&(n=n.slice(0,e)),n}function j(i){const r=i.length<0?0:X(i.length)|0,t=T(r);for(let n=0;n=w)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+w.toString(16)+" bytes");return i|0}function ar(i){return+i!=i&&(i=0),o.alloc(+i)}o.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==o.prototype},o.compare=function(r,t){if(b(r,c)&&(r=o.from(r,r.offset,r.byteLength)),b(t,c)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(r)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,e=t.length;for(let u=0,h=Math.min(n,e);ue.length?(o.isBuffer(h)||(h=o.from(h)),h.copy(e,u)):c.prototype.set.call(e,h,u);else if(o.isBuffer(h))h.copy(e,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=h.length}return e};function K(i,r){if(o.isBuffer(i))return i.length;if(l.isView(i)||b(i,l))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);const t=i.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let e=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return H(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return cr(i).length;default:if(e)return n?-1:H(i).length;r=(""+r).toLowerCase(),e=!0}}o.byteLength=K;function fr(i,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return Ur(this,r,t);case"utf8":case"utf-8":return v(this,r,t);case"ascii":return dr(this,r,t);case"latin1":case"binary":return Ar(this,r,t);case"base64":return mr(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tr(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),n=!0}}o.prototype._isBuffer=!0;function k(i,r,t){const n=i[r];i[r]=i[t],i[t]=n}o.prototype.swap16=function(){const r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tt&&(r+=" ... "),""},B&&(o.prototype[B]=o.prototype.inspect),o.prototype.compare=function(r,t,n,e,u){if(b(r,c)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),e===void 0&&(e=0),u===void 0&&(u=this.length),t<0||n>r.length||e<0||u>this.length)throw new RangeError("out of range index");if(e>=u&&t>=n)return 0;if(e>=u)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,e>>>=0,u>>>=0,this===r)return 0;let h=u-e,a=n-t;const m=Math.min(h,a),g=this.slice(e,u),I=r.slice(t,n);for(let y=0;y2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,V(t)&&(t=e?0:i.length-1),t<0&&(t=i.length+t),t>=i.length){if(e)return-1;t=i.length-1}else if(t<0)if(e)t=0;else return-1;if(typeof r=="string"&&(r=o.from(r,n)),o.isBuffer(r))return r.length===0?-1:Q(i,r,t,n,e);if(typeof r=="number")return r=r&255,typeof c.prototype.indexOf=="function"?e?c.prototype.indexOf.call(i,r,t):c.prototype.lastIndexOf.call(i,r,t):Q(i,[r],t,n,e);throw new TypeError("val must be string, number or Buffer")}function Q(i,r,t,n,e){let u=1,h=i.length,a=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,h/=2,a/=2,t/=2}function m(I,y){return u===1?I[y]:I.readUInt16BE(y*u)}let g;if(e){let I=-1;for(g=t;gh&&(t=h-a),g=t;g>=0;g--){let I=!0;for(let y=0;ye&&(n=e)):n=e;const u=r.length;n>u/2&&(n=u/2);let h;for(h=0;h>>0,isFinite(n)?(n=n>>>0,e===void 0&&(e="utf8")):(e=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const u=this.length-t;if((n===void 0||n>u)&&(n=u),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");let h=!1;for(;;)switch(e){case"hex":return wr(this,r,t,n);case"utf8":case"utf-8":return yr(this,r,t,n);case"ascii":case"latin1":case"binary":return Br(this,r,t,n);case"base64":return Er(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gr(this,r,t,n);default:if(h)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),h=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mr(i,r,t){return r===0&&t===i.length?p.fromByteArray(i):p.fromByteArray(i.slice(r,t))}function v(i,r,t){t=Math.min(i.length,t);const n=[];let e=r;for(;e239?4:u>223?3:u>191?2:1;if(e+a<=t){let m,g,I,y;switch(a){case 1:u<128&&(h=u);break;case 2:m=i[e+1],(m&192)===128&&(y=(u&31)<<6|m&63,y>127&&(h=y));break;case 3:m=i[e+1],g=i[e+2],(m&192)===128&&(g&192)===128&&(y=(u&15)<<12|(m&63)<<6|g&63,y>2047&&(y<55296||y>57343)&&(h=y));break;case 4:m=i[e+1],g=i[e+2],I=i[e+3],(m&192)===128&&(g&192)===128&&(I&192)===128&&(y=(u&15)<<18|(m&63)<<12|(g&63)<<6|I&63,y>65535&&y<1114112&&(h=y))}}h===null?(h=65533,a=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|h&1023),n.push(h),e+=a}return Ir(n)}const rr=4096;function Ir(i){const r=i.length;if(r<=rr)return String.fromCharCode.apply(String,i);let t="",n=0;for(;nn)&&(t=n);let e="";for(let u=r;un&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||U(r,t,this.length);let e=this[r],u=1,h=0;for(;++h>>0,t=t>>>0,n||U(r,t,this.length);let e=this[r+--t],u=1;for(;t>0&&(u*=256);)e+=this[r+--t]*u;return e},o.prototype.readUint8=o.prototype.readUInt8=function(r,t){return r=r>>>0,t||U(r,1,this.length),this[r]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||U(r,2,this.length),this[r]|this[r+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||U(r,2,this.length),this[r]<<8|this[r+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||U(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||U(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},o.prototype.readBigUInt64LE=M(function(r){r=r>>>0,$(r,"offset");const t=this[r],n=this[r+7];(t===void 0||n===void 0)&&O(r,this.length-8);const e=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,u=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(e)+(BigInt(u)<>>0,$(r,"offset");const t=this[r],n=this[r+7];(t===void 0||n===void 0)&&O(r,this.length-8);const e=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],u=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return(BigInt(e)<>>0,t=t>>>0,n||U(r,t,this.length);let e=this[r],u=1,h=0;for(;++h=u&&(e-=Math.pow(2,8*t)),e},o.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||U(r,t,this.length);let e=t,u=1,h=this[r+--e];for(;e>0&&(u*=256);)h+=this[r+--e]*u;return u*=128,h>=u&&(h-=Math.pow(2,8*t)),h},o.prototype.readInt8=function(r,t){return r=r>>>0,t||U(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},o.prototype.readInt16LE=function(r,t){r=r>>>0,t||U(r,2,this.length);const n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n},o.prototype.readInt16BE=function(r,t){r=r>>>0,t||U(r,2,this.length);const n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n},o.prototype.readInt32LE=function(r,t){return r=r>>>0,t||U(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},o.prototype.readInt32BE=function(r,t){return r=r>>>0,t||U(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},o.prototype.readBigInt64LE=M(function(r){r=r>>>0,$(r,"offset");const t=this[r],n=this[r+7];(t===void 0||n===void 0)&&O(r,this.length-8);const e=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return(BigInt(e)<>>0,$(r,"offset");const t=this[r],n=this[r+7];(t===void 0||n===void 0)&&O(r,this.length-8);const e=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(e)<>>0,t||U(r,4,this.length),f.read(this,r,!0,23,4)},o.prototype.readFloatBE=function(r,t){return r=r>>>0,t||U(r,4,this.length),f.read(this,r,!1,23,4)},o.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||U(r,8,this.length),f.read(this,r,!0,52,8)},o.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||U(r,8,this.length),f.read(this,r,!1,52,8)};function S(i,r,t,n,e,u){if(!o.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>e||ri.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(r,t,n,e){if(r=+r,t=t>>>0,n=n>>>0,!e){const a=Math.pow(2,8*n)-1;S(this,r,t,n,a,0)}let u=1,h=0;for(this[t]=r&255;++h>>0,n=n>>>0,!e){const a=Math.pow(2,8*n)-1;S(this,r,t,n,a,0)}let u=n-1,h=1;for(this[t+u]=r&255;--u>=0&&(h*=256);)this[t+u]=r/h&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,1,255,0),this[t]=r&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function tr(i,r,t,n,e){hr(r,n,e,i,t,7);let u=Number(r&BigInt(4294967295));i[t++]=u,u=u>>8,i[t++]=u,u=u>>8,i[t++]=u,u=u>>8,i[t++]=u;let h=Number(r>>BigInt(32)&BigInt(4294967295));return i[t++]=h,h=h>>8,i[t++]=h,h=h>>8,i[t++]=h,h=h>>8,i[t++]=h,t}function ir(i,r,t,n,e){hr(r,n,e,i,t,7);let u=Number(r&BigInt(4294967295));i[t+7]=u,u=u>>8,i[t+6]=u,u=u>>8,i[t+5]=u,u=u>>8,i[t+4]=u;let h=Number(r>>BigInt(32)&BigInt(4294967295));return i[t+3]=h,h=h>>8,i[t+2]=h,h=h>>8,i[t+1]=h,h=h>>8,i[t]=h,t+8}o.prototype.writeBigUInt64LE=M(function(r,t=0){return tr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=M(function(r,t=0){return ir(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(r,t,n,e){if(r=+r,t=t>>>0,!e){const m=Math.pow(2,8*n-1);S(this,r,t,n,m-1,-m)}let u=0,h=1,a=0;for(this[t]=r&255;++u>0)-a&255;return t+n},o.prototype.writeIntBE=function(r,t,n,e){if(r=+r,t=t>>>0,!e){const m=Math.pow(2,8*n-1);S(this,r,t,n,m-1,-m)}let u=n-1,h=1,a=0;for(this[t+u]=r&255;--u>=0&&(h*=256);)r<0&&a===0&&this[t+u+1]!==0&&(a=1),this[t+u]=(r/h>>0)-a&255;return t+n},o.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1},o.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4},o.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||S(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4},o.prototype.writeBigInt64LE=M(function(r,t=0){return tr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=M(function(r,t=0){return ir(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nr(i,r,t,n,e,u){if(t+n>i.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function er(i,r,t,n,e){return r=+r,t=t>>>0,e||nr(i,r,t,4),f.write(i,r,t,n,23,4),t+4}o.prototype.writeFloatLE=function(r,t,n){return er(this,r,t,!0,n)},o.prototype.writeFloatBE=function(r,t,n){return er(this,r,t,!1,n)};function or(i,r,t,n,e){return r=+r,t=t>>>0,e||nr(i,r,t,8),f.write(i,r,t,n,52,8),t+8}o.prototype.writeDoubleLE=function(r,t,n){return or(this,r,t,!0,n)},o.prototype.writeDoubleBE=function(r,t,n){return or(this,r,t,!1,n)},o.prototype.copy=function(r,t,n,e){if(!o.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!e&&e!==0&&(e=this.length),t>=r.length&&(t=r.length),t||(t=0),e>0&&e=this.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),r.length-t>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let u;if(typeof r=="number")for(u=t;u2**32?e=ur(String(t)):typeof t=="bigint"&&(e=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(e=ur(e)),e+="n"),n+=` It must be ${r}. Received ${e}`,n},RangeError);function ur(i){let r="",t=i.length;const n=i[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${i.slice(t-3,t)}${r}`;return`${i.slice(0,t)}${r}`}function Rr(i,r,t){$(r,"offset"),(i[r]===void 0||i[r+t]===void 0)&&O(r,i.length-(t+1))}function hr(i,r,t,n,e,u){if(i>t||i= 0${h} and < 2${h} ** ${(u+1)*8}${h}`:a=`>= -(2${h} ** ${(u+1)*8-1}${h}) and < 2 ** ${(u+1)*8-1}${h}`,new P.ERR_OUT_OF_RANGE("value",a,i)}Rr(n,e,u)}function $(i,r){if(typeof i!="number")throw new P.ERR_INVALID_ARG_TYPE(r,"number",i)}function O(i,r,t){throw Math.floor(i)!==i?($(i,t),new P.ERR_OUT_OF_RANGE("offset","an integer",i)):r<0?new P.ERR_BUFFER_OUT_OF_BOUNDS:new P.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${r}`,i)}const Sr=/[^+/0-9A-Za-z-_]/g;function _r(i){if(i=i.split("=")[0],i=i.trim().replace(Sr,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function H(i,r){r=r||1/0;let t;const n=i.length;let e=null;const u=[];for(let h=0;h55295&&t<57344){if(!e){if(t>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(h+1===n){(r-=3)>-1&&u.push(239,191,189);continue}e=t;continue}if(t<56320){(r-=3)>-1&&u.push(239,191,189),e=t;continue}t=(e-55296<<10|t-56320)+65536}else e&&(r-=3)>-1&&u.push(239,191,189);if(e=null,t<128){if((r-=1)<0)break;u.push(t)}else if(t<2048){if((r-=2)<0)break;u.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;u.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;u.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return u}function xr(i){const r=[];for(let t=0;t>8,e=t%256,u.push(e),u.push(n);return u}function cr(i){return p.toByteArray(_r(i))}function D(i,r,t,n){let e;for(e=0;e=r.length||e>=i.length);++e)r[e+t]=i[e];return e}function b(i,r){return i instanceof r||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===r.name}function V(i){return i!==i}const Lr=function(){const i="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){const n=t*16;for(let e=0;e<16;++e)r[n+e]=i[t]+i[e]}return r}();function M(i){return typeof BigInt>"u"?Cr:i}function Cr(){throw new Error("BigInt not supported")}})(A);const Gr=A.Buffer,Yr=A.Blob,jr=A.BlobOptions,Wr=A.Buffer,Xr=A.File,qr=A.FileOptions,Hr=A.INSPECT_MAX_BYTES,Vr=A.SlowBuffer,zr=A.TranscodeEncoding,Jr=A.atob,Kr=A.btoa,Zr=A.constants,Qr=A.isAscii,vr=A.isUtf8,rt=A.kMaxLength,tt=A.kStringMaxLength,it=A.resolveObjectURL,nt=A.transcode,ot=Object.freeze(Object.defineProperty({__proto__:null,Blob:Yr,BlobOptions:jr,Buffer:Wr,File:Xr,FileOptions:qr,INSPECT_MAX_BYTES:Hr,SlowBuffer:Vr,TranscodeEncoding:zr,atob:Jr,btoa:Kr,constants:Zr,default:Gr,isAscii:Qr,isUtf8:vr,kMaxLength:rt,kStringMaxLength:tt,resolveObjectURL:it,transcode:nt},Symbol.toStringTag,{value:"Module"}));export{Gr as B,ot as d}; diff --git a/assets/index-dFR7CGs6.js b/assets/index-dFR7CGs6.js deleted file mode 100644 index a84d3f7..0000000 --- a/assets/index-dFR7CGs6.js +++ /dev/null @@ -1,8 +0,0 @@ -var ge=(c,d)=>()=>(d||c((d={exports:{}}).exports,d),d.exports);import{p as process$1,i as inherits_browserExports,u as util$3}from"./util-1Y60FSNK.js";import{s as safeBufferExports$1,a as streamBrowserify,r as require$$0$1,b as string_decoder,c as commonjsGlobal,d as requireBrowser$3}from"./index-CcnsKYy9.js";import{B as Buffer$B}from"./index-DMvpfBi2.js";import{e as eventsExports}from"./events-CXH2uRM3.js";var ye=ge(exports=>{var cryptoBrowserify={},browser$a={exports:{}},MAX_BYTES=65536,MAX_UINT32=4294967295;function oldBrowser$1(){throw new Error(`Secure random number generation is not supported by this browser. -Use Chrome, Firefox or Internet Explorer 11`)}var Buffer$A=safeBufferExports$1.Buffer,crypto$1=globalThis.crypto||globalThis.msCrypto;crypto$1&&crypto$1.getRandomValues?browser$a.exports=randomBytes$2:browser$a.exports=oldBrowser$1;function randomBytes$2(c,d){if(c>MAX_UINT32)throw new RangeError("requested too many random bytes");var g=Buffer$A.allocUnsafe(c);if(c>0)if(c>MAX_BYTES)for(var p=0;p=this._blockSize;){for(var y=this._blockOffset;y0;++h)this._length[h]+=w,w=this._length[h]/4294967296|0,w>0&&(this._length[h]-=4294967296*w);return this};HashBase$2.prototype._update=function(){throw new Error("_update is not implemented")};HashBase$2.prototype.digest=function(c){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var d=this._digest();c!==void 0&&(d=d.toString(c)),this._block.fill(0),this._blockOffset=0;for(var g=0;g<4;++g)this._length[g]=0;return d};HashBase$2.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$2,inherits$o=inherits_browserExports,HashBase$1=hashBase,Buffer$y=safeBufferExports$1.Buffer,ARRAY16$1=new Array(16);function MD5$3(){HashBase$1.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits$o(MD5$3,HashBase$1);MD5$3.prototype._update=function(){for(var c=ARRAY16$1,d=0;d<16;++d)c[d]=this._block.readInt32LE(d*4);var g=this._a,p=this._b,y=this._c,h=this._d;g=fnF(g,p,y,h,c[0],3614090360,7),h=fnF(h,g,p,y,c[1],3905402710,12),y=fnF(y,h,g,p,c[2],606105819,17),p=fnF(p,y,h,g,c[3],3250441966,22),g=fnF(g,p,y,h,c[4],4118548399,7),h=fnF(h,g,p,y,c[5],1200080426,12),y=fnF(y,h,g,p,c[6],2821735955,17),p=fnF(p,y,h,g,c[7],4249261313,22),g=fnF(g,p,y,h,c[8],1770035416,7),h=fnF(h,g,p,y,c[9],2336552879,12),y=fnF(y,h,g,p,c[10],4294925233,17),p=fnF(p,y,h,g,c[11],2304563134,22),g=fnF(g,p,y,h,c[12],1804603682,7),h=fnF(h,g,p,y,c[13],4254626195,12),y=fnF(y,h,g,p,c[14],2792965006,17),p=fnF(p,y,h,g,c[15],1236535329,22),g=fnG(g,p,y,h,c[1],4129170786,5),h=fnG(h,g,p,y,c[6],3225465664,9),y=fnG(y,h,g,p,c[11],643717713,14),p=fnG(p,y,h,g,c[0],3921069994,20),g=fnG(g,p,y,h,c[5],3593408605,5),h=fnG(h,g,p,y,c[10],38016083,9),y=fnG(y,h,g,p,c[15],3634488961,14),p=fnG(p,y,h,g,c[4],3889429448,20),g=fnG(g,p,y,h,c[9],568446438,5),h=fnG(h,g,p,y,c[14],3275163606,9),y=fnG(y,h,g,p,c[3],4107603335,14),p=fnG(p,y,h,g,c[8],1163531501,20),g=fnG(g,p,y,h,c[13],2850285829,5),h=fnG(h,g,p,y,c[2],4243563512,9),y=fnG(y,h,g,p,c[7],1735328473,14),p=fnG(p,y,h,g,c[12],2368359562,20),g=fnH(g,p,y,h,c[5],4294588738,4),h=fnH(h,g,p,y,c[8],2272392833,11),y=fnH(y,h,g,p,c[11],1839030562,16),p=fnH(p,y,h,g,c[14],4259657740,23),g=fnH(g,p,y,h,c[1],2763975236,4),h=fnH(h,g,p,y,c[4],1272893353,11),y=fnH(y,h,g,p,c[7],4139469664,16),p=fnH(p,y,h,g,c[10],3200236656,23),g=fnH(g,p,y,h,c[13],681279174,4),h=fnH(h,g,p,y,c[0],3936430074,11),y=fnH(y,h,g,p,c[3],3572445317,16),p=fnH(p,y,h,g,c[6],76029189,23),g=fnH(g,p,y,h,c[9],3654602809,4),h=fnH(h,g,p,y,c[12],3873151461,11),y=fnH(y,h,g,p,c[15],530742520,16),p=fnH(p,y,h,g,c[2],3299628645,23),g=fnI(g,p,y,h,c[0],4096336452,6),h=fnI(h,g,p,y,c[7],1126891415,10),y=fnI(y,h,g,p,c[14],2878612391,15),p=fnI(p,y,h,g,c[5],4237533241,21),g=fnI(g,p,y,h,c[12],1700485571,6),h=fnI(h,g,p,y,c[3],2399980690,10),y=fnI(y,h,g,p,c[10],4293915773,15),p=fnI(p,y,h,g,c[1],2240044497,21),g=fnI(g,p,y,h,c[8],1873313359,6),h=fnI(h,g,p,y,c[15],4264355552,10),y=fnI(y,h,g,p,c[6],2734768916,15),p=fnI(p,y,h,g,c[13],1309151649,21),g=fnI(g,p,y,h,c[4],4149444226,6),h=fnI(h,g,p,y,c[11],3174756917,10),y=fnI(y,h,g,p,c[2],718787259,15),p=fnI(p,y,h,g,c[9],3951481745,21),this._a=this._a+g|0,this._b=this._b+p|0,this._c=this._c+y|0,this._d=this._d+h|0};MD5$3.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var c=Buffer$y.allocUnsafe(16);return c.writeInt32LE(this._a,0),c.writeInt32LE(this._b,4),c.writeInt32LE(this._c,8),c.writeInt32LE(this._d,12),c};function rotl$1(c,d){return c<>>32-d}function fnF(c,d,g,p,y,h,w){return rotl$1(c+(d&g|~d&p)+y+h|0,w)+d|0}function fnG(c,d,g,p,y,h,w){return rotl$1(c+(d&p|g&~p)+y+h|0,w)+d|0}function fnH(c,d,g,p,y,h,w){return rotl$1(c+(d^g^p)+y+h|0,w)+d|0}function fnI(c,d,g,p,y,h,w){return rotl$1(c+(g^(d|~p))+y+h|0,w)+d|0}var md5_js=MD5$3,Buffer$x=require$$0$1.Buffer,inherits$n=inherits_browserExports,HashBase=hashBase,ARRAY16=new Array(16),zl=[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],zr=[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],sl=[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],sr=[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],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160$4(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}inherits$n(RIPEMD160$4,HashBase);RIPEMD160$4.prototype._update=function(){for(var c=ARRAY16,d=0;d<16;++d)c[d]=this._block.readInt32LE(d*4);for(var g=this._a|0,p=this._b|0,y=this._c|0,h=this._d|0,w=this._e|0,_=this._a|0,S=this._b|0,A=this._c|0,x=this._d|0,B=this._e|0,k=0;k<80;k+=1){var R,C;k<16?(R=fn1(g,p,y,h,w,c[zl[k]],hl[0],sl[k]),C=fn5(_,S,A,x,B,c[zr[k]],hr[0],sr[k])):k<32?(R=fn2(g,p,y,h,w,c[zl[k]],hl[1],sl[k]),C=fn4(_,S,A,x,B,c[zr[k]],hr[1],sr[k])):k<48?(R=fn3(g,p,y,h,w,c[zl[k]],hl[2],sl[k]),C=fn3(_,S,A,x,B,c[zr[k]],hr[2],sr[k])):k<64?(R=fn4(g,p,y,h,w,c[zl[k]],hl[3],sl[k]),C=fn2(_,S,A,x,B,c[zr[k]],hr[3],sr[k])):(R=fn5(g,p,y,h,w,c[zl[k]],hl[4],sl[k]),C=fn1(_,S,A,x,B,c[zr[k]],hr[4],sr[k])),g=w,w=h,h=rotl(y,10),y=p,p=R,_=B,B=x,x=rotl(A,10),A=S,S=C}var H=this._b+y+x|0;this._b=this._c+h+B|0,this._c=this._d+w+_|0,this._d=this._e+g+S|0,this._e=this._a+p+A|0,this._a=H};RIPEMD160$4.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var c=Buffer$x.alloc?Buffer$x.alloc(20):new Buffer$x(20);return c.writeInt32LE(this._a,0),c.writeInt32LE(this._b,4),c.writeInt32LE(this._c,8),c.writeInt32LE(this._d,12),c.writeInt32LE(this._e,16),c};function rotl(c,d){return c<>>32-d}function fn1(c,d,g,p,y,h,w,_){return rotl(c+(d^g^p)+h+w|0,_)+y|0}function fn2(c,d,g,p,y,h,w,_){return rotl(c+(d&g|~d&p)+h+w|0,_)+y|0}function fn3(c,d,g,p,y,h,w,_){return rotl(c+((d|~g)^p)+h+w|0,_)+y|0}function fn4(c,d,g,p,y,h,w,_){return rotl(c+(d&p|g&~p)+h+w|0,_)+y|0}function fn5(c,d,g,p,y,h,w,_){return rotl(c+(d^(g|~p))+h+w|0,_)+y|0}var ripemd160=RIPEMD160$4,sha_js={exports:{}},Buffer$w=safeBufferExports$1.Buffer;function Hash$7(c,d){this._block=Buffer$w.alloc(c),this._finalSize=d,this._blockSize=c,this._len=0}Hash$7.prototype.update=function(c,d){typeof c=="string"&&(d=d||"utf8",c=Buffer$w.from(c,d));for(var g=this._block,p=this._blockSize,y=c.length,h=this._len,w=0;w=this._finalSize&&(this._update(this._block),this._block.fill(0));var g=this._len*8;if(g<=4294967295)this._block.writeUInt32BE(g,this._blockSize-4);else{var p=(g&4294967295)>>>0,y=(g-p)/4294967296;this._block.writeUInt32BE(y,this._blockSize-8),this._block.writeUInt32BE(p,this._blockSize-4)}this._update(this._block);var h=this._hash();return c?h.toString(c):h};Hash$7.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$3=Hash$7,inherits$m=inherits_browserExports,Hash$6=hash$3,Buffer$v=safeBufferExports$1.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$6.call(this,64,56)}inherits$m(Sha,Hash$6);Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(c){return c<<5|c>>>27}function rotl30$1(c){return c<<30|c>>>2}function ft$1(c,d,g,p){return c===0?d&g|~d&p:c===2?d&g|d&p|g&p:d^g^p}Sha.prototype._update=function(c){for(var d=this._w,g=this._a|0,p=this._b|0,y=this._c|0,h=this._d|0,w=this._e|0,_=0;_<16;++_)d[_]=c.readInt32BE(_*4);for(;_<80;++_)d[_]=d[_-3]^d[_-8]^d[_-14]^d[_-16];for(var S=0;S<80;++S){var A=~~(S/20),x=rotl5$1(g)+ft$1(A,p,y,h)+w+d[S]+K$4[A]|0;w=h,h=y,y=rotl30$1(p),p=g,g=x}this._a=g+this._a|0,this._b=p+this._b|0,this._c=y+this._c|0,this._d=h+this._d|0,this._e=w+this._e|0};Sha.prototype._hash=function(){var c=Buffer$v.allocUnsafe(20);return c.writeInt32BE(this._a|0,0),c.writeInt32BE(this._b|0,4),c.writeInt32BE(this._c|0,8),c.writeInt32BE(this._d|0,12),c.writeInt32BE(this._e|0,16),c};var sha$4=Sha,inherits$l=inherits_browserExports,Hash$5=hash$3,Buffer$u=safeBufferExports$1.Buffer,K$3=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$5.call(this,64,56)}inherits$l(Sha1,Hash$5);Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(c){return c<<1|c>>>31}function rotl5(c){return c<<5|c>>>27}function rotl30(c){return c<<30|c>>>2}function ft(c,d,g,p){return c===0?d&g|~d&p:c===2?d&g|d&p|g&p:d^g^p}Sha1.prototype._update=function(c){for(var d=this._w,g=this._a|0,p=this._b|0,y=this._c|0,h=this._d|0,w=this._e|0,_=0;_<16;++_)d[_]=c.readInt32BE(_*4);for(;_<80;++_)d[_]=rotl1(d[_-3]^d[_-8]^d[_-14]^d[_-16]);for(var S=0;S<80;++S){var A=~~(S/20),x=rotl5(g)+ft(A,p,y,h)+w+d[S]+K$3[A]|0;w=h,h=y,y=rotl30(p),p=g,g=x}this._a=g+this._a|0,this._b=p+this._b|0,this._c=y+this._c|0,this._d=h+this._d|0,this._e=w+this._e|0};Sha1.prototype._hash=function(){var c=Buffer$u.allocUnsafe(20);return c.writeInt32BE(this._a|0,0),c.writeInt32BE(this._b|0,4),c.writeInt32BE(this._c|0,8),c.writeInt32BE(this._d|0,12),c.writeInt32BE(this._e|0,16),c};var sha1=Sha1,inherits$k=inherits_browserExports,Hash$4=hash$3,Buffer$t=safeBufferExports$1.Buffer,K$2=[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],W$3=new Array(64);function Sha256$1(){this.init(),this._w=W$3,Hash$4.call(this,64,56)}inherits$k(Sha256$1,Hash$4);Sha256$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ch(c,d,g){return g^c&(d^g)}function maj$1(c,d,g){return c&d|g&(c|d)}function sigma0$1(c){return(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10)}function sigma1$1(c){return(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7)}function gamma0(c){return(c>>>7|c<<25)^(c>>>18|c<<14)^c>>>3}function gamma1(c){return(c>>>17|c<<15)^(c>>>19|c<<13)^c>>>10}Sha256$1.prototype._update=function(c){for(var d=this._w,g=this._a|0,p=this._b|0,y=this._c|0,h=this._d|0,w=this._e|0,_=this._f|0,S=this._g|0,A=this._h|0,x=0;x<16;++x)d[x]=c.readInt32BE(x*4);for(;x<64;++x)d[x]=gamma1(d[x-2])+d[x-7]+gamma0(d[x-15])+d[x-16]|0;for(var B=0;B<64;++B){var k=A+sigma1$1(w)+ch(w,_,S)+K$2[B]+d[B]|0,R=sigma0$1(g)+maj$1(g,p,y)|0;A=S,S=_,_=w,w=h+k|0,h=y,y=p,p=g,g=k+R|0}this._a=g+this._a|0,this._b=p+this._b|0,this._c=y+this._c|0,this._d=h+this._d|0,this._e=w+this._e|0,this._f=_+this._f|0,this._g=S+this._g|0,this._h=A+this._h|0};Sha256$1.prototype._hash=function(){var c=Buffer$t.allocUnsafe(32);return c.writeInt32BE(this._a,0),c.writeInt32BE(this._b,4),c.writeInt32BE(this._c,8),c.writeInt32BE(this._d,12),c.writeInt32BE(this._e,16),c.writeInt32BE(this._f,20),c.writeInt32BE(this._g,24),c.writeInt32BE(this._h,28),c};var sha256$1=Sha256$1,inherits$j=inherits_browserExports,Sha256=sha256$1,Hash$3=hash$3,Buffer$s=safeBufferExports$1.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$3.call(this,64,56)}inherits$j(Sha224,Sha256);Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Sha224.prototype._hash=function(){var c=Buffer$s.allocUnsafe(28);return c.writeInt32BE(this._a,0),c.writeInt32BE(this._b,4),c.writeInt32BE(this._c,8),c.writeInt32BE(this._d,12),c.writeInt32BE(this._e,16),c.writeInt32BE(this._f,20),c.writeInt32BE(this._g,24),c};var sha224$1=Sha224,inherits$i=inherits_browserExports,Hash$2=hash$3,Buffer$r=safeBufferExports$1.Buffer,K$1=[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],W$1=new Array(160);function Sha512(){this.init(),this._w=W$1,Hash$2.call(this,128,112)}inherits$i(Sha512,Hash$2);Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ch(c,d,g){return g^c&(d^g)}function maj(c,d,g){return c&d|g&(c|d)}function sigma0(c,d){return(c>>>28|d<<4)^(d>>>2|c<<30)^(d>>>7|c<<25)}function sigma1(c,d){return(c>>>14|d<<18)^(c>>>18|d<<14)^(d>>>9|c<<23)}function Gamma0(c,d){return(c>>>1|d<<31)^(c>>>8|d<<24)^c>>>7}function Gamma0l(c,d){return(c>>>1|d<<31)^(c>>>8|d<<24)^(c>>>7|d<<25)}function Gamma1(c,d){return(c>>>19|d<<13)^(d>>>29|c<<3)^c>>>6}function Gamma1l(c,d){return(c>>>19|d<<13)^(d>>>29|c<<3)^(c>>>6|d<<26)}function getCarry(c,d){return c>>>0>>0?1:0}Sha512.prototype._update=function(c){for(var d=this._w,g=this._ah|0,p=this._bh|0,y=this._ch|0,h=this._dh|0,w=this._eh|0,_=this._fh|0,S=this._gh|0,A=this._hh|0,x=this._al|0,B=this._bl|0,k=this._cl|0,R=this._dl|0,C=this._el|0,H=this._fl|0,U=this._gl|0,L=this._hl|0,T=0;T<32;T+=2)d[T]=c.readInt32BE(T*4),d[T+1]=c.readInt32BE(T*4+4);for(;T<160;T+=2){var dt=d[T-30],O=d[T-15*2+1],kt=Gamma0(dt,O),Rt=Gamma0l(O,dt);dt=d[T-2*2],O=d[T-2*2+1];var Ct=Gamma1(dt,O),qt=Gamma1l(O,dt),Z=d[T-7*2],Pt=d[T-7*2+1],b=d[T-16*2],t=d[T-16*2+1],i=Rt+Pt|0,n=kt+Z+getCarry(i,Rt)|0;i=i+qt|0,n=n+Ct+getCarry(i,qt)|0,i=i+t|0,n=n+b+getCarry(i,t)|0,d[T]=n,d[T+1]=i}for(var a=0;a<160;a+=2){n=d[a],i=d[a+1];var l=maj(g,p,y),v=maj(x,B,k),m=sigma0(g,x),o=sigma0(x,g),e=sigma1(w,C),u=sigma1(C,w),M=K$1[a],$=K$1[a+1],q=Ch(w,_,S),I=Ch(C,H,U),N=L+u|0,E=A+e+getCarry(N,L)|0;N=N+I|0,E=E+q+getCarry(N,I)|0,N=N+$|0,E=E+M+getCarry(N,$)|0,N=N+i|0,E=E+n+getCarry(N,i)|0;var P=o+v|0,D=m+l+getCarry(P,o)|0;A=S,L=U,S=_,U=H,_=w,H=C,C=R+N|0,w=h+E+getCarry(C,R)|0,h=y,R=k,y=p,k=B,p=g,B=x,x=N+P|0,g=E+D+getCarry(x,N)|0}this._al=this._al+x|0,this._bl=this._bl+B|0,this._cl=this._cl+k|0,this._dl=this._dl+R|0,this._el=this._el+C|0,this._fl=this._fl+H|0,this._gl=this._gl+U|0,this._hl=this._hl+L|0,this._ah=this._ah+g+getCarry(this._al,x)|0,this._bh=this._bh+p+getCarry(this._bl,B)|0,this._ch=this._ch+y+getCarry(this._cl,k)|0,this._dh=this._dh+h+getCarry(this._dl,R)|0,this._eh=this._eh+w+getCarry(this._el,C)|0,this._fh=this._fh+_+getCarry(this._fl,H)|0,this._gh=this._gh+S+getCarry(this._gl,U)|0,this._hh=this._hh+A+getCarry(this._hl,L)|0};Sha512.prototype._hash=function(){var c=Buffer$r.allocUnsafe(64);function d(g,p,y){c.writeInt32BE(g,y),c.writeInt32BE(p,y+4)}return d(this._ah,this._al,0),d(this._bh,this._bl,8),d(this._ch,this._cl,16),d(this._dh,this._dl,24),d(this._eh,this._el,32),d(this._fh,this._fl,40),d(this._gh,this._gl,48),d(this._hh,this._hl,56),c};var sha512$1=Sha512,inherits$h=inherits_browserExports,SHA512$2=sha512$1,Hash$1=hash$3,Buffer$q=safeBufferExports$1.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$1.call(this,128,112)}inherits$h(Sha384,SHA512$2);Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Sha384.prototype._hash=function(){var c=Buffer$q.allocUnsafe(48);function d(g,p,y){c.writeInt32BE(g,y),c.writeInt32BE(p,y+4)}return d(this._ah,this._al,0),d(this._bh,this._bl,8),d(this._ch,this._cl,16),d(this._dh,this._dl,24),d(this._eh,this._el,32),d(this._fh,this._fl,40),c};var sha384$1=Sha384,exports=sha_js.exports=function(d){d=d.toLowerCase();var g=exports[d];if(!g)throw new Error(d+" is not supported (we accept pull requests)");return new g};exports.sha=sha$4;exports.sha1=sha1;exports.sha224=sha224$1;exports.sha256=sha256$1;exports.sha384=sha384$1;exports.sha512=sha512$1;var sha_jsExports=sha_js.exports,Buffer$p=safeBufferExports$1.Buffer,Transform$6=streamBrowserify.Transform,StringDecoder=string_decoder.StringDecoder,inherits$g=inherits_browserExports;function CipherBase$1(c){Transform$6.call(this),this.hashMode=typeof c=="string",this.hashMode?this[c]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$g(CipherBase$1,Transform$6);var useUint8Array=typeof Uint8Array<"u",useArrayBuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(Buffer$p.prototype instanceof Uint8Array||Buffer$p.TYPED_ARRAY_SUPPORT);CipherBase$1.prototype.update=function(c,d,g){var p;if(c instanceof Buffer$p)p=c;else if(typeof c=="string")p=Buffer$p.from(c,d);else if(useArrayBuffer&&ArrayBuffer.isView(c))p=Buffer$p.from(c.buffer,c.byteOffset,c.byteLength);else if(useUint8Array&&c instanceof Uint8Array)p=Buffer$p.from(c);else if(Buffer$p.isBuffer(c)&&c.constructor&&c.constructor.isBuffer&&c.constructor.isBuffer(c))p=Buffer$p.from(c);else throw new Error('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.');var y=this._update(p);return this.hashMode?this:(g&&(y=this._toString(y,g)),y)};CipherBase$1.prototype.setAutoPadding=function(){};CipherBase$1.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};CipherBase$1.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};CipherBase$1.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};CipherBase$1.prototype._transform=function(c,d,g){var p;try{this.hashMode?this._update(c):this.push(this._update(c))}catch(y){p=y}finally{g(p)}};CipherBase$1.prototype._flush=function(c){var d;try{this.push(this.__final())}catch(g){d=g}c(d)};CipherBase$1.prototype._finalOrDigest=function(c){var d=this.__final()||Buffer$p.alloc(0);return c&&(d=this._toString(d,c,!0)),d};CipherBase$1.prototype._toString=function(c,d,g){if(this._decoder||(this._decoder=new StringDecoder(d),this._encoding=d),this._encoding!==d)throw new Error("can’t switch encodings");var p=this._decoder.write(c);return g&&(p+=this._decoder.end()),p};var cipherBase=CipherBase$1,inherits$f=inherits_browserExports,MD5$2=md5_js,RIPEMD160$3=ripemd160,sha$3=sha_jsExports,Base$5=cipherBase;function Hash(c){Base$5.call(this,"digest"),this._hash=c}inherits$f(Hash,Base$5);Hash.prototype._update=function(c){this._hash.update(c)};Hash.prototype._final=function(){return this._hash.digest()};var browser$9=function(d){return d=d.toLowerCase(),d==="md5"?new MD5$2:d==="rmd160"||d==="ripemd160"?new RIPEMD160$3:new Hash(sha$3(d))},inherits$e=inherits_browserExports,Buffer$o=safeBufferExports$1.Buffer,Base$4=cipherBase,ZEROS$2=Buffer$o.alloc(128),blocksize=64;function Hmac$3(c,d){Base$4.call(this,"digest"),typeof d=="string"&&(d=Buffer$o.from(d)),this._alg=c,this._key=d,d.length>blocksize?d=c(d):d.lengthg){var p=c==="rmd160"?new RIPEMD160$2:sha$2(c);d=p.update(d).digest()}else d.lengthMAX_ALLOC||d!==d)throw new TypeError("Bad key length")},defaultEncoding$2;if(globalThis.process&&globalThis.process.browser)defaultEncoding$2="utf-8";else if(globalThis.process&&globalThis.process.version){var pVersionMajor=parseInt(process$1.version.split(".")[0].slice(1),10);defaultEncoding$2=pVersionMajor>=6?"utf-8":"binary"}else defaultEncoding$2="utf-8";var defaultEncoding_1=defaultEncoding$2,Buffer$m=safeBufferExports$1.Buffer,toBuffer$2=function(c,d,g){if(Buffer$m.isBuffer(c))return c;if(typeof c=="string")return Buffer$m.from(c,d);if(ArrayBuffer.isView(c))return Buffer$m.from(c.buffer);throw new TypeError(g+" must be a string, a Buffer, a typed array or a DataView")},md5=md5$2,RIPEMD160$1=ripemd160,sha$1=sha_jsExports,Buffer$l=safeBufferExports$1.Buffer,checkParameters$1=precondition,defaultEncoding$1=defaultEncoding_1,toBuffer$1=toBuffer$2,ZEROS=Buffer$l.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac$1(c,d,g){var p=getDigest(c),y=c==="sha512"||c==="sha384"?128:64;d.length>y?d=p(d):d.length>>0};utils$n.writeUInt32BE=function(d,g,p){d[0+p]=g>>>24,d[1+p]=g>>>16&255,d[2+p]=g>>>8&255,d[3+p]=g&255};utils$n.ip=function(d,g,p,y){for(var h=0,w=0,_=6;_>=0;_-=2){for(var S=0;S<=24;S+=8)h<<=1,h|=g>>>S+_&1;for(var S=0;S<=24;S+=8)h<<=1,h|=d>>>S+_&1}for(var _=6;_>=0;_-=2){for(var S=1;S<=25;S+=8)w<<=1,w|=g>>>S+_&1;for(var S=1;S<=25;S+=8)w<<=1,w|=d>>>S+_&1}p[y+0]=h>>>0,p[y+1]=w>>>0};utils$n.rip=function(d,g,p,y){for(var h=0,w=0,_=0;_<4;_++)for(var S=24;S>=0;S-=8)h<<=1,h|=g>>>S+_&1,h<<=1,h|=d>>>S+_&1;for(var _=4;_<8;_++)for(var S=24;S>=0;S-=8)w<<=1,w|=g>>>S+_&1,w<<=1,w|=d>>>S+_&1;p[y+0]=h>>>0,p[y+1]=w>>>0};utils$n.pc1=function(d,g,p,y){for(var h=0,w=0,_=7;_>=5;_--){for(var S=0;S<=24;S+=8)h<<=1,h|=g>>S+_&1;for(var S=0;S<=24;S+=8)h<<=1,h|=d>>S+_&1}for(var S=0;S<=24;S+=8)h<<=1,h|=g>>S+_&1;for(var _=1;_<=3;_++){for(var S=0;S<=24;S+=8)w<<=1,w|=g>>S+_&1;for(var S=0;S<=24;S+=8)w<<=1,w|=d>>S+_&1}for(var S=0;S<=24;S+=8)w<<=1,w|=d>>S+_&1;p[y+0]=h>>>0,p[y+1]=w>>>0};utils$n.r28shl=function(d,g){return d<>>28-g};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$n.pc2=function(d,g,p,y){for(var h=0,w=0,_=pc2table.length>>>1,S=0;S<_;S++)h<<=1,h|=d>>>pc2table[S]&1;for(var S=_;S>>pc2table[S]&1;p[y+0]=h>>>0,p[y+1]=w>>>0};utils$n.expand=function(d,g,p){var y=0,h=0;y=(d&1)<<5|d>>>27;for(var w=23;w>=15;w-=4)y<<=6,y|=d>>>w&63;for(var w=11;w>=3;w-=4)h|=d>>>w&63,h<<=6;h|=(d&31)<<1|d>>>31,g[p+0]=y>>>0,g[p+1]=h>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$n.substitute=function(d,g){for(var p=0,y=0;y<4;y++){var h=d>>>18-y*6&63,w=sTable[y*64+h];p<<=4,p|=w}for(var y=0;y<4;y++){var h=g>>>18-y*6&63,w=sTable[4*64+y*64+h];p<<=4,p|=w}return p>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];utils$n.permute=function(d){for(var g=0,p=0;p>>permuteTable[p]&1;return g>>>0};utils$n.padSplit=function(d,g,p){for(var y=d.toString(2);y.length0;y--)g+=this._buffer(d,g),p+=this._flushBuffer(h,p);return g+=this._buffer(d,g),h};Cipher$3.prototype.final=function(d){var g;d&&(g=this.update(d));var p;return this.type==="encrypt"?p=this._finalEncrypt():p=this._finalDecrypt(),g?g.concat(p):p};Cipher$3.prototype._pad=function(d,g){if(g===0)return!1;for(;g>>1];p=utils$m.r28shl(p,w),y=utils$m.r28shl(y,w),utils$m.pc2(p,y,d.keys,h)}};DES$3.prototype._update=function(d,g,p,y){var h=this._desState,w=utils$m.readUInt32BE(d,g),_=utils$m.readUInt32BE(d,g+4);utils$m.ip(w,_,h.tmp,0),w=h.tmp[0],_=h.tmp[1],this.type==="encrypt"?this._encrypt(h,w,_,h.tmp,0):this._decrypt(h,w,_,h.tmp,0),w=h.tmp[0],_=h.tmp[1],utils$m.writeUInt32BE(p,w,y),utils$m.writeUInt32BE(p,_,y+4)};DES$3.prototype._pad=function(d,g){if(this.padding===!1)return!1;for(var p=d.length-g,y=g;y>>0,w=R}utils$m.rip(_,w,y,h)};DES$3.prototype._decrypt=function(d,g,p,y,h){for(var w=p,_=g,S=d.keys.length-2;S>=0;S-=2){var A=d.keys[S],x=d.keys[S+1];utils$m.expand(w,d.tmp,0),A^=d.tmp[0],x^=d.tmp[1];var B=utils$m.substitute(A,x),k=utils$m.permute(B),R=w;w=(_^k)>>>0,_=R}utils$m.rip(w,_,y,h)};var cbc$1={},assert$f=minimalisticAssert,inherits$b=inherits_browserExports,proto={};function CBCState(c){assert$f.equal(c.length,8,"Invalid IV length"),this.iv=new Array(8);for(var d=0;d>y%8,c._prev=shiftIn(c._prev,g?_:S);return w}function shiftIn(c,d){var g=c.length,p=-1,y=Buffer$g.allocUnsafe(c.length);for(c=Buffer$g.concat([c,Buffer$g.from([d])]);++p>7;return y}cfb1.encrypt=function(c,d,g){for(var p=d.length,y=Buffer$g.allocUnsafe(p),h=-1;++h>>24]^w[x>>>16&255]^_[B>>>8&255]^S[k&255]^d[L++],C=h[x>>>24]^w[B>>>16&255]^_[k>>>8&255]^S[A&255]^d[L++],H=h[B>>>24]^w[k>>>16&255]^_[A>>>8&255]^S[x&255]^d[L++],U=h[k>>>24]^w[A>>>16&255]^_[x>>>8&255]^S[B&255]^d[L++],A=R,x=C,B=H,k=U;return R=(p[A>>>24]<<24|p[x>>>16&255]<<16|p[B>>>8&255]<<8|p[k&255])^d[L++],C=(p[x>>>24]<<24|p[B>>>16&255]<<16|p[k>>>8&255]<<8|p[A&255])^d[L++],H=(p[B>>>24]<<24|p[k>>>16&255]<<16|p[A>>>8&255]<<8|p[x&255])^d[L++],U=(p[k>>>24]<<24|p[A>>>16&255]<<16|p[x>>>8&255]<<8|p[B&255])^d[L++],R=R>>>0,C=C>>>0,H=H>>>0,U=U>>>0,[R,C,H,U]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var c=new Array(256),d=0;d<256;d++)d<128?c[d]=d<<1:c[d]=d<<1^283;for(var g=[],p=[],y=[[],[],[],[]],h=[[],[],[],[]],w=0,_=0,S=0;S<256;++S){var A=_^_<<1^_<<2^_<<3^_<<4;A=A>>>8^A&255^99,g[w]=A,p[A]=w;var x=c[w],B=c[x],k=c[B],R=c[A]*257^A*16843008;y[0][w]=R<<24|R>>>8,y[1][w]=R<<16|R>>>16,y[2][w]=R<<8|R>>>24,y[3][w]=R,R=k*16843009^B*65537^x*257^w*16843008,h[0][A]=R<<24|R>>>8,h[1][A]=R<<16|R>>>16,h[2][A]=R<<8|R>>>24,h[3][A]=R,w===0?w=_=1:(w=x^c[c[c[k^x]]],_^=c[c[_]])}return{SBOX:g,INV_SBOX:p,SUB_MIX:y,INV_SUB_MIX:h}}();function AES(c){this._key=asUInt32Array(c),this._reset()}AES.blockSize=4*4;AES.keySize=256/8;AES.prototype.blockSize=AES.blockSize;AES.prototype.keySize=AES.keySize;AES.prototype._reset=function(){for(var c=this._key,d=c.length,g=d+6,p=(g+1)*4,y=[],h=0;h>>24,w=G.SBOX[w>>>24]<<24|G.SBOX[w>>>16&255]<<16|G.SBOX[w>>>8&255]<<8|G.SBOX[w&255],w^=RCON[h/d|0]<<24):d>6&&h%d===4&&(w=G.SBOX[w>>>24]<<24|G.SBOX[w>>>16&255]<<16|G.SBOX[w>>>8&255]<<8|G.SBOX[w&255]),y[h]=y[h-d]^w}for(var _=[],S=0;S>>24]]^G.INV_SUB_MIX[1][G.SBOX[x>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[x>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[x&255]]}this._nRounds=g,this._keySchedule=y,this._invKeySchedule=_};AES.prototype.encryptBlockRaw=function(c){return c=asUInt32Array(c),cryptBlock(c,this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)};AES.prototype.encryptBlock=function(c){var d=this.encryptBlockRaw(c),g=Buffer$e.allocUnsafe(16);return g.writeUInt32BE(d[0],0),g.writeUInt32BE(d[1],4),g.writeUInt32BE(d[2],8),g.writeUInt32BE(d[3],12),g};AES.prototype.decryptBlock=function(c){c=asUInt32Array(c);var d=c[1];c[1]=c[3],c[3]=d;var g=cryptBlock(c,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),p=Buffer$e.allocUnsafe(16);return p.writeUInt32BE(g[0],0),p.writeUInt32BE(g[3],4),p.writeUInt32BE(g[2],8),p.writeUInt32BE(g[1],12),p};AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)};aes$5.AES=AES;var Buffer$d=safeBufferExports$1.Buffer,ZEROES=Buffer$d.alloc(16,0);function toArray$1(c){return[c.readUInt32BE(0),c.readUInt32BE(4),c.readUInt32BE(8),c.readUInt32BE(12)]}function fromArray(c){var d=Buffer$d.allocUnsafe(16);return d.writeUInt32BE(c[0]>>>0,0),d.writeUInt32BE(c[1]>>>0,4),d.writeUInt32BE(c[2]>>>0,8),d.writeUInt32BE(c[3]>>>0,12),d}function GHASH$1(c){this.h=c,this.state=Buffer$d.alloc(16,0),this.cache=Buffer$d.allocUnsafe(0)}GHASH$1.prototype.ghash=function(c){for(var d=-1;++d0;g--)c[g]=c[g]>>>1|(c[g-1]&1)<<31;c[0]=c[0]>>>1,y&&(c[0]=c[0]^225<<24)}this.state=fromArray(d)};GHASH$1.prototype.update=function(c){this.cache=Buffer$d.concat([this.cache,c]);for(var d;this.cache.length>=16;)d=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(d)};GHASH$1.prototype.final=function(c,d){return this.cache.length&&this.ghash(Buffer$d.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,c,0,d])),this.state};var ghash=GHASH$1,aes$4=aes$5,Buffer$c=safeBufferExports$1.Buffer,Transform$5=cipherBase,inherits$8=inherits_browserExports,GHASH=ghash,xor$3=bufferXor,incr32=incr32_1;function xorTest(c,d){var g=0;c.length!==d.length&&g++;for(var p=Math.min(c.length,d.length),y=0;y0||p>0;){var S=new MD5;S.update(_),S.update(c),d&&S.update(d),_=S.digest();var A=0;if(y>0){var x=h.length-y;A=Math.min(y,_.length),_.copy(h,x,0,A),y-=A}if(A<_.length&&p>0){var B=w.length-p,k=Math.min(p,_.length-A);_.copy(w,B,A,A+k),p-=k}}return _.fill(0),{key:h,iv:w}}var evp_bytestokey=EVP_BytesToKey,MODES$1=modes_1,AuthCipher$1=authCipher,Buffer$9=safeBufferExports$1.Buffer,StreamCipher$1=streamCipher,Transform$3=cipherBase,aes$2=aes$5,ebtk$2=evp_bytestokey,inherits$6=inherits_browserExports;function Cipher(c,d,g){Transform$3.call(this),this._cache=new Splitter$1,this._cipher=new aes$2.AES(d),this._prev=Buffer$9.from(g),this._mode=c,this._autopadding=!0}inherits$6(Cipher,Transform$3);Cipher.prototype._update=function(c){this._cache.add(c);for(var d,g,p=[];d=this._cache.get();)g=this._mode.encrypt(this,d),p.push(g);return Buffer$9.concat(p)};var PADDING=Buffer$9.alloc(16,16);Cipher.prototype._final=function(){var c=this._cache.flush();if(this._autopadding)return c=this._mode.encrypt(this,c),this._cipher.scrub(),c;if(!c.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")};Cipher.prototype.setAutoPadding=function(c){return this._autopadding=!!c,this};function Splitter$1(){this.cache=Buffer$9.allocUnsafe(0)}Splitter$1.prototype.add=function(c){this.cache=Buffer$9.concat([this.cache,c])};Splitter$1.prototype.get=function(){if(this.cache.length>15){var c=this.cache.slice(0,16);return this.cache=this.cache.slice(16),c}return null};Splitter$1.prototype.flush=function(){for(var c=16-this.cache.length,d=Buffer$9.allocUnsafe(c),g=-1;++g16)return d=this.cache.slice(0,16),this.cache=this.cache.slice(16),d}else if(this.cache.length>=16)return d=this.cache.slice(0,16),this.cache=this.cache.slice(16),d;return null};Splitter.prototype.flush=function(){if(this.cache.length)return this.cache};function unpad(c){var d=c[15];if(d<1||d>16)throw new Error("unable to decrypt data");for(var g=-1;++g0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if(typeof t=="number")return this._initNumber(t,i,n);if(typeof t=="object")return this._initArray(t,i,n);i==="hex"&&(i=16),p(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var a=0;t[0]==="-"&&(a++,this.negative=1),a=0;a-=3)v=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[l]|=v<>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);else if(n==="le")for(a=0,l=0;a>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);return this.strip()};function _(b,t){var i=b.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function S(b,t,i){var n=_(b,i);return i-1>=t&&(n|=_(b,i-1)<<4),n}h.prototype._parseHex=function(t,i,n){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a=i;a-=2)m=S(t,i,a)<=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8;else{var o=t.length-i;for(a=o%2===0?i+1:i;a=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8}this.strip()};function A(b,t,i,n){for(var a=0,l=Math.min(b.length,i),v=t;v=49?a+=m-49+10:m>=17?a+=m-17+10:a+=m}return a}h.prototype._parseBase=function(t,i,n){this.words=[0],this.length=1;for(var a=0,l=1;l<=67108863;l*=i)a++;a--,l=l/i|0;for(var v=t.length-n,m=v%a,o=Math.min(v,v-m)+n,e=0,u=n;u1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var x=["","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"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){t=t||10,i=i|0||1;var n;if(t===16||t==="hex"){n="";for(var a=0,l=0,v=0;v>>24-a&16777215,a+=2,a>=26&&(a-=26,v--),l!==0||v!==this.length-1?n=x[6-o.length]+o+n:n=o+n}for(l!==0&&(n=l.toString(16)+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}if(t===(t|0)&&t>=2&&t<=36){var e=B[t],u=k[t];n="";var M=this.clone();for(M.negative=0;!M.isZero();){var $=M.modn(u).toString(t);M=M.idivn(u),M.isZero()?n=$+n:n=x[e-$.length]+$+n}for(this.isZero()&&(n="0"+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}p(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&p(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return p(typeof w<"u"),this.toArrayLike(w,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var a=this.byteLength(),l=n||Math.max(1,a);p(a<=l,"byte array longer than desired length"),p(l>0,"Requested array length <= 0"),this.strip();var v=i==="le",m=new t(l),o,e,u=this.clone();if(v){for(e=0;!u.isZero();e++)o=u.andln(255),u.iushrn(8),m[e]=o;for(;e=4096&&(n+=13,i>>>=13),i>=64&&(n+=7,i>>>=7),i>=8&&(n+=4,i>>>=4),i>=2&&(n+=2,i>>>=2),n+i},h.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,n=0;return i&8191||(n+=13,i>>>=13),i&127||(n+=7,i>>>=7),i&15||(n+=4,i>>>=4),i&3||(n+=2,i>>>=2),i&1||n++,n},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function R(b){for(var t=new Array(b.bitLength()),i=0;i>>a}return t}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,n;this.length>t.length?(i=this,n=t):(i=t,n=this);for(var a=0;at.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){p(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,n=t%26;this._expand(i),n>0&&i--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){p(typeof t=="number"&&t>=0);var n=t/26|0,a=t%26;return this._expand(n+1),i?this.words[n]=this.words[n]|1<t.length?(n=this,a=t):(n=t,a=this);for(var l=0,v=0;v>>26;for(;l!==0&&v>>26;if(this.length=n.length,l!==0)this.words[this.length]=l,this.length++;else if(n!==this)for(;vt.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,l;n>0?(a=this,l=t):(a=t,l=this);for(var v=0,m=0;m>26,this.words[m]=i&67108863;for(;v!==0&&m>26,this.words[m]=i&67108863;if(v===0&&m>>26,M=o&67108863,$=Math.min(e,t.length-1),q=Math.max(0,e-b.length+1);q<=$;q++){var I=e-q|0;a=b.words[I]|0,l=t.words[q]|0,v=a*l+M,u+=v/67108864|0,M=v&67108863}i.words[e]=M|0,o=u|0}return o!==0?i.words[e]=o|0:i.length--,i.strip()}var H=function(t,i,n){var a=t.words,l=i.words,v=n.words,m=0,o,e,u,M=a[0]|0,$=M&8191,q=M>>>13,I=a[1]|0,N=I&8191,E=I>>>13,P=a[2]|0,D=P&8191,z=P>>>13,It=a[3]|0,F=It&8191,V=It>>>13,Ht=a[4]|0,J=Ht&8191,pt=Ht>>>13,zt=a[5]|0,X=zt&8191,mt=zt>>>13,Lt=a[6]|0,Y=Lt&8191,vt=Lt>>>13,Dt=a[7]|0,j=Dt&8191,ct=Dt>>>13,Ot=a[8]|0,Q=Ot&8191,bt=Ot>>>13,Kt=a[9]|0,tt=Kt&8191,gt=Kt>>>13,Ft=l[0]|0,et=Ft&8191,yt=Ft>>>13,Ut=l[1]|0,rt=Ut&8191,Mt=Ut>>>13,Zt=l[2]|0,it=Zt&8191,wt=Zt>>>13,Gt=l[3]|0,nt=Gt&8191,xt=Gt>>>13,Wt=l[4]|0,at=Wt&8191,_t=Wt>>>13,Vt=l[5]|0,st=Vt&8191,$t=Vt>>>13,jt=l[6]|0,ht=jt&8191,Bt=jt>>>13,Jt=l[7]|0,ot=Jt&8191,St=Jt>>>13,Xt=l[8]|0,ut=Xt&8191,At=Xt>>>13,Yt=l[9]|0,lt=Yt&8191,Et=Yt>>>13;n.negative=t.negative^i.negative,n.length=19,o=Math.imul($,et),e=Math.imul($,yt),e=e+Math.imul(q,et)|0,u=Math.imul(q,yt);var Tt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,o=Math.imul(N,et),e=Math.imul(N,yt),e=e+Math.imul(E,et)|0,u=Math.imul(E,yt),o=o+Math.imul($,rt)|0,e=e+Math.imul($,Mt)|0,e=e+Math.imul(q,rt)|0,u=u+Math.imul(q,Mt)|0;var Nt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,o=Math.imul(D,et),e=Math.imul(D,yt),e=e+Math.imul(z,et)|0,u=Math.imul(z,yt),o=o+Math.imul(N,rt)|0,e=e+Math.imul(N,Mt)|0,e=e+Math.imul(E,rt)|0,u=u+Math.imul(E,Mt)|0,o=o+Math.imul($,it)|0,e=e+Math.imul($,wt)|0,e=e+Math.imul(q,it)|0,u=u+Math.imul(q,wt)|0;var Qt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,o=Math.imul(F,et),e=Math.imul(F,yt),e=e+Math.imul(V,et)|0,u=Math.imul(V,yt),o=o+Math.imul(D,rt)|0,e=e+Math.imul(D,Mt)|0,e=e+Math.imul(z,rt)|0,u=u+Math.imul(z,Mt)|0,o=o+Math.imul(N,it)|0,e=e+Math.imul(N,wt)|0,e=e+Math.imul(E,it)|0,u=u+Math.imul(E,wt)|0,o=o+Math.imul($,nt)|0,e=e+Math.imul($,xt)|0,e=e+Math.imul(q,nt)|0,u=u+Math.imul(q,xt)|0;var te=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(te>>>26)|0,te&=67108863,o=Math.imul(J,et),e=Math.imul(J,yt),e=e+Math.imul(pt,et)|0,u=Math.imul(pt,yt),o=o+Math.imul(F,rt)|0,e=e+Math.imul(F,Mt)|0,e=e+Math.imul(V,rt)|0,u=u+Math.imul(V,Mt)|0,o=o+Math.imul(D,it)|0,e=e+Math.imul(D,wt)|0,e=e+Math.imul(z,it)|0,u=u+Math.imul(z,wt)|0,o=o+Math.imul(N,nt)|0,e=e+Math.imul(N,xt)|0,e=e+Math.imul(E,nt)|0,u=u+Math.imul(E,xt)|0,o=o+Math.imul($,at)|0,e=e+Math.imul($,_t)|0,e=e+Math.imul(q,at)|0,u=u+Math.imul(q,_t)|0;var ee=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ee>>>26)|0,ee&=67108863,o=Math.imul(X,et),e=Math.imul(X,yt),e=e+Math.imul(mt,et)|0,u=Math.imul(mt,yt),o=o+Math.imul(J,rt)|0,e=e+Math.imul(J,Mt)|0,e=e+Math.imul(pt,rt)|0,u=u+Math.imul(pt,Mt)|0,o=o+Math.imul(F,it)|0,e=e+Math.imul(F,wt)|0,e=e+Math.imul(V,it)|0,u=u+Math.imul(V,wt)|0,o=o+Math.imul(D,nt)|0,e=e+Math.imul(D,xt)|0,e=e+Math.imul(z,nt)|0,u=u+Math.imul(z,xt)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(N,_t)|0,e=e+Math.imul(E,at)|0,u=u+Math.imul(E,_t)|0,o=o+Math.imul($,st)|0,e=e+Math.imul($,$t)|0,e=e+Math.imul(q,st)|0,u=u+Math.imul(q,$t)|0;var re=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(re>>>26)|0,re&=67108863,o=Math.imul(Y,et),e=Math.imul(Y,yt),e=e+Math.imul(vt,et)|0,u=Math.imul(vt,yt),o=o+Math.imul(X,rt)|0,e=e+Math.imul(X,Mt)|0,e=e+Math.imul(mt,rt)|0,u=u+Math.imul(mt,Mt)|0,o=o+Math.imul(J,it)|0,e=e+Math.imul(J,wt)|0,e=e+Math.imul(pt,it)|0,u=u+Math.imul(pt,wt)|0,o=o+Math.imul(F,nt)|0,e=e+Math.imul(F,xt)|0,e=e+Math.imul(V,nt)|0,u=u+Math.imul(V,xt)|0,o=o+Math.imul(D,at)|0,e=e+Math.imul(D,_t)|0,e=e+Math.imul(z,at)|0,u=u+Math.imul(z,_t)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(N,$t)|0,e=e+Math.imul(E,st)|0,u=u+Math.imul(E,$t)|0,o=o+Math.imul($,ht)|0,e=e+Math.imul($,Bt)|0,e=e+Math.imul(q,ht)|0,u=u+Math.imul(q,Bt)|0;var ie=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ie>>>26)|0,ie&=67108863,o=Math.imul(j,et),e=Math.imul(j,yt),e=e+Math.imul(ct,et)|0,u=Math.imul(ct,yt),o=o+Math.imul(Y,rt)|0,e=e+Math.imul(Y,Mt)|0,e=e+Math.imul(vt,rt)|0,u=u+Math.imul(vt,Mt)|0,o=o+Math.imul(X,it)|0,e=e+Math.imul(X,wt)|0,e=e+Math.imul(mt,it)|0,u=u+Math.imul(mt,wt)|0,o=o+Math.imul(J,nt)|0,e=e+Math.imul(J,xt)|0,e=e+Math.imul(pt,nt)|0,u=u+Math.imul(pt,xt)|0,o=o+Math.imul(F,at)|0,e=e+Math.imul(F,_t)|0,e=e+Math.imul(V,at)|0,u=u+Math.imul(V,_t)|0,o=o+Math.imul(D,st)|0,e=e+Math.imul(D,$t)|0,e=e+Math.imul(z,st)|0,u=u+Math.imul(z,$t)|0,o=o+Math.imul(N,ht)|0,e=e+Math.imul(N,Bt)|0,e=e+Math.imul(E,ht)|0,u=u+Math.imul(E,Bt)|0,o=o+Math.imul($,ot)|0,e=e+Math.imul($,St)|0,e=e+Math.imul(q,ot)|0,u=u+Math.imul(q,St)|0;var fe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(fe>>>26)|0,fe&=67108863,o=Math.imul(Q,et),e=Math.imul(Q,yt),e=e+Math.imul(bt,et)|0,u=Math.imul(bt,yt),o=o+Math.imul(j,rt)|0,e=e+Math.imul(j,Mt)|0,e=e+Math.imul(ct,rt)|0,u=u+Math.imul(ct,Mt)|0,o=o+Math.imul(Y,it)|0,e=e+Math.imul(Y,wt)|0,e=e+Math.imul(vt,it)|0,u=u+Math.imul(vt,wt)|0,o=o+Math.imul(X,nt)|0,e=e+Math.imul(X,xt)|0,e=e+Math.imul(mt,nt)|0,u=u+Math.imul(mt,xt)|0,o=o+Math.imul(J,at)|0,e=e+Math.imul(J,_t)|0,e=e+Math.imul(pt,at)|0,u=u+Math.imul(pt,_t)|0,o=o+Math.imul(F,st)|0,e=e+Math.imul(F,$t)|0,e=e+Math.imul(V,st)|0,u=u+Math.imul(V,$t)|0,o=o+Math.imul(D,ht)|0,e=e+Math.imul(D,Bt)|0,e=e+Math.imul(z,ht)|0,u=u+Math.imul(z,Bt)|0,o=o+Math.imul(N,ot)|0,e=e+Math.imul(N,St)|0,e=e+Math.imul(E,ot)|0,u=u+Math.imul(E,St)|0,o=o+Math.imul($,ut)|0,e=e+Math.imul($,At)|0,e=e+Math.imul(q,ut)|0,u=u+Math.imul(q,At)|0;var ne=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ne>>>26)|0,ne&=67108863,o=Math.imul(tt,et),e=Math.imul(tt,yt),e=e+Math.imul(gt,et)|0,u=Math.imul(gt,yt),o=o+Math.imul(Q,rt)|0,e=e+Math.imul(Q,Mt)|0,e=e+Math.imul(bt,rt)|0,u=u+Math.imul(bt,Mt)|0,o=o+Math.imul(j,it)|0,e=e+Math.imul(j,wt)|0,e=e+Math.imul(ct,it)|0,u=u+Math.imul(ct,wt)|0,o=o+Math.imul(Y,nt)|0,e=e+Math.imul(Y,xt)|0,e=e+Math.imul(vt,nt)|0,u=u+Math.imul(vt,xt)|0,o=o+Math.imul(X,at)|0,e=e+Math.imul(X,_t)|0,e=e+Math.imul(mt,at)|0,u=u+Math.imul(mt,_t)|0,o=o+Math.imul(J,st)|0,e=e+Math.imul(J,$t)|0,e=e+Math.imul(pt,st)|0,u=u+Math.imul(pt,$t)|0,o=o+Math.imul(F,ht)|0,e=e+Math.imul(F,Bt)|0,e=e+Math.imul(V,ht)|0,u=u+Math.imul(V,Bt)|0,o=o+Math.imul(D,ot)|0,e=e+Math.imul(D,St)|0,e=e+Math.imul(z,ot)|0,u=u+Math.imul(z,St)|0,o=o+Math.imul(N,ut)|0,e=e+Math.imul(N,At)|0,e=e+Math.imul(E,ut)|0,u=u+Math.imul(E,At)|0,o=o+Math.imul($,lt)|0,e=e+Math.imul($,Et)|0,e=e+Math.imul(q,lt)|0,u=u+Math.imul(q,Et)|0;var ae=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ae>>>26)|0,ae&=67108863,o=Math.imul(tt,rt),e=Math.imul(tt,Mt),e=e+Math.imul(gt,rt)|0,u=Math.imul(gt,Mt),o=o+Math.imul(Q,it)|0,e=e+Math.imul(Q,wt)|0,e=e+Math.imul(bt,it)|0,u=u+Math.imul(bt,wt)|0,o=o+Math.imul(j,nt)|0,e=e+Math.imul(j,xt)|0,e=e+Math.imul(ct,nt)|0,u=u+Math.imul(ct,xt)|0,o=o+Math.imul(Y,at)|0,e=e+Math.imul(Y,_t)|0,e=e+Math.imul(vt,at)|0,u=u+Math.imul(vt,_t)|0,o=o+Math.imul(X,st)|0,e=e+Math.imul(X,$t)|0,e=e+Math.imul(mt,st)|0,u=u+Math.imul(mt,$t)|0,o=o+Math.imul(J,ht)|0,e=e+Math.imul(J,Bt)|0,e=e+Math.imul(pt,ht)|0,u=u+Math.imul(pt,Bt)|0,o=o+Math.imul(F,ot)|0,e=e+Math.imul(F,St)|0,e=e+Math.imul(V,ot)|0,u=u+Math.imul(V,St)|0,o=o+Math.imul(D,ut)|0,e=e+Math.imul(D,At)|0,e=e+Math.imul(z,ut)|0,u=u+Math.imul(z,At)|0,o=o+Math.imul(N,lt)|0,e=e+Math.imul(N,Et)|0,e=e+Math.imul(E,lt)|0,u=u+Math.imul(E,Et)|0;var se=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(se>>>26)|0,se&=67108863,o=Math.imul(tt,it),e=Math.imul(tt,wt),e=e+Math.imul(gt,it)|0,u=Math.imul(gt,wt),o=o+Math.imul(Q,nt)|0,e=e+Math.imul(Q,xt)|0,e=e+Math.imul(bt,nt)|0,u=u+Math.imul(bt,xt)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(j,_t)|0,e=e+Math.imul(ct,at)|0,u=u+Math.imul(ct,_t)|0,o=o+Math.imul(Y,st)|0,e=e+Math.imul(Y,$t)|0,e=e+Math.imul(vt,st)|0,u=u+Math.imul(vt,$t)|0,o=o+Math.imul(X,ht)|0,e=e+Math.imul(X,Bt)|0,e=e+Math.imul(mt,ht)|0,u=u+Math.imul(mt,Bt)|0,o=o+Math.imul(J,ot)|0,e=e+Math.imul(J,St)|0,e=e+Math.imul(pt,ot)|0,u=u+Math.imul(pt,St)|0,o=o+Math.imul(F,ut)|0,e=e+Math.imul(F,At)|0,e=e+Math.imul(V,ut)|0,u=u+Math.imul(V,At)|0,o=o+Math.imul(D,lt)|0,e=e+Math.imul(D,Et)|0,e=e+Math.imul(z,lt)|0,u=u+Math.imul(z,Et)|0;var he=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(he>>>26)|0,he&=67108863,o=Math.imul(tt,nt),e=Math.imul(tt,xt),e=e+Math.imul(gt,nt)|0,u=Math.imul(gt,xt),o=o+Math.imul(Q,at)|0,e=e+Math.imul(Q,_t)|0,e=e+Math.imul(bt,at)|0,u=u+Math.imul(bt,_t)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(j,$t)|0,e=e+Math.imul(ct,st)|0,u=u+Math.imul(ct,$t)|0,o=o+Math.imul(Y,ht)|0,e=e+Math.imul(Y,Bt)|0,e=e+Math.imul(vt,ht)|0,u=u+Math.imul(vt,Bt)|0,o=o+Math.imul(X,ot)|0,e=e+Math.imul(X,St)|0,e=e+Math.imul(mt,ot)|0,u=u+Math.imul(mt,St)|0,o=o+Math.imul(J,ut)|0,e=e+Math.imul(J,At)|0,e=e+Math.imul(pt,ut)|0,u=u+Math.imul(pt,At)|0,o=o+Math.imul(F,lt)|0,e=e+Math.imul(F,Et)|0,e=e+Math.imul(V,lt)|0,u=u+Math.imul(V,Et)|0;var oe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(oe>>>26)|0,oe&=67108863,o=Math.imul(tt,at),e=Math.imul(tt,_t),e=e+Math.imul(gt,at)|0,u=Math.imul(gt,_t),o=o+Math.imul(Q,st)|0,e=e+Math.imul(Q,$t)|0,e=e+Math.imul(bt,st)|0,u=u+Math.imul(bt,$t)|0,o=o+Math.imul(j,ht)|0,e=e+Math.imul(j,Bt)|0,e=e+Math.imul(ct,ht)|0,u=u+Math.imul(ct,Bt)|0,o=o+Math.imul(Y,ot)|0,e=e+Math.imul(Y,St)|0,e=e+Math.imul(vt,ot)|0,u=u+Math.imul(vt,St)|0,o=o+Math.imul(X,ut)|0,e=e+Math.imul(X,At)|0,e=e+Math.imul(mt,ut)|0,u=u+Math.imul(mt,At)|0,o=o+Math.imul(J,lt)|0,e=e+Math.imul(J,Et)|0,e=e+Math.imul(pt,lt)|0,u=u+Math.imul(pt,Et)|0;var ue=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ue>>>26)|0,ue&=67108863,o=Math.imul(tt,st),e=Math.imul(tt,$t),e=e+Math.imul(gt,st)|0,u=Math.imul(gt,$t),o=o+Math.imul(Q,ht)|0,e=e+Math.imul(Q,Bt)|0,e=e+Math.imul(bt,ht)|0,u=u+Math.imul(bt,Bt)|0,o=o+Math.imul(j,ot)|0,e=e+Math.imul(j,St)|0,e=e+Math.imul(ct,ot)|0,u=u+Math.imul(ct,St)|0,o=o+Math.imul(Y,ut)|0,e=e+Math.imul(Y,At)|0,e=e+Math.imul(vt,ut)|0,u=u+Math.imul(vt,At)|0,o=o+Math.imul(X,lt)|0,e=e+Math.imul(X,Et)|0,e=e+Math.imul(mt,lt)|0,u=u+Math.imul(mt,Et)|0;var le=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(le>>>26)|0,le&=67108863,o=Math.imul(tt,ht),e=Math.imul(tt,Bt),e=e+Math.imul(gt,ht)|0,u=Math.imul(gt,Bt),o=o+Math.imul(Q,ot)|0,e=e+Math.imul(Q,St)|0,e=e+Math.imul(bt,ot)|0,u=u+Math.imul(bt,St)|0,o=o+Math.imul(j,ut)|0,e=e+Math.imul(j,At)|0,e=e+Math.imul(ct,ut)|0,u=u+Math.imul(ct,At)|0,o=o+Math.imul(Y,lt)|0,e=e+Math.imul(Y,Et)|0,e=e+Math.imul(vt,lt)|0,u=u+Math.imul(vt,Et)|0;var de=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(de>>>26)|0,de&=67108863,o=Math.imul(tt,ot),e=Math.imul(tt,St),e=e+Math.imul(gt,ot)|0,u=Math.imul(gt,St),o=o+Math.imul(Q,ut)|0,e=e+Math.imul(Q,At)|0,e=e+Math.imul(bt,ut)|0,u=u+Math.imul(bt,At)|0,o=o+Math.imul(j,lt)|0,e=e+Math.imul(j,Et)|0,e=e+Math.imul(ct,lt)|0,u=u+Math.imul(ct,Et)|0;var ce=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ce>>>26)|0,ce&=67108863,o=Math.imul(tt,ut),e=Math.imul(tt,At),e=e+Math.imul(gt,ut)|0,u=Math.imul(gt,At),o=o+Math.imul(Q,lt)|0,e=e+Math.imul(Q,Et)|0,e=e+Math.imul(bt,lt)|0,u=u+Math.imul(bt,Et)|0;var ve=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(tt,lt),e=Math.imul(tt,Et),e=e+Math.imul(gt,lt)|0,u=Math.imul(gt,Et);var pe=(m+o|0)+((e&8191)<<13)|0;return m=(u+(e>>>13)|0)+(pe>>>26)|0,pe&=67108863,v[0]=Tt,v[1]=Nt,v[2]=Qt,v[3]=te,v[4]=ee,v[5]=re,v[6]=ie,v[7]=fe,v[8]=ne,v[9]=ae,v[10]=se,v[11]=he,v[12]=oe,v[13]=ue,v[14]=le,v[15]=de,v[16]=ce,v[17]=ve,v[18]=pe,m!==0&&(v[19]=m,n.length++),n};Math.imul||(H=C);function U(b,t,i){i.negative=t.negative^b.negative,i.length=b.length+t.length;for(var n=0,a=0,l=0;l>>26)|0,a+=v>>>26,v&=67108863}i.words[l]=m,n=v,v=a}return n!==0?i.words[l]=n:i.length--,i.strip()}function L(b,t,i){var n=new T;return n.mulp(b,t,i)}h.prototype.mulTo=function(t,i){var n,a=this.length+t.length;return this.length===10&&t.length===10?n=H(this,t,i):a<63?n=C(this,t,i):a<1024?n=U(this,t,i):n=L(this,t,i),n};function T(b,t){this.x=b,this.y=t}T.prototype.makeRBT=function(t){for(var i=new Array(t),n=h.prototype._countBits(t)-1,a=0;a>=1;return a},T.prototype.permute=function(t,i,n,a,l,v){for(var m=0;m>>1)l++;return 1<>>13,n[2*v+1]=l&8191,l=l>>>13;for(v=2*i;v>=26,i+=a/67108864|0,i+=l>>>26,this.words[n]=l&67108863}return i!==0&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=R(t);if(i.length===0)return new h(1);for(var n=this,a=0;a=0);var i=t%26,n=(t-i)/26,a=67108863>>>26-i<<26-i,l;if(i!==0){var v=0;for(l=0;l>>26-i}v&&(this.words[l]=v,this.length++)}if(n!==0){for(l=this.length-1;l>=0;l--)this.words[l+n]=this.words[l];for(l=0;l=0);var a;i?a=(i-i%26)/26:a=0;var l=t%26,v=Math.min((t-l)/26,this.length),m=67108863^67108863>>>l<v)for(this.length-=v,e=0;e=0&&(u!==0||e>=a);e--){var M=this.words[e]|0;this.words[e]=u<<26-l|M>>>l,u=M&m}return o&&u!==0&&(o.words[o.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return p(this.negative===0),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){p(typeof t=="number"&&t>=0);var i=t%26,n=(t-i)/26,a=1<=0);var i=t%26,n=(t-i)/26;if(p(this.negative===0,"imaskn works only with positive numbers"),this.length<=n)return this;if(i!==0&&n++,this.length=Math.min(n,this.length),i!==0){var a=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(p(typeof t=="number"),p(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(o/67108864|0),this.words[l+n]=v&67108863}for(;l>26,this.words[l+n]=v&67108863;if(m===0)return this.strip();for(p(m===-1),m=0,l=0;l>26,this.words[l]=v&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var n=this.length-t.length,a=this.clone(),l=t,v=l.words[l.length-1]|0,m=this._countBits(v);n=26-m,n!==0&&(l=l.ushln(n),a.iushln(n),v=l.words[l.length-1]|0);var o=a.length-l.length,e;if(i!=="mod"){e=new h(null),e.length=o+1,e.words=new Array(e.length);for(var u=0;u=0;$--){var q=(a.words[l.length+$]|0)*67108864+(a.words[l.length+$-1]|0);for(q=Math.min(q/v|0,67108863),a._ishlnsubmul(l,q,$);a.negative!==0;)q--,a.negative=0,a._ishlnsubmul(l,1,$),a.isZero()||(a.negative^=1);e&&(e.words[$]=q)}return e&&e.strip(),a.strip(),i!=="div"&&n!==0&&a.iushrn(n),{div:e||null,mod:a}},h.prototype.divmod=function(t,i,n){if(p(!t.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var a,l,v;return this.negative!==0&&t.negative===0?(v=this.neg().divmod(t,i),i!=="mod"&&(a=v.div.neg()),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.iadd(t)),{div:a,mod:l}):this.negative===0&&t.negative!==0?(v=this.divmod(t.neg(),i),i!=="mod"&&(a=v.div.neg()),{div:a,mod:v.mod}):this.negative&t.negative?(v=this.neg().divmod(t.neg(),i),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.isub(t)),{div:v.div,mod:l}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i)},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var n=i.div.negative!==0?i.mod.isub(t):i.mod,a=t.ushrn(1),l=t.andln(1),v=n.cmp(a);return v<0||l===1&&v===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){p(t<=67108863);for(var i=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(i*n+(this.words[a]|0))%t;return n},h.prototype.idivn=function(t){p(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var a=(this.words[n]|0)+i*67108864;this.words[n]=a/t|0,i=a%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=new h(0),m=new h(1),o=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++o;for(var e=n.clone(),u=i.clone();!i.isZero();){for(var M=0,$=1;!(i.words[0]&$)&&M<26;++M,$<<=1);if(M>0)for(i.iushrn(M);M-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(e),l.isub(u)),a.iushrn(1),l.iushrn(1);for(var q=0,I=1;!(n.words[0]&I)&&q<26;++q,I<<=1);if(q>0)for(n.iushrn(q);q-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(e),m.isub(u)),v.iushrn(1),m.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(v),l.isub(m)):(n.isub(i),v.isub(a),m.isub(l))}return{a:v,b:m,gcd:n.iushln(o)}},h.prototype._invmp=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var m=0,o=1;!(i.words[0]&o)&&m<26;++m,o<<=1);if(m>0)for(i.iushrn(m);m-- >0;)a.isOdd()&&a.iadd(v),a.iushrn(1);for(var e=0,u=1;!(n.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(n.iushrn(e);e-- >0;)l.isOdd()&&l.iadd(v),l.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(l)):(n.isub(i),l.isub(a))}var M;return i.cmpn(1)===0?M=a:M=l,M.cmpn(0)<0&&M.iadd(t),M},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),n=t.clone();i.negative=0,n.negative=0;for(var a=0;i.isEven()&&n.isEven();a++)i.iushrn(1),n.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;n.isEven();)n.iushrn(1);var l=i.cmp(n);if(l<0){var v=i;i=n,n=v}else if(l===0||n.cmpn(1)===0)break;i.isub(n)}while(!0);return n.iushln(a)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){p(typeof t=="number");var i=t%26,n=(t-i)/26,a=1<>>26,m&=67108863,this.words[v]=m}return l!==0&&(this.words[v]=l,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var n;if(this.length>1)n=1;else{i&&(t=-t),p(t<=67108863,"Number is too big");var a=this.words[0]|0;n=a===t?0:at.length)return 1;if(this.length=0;n--){var a=this.words[n]|0,l=t.words[n]|0;if(a!==l){al&&(i=1);break}}return i},h.prototype.gtn=function(t){return this.cmpn(t)===1},h.prototype.gt=function(t){return this.cmp(t)===1},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return this.cmpn(t)===-1},h.prototype.lt=function(t){return this.cmp(t)===-1},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return this.cmpn(t)===0},h.prototype.eq=function(t){return this.cmp(t)===0},h.red=function(t){return new Z(t)},h.prototype.toRed=function(t){return p(!this.red,"Already a number in reduction context"),p(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return p(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return p(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return p(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return p(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return p(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return p(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return p(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return p(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return p(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return p(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return p(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return p(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return p(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var dt={k256:null,p224:null,p192:null,p25519:null};function O(b,t){this.name=b,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,n;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),n=i.bitLength();while(n>this.n);var a=n0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function kt(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}y(kt,O),kt.prototype.split=function(t,i){for(var n=4194303,a=Math.min(t.length,9),l=0;l>>22,v=m}v>>>=22,t.words[l-10]=v,v===0&&t.length>10?t.length-=10:t.length-=9},kt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,n=0;n>>=26,t.words[n]=l,i=a}return i!==0&&(t.words[t.length++]=i),t},h._prime=function(t){if(dt[t])return dt[t];var i;if(t==="k256")i=new kt;else if(t==="p224")i=new Rt;else if(t==="p192")i=new Ct;else if(t==="p25519")i=new qt;else throw new Error("Unknown prime "+t);return dt[t]=i,i};function Z(b){if(typeof b=="string"){var t=h._prime(b);this.m=t.p,this.prime=t}else p(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Z.prototype._verify1=function(t){p(t.negative===0,"red works only with positives"),p(t.red,"red works only with red numbers")},Z.prototype._verify2=function(t,i){p((t.negative|i.negative)===0,"red works only with positives"),p(t.red&&t.red===i.red,"red works only with red numbers")},Z.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Z.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Z.prototype.add=function(t,i){this._verify2(t,i);var n=t.add(i);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},Z.prototype.iadd=function(t,i){this._verify2(t,i);var n=t.iadd(i);return n.cmp(this.m)>=0&&n.isub(this.m),n},Z.prototype.sub=function(t,i){this._verify2(t,i);var n=t.sub(i);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},Z.prototype.isub=function(t,i){this._verify2(t,i);var n=t.isub(i);return n.cmpn(0)<0&&n.iadd(this.m),n},Z.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},Z.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Z.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Z.prototype.isqr=function(t){return this.imul(t,t.clone())},Z.prototype.sqr=function(t){return this.mul(t,t)},Z.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(p(i%2===1),i===3){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var a=this.m.subn(1),l=0;!a.isZero()&&a.andln(1)===0;)l++,a.iushrn(1);p(!a.isZero());var v=new h(1).toRed(this),m=v.redNeg(),o=this.m.subn(1).iushrn(1),e=this.m.bitLength();for(e=new h(2*e*e).toRed(this);this.pow(e,o).cmp(m)!==0;)e.redIAdd(m);for(var u=this.pow(e,a),M=this.pow(t,a.addn(1).iushrn(1)),$=this.pow(t,a),q=l;$.cmp(v)!==0;){for(var I=$,N=0;I.cmp(v)!==0;N++)I=I.redSqr();p(N=0;l--){for(var u=i.words[l],M=e-1;M>=0;M--){var $=u>>M&1;if(v!==a[0]&&(v=this.sqr(v)),$===0&&m===0){o=0;continue}m<<=1,m|=$,o++,!(o!==n&&(l!==0||M!==0))&&(v=this.mul(v,a[m]),o=0,m=0)}e=26}return v},Z.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},Z.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new Pt(t)};function Pt(b){Z.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}y(Pt,Z),Pt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Pt.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Pt.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var n=t.mul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(c,commonjsGlobal)})(bn$6);var bnExports$6=bn$6.exports,bn$5={exports:{}};bn$5.exports;(function(c){(function(d,g){function p(b,t){if(!b)throw new Error(t||"Assertion failed")}function y(b,t){b.super_=t;var i=function(){};i.prototype=t.prototype,b.prototype=new i,b.prototype.constructor=b}function h(b,t,i){if(h.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((t==="le"||t==="be")&&(i=t,t=10),this._init(b||0,t||10,i||"be"))}typeof d=="object"?d.exports=h:g.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=require$$0$1.Buffer}catch{}h.isBN=function(t){return t instanceof h?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if(typeof t=="number")return this._initNumber(t,i,n);if(typeof t=="object")return this._initArray(t,i,n);i==="hex"&&(i=16),p(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var a=0;t[0]==="-"&&(a++,this.negative=1),a=0;a-=3)v=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[l]|=v<>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);else if(n==="le")for(a=0,l=0;a>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);return this.strip()};function _(b,t){var i=b.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function S(b,t,i){var n=_(b,i);return i-1>=t&&(n|=_(b,i-1)<<4),n}h.prototype._parseHex=function(t,i,n){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a=i;a-=2)m=S(t,i,a)<=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8;else{var o=t.length-i;for(a=o%2===0?i+1:i;a=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8}this.strip()};function A(b,t,i,n){for(var a=0,l=Math.min(b.length,i),v=t;v=49?a+=m-49+10:m>=17?a+=m-17+10:a+=m}return a}h.prototype._parseBase=function(t,i,n){this.words=[0],this.length=1;for(var a=0,l=1;l<=67108863;l*=i)a++;a--,l=l/i|0;for(var v=t.length-n,m=v%a,o=Math.min(v,v-m)+n,e=0,u=n;u1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var x=["","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"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){t=t||10,i=i|0||1;var n;if(t===16||t==="hex"){n="";for(var a=0,l=0,v=0;v>>24-a&16777215,a+=2,a>=26&&(a-=26,v--),l!==0||v!==this.length-1?n=x[6-o.length]+o+n:n=o+n}for(l!==0&&(n=l.toString(16)+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}if(t===(t|0)&&t>=2&&t<=36){var e=B[t],u=k[t];n="";var M=this.clone();for(M.negative=0;!M.isZero();){var $=M.modn(u).toString(t);M=M.idivn(u),M.isZero()?n=$+n:n=x[e-$.length]+$+n}for(this.isZero()&&(n="0"+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}p(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&p(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return p(typeof w<"u"),this.toArrayLike(w,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var a=this.byteLength(),l=n||Math.max(1,a);p(a<=l,"byte array longer than desired length"),p(l>0,"Requested array length <= 0"),this.strip();var v=i==="le",m=new t(l),o,e,u=this.clone();if(v){for(e=0;!u.isZero();e++)o=u.andln(255),u.iushrn(8),m[e]=o;for(;e=4096&&(n+=13,i>>>=13),i>=64&&(n+=7,i>>>=7),i>=8&&(n+=4,i>>>=4),i>=2&&(n+=2,i>>>=2),n+i},h.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,n=0;return i&8191||(n+=13,i>>>=13),i&127||(n+=7,i>>>=7),i&15||(n+=4,i>>>=4),i&3||(n+=2,i>>>=2),i&1||n++,n},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function R(b){for(var t=new Array(b.bitLength()),i=0;i>>a}return t}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,n;this.length>t.length?(i=this,n=t):(i=t,n=this);for(var a=0;at.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){p(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,n=t%26;this._expand(i),n>0&&i--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){p(typeof t=="number"&&t>=0);var n=t/26|0,a=t%26;return this._expand(n+1),i?this.words[n]=this.words[n]|1<t.length?(n=this,a=t):(n=t,a=this);for(var l=0,v=0;v>>26;for(;l!==0&&v>>26;if(this.length=n.length,l!==0)this.words[this.length]=l,this.length++;else if(n!==this)for(;vt.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,l;n>0?(a=this,l=t):(a=t,l=this);for(var v=0,m=0;m>26,this.words[m]=i&67108863;for(;v!==0&&m>26,this.words[m]=i&67108863;if(v===0&&m>>26,M=o&67108863,$=Math.min(e,t.length-1),q=Math.max(0,e-b.length+1);q<=$;q++){var I=e-q|0;a=b.words[I]|0,l=t.words[q]|0,v=a*l+M,u+=v/67108864|0,M=v&67108863}i.words[e]=M|0,o=u|0}return o!==0?i.words[e]=o|0:i.length--,i.strip()}var H=function(t,i,n){var a=t.words,l=i.words,v=n.words,m=0,o,e,u,M=a[0]|0,$=M&8191,q=M>>>13,I=a[1]|0,N=I&8191,E=I>>>13,P=a[2]|0,D=P&8191,z=P>>>13,It=a[3]|0,F=It&8191,V=It>>>13,Ht=a[4]|0,J=Ht&8191,pt=Ht>>>13,zt=a[5]|0,X=zt&8191,mt=zt>>>13,Lt=a[6]|0,Y=Lt&8191,vt=Lt>>>13,Dt=a[7]|0,j=Dt&8191,ct=Dt>>>13,Ot=a[8]|0,Q=Ot&8191,bt=Ot>>>13,Kt=a[9]|0,tt=Kt&8191,gt=Kt>>>13,Ft=l[0]|0,et=Ft&8191,yt=Ft>>>13,Ut=l[1]|0,rt=Ut&8191,Mt=Ut>>>13,Zt=l[2]|0,it=Zt&8191,wt=Zt>>>13,Gt=l[3]|0,nt=Gt&8191,xt=Gt>>>13,Wt=l[4]|0,at=Wt&8191,_t=Wt>>>13,Vt=l[5]|0,st=Vt&8191,$t=Vt>>>13,jt=l[6]|0,ht=jt&8191,Bt=jt>>>13,Jt=l[7]|0,ot=Jt&8191,St=Jt>>>13,Xt=l[8]|0,ut=Xt&8191,At=Xt>>>13,Yt=l[9]|0,lt=Yt&8191,Et=Yt>>>13;n.negative=t.negative^i.negative,n.length=19,o=Math.imul($,et),e=Math.imul($,yt),e=e+Math.imul(q,et)|0,u=Math.imul(q,yt);var Tt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,o=Math.imul(N,et),e=Math.imul(N,yt),e=e+Math.imul(E,et)|0,u=Math.imul(E,yt),o=o+Math.imul($,rt)|0,e=e+Math.imul($,Mt)|0,e=e+Math.imul(q,rt)|0,u=u+Math.imul(q,Mt)|0;var Nt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,o=Math.imul(D,et),e=Math.imul(D,yt),e=e+Math.imul(z,et)|0,u=Math.imul(z,yt),o=o+Math.imul(N,rt)|0,e=e+Math.imul(N,Mt)|0,e=e+Math.imul(E,rt)|0,u=u+Math.imul(E,Mt)|0,o=o+Math.imul($,it)|0,e=e+Math.imul($,wt)|0,e=e+Math.imul(q,it)|0,u=u+Math.imul(q,wt)|0;var Qt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,o=Math.imul(F,et),e=Math.imul(F,yt),e=e+Math.imul(V,et)|0,u=Math.imul(V,yt),o=o+Math.imul(D,rt)|0,e=e+Math.imul(D,Mt)|0,e=e+Math.imul(z,rt)|0,u=u+Math.imul(z,Mt)|0,o=o+Math.imul(N,it)|0,e=e+Math.imul(N,wt)|0,e=e+Math.imul(E,it)|0,u=u+Math.imul(E,wt)|0,o=o+Math.imul($,nt)|0,e=e+Math.imul($,xt)|0,e=e+Math.imul(q,nt)|0,u=u+Math.imul(q,xt)|0;var te=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(te>>>26)|0,te&=67108863,o=Math.imul(J,et),e=Math.imul(J,yt),e=e+Math.imul(pt,et)|0,u=Math.imul(pt,yt),o=o+Math.imul(F,rt)|0,e=e+Math.imul(F,Mt)|0,e=e+Math.imul(V,rt)|0,u=u+Math.imul(V,Mt)|0,o=o+Math.imul(D,it)|0,e=e+Math.imul(D,wt)|0,e=e+Math.imul(z,it)|0,u=u+Math.imul(z,wt)|0,o=o+Math.imul(N,nt)|0,e=e+Math.imul(N,xt)|0,e=e+Math.imul(E,nt)|0,u=u+Math.imul(E,xt)|0,o=o+Math.imul($,at)|0,e=e+Math.imul($,_t)|0,e=e+Math.imul(q,at)|0,u=u+Math.imul(q,_t)|0;var ee=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ee>>>26)|0,ee&=67108863,o=Math.imul(X,et),e=Math.imul(X,yt),e=e+Math.imul(mt,et)|0,u=Math.imul(mt,yt),o=o+Math.imul(J,rt)|0,e=e+Math.imul(J,Mt)|0,e=e+Math.imul(pt,rt)|0,u=u+Math.imul(pt,Mt)|0,o=o+Math.imul(F,it)|0,e=e+Math.imul(F,wt)|0,e=e+Math.imul(V,it)|0,u=u+Math.imul(V,wt)|0,o=o+Math.imul(D,nt)|0,e=e+Math.imul(D,xt)|0,e=e+Math.imul(z,nt)|0,u=u+Math.imul(z,xt)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(N,_t)|0,e=e+Math.imul(E,at)|0,u=u+Math.imul(E,_t)|0,o=o+Math.imul($,st)|0,e=e+Math.imul($,$t)|0,e=e+Math.imul(q,st)|0,u=u+Math.imul(q,$t)|0;var re=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(re>>>26)|0,re&=67108863,o=Math.imul(Y,et),e=Math.imul(Y,yt),e=e+Math.imul(vt,et)|0,u=Math.imul(vt,yt),o=o+Math.imul(X,rt)|0,e=e+Math.imul(X,Mt)|0,e=e+Math.imul(mt,rt)|0,u=u+Math.imul(mt,Mt)|0,o=o+Math.imul(J,it)|0,e=e+Math.imul(J,wt)|0,e=e+Math.imul(pt,it)|0,u=u+Math.imul(pt,wt)|0,o=o+Math.imul(F,nt)|0,e=e+Math.imul(F,xt)|0,e=e+Math.imul(V,nt)|0,u=u+Math.imul(V,xt)|0,o=o+Math.imul(D,at)|0,e=e+Math.imul(D,_t)|0,e=e+Math.imul(z,at)|0,u=u+Math.imul(z,_t)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(N,$t)|0,e=e+Math.imul(E,st)|0,u=u+Math.imul(E,$t)|0,o=o+Math.imul($,ht)|0,e=e+Math.imul($,Bt)|0,e=e+Math.imul(q,ht)|0,u=u+Math.imul(q,Bt)|0;var ie=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ie>>>26)|0,ie&=67108863,o=Math.imul(j,et),e=Math.imul(j,yt),e=e+Math.imul(ct,et)|0,u=Math.imul(ct,yt),o=o+Math.imul(Y,rt)|0,e=e+Math.imul(Y,Mt)|0,e=e+Math.imul(vt,rt)|0,u=u+Math.imul(vt,Mt)|0,o=o+Math.imul(X,it)|0,e=e+Math.imul(X,wt)|0,e=e+Math.imul(mt,it)|0,u=u+Math.imul(mt,wt)|0,o=o+Math.imul(J,nt)|0,e=e+Math.imul(J,xt)|0,e=e+Math.imul(pt,nt)|0,u=u+Math.imul(pt,xt)|0,o=o+Math.imul(F,at)|0,e=e+Math.imul(F,_t)|0,e=e+Math.imul(V,at)|0,u=u+Math.imul(V,_t)|0,o=o+Math.imul(D,st)|0,e=e+Math.imul(D,$t)|0,e=e+Math.imul(z,st)|0,u=u+Math.imul(z,$t)|0,o=o+Math.imul(N,ht)|0,e=e+Math.imul(N,Bt)|0,e=e+Math.imul(E,ht)|0,u=u+Math.imul(E,Bt)|0,o=o+Math.imul($,ot)|0,e=e+Math.imul($,St)|0,e=e+Math.imul(q,ot)|0,u=u+Math.imul(q,St)|0;var fe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(fe>>>26)|0,fe&=67108863,o=Math.imul(Q,et),e=Math.imul(Q,yt),e=e+Math.imul(bt,et)|0,u=Math.imul(bt,yt),o=o+Math.imul(j,rt)|0,e=e+Math.imul(j,Mt)|0,e=e+Math.imul(ct,rt)|0,u=u+Math.imul(ct,Mt)|0,o=o+Math.imul(Y,it)|0,e=e+Math.imul(Y,wt)|0,e=e+Math.imul(vt,it)|0,u=u+Math.imul(vt,wt)|0,o=o+Math.imul(X,nt)|0,e=e+Math.imul(X,xt)|0,e=e+Math.imul(mt,nt)|0,u=u+Math.imul(mt,xt)|0,o=o+Math.imul(J,at)|0,e=e+Math.imul(J,_t)|0,e=e+Math.imul(pt,at)|0,u=u+Math.imul(pt,_t)|0,o=o+Math.imul(F,st)|0,e=e+Math.imul(F,$t)|0,e=e+Math.imul(V,st)|0,u=u+Math.imul(V,$t)|0,o=o+Math.imul(D,ht)|0,e=e+Math.imul(D,Bt)|0,e=e+Math.imul(z,ht)|0,u=u+Math.imul(z,Bt)|0,o=o+Math.imul(N,ot)|0,e=e+Math.imul(N,St)|0,e=e+Math.imul(E,ot)|0,u=u+Math.imul(E,St)|0,o=o+Math.imul($,ut)|0,e=e+Math.imul($,At)|0,e=e+Math.imul(q,ut)|0,u=u+Math.imul(q,At)|0;var ne=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ne>>>26)|0,ne&=67108863,o=Math.imul(tt,et),e=Math.imul(tt,yt),e=e+Math.imul(gt,et)|0,u=Math.imul(gt,yt),o=o+Math.imul(Q,rt)|0,e=e+Math.imul(Q,Mt)|0,e=e+Math.imul(bt,rt)|0,u=u+Math.imul(bt,Mt)|0,o=o+Math.imul(j,it)|0,e=e+Math.imul(j,wt)|0,e=e+Math.imul(ct,it)|0,u=u+Math.imul(ct,wt)|0,o=o+Math.imul(Y,nt)|0,e=e+Math.imul(Y,xt)|0,e=e+Math.imul(vt,nt)|0,u=u+Math.imul(vt,xt)|0,o=o+Math.imul(X,at)|0,e=e+Math.imul(X,_t)|0,e=e+Math.imul(mt,at)|0,u=u+Math.imul(mt,_t)|0,o=o+Math.imul(J,st)|0,e=e+Math.imul(J,$t)|0,e=e+Math.imul(pt,st)|0,u=u+Math.imul(pt,$t)|0,o=o+Math.imul(F,ht)|0,e=e+Math.imul(F,Bt)|0,e=e+Math.imul(V,ht)|0,u=u+Math.imul(V,Bt)|0,o=o+Math.imul(D,ot)|0,e=e+Math.imul(D,St)|0,e=e+Math.imul(z,ot)|0,u=u+Math.imul(z,St)|0,o=o+Math.imul(N,ut)|0,e=e+Math.imul(N,At)|0,e=e+Math.imul(E,ut)|0,u=u+Math.imul(E,At)|0,o=o+Math.imul($,lt)|0,e=e+Math.imul($,Et)|0,e=e+Math.imul(q,lt)|0,u=u+Math.imul(q,Et)|0;var ae=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ae>>>26)|0,ae&=67108863,o=Math.imul(tt,rt),e=Math.imul(tt,Mt),e=e+Math.imul(gt,rt)|0,u=Math.imul(gt,Mt),o=o+Math.imul(Q,it)|0,e=e+Math.imul(Q,wt)|0,e=e+Math.imul(bt,it)|0,u=u+Math.imul(bt,wt)|0,o=o+Math.imul(j,nt)|0,e=e+Math.imul(j,xt)|0,e=e+Math.imul(ct,nt)|0,u=u+Math.imul(ct,xt)|0,o=o+Math.imul(Y,at)|0,e=e+Math.imul(Y,_t)|0,e=e+Math.imul(vt,at)|0,u=u+Math.imul(vt,_t)|0,o=o+Math.imul(X,st)|0,e=e+Math.imul(X,$t)|0,e=e+Math.imul(mt,st)|0,u=u+Math.imul(mt,$t)|0,o=o+Math.imul(J,ht)|0,e=e+Math.imul(J,Bt)|0,e=e+Math.imul(pt,ht)|0,u=u+Math.imul(pt,Bt)|0,o=o+Math.imul(F,ot)|0,e=e+Math.imul(F,St)|0,e=e+Math.imul(V,ot)|0,u=u+Math.imul(V,St)|0,o=o+Math.imul(D,ut)|0,e=e+Math.imul(D,At)|0,e=e+Math.imul(z,ut)|0,u=u+Math.imul(z,At)|0,o=o+Math.imul(N,lt)|0,e=e+Math.imul(N,Et)|0,e=e+Math.imul(E,lt)|0,u=u+Math.imul(E,Et)|0;var se=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(se>>>26)|0,se&=67108863,o=Math.imul(tt,it),e=Math.imul(tt,wt),e=e+Math.imul(gt,it)|0,u=Math.imul(gt,wt),o=o+Math.imul(Q,nt)|0,e=e+Math.imul(Q,xt)|0,e=e+Math.imul(bt,nt)|0,u=u+Math.imul(bt,xt)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(j,_t)|0,e=e+Math.imul(ct,at)|0,u=u+Math.imul(ct,_t)|0,o=o+Math.imul(Y,st)|0,e=e+Math.imul(Y,$t)|0,e=e+Math.imul(vt,st)|0,u=u+Math.imul(vt,$t)|0,o=o+Math.imul(X,ht)|0,e=e+Math.imul(X,Bt)|0,e=e+Math.imul(mt,ht)|0,u=u+Math.imul(mt,Bt)|0,o=o+Math.imul(J,ot)|0,e=e+Math.imul(J,St)|0,e=e+Math.imul(pt,ot)|0,u=u+Math.imul(pt,St)|0,o=o+Math.imul(F,ut)|0,e=e+Math.imul(F,At)|0,e=e+Math.imul(V,ut)|0,u=u+Math.imul(V,At)|0,o=o+Math.imul(D,lt)|0,e=e+Math.imul(D,Et)|0,e=e+Math.imul(z,lt)|0,u=u+Math.imul(z,Et)|0;var he=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(he>>>26)|0,he&=67108863,o=Math.imul(tt,nt),e=Math.imul(tt,xt),e=e+Math.imul(gt,nt)|0,u=Math.imul(gt,xt),o=o+Math.imul(Q,at)|0,e=e+Math.imul(Q,_t)|0,e=e+Math.imul(bt,at)|0,u=u+Math.imul(bt,_t)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(j,$t)|0,e=e+Math.imul(ct,st)|0,u=u+Math.imul(ct,$t)|0,o=o+Math.imul(Y,ht)|0,e=e+Math.imul(Y,Bt)|0,e=e+Math.imul(vt,ht)|0,u=u+Math.imul(vt,Bt)|0,o=o+Math.imul(X,ot)|0,e=e+Math.imul(X,St)|0,e=e+Math.imul(mt,ot)|0,u=u+Math.imul(mt,St)|0,o=o+Math.imul(J,ut)|0,e=e+Math.imul(J,At)|0,e=e+Math.imul(pt,ut)|0,u=u+Math.imul(pt,At)|0,o=o+Math.imul(F,lt)|0,e=e+Math.imul(F,Et)|0,e=e+Math.imul(V,lt)|0,u=u+Math.imul(V,Et)|0;var oe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(oe>>>26)|0,oe&=67108863,o=Math.imul(tt,at),e=Math.imul(tt,_t),e=e+Math.imul(gt,at)|0,u=Math.imul(gt,_t),o=o+Math.imul(Q,st)|0,e=e+Math.imul(Q,$t)|0,e=e+Math.imul(bt,st)|0,u=u+Math.imul(bt,$t)|0,o=o+Math.imul(j,ht)|0,e=e+Math.imul(j,Bt)|0,e=e+Math.imul(ct,ht)|0,u=u+Math.imul(ct,Bt)|0,o=o+Math.imul(Y,ot)|0,e=e+Math.imul(Y,St)|0,e=e+Math.imul(vt,ot)|0,u=u+Math.imul(vt,St)|0,o=o+Math.imul(X,ut)|0,e=e+Math.imul(X,At)|0,e=e+Math.imul(mt,ut)|0,u=u+Math.imul(mt,At)|0,o=o+Math.imul(J,lt)|0,e=e+Math.imul(J,Et)|0,e=e+Math.imul(pt,lt)|0,u=u+Math.imul(pt,Et)|0;var ue=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ue>>>26)|0,ue&=67108863,o=Math.imul(tt,st),e=Math.imul(tt,$t),e=e+Math.imul(gt,st)|0,u=Math.imul(gt,$t),o=o+Math.imul(Q,ht)|0,e=e+Math.imul(Q,Bt)|0,e=e+Math.imul(bt,ht)|0,u=u+Math.imul(bt,Bt)|0,o=o+Math.imul(j,ot)|0,e=e+Math.imul(j,St)|0,e=e+Math.imul(ct,ot)|0,u=u+Math.imul(ct,St)|0,o=o+Math.imul(Y,ut)|0,e=e+Math.imul(Y,At)|0,e=e+Math.imul(vt,ut)|0,u=u+Math.imul(vt,At)|0,o=o+Math.imul(X,lt)|0,e=e+Math.imul(X,Et)|0,e=e+Math.imul(mt,lt)|0,u=u+Math.imul(mt,Et)|0;var le=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(le>>>26)|0,le&=67108863,o=Math.imul(tt,ht),e=Math.imul(tt,Bt),e=e+Math.imul(gt,ht)|0,u=Math.imul(gt,Bt),o=o+Math.imul(Q,ot)|0,e=e+Math.imul(Q,St)|0,e=e+Math.imul(bt,ot)|0,u=u+Math.imul(bt,St)|0,o=o+Math.imul(j,ut)|0,e=e+Math.imul(j,At)|0,e=e+Math.imul(ct,ut)|0,u=u+Math.imul(ct,At)|0,o=o+Math.imul(Y,lt)|0,e=e+Math.imul(Y,Et)|0,e=e+Math.imul(vt,lt)|0,u=u+Math.imul(vt,Et)|0;var de=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(de>>>26)|0,de&=67108863,o=Math.imul(tt,ot),e=Math.imul(tt,St),e=e+Math.imul(gt,ot)|0,u=Math.imul(gt,St),o=o+Math.imul(Q,ut)|0,e=e+Math.imul(Q,At)|0,e=e+Math.imul(bt,ut)|0,u=u+Math.imul(bt,At)|0,o=o+Math.imul(j,lt)|0,e=e+Math.imul(j,Et)|0,e=e+Math.imul(ct,lt)|0,u=u+Math.imul(ct,Et)|0;var ce=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ce>>>26)|0,ce&=67108863,o=Math.imul(tt,ut),e=Math.imul(tt,At),e=e+Math.imul(gt,ut)|0,u=Math.imul(gt,At),o=o+Math.imul(Q,lt)|0,e=e+Math.imul(Q,Et)|0,e=e+Math.imul(bt,lt)|0,u=u+Math.imul(bt,Et)|0;var ve=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(tt,lt),e=Math.imul(tt,Et),e=e+Math.imul(gt,lt)|0,u=Math.imul(gt,Et);var pe=(m+o|0)+((e&8191)<<13)|0;return m=(u+(e>>>13)|0)+(pe>>>26)|0,pe&=67108863,v[0]=Tt,v[1]=Nt,v[2]=Qt,v[3]=te,v[4]=ee,v[5]=re,v[6]=ie,v[7]=fe,v[8]=ne,v[9]=ae,v[10]=se,v[11]=he,v[12]=oe,v[13]=ue,v[14]=le,v[15]=de,v[16]=ce,v[17]=ve,v[18]=pe,m!==0&&(v[19]=m,n.length++),n};Math.imul||(H=C);function U(b,t,i){i.negative=t.negative^b.negative,i.length=b.length+t.length;for(var n=0,a=0,l=0;l>>26)|0,a+=v>>>26,v&=67108863}i.words[l]=m,n=v,v=a}return n!==0?i.words[l]=n:i.length--,i.strip()}function L(b,t,i){var n=new T;return n.mulp(b,t,i)}h.prototype.mulTo=function(t,i){var n,a=this.length+t.length;return this.length===10&&t.length===10?n=H(this,t,i):a<63?n=C(this,t,i):a<1024?n=U(this,t,i):n=L(this,t,i),n};function T(b,t){this.x=b,this.y=t}T.prototype.makeRBT=function(t){for(var i=new Array(t),n=h.prototype._countBits(t)-1,a=0;a>=1;return a},T.prototype.permute=function(t,i,n,a,l,v){for(var m=0;m>>1)l++;return 1<>>13,n[2*v+1]=l&8191,l=l>>>13;for(v=2*i;v>=26,i+=a/67108864|0,i+=l>>>26,this.words[n]=l&67108863}return i!==0&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=R(t);if(i.length===0)return new h(1);for(var n=this,a=0;a=0);var i=t%26,n=(t-i)/26,a=67108863>>>26-i<<26-i,l;if(i!==0){var v=0;for(l=0;l>>26-i}v&&(this.words[l]=v,this.length++)}if(n!==0){for(l=this.length-1;l>=0;l--)this.words[l+n]=this.words[l];for(l=0;l=0);var a;i?a=(i-i%26)/26:a=0;var l=t%26,v=Math.min((t-l)/26,this.length),m=67108863^67108863>>>l<v)for(this.length-=v,e=0;e=0&&(u!==0||e>=a);e--){var M=this.words[e]|0;this.words[e]=u<<26-l|M>>>l,u=M&m}return o&&u!==0&&(o.words[o.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return p(this.negative===0),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){p(typeof t=="number"&&t>=0);var i=t%26,n=(t-i)/26,a=1<=0);var i=t%26,n=(t-i)/26;if(p(this.negative===0,"imaskn works only with positive numbers"),this.length<=n)return this;if(i!==0&&n++,this.length=Math.min(n,this.length),i!==0){var a=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(p(typeof t=="number"),p(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(o/67108864|0),this.words[l+n]=v&67108863}for(;l>26,this.words[l+n]=v&67108863;if(m===0)return this.strip();for(p(m===-1),m=0,l=0;l>26,this.words[l]=v&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var n=this.length-t.length,a=this.clone(),l=t,v=l.words[l.length-1]|0,m=this._countBits(v);n=26-m,n!==0&&(l=l.ushln(n),a.iushln(n),v=l.words[l.length-1]|0);var o=a.length-l.length,e;if(i!=="mod"){e=new h(null),e.length=o+1,e.words=new Array(e.length);for(var u=0;u=0;$--){var q=(a.words[l.length+$]|0)*67108864+(a.words[l.length+$-1]|0);for(q=Math.min(q/v|0,67108863),a._ishlnsubmul(l,q,$);a.negative!==0;)q--,a.negative=0,a._ishlnsubmul(l,1,$),a.isZero()||(a.negative^=1);e&&(e.words[$]=q)}return e&&e.strip(),a.strip(),i!=="div"&&n!==0&&a.iushrn(n),{div:e||null,mod:a}},h.prototype.divmod=function(t,i,n){if(p(!t.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var a,l,v;return this.negative!==0&&t.negative===0?(v=this.neg().divmod(t,i),i!=="mod"&&(a=v.div.neg()),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.iadd(t)),{div:a,mod:l}):this.negative===0&&t.negative!==0?(v=this.divmod(t.neg(),i),i!=="mod"&&(a=v.div.neg()),{div:a,mod:v.mod}):this.negative&t.negative?(v=this.neg().divmod(t.neg(),i),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.isub(t)),{div:v.div,mod:l}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i)},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var n=i.div.negative!==0?i.mod.isub(t):i.mod,a=t.ushrn(1),l=t.andln(1),v=n.cmp(a);return v<0||l===1&&v===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){p(t<=67108863);for(var i=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(i*n+(this.words[a]|0))%t;return n},h.prototype.idivn=function(t){p(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var a=(this.words[n]|0)+i*67108864;this.words[n]=a/t|0,i=a%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=new h(0),m=new h(1),o=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++o;for(var e=n.clone(),u=i.clone();!i.isZero();){for(var M=0,$=1;!(i.words[0]&$)&&M<26;++M,$<<=1);if(M>0)for(i.iushrn(M);M-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(e),l.isub(u)),a.iushrn(1),l.iushrn(1);for(var q=0,I=1;!(n.words[0]&I)&&q<26;++q,I<<=1);if(q>0)for(n.iushrn(q);q-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(e),m.isub(u)),v.iushrn(1),m.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(v),l.isub(m)):(n.isub(i),v.isub(a),m.isub(l))}return{a:v,b:m,gcd:n.iushln(o)}},h.prototype._invmp=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var m=0,o=1;!(i.words[0]&o)&&m<26;++m,o<<=1);if(m>0)for(i.iushrn(m);m-- >0;)a.isOdd()&&a.iadd(v),a.iushrn(1);for(var e=0,u=1;!(n.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(n.iushrn(e);e-- >0;)l.isOdd()&&l.iadd(v),l.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(l)):(n.isub(i),l.isub(a))}var M;return i.cmpn(1)===0?M=a:M=l,M.cmpn(0)<0&&M.iadd(t),M},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),n=t.clone();i.negative=0,n.negative=0;for(var a=0;i.isEven()&&n.isEven();a++)i.iushrn(1),n.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;n.isEven();)n.iushrn(1);var l=i.cmp(n);if(l<0){var v=i;i=n,n=v}else if(l===0||n.cmpn(1)===0)break;i.isub(n)}while(!0);return n.iushln(a)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){p(typeof t=="number");var i=t%26,n=(t-i)/26,a=1<>>26,m&=67108863,this.words[v]=m}return l!==0&&(this.words[v]=l,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var n;if(this.length>1)n=1;else{i&&(t=-t),p(t<=67108863,"Number is too big");var a=this.words[0]|0;n=a===t?0:at.length)return 1;if(this.length=0;n--){var a=this.words[n]|0,l=t.words[n]|0;if(a!==l){al&&(i=1);break}}return i},h.prototype.gtn=function(t){return this.cmpn(t)===1},h.prototype.gt=function(t){return this.cmp(t)===1},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return this.cmpn(t)===-1},h.prototype.lt=function(t){return this.cmp(t)===-1},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return this.cmpn(t)===0},h.prototype.eq=function(t){return this.cmp(t)===0},h.red=function(t){return new Z(t)},h.prototype.toRed=function(t){return p(!this.red,"Already a number in reduction context"),p(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return p(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return p(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return p(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return p(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return p(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return p(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return p(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return p(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return p(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return p(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return p(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return p(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return p(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var dt={k256:null,p224:null,p192:null,p25519:null};function O(b,t){this.name=b,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,n;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),n=i.bitLength();while(n>this.n);var a=n0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function kt(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}y(kt,O),kt.prototype.split=function(t,i){for(var n=4194303,a=Math.min(t.length,9),l=0;l>>22,v=m}v>>>=22,t.words[l-10]=v,v===0&&t.length>10?t.length-=10:t.length-=9},kt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,n=0;n>>=26,t.words[n]=l,i=a}return i!==0&&(t.words[t.length++]=i),t},h._prime=function(t){if(dt[t])return dt[t];var i;if(t==="k256")i=new kt;else if(t==="p224")i=new Rt;else if(t==="p192")i=new Ct;else if(t==="p25519")i=new qt;else throw new Error("Unknown prime "+t);return dt[t]=i,i};function Z(b){if(typeof b=="string"){var t=h._prime(b);this.m=t.p,this.prime=t}else p(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Z.prototype._verify1=function(t){p(t.negative===0,"red works only with positives"),p(t.red,"red works only with red numbers")},Z.prototype._verify2=function(t,i){p((t.negative|i.negative)===0,"red works only with positives"),p(t.red&&t.red===i.red,"red works only with red numbers")},Z.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Z.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Z.prototype.add=function(t,i){this._verify2(t,i);var n=t.add(i);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},Z.prototype.iadd=function(t,i){this._verify2(t,i);var n=t.iadd(i);return n.cmp(this.m)>=0&&n.isub(this.m),n},Z.prototype.sub=function(t,i){this._verify2(t,i);var n=t.sub(i);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},Z.prototype.isub=function(t,i){this._verify2(t,i);var n=t.isub(i);return n.cmpn(0)<0&&n.iadd(this.m),n},Z.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},Z.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Z.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Z.prototype.isqr=function(t){return this.imul(t,t.clone())},Z.prototype.sqr=function(t){return this.mul(t,t)},Z.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(p(i%2===1),i===3){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var a=this.m.subn(1),l=0;!a.isZero()&&a.andln(1)===0;)l++,a.iushrn(1);p(!a.isZero());var v=new h(1).toRed(this),m=v.redNeg(),o=this.m.subn(1).iushrn(1),e=this.m.bitLength();for(e=new h(2*e*e).toRed(this);this.pow(e,o).cmp(m)!==0;)e.redIAdd(m);for(var u=this.pow(e,a),M=this.pow(t,a.addn(1).iushrn(1)),$=this.pow(t,a),q=l;$.cmp(v)!==0;){for(var I=$,N=0;I.cmp(v)!==0;N++)I=I.redSqr();p(N=0;l--){for(var u=i.words[l],M=e-1;M>=0;M--){var $=u>>M&1;if(v!==a[0]&&(v=this.sqr(v)),$===0&&m===0){o=0;continue}m<<=1,m|=$,o++,!(o!==n&&(l!==0||M!==0))&&(v=this.mul(v,a[m]),o=0,m=0)}e=26}return v},Z.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},Z.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new Pt(t)};function Pt(b){Z.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}y(Pt,Z),Pt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Pt.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Pt.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var n=t.mul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(c,commonjsGlobal)})(bn$5);var bnExports$5=bn$5.exports,brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var c;brorand.exports=function(y){return c||(c=new d(null)),c.generate(y)};function d(p){this.rand=p}if(brorand.exports.Rand=d,d.prototype.generate=function(y){return this._rand(y)},d.prototype._rand=function(y){if(this.rand.getBytes)return this.rand.getBytes(y);for(var h=new Uint8Array(y),w=0;w=0);return _},g.prototype._randrange=function(y,h){var w=h.sub(y);return y.add(this._randbelow(w))},g.prototype.test=function(y,h,w){var _=y.bitLength(),S=c.mont(y),A=new c(1).toRed(S);h||(h=Math.max(1,_/48|0));for(var x=y.subn(1),B=0;!x.testn(B);B++);for(var k=y.shrn(B),R=x.toRed(S),C=!0;h>0;h--){var H=this._randrange(new c(2),x);w&&w(H);var U=H.toRed(S).redPow(k);if(!(U.cmp(A)===0||U.cmp(R)===0)){for(var L=1;L0;h--){var R=this._randrange(new c(2),A),C=y.gcd(R);if(C.cmpn(1)!==0)return C;var H=R.toRed(_).redPow(B);if(!(H.cmp(S)===0||H.cmp(k)===0)){for(var U=1;UL;)dt.ishrn(1);if(dt.isEven()&&dt.iadd(h),dt.testn(1)||dt.iadd(w),T.cmp(w)){if(!T.cmp(_))for(;dt.mod(S).cmp(A);)dt.iadd(B)}else for(;dt.mod(g).cmp(x);)dt.iadd(B);if(O=dt.shrn(1),C(O)&&C(dt)&&H(O)&&H(dt)&&y.test(O)&&y.test(dt))return dt}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$1={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var c=bnExports$6,d=requireMr(),g=new d,p=new c(24),y=new c(11),h=new c(10),w=new c(3),_=new c(7),S=requireGeneratePrime(),A=browserExports;dh=C;function x(U,L){return L=L||"utf8",Buffer$B.isBuffer(U)||(U=new Buffer$B(U,L)),this._pub=new c(U),this}function B(U,L){return L=L||"utf8",Buffer$B.isBuffer(U)||(U=new Buffer$B(U,L)),this._priv=new c(U),this}var k={};function R(U,L){var T=L.toString("hex"),dt=[T,U.toString(16)].join("_");if(dt in k)return k[dt];var O=0;if(U.isEven()||!S.simpleSieve||!S.fermatTest(U)||!g.test(U))return O+=1,T==="02"||T==="05"?O+=8:O+=4,k[dt]=O,O;g.test(U.shrn(1))||(O+=2);var kt;switch(T){case"02":U.mod(p).cmp(y)&&(O+=8);break;case"05":kt=U.mod(h),kt.cmp(w)&&kt.cmp(_)&&(O+=8);break;default:O+=4}return k[dt]=O,O}function C(U,L,T){this.setGenerator(L),this.__prime=new c(U),this._prime=c.mont(this.__prime),this._primeLen=U.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,T?(this.setPublicKey=x,this.setPrivateKey=B):this._primeCode=8}Object.defineProperty(C.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=R(this.__prime,this.__gen)),this._primeCode}}),C.prototype.generateKeys=function(){return this._priv||(this._priv=new c(A(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},C.prototype.computeSecret=function(U){U=new c(U),U=U.toRed(this._prime);var L=U.redPow(this._priv).fromRed(),T=new Buffer$B(L.toArray()),dt=this.getPrime();if(T.length"u"||!process$1.version||process$1.version.indexOf("v0.")===0||process$1.version.indexOf("v1.")===0&&process$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick}:processNextickArgs.exports=process$1;function nextTick(c,d,g,p){if(typeof c!="function")throw new TypeError('"callback" argument must be a function');var y=arguments.length,h,w;switch(y){case 0:case 1:return process$1.nextTick(c);case 2:return process$1.nextTick(function(){c.call(null,d)});case 3:return process$1.nextTick(function(){c.call(null,d,g)});case 4:return process$1.nextTick(function(){c.call(null,d,g,p)});default:for(h=new Array(y-1),w=0;w"u"}util$2.isPrimitive=isPrimitive;util$2.isBuffer=require$$0$1.Buffer.isBuffer;function objectToString(c){return Object.prototype.toString.call(c)}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(c){function d(h,w){if(!(h instanceof w))throw new TypeError("Cannot call a class as a function")}var g=safeBufferExports.Buffer,p=util$3;function y(h,w,_){h.copy(w,_)}c.exports=function(){function h(){d(this,h),this.head=null,this.tail=null,this.length=0}return h.prototype.push=function(_){var S={data:_,next:null};this.length>0?this.tail.next=S:this.head=S,this.tail=S,++this.length},h.prototype.unshift=function(_){var S={data:_,next:this.head};this.length===0&&(this.tail=S),this.head=S,++this.length},h.prototype.shift=function(){if(this.length!==0){var _=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,_}},h.prototype.clear=function(){this.head=this.tail=null,this.length=0},h.prototype.join=function(_){if(this.length===0)return"";for(var S=this.head,A=""+S.data;S=S.next;)A+=_+S.data;return A},h.prototype.concat=function(_){if(this.length===0)return g.alloc(0);for(var S=g.allocUnsafe(_>>>0),A=this.head,x=0;A;)y(A.data,S,x),x+=A.data.length,A=A.next;return S},h}(),p&&p.inspect&&p.inspect.custom&&(c.exports.prototype[p.inspect.custom]=function(){var h=p.inspect({length:this.length});return this.constructor.name+" "+h})}(BufferList)),BufferList.exports}var pna=processNextickArgsExports;function destroy(c,d){var g=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(d?d(c):c&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,this,c)):pna.nextTick(emitErrorNT,this,c)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(c||null,function(h){!d&&h?g._writableState?g._writableState.errorEmitted||(g._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,g,h)):pna.nextTick(emitErrorNT,g,h):d&&d(h)}),this)}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(c,d){c.emit("error",d)}var destroy_1={destroy,undestroy},_stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var c=processNextickArgsExports;_stream_writable=H;function d(v){var m=this;this.next=null,this.entry=null,this.finish=function(){l(m,v)}}var g=!process$1.browser&&["v0.10","v0.9."].indexOf(process$1.version.slice(0,5))>-1?setImmediate:c.nextTick,p;H.WritableState=R;var y=Object.create(util$2);y.inherits=inherits_browserExports;var h={deprecate:requireBrowser$3()},w=streamBrowser,_=safeBufferExports.Buffer,S=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function A(v){return _.from(v)}function x(v){return _.isBuffer(v)||v instanceof S}var B=destroy_1;y.inherits(H,w);function k(){}function R(v,m){p=p||require_stream_duplex(),v=v||{};var o=m instanceof p;this.objectMode=!!v.objectMode,o&&(this.objectMode=this.objectMode||!!v.writableObjectMode);var e=v.highWaterMark,u=v.writableHighWaterMark,M=this.objectMode?16:16*1024;e||e===0?this.highWaterMark=e:o&&(u||u===0)?this.highWaterMark=u:this.highWaterMark=M,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var $=v.decodeStrings===!1;this.decodeStrings=!$,this.defaultEncoding=v.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(q){Ct(m,q)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new d(this)}R.prototype.getBuffer=function(){for(var m=this.bufferedRequest,o=[];m;)o.push(m),m=m.next;return o},function(){try{Object.defineProperty(R.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var C;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(C=Function.prototype[Symbol.hasInstance],Object.defineProperty(H,Symbol.hasInstance,{value:function(v){return C.call(this,v)?!0:this!==H?!1:v&&v._writableState instanceof R}})):C=function(v){return v instanceof this};function H(v){if(p=p||require_stream_duplex(),!C.call(H,this)&&!(this instanceof p))return new H(v);this._writableState=new R(v,this),this.writable=!0,v&&(typeof v.write=="function"&&(this._write=v.write),typeof v.writev=="function"&&(this._writev=v.writev),typeof v.destroy=="function"&&(this._destroy=v.destroy),typeof v.final=="function"&&(this._final=v.final)),w.call(this)}H.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function U(v,m){var o=new Error("write after end");v.emit("error",o),c.nextTick(m,o)}function L(v,m,o,e){var u=!0,M=!1;return o===null?M=new TypeError("May not write null values to stream"):typeof o!="string"&&o!==void 0&&!m.objectMode&&(M=new TypeError("Invalid non-string/buffer chunk")),M&&(v.emit("error",M),c.nextTick(e,M),u=!1),u}H.prototype.write=function(v,m,o){var e=this._writableState,u=!1,M=!e.objectMode&&x(v);return M&&!_.isBuffer(v)&&(v=A(v)),typeof m=="function"&&(o=m,m=null),M?m="buffer":m||(m=e.defaultEncoding),typeof o!="function"&&(o=k),e.ended?U(this,o):(M||L(this,e,v,o))&&(e.pendingcb++,u=dt(this,e,M,v,m,o)),u},H.prototype.cork=function(){var v=this._writableState;v.corked++},H.prototype.uncork=function(){var v=this._writableState;v.corked&&(v.corked--,!v.writing&&!v.corked&&!v.bufferProcessing&&v.bufferedRequest&&Pt(this,v))},H.prototype.setDefaultEncoding=function(m){if(typeof m=="string"&&(m=m.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((m+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+m);return this._writableState.defaultEncoding=m,this};function T(v,m,o){return!v.objectMode&&v.decodeStrings!==!1&&typeof m=="string"&&(m=_.from(m,o)),m}Object.defineProperty(H.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function dt(v,m,o,e,u,M){if(!o){var $=T(m,e,u);e!==$&&(o=!0,u="buffer",e=$)}var q=m.objectMode?1:e.length;m.length+=q;var I=m.length0?(typeof P!="string"&&!F.objectMode&&Object.getPrototypeOf(P)!==h.prototype&&(P=_(P)),z?F.endEmitted?E.emit("error",new Error("stream.unshift() after end event")):O(E,F,P,!0):F.ended?E.emit("error",new Error("stream.push() after EOF")):(F.reading=!1,F.decoder&&!D?(P=F.decoder.write(P),F.objectMode||P.length!==0?O(E,F,P,!1):i(E,F)):O(E,F,P,!1))):z||(F.reading=!1)}return Rt(F)}function O(E,P,D,z){P.flowing&&P.length===0&&!P.sync?(E.emit("data",D),E.read(0)):(P.length+=P.objectMode?1:D.length,z?P.buffer.unshift(D):P.buffer.push(D),P.needReadable&&b(E)),i(E,P)}function kt(E,P){var D;return!S(P)&&typeof P!="string"&&P!==void 0&&!E.objectMode&&(D=new TypeError("Invalid non-string/buffer chunk")),D}function Rt(E){return!E.ended&&(E.needReadable||E.length=Ct?E=Ct:(E--,E|=E>>>1,E|=E>>>2,E|=E>>>4,E|=E>>>8,E|=E>>>16,E++),E}function Z(E,P){return E<=0||P.length===0&&P.ended?0:P.objectMode?1:E!==E?P.flowing&&P.length?P.buffer.head.data.length:P.length:(E>P.highWaterMark&&(P.highWaterMark=qt(E)),E<=P.length?E:P.ended?P.length:(P.needReadable=!0,0))}T.prototype.read=function(E){B("read",E),E=parseInt(E,10);var P=this._readableState,D=E;if(E!==0&&(P.emittedReadable=!1),E===0&&P.needReadable&&(P.length>=P.highWaterMark||P.ended))return B("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?q(this):b(this),null;if(E=Z(E,P),E===0&&P.ended)return P.length===0&&q(this),null;var z=P.needReadable;B("need readable",z),(P.length===0||P.length-E0?It=e(E,P):It=null,It===null?(P.needReadable=!0,E=0):P.length-=E,P.length===0&&(P.ended||(P.needReadable=!0),D!==E&&P.ended&&q(this)),It!==null&&this.emit("data",It),It};function Pt(E,P){if(!P.ended){if(P.decoder){var D=P.decoder.end();D&&D.length&&(P.buffer.push(D),P.length+=P.objectMode?1:D.length)}P.ended=!0,b(E)}}function b(E){var P=E._readableState;P.needReadable=!1,P.emittedReadable||(B("emitReadable",P.flowing),P.emittedReadable=!0,P.sync?c.nextTick(t,E):t(E))}function t(E){B("emit readable"),E.emit("readable"),o(E)}function i(E,P){P.readingMore||(P.readingMore=!0,c.nextTick(n,E,P))}function n(E,P){for(var D=P.length;!P.reading&&!P.flowing&&!P.ended&&P.length1&&N(z.pipes,E)!==-1)&&!pt&&(B("false write response, pause",z.awaitDrain),z.awaitDrain++,X=!0),D.pause())}function Lt(j){B("onerror",j),Dt(),E.removeListener("error",Lt),p(E,"error")===0&&E.emit("error",j)}U(E,"error",Lt);function Y(){E.removeListener("finish",vt),Dt()}E.once("close",Y);function vt(){B("onfinish"),E.removeListener("close",Y),Dt()}E.once("finish",vt);function Dt(){B("unpipe"),D.unpipe(E)}return E.emit("pipe",D),z.flowing||(B("pipe resume"),D.resume()),E};function a(E){return function(){var P=E._readableState;B("pipeOnDrain",P.awaitDrain),P.awaitDrain&&P.awaitDrain--,P.awaitDrain===0&&p(E,"data")&&(P.flowing=!0,o(E))}}T.prototype.unpipe=function(E){var P=this._readableState,D={hasUnpiped:!1};if(P.pipesCount===0)return this;if(P.pipesCount===1)return E&&E!==P.pipes?this:(E||(E=P.pipes),P.pipes=null,P.pipesCount=0,P.flowing=!1,E&&E.emit("unpipe",this,D),this);if(!E){var z=P.pipes,It=P.pipesCount;P.pipes=null,P.pipesCount=0,P.flowing=!1;for(var F=0;F=P.length?(P.decoder?D=P.buffer.join(""):P.buffer.length===1?D=P.buffer.head.data:D=P.buffer.concat(P.length),P.buffer.clear()):D=u(E,P.buffer,P.decoder),D}function u(E,P,D){var z;return EF.length?F.length:E;if(V===F.length?It+=F:It+=F.slice(0,E),E-=V,E===0){V===F.length?(++z,D.next?P.head=D.next:P.head=P.tail=null):(P.head=D,D.data=F.slice(V));break}++z}return P.length-=z,It}function $(E,P){var D=h.allocUnsafe(E),z=P.head,It=1;for(z.data.copy(D),E-=z.data.length;z=z.next;){var F=z.data,V=E>F.length?F.length:E;if(F.copy(D,D.length-E,0,V),E-=V,E===0){V===F.length?(++It,z.next?P.head=z.next:P.head=P.tail=null):(P.head=z,z.data=F.slice(V));break}++It}return P.length-=It,D}function q(E){var P=E._readableState;if(P.length>0)throw new Error('"endReadable()" called on non-empty stream');P.endEmitted||(P.ended=!0,c.nextTick(I,P,E))}function I(E,P){!E.endEmitted&&E.length===0&&(E.endEmitted=!0,P.readable=!1,P.emit("end"))}function N(E,P){for(var D=0,z=E.length;D0?n:a},h.min=function(n,a){return n.cmp(a)<0?n:a},h.prototype._init=function(n,a,l){if(typeof n=="number")return this._initNumber(n,a,l);if(typeof n=="object")return this._initArray(n,a,l);a==="hex"&&(a=16),p(a===(a|0)&&a>=2&&a<=36),n=n.toString().replace(/\s+/g,"");var v=0;n[0]==="-"&&(v++,this.negative=1),v=0;v-=3)o=n[v]|n[v-1]<<8|n[v-2]<<16,this.words[m]|=o<>>26-e&67108863,e+=24,e>=26&&(e-=26,m++);else if(l==="le")for(v=0,m=0;v>>26-e&67108863,e+=24,e>=26&&(e-=26,m++);return this._strip()};function _(i,n){var a=i.charCodeAt(n);if(a>=48&&a<=57)return a-48;if(a>=65&&a<=70)return a-55;if(a>=97&&a<=102)return a-87;p(!1,"Invalid character in "+i)}function S(i,n,a){var l=_(i,a);return a-1>=n&&(l|=_(i,a-1)<<4),l}h.prototype._parseHex=function(n,a,l){this.length=Math.ceil((n.length-a)/6),this.words=new Array(this.length);for(var v=0;v=a;v-=2)e=S(n,a,v)<=18?(m-=18,o+=1,this.words[o]|=e>>>26):m+=8;else{var u=n.length-a;for(v=u%2===0?a+1:a;v=18?(m-=18,o+=1,this.words[o]|=e>>>26):m+=8}this._strip()};function A(i,n,a,l){for(var v=0,m=0,o=Math.min(i.length,a),e=n;e=49?m=u-49+10:u>=17?m=u-17+10:m=u,p(u>=0&&m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{h.prototype[Symbol.for("nodejs.util.inspect.custom")]=B}catch{h.prototype.inspect=B}else h.prototype.inspect=B;function B(){return(this.red?""}var k=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],R=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],C=[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];h.prototype.toString=function(n,a){n=n||10,a=a|0||1;var l;if(n===16||n==="hex"){l="";for(var v=0,m=0,o=0;o>>24-v&16777215,v+=2,v>=26&&(v-=26,o--),m!==0||o!==this.length-1?l=k[6-u.length]+u+l:l=u+l}for(m!==0&&(l=m.toString(16)+l);l.length%a!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(n===(n|0)&&n>=2&&n<=36){var M=R[n],$=C[n];l="";var q=this.clone();for(q.negative=0;!q.isZero();){var I=q.modrn($).toString(n);q=q.idivn($),q.isZero()?l=I+l:l=k[M-I.length]+I+l}for(this.isZero()&&(l="0"+l);l.length%a!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}p(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&p(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},h.prototype.toJSON=function(){return this.toString(16,2)},w&&(h.prototype.toBuffer=function(n,a){return this.toArrayLike(w,n,a)}),h.prototype.toArray=function(n,a){return this.toArrayLike(Array,n,a)};var H=function(n,a){return n.allocUnsafe?n.allocUnsafe(a):new n(a)};h.prototype.toArrayLike=function(n,a,l){this._strip();var v=this.byteLength(),m=l||Math.max(1,v);p(v<=m,"byte array longer than desired length"),p(m>0,"Requested array length <= 0");var o=H(n,m),e=a==="le"?"LE":"BE";return this["_toArrayLike"+e](o,v),o},h.prototype._toArrayLikeLE=function(n,a){for(var l=0,v=0,m=0,o=0;m>8&255),l>16&255),o===6?(l>24&255),v=0,o=0):(v=e>>>24,o+=2)}if(l=0&&(n[l--]=e>>8&255),l>=0&&(n[l--]=e>>16&255),o===6?(l>=0&&(n[l--]=e>>24&255),v=0,o=0):(v=e>>>24,o+=2)}if(l>=0)for(n[l--]=v;l>=0;)n[l--]=0},Math.clz32?h.prototype._countBits=function(n){return 32-Math.clz32(n)}:h.prototype._countBits=function(n){var a=n,l=0;return a>=4096&&(l+=13,a>>>=13),a>=64&&(l+=7,a>>>=7),a>=8&&(l+=4,a>>>=4),a>=2&&(l+=2,a>>>=2),l+a},h.prototype._zeroBits=function(n){if(n===0)return 26;var a=n,l=0;return a&8191||(l+=13,a>>>=13),a&127||(l+=7,a>>>=7),a&15||(l+=4,a>>>=4),a&3||(l+=2,a>>>=2),a&1||l++,l},h.prototype.bitLength=function(){var n=this.words[this.length-1],a=this._countBits(n);return(this.length-1)*26+a};function U(i){for(var n=new Array(i.bitLength()),a=0;a>>v&1}return n}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,a=0;an.length?this.clone().ior(n):n.clone().ior(this)},h.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},h.prototype.iuand=function(n){var a;this.length>n.length?a=n:a=this;for(var l=0;ln.length?this.clone().iand(n):n.clone().iand(this)},h.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},h.prototype.iuxor=function(n){var a,l;this.length>n.length?(a=this,l=n):(a=n,l=this);for(var v=0;vn.length?this.clone().ixor(n):n.clone().ixor(this)},h.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},h.prototype.inotn=function(n){p(typeof n=="number"&&n>=0);var a=Math.ceil(n/26)|0,l=n%26;this._expand(a),l>0&&a--;for(var v=0;v0&&(this.words[v]=~this.words[v]&67108863>>26-l),this._strip()},h.prototype.notn=function(n){return this.clone().inotn(n)},h.prototype.setn=function(n,a){p(typeof n=="number"&&n>=0);var l=n/26|0,v=n%26;return this._expand(l+1),a?this.words[l]=this.words[l]|1<n.length?(l=this,v=n):(l=n,v=this);for(var m=0,o=0;o>>26;for(;m!==0&&o>>26;if(this.length=l.length,m!==0)this.words[this.length]=m,this.length++;else if(l!==this)for(;on.length?this.clone().iadd(n):n.clone().iadd(this)},h.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var a=this.iadd(n);return n.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var l=this.cmp(n);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,m;l>0?(v=this,m=n):(v=n,m=this);for(var o=0,e=0;e>26,this.words[e]=a&67108863;for(;o!==0&&e>26,this.words[e]=a&67108863;if(o===0&&e>>26,q=u&67108863,I=Math.min(M,n.length-1),N=Math.max(0,M-i.length+1);N<=I;N++){var E=M-N|0;v=i.words[E]|0,m=n.words[N]|0,o=v*m+q,$+=o/67108864|0,q=o&67108863}a.words[M]=q|0,u=$|0}return u!==0?a.words[M]=u|0:a.length--,a._strip()}var T=function(n,a,l){var v=n.words,m=a.words,o=l.words,e=0,u,M,$,q=v[0]|0,I=q&8191,N=q>>>13,E=v[1]|0,P=E&8191,D=E>>>13,z=v[2]|0,It=z&8191,F=z>>>13,V=v[3]|0,Ht=V&8191,J=V>>>13,pt=v[4]|0,zt=pt&8191,X=pt>>>13,mt=v[5]|0,Lt=mt&8191,Y=mt>>>13,vt=v[6]|0,Dt=vt&8191,j=vt>>>13,ct=v[7]|0,Ot=ct&8191,Q=ct>>>13,bt=v[8]|0,Kt=bt&8191,tt=bt>>>13,gt=v[9]|0,Ft=gt&8191,et=gt>>>13,yt=m[0]|0,Ut=yt&8191,rt=yt>>>13,Mt=m[1]|0,Zt=Mt&8191,it=Mt>>>13,wt=m[2]|0,Gt=wt&8191,nt=wt>>>13,xt=m[3]|0,Wt=xt&8191,at=xt>>>13,_t=m[4]|0,Vt=_t&8191,st=_t>>>13,$t=m[5]|0,jt=$t&8191,ht=$t>>>13,Bt=m[6]|0,Jt=Bt&8191,ot=Bt>>>13,St=m[7]|0,Xt=St&8191,ut=St>>>13,At=m[8]|0,Yt=At&8191,lt=At>>>13,Et=m[9]|0,Tt=Et&8191,Nt=Et>>>13;l.negative=n.negative^a.negative,l.length=19,u=Math.imul(I,Ut),M=Math.imul(I,rt),M=M+Math.imul(N,Ut)|0,$=Math.imul(N,rt);var Qt=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,u=Math.imul(P,Ut),M=Math.imul(P,rt),M=M+Math.imul(D,Ut)|0,$=Math.imul(D,rt),u=u+Math.imul(I,Zt)|0,M=M+Math.imul(I,it)|0,M=M+Math.imul(N,Zt)|0,$=$+Math.imul(N,it)|0;var te=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(te>>>26)|0,te&=67108863,u=Math.imul(It,Ut),M=Math.imul(It,rt),M=M+Math.imul(F,Ut)|0,$=Math.imul(F,rt),u=u+Math.imul(P,Zt)|0,M=M+Math.imul(P,it)|0,M=M+Math.imul(D,Zt)|0,$=$+Math.imul(D,it)|0,u=u+Math.imul(I,Gt)|0,M=M+Math.imul(I,nt)|0,M=M+Math.imul(N,Gt)|0,$=$+Math.imul(N,nt)|0;var ee=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(ee>>>26)|0,ee&=67108863,u=Math.imul(Ht,Ut),M=Math.imul(Ht,rt),M=M+Math.imul(J,Ut)|0,$=Math.imul(J,rt),u=u+Math.imul(It,Zt)|0,M=M+Math.imul(It,it)|0,M=M+Math.imul(F,Zt)|0,$=$+Math.imul(F,it)|0,u=u+Math.imul(P,Gt)|0,M=M+Math.imul(P,nt)|0,M=M+Math.imul(D,Gt)|0,$=$+Math.imul(D,nt)|0,u=u+Math.imul(I,Wt)|0,M=M+Math.imul(I,at)|0,M=M+Math.imul(N,Wt)|0,$=$+Math.imul(N,at)|0;var re=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(re>>>26)|0,re&=67108863,u=Math.imul(zt,Ut),M=Math.imul(zt,rt),M=M+Math.imul(X,Ut)|0,$=Math.imul(X,rt),u=u+Math.imul(Ht,Zt)|0,M=M+Math.imul(Ht,it)|0,M=M+Math.imul(J,Zt)|0,$=$+Math.imul(J,it)|0,u=u+Math.imul(It,Gt)|0,M=M+Math.imul(It,nt)|0,M=M+Math.imul(F,Gt)|0,$=$+Math.imul(F,nt)|0,u=u+Math.imul(P,Wt)|0,M=M+Math.imul(P,at)|0,M=M+Math.imul(D,Wt)|0,$=$+Math.imul(D,at)|0,u=u+Math.imul(I,Vt)|0,M=M+Math.imul(I,st)|0,M=M+Math.imul(N,Vt)|0,$=$+Math.imul(N,st)|0;var ie=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(ie>>>26)|0,ie&=67108863,u=Math.imul(Lt,Ut),M=Math.imul(Lt,rt),M=M+Math.imul(Y,Ut)|0,$=Math.imul(Y,rt),u=u+Math.imul(zt,Zt)|0,M=M+Math.imul(zt,it)|0,M=M+Math.imul(X,Zt)|0,$=$+Math.imul(X,it)|0,u=u+Math.imul(Ht,Gt)|0,M=M+Math.imul(Ht,nt)|0,M=M+Math.imul(J,Gt)|0,$=$+Math.imul(J,nt)|0,u=u+Math.imul(It,Wt)|0,M=M+Math.imul(It,at)|0,M=M+Math.imul(F,Wt)|0,$=$+Math.imul(F,at)|0,u=u+Math.imul(P,Vt)|0,M=M+Math.imul(P,st)|0,M=M+Math.imul(D,Vt)|0,$=$+Math.imul(D,st)|0,u=u+Math.imul(I,jt)|0,M=M+Math.imul(I,ht)|0,M=M+Math.imul(N,jt)|0,$=$+Math.imul(N,ht)|0;var fe=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(fe>>>26)|0,fe&=67108863,u=Math.imul(Dt,Ut),M=Math.imul(Dt,rt),M=M+Math.imul(j,Ut)|0,$=Math.imul(j,rt),u=u+Math.imul(Lt,Zt)|0,M=M+Math.imul(Lt,it)|0,M=M+Math.imul(Y,Zt)|0,$=$+Math.imul(Y,it)|0,u=u+Math.imul(zt,Gt)|0,M=M+Math.imul(zt,nt)|0,M=M+Math.imul(X,Gt)|0,$=$+Math.imul(X,nt)|0,u=u+Math.imul(Ht,Wt)|0,M=M+Math.imul(Ht,at)|0,M=M+Math.imul(J,Wt)|0,$=$+Math.imul(J,at)|0,u=u+Math.imul(It,Vt)|0,M=M+Math.imul(It,st)|0,M=M+Math.imul(F,Vt)|0,$=$+Math.imul(F,st)|0,u=u+Math.imul(P,jt)|0,M=M+Math.imul(P,ht)|0,M=M+Math.imul(D,jt)|0,$=$+Math.imul(D,ht)|0,u=u+Math.imul(I,Jt)|0,M=M+Math.imul(I,ot)|0,M=M+Math.imul(N,Jt)|0,$=$+Math.imul(N,ot)|0;var ne=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(ne>>>26)|0,ne&=67108863,u=Math.imul(Ot,Ut),M=Math.imul(Ot,rt),M=M+Math.imul(Q,Ut)|0,$=Math.imul(Q,rt),u=u+Math.imul(Dt,Zt)|0,M=M+Math.imul(Dt,it)|0,M=M+Math.imul(j,Zt)|0,$=$+Math.imul(j,it)|0,u=u+Math.imul(Lt,Gt)|0,M=M+Math.imul(Lt,nt)|0,M=M+Math.imul(Y,Gt)|0,$=$+Math.imul(Y,nt)|0,u=u+Math.imul(zt,Wt)|0,M=M+Math.imul(zt,at)|0,M=M+Math.imul(X,Wt)|0,$=$+Math.imul(X,at)|0,u=u+Math.imul(Ht,Vt)|0,M=M+Math.imul(Ht,st)|0,M=M+Math.imul(J,Vt)|0,$=$+Math.imul(J,st)|0,u=u+Math.imul(It,jt)|0,M=M+Math.imul(It,ht)|0,M=M+Math.imul(F,jt)|0,$=$+Math.imul(F,ht)|0,u=u+Math.imul(P,Jt)|0,M=M+Math.imul(P,ot)|0,M=M+Math.imul(D,Jt)|0,$=$+Math.imul(D,ot)|0,u=u+Math.imul(I,Xt)|0,M=M+Math.imul(I,ut)|0,M=M+Math.imul(N,Xt)|0,$=$+Math.imul(N,ut)|0;var ae=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(ae>>>26)|0,ae&=67108863,u=Math.imul(Kt,Ut),M=Math.imul(Kt,rt),M=M+Math.imul(tt,Ut)|0,$=Math.imul(tt,rt),u=u+Math.imul(Ot,Zt)|0,M=M+Math.imul(Ot,it)|0,M=M+Math.imul(Q,Zt)|0,$=$+Math.imul(Q,it)|0,u=u+Math.imul(Dt,Gt)|0,M=M+Math.imul(Dt,nt)|0,M=M+Math.imul(j,Gt)|0,$=$+Math.imul(j,nt)|0,u=u+Math.imul(Lt,Wt)|0,M=M+Math.imul(Lt,at)|0,M=M+Math.imul(Y,Wt)|0,$=$+Math.imul(Y,at)|0,u=u+Math.imul(zt,Vt)|0,M=M+Math.imul(zt,st)|0,M=M+Math.imul(X,Vt)|0,$=$+Math.imul(X,st)|0,u=u+Math.imul(Ht,jt)|0,M=M+Math.imul(Ht,ht)|0,M=M+Math.imul(J,jt)|0,$=$+Math.imul(J,ht)|0,u=u+Math.imul(It,Jt)|0,M=M+Math.imul(It,ot)|0,M=M+Math.imul(F,Jt)|0,$=$+Math.imul(F,ot)|0,u=u+Math.imul(P,Xt)|0,M=M+Math.imul(P,ut)|0,M=M+Math.imul(D,Xt)|0,$=$+Math.imul(D,ut)|0,u=u+Math.imul(I,Yt)|0,M=M+Math.imul(I,lt)|0,M=M+Math.imul(N,Yt)|0,$=$+Math.imul(N,lt)|0;var se=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(se>>>26)|0,se&=67108863,u=Math.imul(Ft,Ut),M=Math.imul(Ft,rt),M=M+Math.imul(et,Ut)|0,$=Math.imul(et,rt),u=u+Math.imul(Kt,Zt)|0,M=M+Math.imul(Kt,it)|0,M=M+Math.imul(tt,Zt)|0,$=$+Math.imul(tt,it)|0,u=u+Math.imul(Ot,Gt)|0,M=M+Math.imul(Ot,nt)|0,M=M+Math.imul(Q,Gt)|0,$=$+Math.imul(Q,nt)|0,u=u+Math.imul(Dt,Wt)|0,M=M+Math.imul(Dt,at)|0,M=M+Math.imul(j,Wt)|0,$=$+Math.imul(j,at)|0,u=u+Math.imul(Lt,Vt)|0,M=M+Math.imul(Lt,st)|0,M=M+Math.imul(Y,Vt)|0,$=$+Math.imul(Y,st)|0,u=u+Math.imul(zt,jt)|0,M=M+Math.imul(zt,ht)|0,M=M+Math.imul(X,jt)|0,$=$+Math.imul(X,ht)|0,u=u+Math.imul(Ht,Jt)|0,M=M+Math.imul(Ht,ot)|0,M=M+Math.imul(J,Jt)|0,$=$+Math.imul(J,ot)|0,u=u+Math.imul(It,Xt)|0,M=M+Math.imul(It,ut)|0,M=M+Math.imul(F,Xt)|0,$=$+Math.imul(F,ut)|0,u=u+Math.imul(P,Yt)|0,M=M+Math.imul(P,lt)|0,M=M+Math.imul(D,Yt)|0,$=$+Math.imul(D,lt)|0,u=u+Math.imul(I,Tt)|0,M=M+Math.imul(I,Nt)|0,M=M+Math.imul(N,Tt)|0,$=$+Math.imul(N,Nt)|0;var he=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(he>>>26)|0,he&=67108863,u=Math.imul(Ft,Zt),M=Math.imul(Ft,it),M=M+Math.imul(et,Zt)|0,$=Math.imul(et,it),u=u+Math.imul(Kt,Gt)|0,M=M+Math.imul(Kt,nt)|0,M=M+Math.imul(tt,Gt)|0,$=$+Math.imul(tt,nt)|0,u=u+Math.imul(Ot,Wt)|0,M=M+Math.imul(Ot,at)|0,M=M+Math.imul(Q,Wt)|0,$=$+Math.imul(Q,at)|0,u=u+Math.imul(Dt,Vt)|0,M=M+Math.imul(Dt,st)|0,M=M+Math.imul(j,Vt)|0,$=$+Math.imul(j,st)|0,u=u+Math.imul(Lt,jt)|0,M=M+Math.imul(Lt,ht)|0,M=M+Math.imul(Y,jt)|0,$=$+Math.imul(Y,ht)|0,u=u+Math.imul(zt,Jt)|0,M=M+Math.imul(zt,ot)|0,M=M+Math.imul(X,Jt)|0,$=$+Math.imul(X,ot)|0,u=u+Math.imul(Ht,Xt)|0,M=M+Math.imul(Ht,ut)|0,M=M+Math.imul(J,Xt)|0,$=$+Math.imul(J,ut)|0,u=u+Math.imul(It,Yt)|0,M=M+Math.imul(It,lt)|0,M=M+Math.imul(F,Yt)|0,$=$+Math.imul(F,lt)|0,u=u+Math.imul(P,Tt)|0,M=M+Math.imul(P,Nt)|0,M=M+Math.imul(D,Tt)|0,$=$+Math.imul(D,Nt)|0;var oe=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(oe>>>26)|0,oe&=67108863,u=Math.imul(Ft,Gt),M=Math.imul(Ft,nt),M=M+Math.imul(et,Gt)|0,$=Math.imul(et,nt),u=u+Math.imul(Kt,Wt)|0,M=M+Math.imul(Kt,at)|0,M=M+Math.imul(tt,Wt)|0,$=$+Math.imul(tt,at)|0,u=u+Math.imul(Ot,Vt)|0,M=M+Math.imul(Ot,st)|0,M=M+Math.imul(Q,Vt)|0,$=$+Math.imul(Q,st)|0,u=u+Math.imul(Dt,jt)|0,M=M+Math.imul(Dt,ht)|0,M=M+Math.imul(j,jt)|0,$=$+Math.imul(j,ht)|0,u=u+Math.imul(Lt,Jt)|0,M=M+Math.imul(Lt,ot)|0,M=M+Math.imul(Y,Jt)|0,$=$+Math.imul(Y,ot)|0,u=u+Math.imul(zt,Xt)|0,M=M+Math.imul(zt,ut)|0,M=M+Math.imul(X,Xt)|0,$=$+Math.imul(X,ut)|0,u=u+Math.imul(Ht,Yt)|0,M=M+Math.imul(Ht,lt)|0,M=M+Math.imul(J,Yt)|0,$=$+Math.imul(J,lt)|0,u=u+Math.imul(It,Tt)|0,M=M+Math.imul(It,Nt)|0,M=M+Math.imul(F,Tt)|0,$=$+Math.imul(F,Nt)|0;var ue=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(ue>>>26)|0,ue&=67108863,u=Math.imul(Ft,Wt),M=Math.imul(Ft,at),M=M+Math.imul(et,Wt)|0,$=Math.imul(et,at),u=u+Math.imul(Kt,Vt)|0,M=M+Math.imul(Kt,st)|0,M=M+Math.imul(tt,Vt)|0,$=$+Math.imul(tt,st)|0,u=u+Math.imul(Ot,jt)|0,M=M+Math.imul(Ot,ht)|0,M=M+Math.imul(Q,jt)|0,$=$+Math.imul(Q,ht)|0,u=u+Math.imul(Dt,Jt)|0,M=M+Math.imul(Dt,ot)|0,M=M+Math.imul(j,Jt)|0,$=$+Math.imul(j,ot)|0,u=u+Math.imul(Lt,Xt)|0,M=M+Math.imul(Lt,ut)|0,M=M+Math.imul(Y,Xt)|0,$=$+Math.imul(Y,ut)|0,u=u+Math.imul(zt,Yt)|0,M=M+Math.imul(zt,lt)|0,M=M+Math.imul(X,Yt)|0,$=$+Math.imul(X,lt)|0,u=u+Math.imul(Ht,Tt)|0,M=M+Math.imul(Ht,Nt)|0,M=M+Math.imul(J,Tt)|0,$=$+Math.imul(J,Nt)|0;var le=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(le>>>26)|0,le&=67108863,u=Math.imul(Ft,Vt),M=Math.imul(Ft,st),M=M+Math.imul(et,Vt)|0,$=Math.imul(et,st),u=u+Math.imul(Kt,jt)|0,M=M+Math.imul(Kt,ht)|0,M=M+Math.imul(tt,jt)|0,$=$+Math.imul(tt,ht)|0,u=u+Math.imul(Ot,Jt)|0,M=M+Math.imul(Ot,ot)|0,M=M+Math.imul(Q,Jt)|0,$=$+Math.imul(Q,ot)|0,u=u+Math.imul(Dt,Xt)|0,M=M+Math.imul(Dt,ut)|0,M=M+Math.imul(j,Xt)|0,$=$+Math.imul(j,ut)|0,u=u+Math.imul(Lt,Yt)|0,M=M+Math.imul(Lt,lt)|0,M=M+Math.imul(Y,Yt)|0,$=$+Math.imul(Y,lt)|0,u=u+Math.imul(zt,Tt)|0,M=M+Math.imul(zt,Nt)|0,M=M+Math.imul(X,Tt)|0,$=$+Math.imul(X,Nt)|0;var de=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(de>>>26)|0,de&=67108863,u=Math.imul(Ft,jt),M=Math.imul(Ft,ht),M=M+Math.imul(et,jt)|0,$=Math.imul(et,ht),u=u+Math.imul(Kt,Jt)|0,M=M+Math.imul(Kt,ot)|0,M=M+Math.imul(tt,Jt)|0,$=$+Math.imul(tt,ot)|0,u=u+Math.imul(Ot,Xt)|0,M=M+Math.imul(Ot,ut)|0,M=M+Math.imul(Q,Xt)|0,$=$+Math.imul(Q,ut)|0,u=u+Math.imul(Dt,Yt)|0,M=M+Math.imul(Dt,lt)|0,M=M+Math.imul(j,Yt)|0,$=$+Math.imul(j,lt)|0,u=u+Math.imul(Lt,Tt)|0,M=M+Math.imul(Lt,Nt)|0,M=M+Math.imul(Y,Tt)|0,$=$+Math.imul(Y,Nt)|0;var ce=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(ce>>>26)|0,ce&=67108863,u=Math.imul(Ft,Jt),M=Math.imul(Ft,ot),M=M+Math.imul(et,Jt)|0,$=Math.imul(et,ot),u=u+Math.imul(Kt,Xt)|0,M=M+Math.imul(Kt,ut)|0,M=M+Math.imul(tt,Xt)|0,$=$+Math.imul(tt,ut)|0,u=u+Math.imul(Ot,Yt)|0,M=M+Math.imul(Ot,lt)|0,M=M+Math.imul(Q,Yt)|0,$=$+Math.imul(Q,lt)|0,u=u+Math.imul(Dt,Tt)|0,M=M+Math.imul(Dt,Nt)|0,M=M+Math.imul(j,Tt)|0,$=$+Math.imul(j,Nt)|0;var ve=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(ve>>>26)|0,ve&=67108863,u=Math.imul(Ft,Xt),M=Math.imul(Ft,ut),M=M+Math.imul(et,Xt)|0,$=Math.imul(et,ut),u=u+Math.imul(Kt,Yt)|0,M=M+Math.imul(Kt,lt)|0,M=M+Math.imul(tt,Yt)|0,$=$+Math.imul(tt,lt)|0,u=u+Math.imul(Ot,Tt)|0,M=M+Math.imul(Ot,Nt)|0,M=M+Math.imul(Q,Tt)|0,$=$+Math.imul(Q,Nt)|0;var pe=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(pe>>>26)|0,pe&=67108863,u=Math.imul(Ft,Yt),M=Math.imul(Ft,lt),M=M+Math.imul(et,Yt)|0,$=Math.imul(et,lt),u=u+Math.imul(Kt,Tt)|0,M=M+Math.imul(Kt,Nt)|0,M=M+Math.imul(tt,Tt)|0,$=$+Math.imul(tt,Nt)|0;var me=(e+u|0)+((M&8191)<<13)|0;e=($+(M>>>13)|0)+(me>>>26)|0,me&=67108863,u=Math.imul(Ft,Tt),M=Math.imul(Ft,Nt),M=M+Math.imul(et,Tt)|0,$=Math.imul(et,Nt);var be=(e+u|0)+((M&8191)<<13)|0;return e=($+(M>>>13)|0)+(be>>>26)|0,be&=67108863,o[0]=Qt,o[1]=te,o[2]=ee,o[3]=re,o[4]=ie,o[5]=fe,o[6]=ne,o[7]=ae,o[8]=se,o[9]=he,o[10]=oe,o[11]=ue,o[12]=le,o[13]=de,o[14]=ce,o[15]=ve,o[16]=pe,o[17]=me,o[18]=be,e!==0&&(o[19]=e,l.length++),l};Math.imul||(T=L);function dt(i,n,a){a.negative=n.negative^i.negative,a.length=i.length+n.length;for(var l=0,v=0,m=0;m>>26)|0,v+=o>>>26,o&=67108863}a.words[m]=e,l=o,o=v}return l!==0?a.words[m]=l:a.length--,a._strip()}function O(i,n,a){return dt(i,n,a)}h.prototype.mulTo=function(n,a){var l,v=this.length+n.length;return this.length===10&&n.length===10?l=T(this,n,a):v<63?l=L(this,n,a):v<1024?l=dt(this,n,a):l=O(this,n,a),l},h.prototype.mul=function(n){var a=new h(null);return a.words=new Array(this.length+n.length),this.mulTo(n,a)},h.prototype.mulf=function(n){var a=new h(null);return a.words=new Array(this.length+n.length),O(this,n,a)},h.prototype.imul=function(n){return this.clone().mulTo(n,this)},h.prototype.imuln=function(n){var a=n<0;a&&(n=-n),p(typeof n=="number"),p(n<67108864);for(var l=0,v=0;v>=26,l+=m/67108864|0,l+=o>>>26,this.words[v]=o&67108863}return l!==0&&(this.words[v]=l,this.length++),a?this.ineg():this},h.prototype.muln=function(n){return this.clone().imuln(n)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(n){var a=U(n);if(a.length===0)return new h(1);for(var l=this,v=0;v=0);var a=n%26,l=(n-a)/26,v=67108863>>>26-a<<26-a,m;if(a!==0){var o=0;for(m=0;m>>26-a}o&&(this.words[m]=o,this.length++)}if(l!==0){for(m=this.length-1;m>=0;m--)this.words[m+l]=this.words[m];for(m=0;m=0);var v;a?v=(a-a%26)/26:v=0;var m=n%26,o=Math.min((n-m)/26,this.length),e=67108863^67108863>>>m<o)for(this.length-=o,M=0;M=0&&($!==0||M>=v);M--){var q=this.words[M]|0;this.words[M]=$<<26-m|q>>>m,$=q&e}return u&&$!==0&&(u.words[u.length++]=$),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function(n,a,l){return p(this.negative===0),this.iushrn(n,a,l)},h.prototype.shln=function(n){return this.clone().ishln(n)},h.prototype.ushln=function(n){return this.clone().iushln(n)},h.prototype.shrn=function(n){return this.clone().ishrn(n)},h.prototype.ushrn=function(n){return this.clone().iushrn(n)},h.prototype.testn=function(n){p(typeof n=="number"&&n>=0);var a=n%26,l=(n-a)/26,v=1<=0);var a=n%26,l=(n-a)/26;if(p(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(a!==0&&l++,this.length=Math.min(l,this.length),a!==0){var v=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},h.prototype.isubn=function(n){if(p(typeof n=="number"),p(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(u/67108864|0),this.words[m+l]=o&67108863}for(;m>26,this.words[m+l]=o&67108863;if(e===0)return this._strip();for(p(e===-1),e=0,m=0;m>26,this.words[m]=o&67108863;return this.negative=1,this._strip()},h.prototype._wordDiv=function(n,a){var l=this.length-n.length,v=this.clone(),m=n,o=m.words[m.length-1]|0,e=this._countBits(o);l=26-e,l!==0&&(m=m.ushln(l),v.iushln(l),o=m.words[m.length-1]|0);var u=v.length-m.length,M;if(a!=="mod"){M=new h(null),M.length=u+1,M.words=new Array(M.length);for(var $=0;$=0;I--){var N=(v.words[m.length+I]|0)*67108864+(v.words[m.length+I-1]|0);for(N=Math.min(N/o|0,67108863),v._ishlnsubmul(m,N,I);v.negative!==0;)N--,v.negative=0,v._ishlnsubmul(m,1,I),v.isZero()||(v.negative^=1);M&&(M.words[I]=N)}return M&&M._strip(),v._strip(),a!=="div"&&l!==0&&v.iushrn(l),{div:M||null,mod:v}},h.prototype.divmod=function(n,a,l){if(p(!n.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var v,m,o;return this.negative!==0&&n.negative===0?(o=this.neg().divmod(n,a),a!=="mod"&&(v=o.div.neg()),a!=="div"&&(m=o.mod.neg(),l&&m.negative!==0&&m.iadd(n)),{div:v,mod:m}):this.negative===0&&n.negative!==0?(o=this.divmod(n.neg(),a),a!=="mod"&&(v=o.div.neg()),{div:v,mod:o.mod}):this.negative&n.negative?(o=this.neg().divmod(n.neg(),a),a!=="div"&&(m=o.mod.neg(),l&&m.negative!==0&&m.isub(n)),{div:o.div,mod:m}):n.length>this.length||this.cmp(n)<0?{div:new h(0),mod:this}:n.length===1?a==="div"?{div:this.divn(n.words[0]),mod:null}:a==="mod"?{div:null,mod:new h(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new h(this.modrn(n.words[0]))}:this._wordDiv(n,a)},h.prototype.div=function(n){return this.divmod(n,"div",!1).div},h.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},h.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},h.prototype.divRound=function(n){var a=this.divmod(n);if(a.mod.isZero())return a.div;var l=a.div.negative!==0?a.mod.isub(n):a.mod,v=n.ushrn(1),m=n.andln(1),o=l.cmp(v);return o<0||m===1&&o===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},h.prototype.modrn=function(n){var a=n<0;a&&(n=-n),p(n<=67108863);for(var l=(1<<26)%n,v=0,m=this.length-1;m>=0;m--)v=(l*v+(this.words[m]|0))%n;return a?-v:v},h.prototype.modn=function(n){return this.modrn(n)},h.prototype.idivn=function(n){var a=n<0;a&&(n=-n),p(n<=67108863);for(var l=0,v=this.length-1;v>=0;v--){var m=(this.words[v]|0)+l*67108864;this.words[v]=m/n|0,l=m%n}return this._strip(),a?this.ineg():this},h.prototype.divn=function(n){return this.clone().idivn(n)},h.prototype.egcd=function(n){p(n.negative===0),p(!n.isZero());var a=this,l=n.clone();a.negative!==0?a=a.umod(n):a=a.clone();for(var v=new h(1),m=new h(0),o=new h(0),e=new h(1),u=0;a.isEven()&&l.isEven();)a.iushrn(1),l.iushrn(1),++u;for(var M=l.clone(),$=a.clone();!a.isZero();){for(var q=0,I=1;!(a.words[0]&I)&&q<26;++q,I<<=1);if(q>0)for(a.iushrn(q);q-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(M),m.isub($)),v.iushrn(1),m.iushrn(1);for(var N=0,E=1;!(l.words[0]&E)&&N<26;++N,E<<=1);if(N>0)for(l.iushrn(N);N-- >0;)(o.isOdd()||e.isOdd())&&(o.iadd(M),e.isub($)),o.iushrn(1),e.iushrn(1);a.cmp(l)>=0?(a.isub(l),v.isub(o),m.isub(e)):(l.isub(a),o.isub(v),e.isub(m))}return{a:o,b:e,gcd:l.iushln(u)}},h.prototype._invmp=function(n){p(n.negative===0),p(!n.isZero());var a=this,l=n.clone();a.negative!==0?a=a.umod(n):a=a.clone();for(var v=new h(1),m=new h(0),o=l.clone();a.cmpn(1)>0&&l.cmpn(1)>0;){for(var e=0,u=1;!(a.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(a.iushrn(e);e-- >0;)v.isOdd()&&v.iadd(o),v.iushrn(1);for(var M=0,$=1;!(l.words[0]&$)&&M<26;++M,$<<=1);if(M>0)for(l.iushrn(M);M-- >0;)m.isOdd()&&m.iadd(o),m.iushrn(1);a.cmp(l)>=0?(a.isub(l),v.isub(m)):(l.isub(a),m.isub(v))}var q;return a.cmpn(1)===0?q=v:q=m,q.cmpn(0)<0&&q.iadd(n),q},h.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var a=this.clone(),l=n.clone();a.negative=0,l.negative=0;for(var v=0;a.isEven()&&l.isEven();v++)a.iushrn(1),l.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;l.isEven();)l.iushrn(1);var m=a.cmp(l);if(m<0){var o=a;a=l,l=o}else if(m===0||l.cmpn(1)===0)break;a.isub(l)}while(!0);return l.iushln(v)},h.prototype.invm=function(n){return this.egcd(n).a.umod(n)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(n){return this.words[0]&n},h.prototype.bincn=function(n){p(typeof n=="number");var a=n%26,l=(n-a)/26,v=1<>>26,e&=67108863,this.words[o]=e}return m!==0&&(this.words[o]=m,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(n){var a=n<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this._strip();var l;if(this.length>1)l=1;else{a&&(n=-n),p(n<=67108863,"Number is too big");var v=this.words[0]|0;l=v===n?0:vn.length)return 1;if(this.length=0;l--){var v=this.words[l]|0,m=n.words[l]|0;if(v!==m){vm&&(a=1);break}}return a},h.prototype.gtn=function(n){return this.cmpn(n)===1},h.prototype.gt=function(n){return this.cmp(n)===1},h.prototype.gten=function(n){return this.cmpn(n)>=0},h.prototype.gte=function(n){return this.cmp(n)>=0},h.prototype.ltn=function(n){return this.cmpn(n)===-1},h.prototype.lt=function(n){return this.cmp(n)===-1},h.prototype.lten=function(n){return this.cmpn(n)<=0},h.prototype.lte=function(n){return this.cmp(n)<=0},h.prototype.eqn=function(n){return this.cmpn(n)===0},h.prototype.eq=function(n){return this.cmp(n)===0},h.red=function(n){return new b(n)},h.prototype.toRed=function(n){return p(!this.red,"Already a number in reduction context"),p(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},h.prototype.fromRed=function(){return p(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(n){return this.red=n,this},h.prototype.forceRed=function(n){return p(!this.red,"Already a number in reduction context"),this._forceRed(n)},h.prototype.redAdd=function(n){return p(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},h.prototype.redIAdd=function(n){return p(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},h.prototype.redSub=function(n){return p(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},h.prototype.redISub=function(n){return p(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},h.prototype.redShl=function(n){return p(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},h.prototype.redMul=function(n){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},h.prototype.redIMul=function(n){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},h.prototype.redSqr=function(){return p(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return p(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return p(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return p(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return p(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(n){return p(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var kt={k256:null,p224:null,p192:null,p25519:null};function Rt(i,n){this.name=i,this.p=new h(n,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Rt.prototype._tmp=function(){var n=new h(null);return n.words=new Array(Math.ceil(this.n/13)),n},Rt.prototype.ireduce=function(n){var a=n,l;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),l=a.bitLength();while(l>this.n);var v=l0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},Rt.prototype.split=function(n,a){n.iushrn(this.n,0,a)},Rt.prototype.imulK=function(n){return n.imul(this.k)};function Ct(){Rt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}y(Ct,Rt),Ct.prototype.split=function(n,a){for(var l=4194303,v=Math.min(n.length,9),m=0;m>>22,o=e}o>>>=22,n.words[m-10]=o,o===0&&n.length>10?n.length-=10:n.length-=9},Ct.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var a=0,l=0;l>>=26,n.words[l]=m,a=v}return a!==0&&(n.words[n.length++]=a),n},h._prime=function(n){if(kt[n])return kt[n];var a;if(n==="k256")a=new Ct;else if(n==="p224")a=new qt;else if(n==="p192")a=new Z;else if(n==="p25519")a=new Pt;else throw new Error("Unknown prime "+n);return kt[n]=a,a};function b(i){if(typeof i=="string"){var n=h._prime(i);this.m=n.p,this.prime=n}else p(i.gtn(1),"modulus must be greater than 1"),this.m=i,this.prime=null}b.prototype._verify1=function(n){p(n.negative===0,"red works only with positives"),p(n.red,"red works only with red numbers")},b.prototype._verify2=function(n,a){p((n.negative|a.negative)===0,"red works only with positives"),p(n.red&&n.red===a.red,"red works only with red numbers")},b.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(x(n,n.umod(this.m)._forceRed(this)),n)},b.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},b.prototype.add=function(n,a){this._verify2(n,a);var l=n.add(a);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},b.prototype.iadd=function(n,a){this._verify2(n,a);var l=n.iadd(a);return l.cmp(this.m)>=0&&l.isub(this.m),l},b.prototype.sub=function(n,a){this._verify2(n,a);var l=n.sub(a);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},b.prototype.isub=function(n,a){this._verify2(n,a);var l=n.isub(a);return l.cmpn(0)<0&&l.iadd(this.m),l},b.prototype.shl=function(n,a){return this._verify1(n),this.imod(n.ushln(a))},b.prototype.imul=function(n,a){return this._verify2(n,a),this.imod(n.imul(a))},b.prototype.mul=function(n,a){return this._verify2(n,a),this.imod(n.mul(a))},b.prototype.isqr=function(n){return this.imul(n,n.clone())},b.prototype.sqr=function(n){return this.mul(n,n)},b.prototype.sqrt=function(n){if(n.isZero())return n.clone();var a=this.m.andln(3);if(p(a%2===1),a===3){var l=this.m.add(new h(1)).iushrn(2);return this.pow(n,l)}for(var v=this.m.subn(1),m=0;!v.isZero()&&v.andln(1)===0;)m++,v.iushrn(1);p(!v.isZero());var o=new h(1).toRed(this),e=o.redNeg(),u=this.m.subn(1).iushrn(1),M=this.m.bitLength();for(M=new h(2*M*M).toRed(this);this.pow(M,u).cmp(e)!==0;)M.redIAdd(e);for(var $=this.pow(M,v),q=this.pow(n,v.addn(1).iushrn(1)),I=this.pow(n,v),N=m;I.cmp(o)!==0;){for(var E=I,P=0;E.cmp(o)!==0;P++)E=E.redSqr();p(P=0;m--){for(var $=a.words[m],q=M-1;q>=0;q--){var I=$>>q&1;if(o!==v[0]&&(o=this.sqr(o)),I===0&&e===0){u=0;continue}e<<=1,e|=I,u++,!(u!==l&&(m!==0||q!==0))&&(o=this.mul(o,v[e]),u=0,e=0)}M=26}return o},b.prototype.convertTo=function(n){var a=n.umod(this.m);return a===n?a.clone():a},b.prototype.convertFrom=function(n){var a=n.clone();return a.red=null,a},h.mont=function(n){return new t(n)};function t(i){b.call(this,i),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}y(t,b),t.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},t.prototype.convertFrom=function(n){var a=this.imod(n.mul(this.rinv));return a.red=null,a},t.prototype.imul=function(n,a){if(n.isZero()||a.isZero())return n.words[0]=0,n.length=1,n;var l=n.imul(a),v=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(v).iushrn(this.shift),o=m;return m.cmp(this.m)>=0?o=m.isub(this.m):m.cmpn(0)<0&&(o=m.iadd(this.m)),o._forceRed(this)},t.prototype.mul=function(n,a){if(n.isZero()||a.isZero())return new h(0)._forceRed(this);var l=n.mul(a),v=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(v).iushrn(this.shift),o=m;return m.cmp(this.m)>=0?o=m.isub(this.m):m.cmpn(0)<0&&(o=m.iadd(this.m)),o._forceRed(this)},t.prototype.invm=function(n){var a=this.imod(n._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(c,commonjsGlobal)})(bn$4);var bnExports$4=bn$4.exports,BN$a=bnExports$4,randomBytes$1=browserExports,Buffer$7=safeBufferExports$1.Buffer;function getr(c){var d=c.modulus.byteLength(),g;do g=new BN$a(randomBytes$1(d));while(g.cmp(c.modulus)>=0||!g.umod(c.prime1)||!g.umod(c.prime2));return g}function blind(c){var d=getr(c),g=d.toRed(BN$a.mont(c.modulus)).redPow(new BN$a(c.publicExponent)).fromRed();return{blinder:g,unblinder:d.invm(c.modulus)}}function crt$2(c,d){var g=blind(d),p=d.modulus.byteLength(),y=new BN$a(c).mul(g.blinder).umod(d.modulus),h=y.toRed(BN$a.mont(d.prime1)),w=y.toRed(BN$a.mont(d.prime2)),_=d.coefficient,S=d.prime1,A=d.prime2,x=h.redPow(d.exponent1).fromRed(),B=w.redPow(d.exponent2).fromRed(),k=x.isub(B).imul(_).umod(S).imul(A);return B.iadd(k).imul(g.unblinder).umod(d.modulus).toArrayLike(Buffer$7,"be",p)}crt$2.getr=getr;var browserifyRsa=crt$2,elliptic={};const 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"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$l={},bn$3={exports:{}};bn$3.exports;(function(c){(function(d,g){function p(b,t){if(!b)throw new Error(t||"Assertion failed")}function y(b,t){b.super_=t;var i=function(){};i.prototype=t.prototype,b.prototype=new i,b.prototype.constructor=b}function h(b,t,i){if(h.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((t==="le"||t==="be")&&(i=t,t=10),this._init(b||0,t||10,i||"be"))}typeof d=="object"?d.exports=h:g.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=require$$0$1.Buffer}catch{}h.isBN=function(t){return t instanceof h?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if(typeof t=="number")return this._initNumber(t,i,n);if(typeof t=="object")return this._initArray(t,i,n);i==="hex"&&(i=16),p(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var a=0;t[0]==="-"&&(a++,this.negative=1),a=0;a-=3)v=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[l]|=v<>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);else if(n==="le")for(a=0,l=0;a>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);return this.strip()};function _(b,t){var i=b.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function S(b,t,i){var n=_(b,i);return i-1>=t&&(n|=_(b,i-1)<<4),n}h.prototype._parseHex=function(t,i,n){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a=i;a-=2)m=S(t,i,a)<=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8;else{var o=t.length-i;for(a=o%2===0?i+1:i;a=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8}this.strip()};function A(b,t,i,n){for(var a=0,l=Math.min(b.length,i),v=t;v=49?a+=m-49+10:m>=17?a+=m-17+10:a+=m}return a}h.prototype._parseBase=function(t,i,n){this.words=[0],this.length=1;for(var a=0,l=1;l<=67108863;l*=i)a++;a--,l=l/i|0;for(var v=t.length-n,m=v%a,o=Math.min(v,v-m)+n,e=0,u=n;u1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var x=["","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"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){t=t||10,i=i|0||1;var n;if(t===16||t==="hex"){n="";for(var a=0,l=0,v=0;v>>24-a&16777215,a+=2,a>=26&&(a-=26,v--),l!==0||v!==this.length-1?n=x[6-o.length]+o+n:n=o+n}for(l!==0&&(n=l.toString(16)+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}if(t===(t|0)&&t>=2&&t<=36){var e=B[t],u=k[t];n="";var M=this.clone();for(M.negative=0;!M.isZero();){var $=M.modn(u).toString(t);M=M.idivn(u),M.isZero()?n=$+n:n=x[e-$.length]+$+n}for(this.isZero()&&(n="0"+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}p(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&p(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return p(typeof w<"u"),this.toArrayLike(w,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var a=this.byteLength(),l=n||Math.max(1,a);p(a<=l,"byte array longer than desired length"),p(l>0,"Requested array length <= 0"),this.strip();var v=i==="le",m=new t(l),o,e,u=this.clone();if(v){for(e=0;!u.isZero();e++)o=u.andln(255),u.iushrn(8),m[e]=o;for(;e=4096&&(n+=13,i>>>=13),i>=64&&(n+=7,i>>>=7),i>=8&&(n+=4,i>>>=4),i>=2&&(n+=2,i>>>=2),n+i},h.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,n=0;return i&8191||(n+=13,i>>>=13),i&127||(n+=7,i>>>=7),i&15||(n+=4,i>>>=4),i&3||(n+=2,i>>>=2),i&1||n++,n},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function R(b){for(var t=new Array(b.bitLength()),i=0;i>>a}return t}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,n;this.length>t.length?(i=this,n=t):(i=t,n=this);for(var a=0;at.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){p(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,n=t%26;this._expand(i),n>0&&i--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){p(typeof t=="number"&&t>=0);var n=t/26|0,a=t%26;return this._expand(n+1),i?this.words[n]=this.words[n]|1<t.length?(n=this,a=t):(n=t,a=this);for(var l=0,v=0;v>>26;for(;l!==0&&v>>26;if(this.length=n.length,l!==0)this.words[this.length]=l,this.length++;else if(n!==this)for(;vt.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,l;n>0?(a=this,l=t):(a=t,l=this);for(var v=0,m=0;m>26,this.words[m]=i&67108863;for(;v!==0&&m>26,this.words[m]=i&67108863;if(v===0&&m>>26,M=o&67108863,$=Math.min(e,t.length-1),q=Math.max(0,e-b.length+1);q<=$;q++){var I=e-q|0;a=b.words[I]|0,l=t.words[q]|0,v=a*l+M,u+=v/67108864|0,M=v&67108863}i.words[e]=M|0,o=u|0}return o!==0?i.words[e]=o|0:i.length--,i.strip()}var H=function(t,i,n){var a=t.words,l=i.words,v=n.words,m=0,o,e,u,M=a[0]|0,$=M&8191,q=M>>>13,I=a[1]|0,N=I&8191,E=I>>>13,P=a[2]|0,D=P&8191,z=P>>>13,It=a[3]|0,F=It&8191,V=It>>>13,Ht=a[4]|0,J=Ht&8191,pt=Ht>>>13,zt=a[5]|0,X=zt&8191,mt=zt>>>13,Lt=a[6]|0,Y=Lt&8191,vt=Lt>>>13,Dt=a[7]|0,j=Dt&8191,ct=Dt>>>13,Ot=a[8]|0,Q=Ot&8191,bt=Ot>>>13,Kt=a[9]|0,tt=Kt&8191,gt=Kt>>>13,Ft=l[0]|0,et=Ft&8191,yt=Ft>>>13,Ut=l[1]|0,rt=Ut&8191,Mt=Ut>>>13,Zt=l[2]|0,it=Zt&8191,wt=Zt>>>13,Gt=l[3]|0,nt=Gt&8191,xt=Gt>>>13,Wt=l[4]|0,at=Wt&8191,_t=Wt>>>13,Vt=l[5]|0,st=Vt&8191,$t=Vt>>>13,jt=l[6]|0,ht=jt&8191,Bt=jt>>>13,Jt=l[7]|0,ot=Jt&8191,St=Jt>>>13,Xt=l[8]|0,ut=Xt&8191,At=Xt>>>13,Yt=l[9]|0,lt=Yt&8191,Et=Yt>>>13;n.negative=t.negative^i.negative,n.length=19,o=Math.imul($,et),e=Math.imul($,yt),e=e+Math.imul(q,et)|0,u=Math.imul(q,yt);var Tt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,o=Math.imul(N,et),e=Math.imul(N,yt),e=e+Math.imul(E,et)|0,u=Math.imul(E,yt),o=o+Math.imul($,rt)|0,e=e+Math.imul($,Mt)|0,e=e+Math.imul(q,rt)|0,u=u+Math.imul(q,Mt)|0;var Nt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,o=Math.imul(D,et),e=Math.imul(D,yt),e=e+Math.imul(z,et)|0,u=Math.imul(z,yt),o=o+Math.imul(N,rt)|0,e=e+Math.imul(N,Mt)|0,e=e+Math.imul(E,rt)|0,u=u+Math.imul(E,Mt)|0,o=o+Math.imul($,it)|0,e=e+Math.imul($,wt)|0,e=e+Math.imul(q,it)|0,u=u+Math.imul(q,wt)|0;var Qt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,o=Math.imul(F,et),e=Math.imul(F,yt),e=e+Math.imul(V,et)|0,u=Math.imul(V,yt),o=o+Math.imul(D,rt)|0,e=e+Math.imul(D,Mt)|0,e=e+Math.imul(z,rt)|0,u=u+Math.imul(z,Mt)|0,o=o+Math.imul(N,it)|0,e=e+Math.imul(N,wt)|0,e=e+Math.imul(E,it)|0,u=u+Math.imul(E,wt)|0,o=o+Math.imul($,nt)|0,e=e+Math.imul($,xt)|0,e=e+Math.imul(q,nt)|0,u=u+Math.imul(q,xt)|0;var te=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(te>>>26)|0,te&=67108863,o=Math.imul(J,et),e=Math.imul(J,yt),e=e+Math.imul(pt,et)|0,u=Math.imul(pt,yt),o=o+Math.imul(F,rt)|0,e=e+Math.imul(F,Mt)|0,e=e+Math.imul(V,rt)|0,u=u+Math.imul(V,Mt)|0,o=o+Math.imul(D,it)|0,e=e+Math.imul(D,wt)|0,e=e+Math.imul(z,it)|0,u=u+Math.imul(z,wt)|0,o=o+Math.imul(N,nt)|0,e=e+Math.imul(N,xt)|0,e=e+Math.imul(E,nt)|0,u=u+Math.imul(E,xt)|0,o=o+Math.imul($,at)|0,e=e+Math.imul($,_t)|0,e=e+Math.imul(q,at)|0,u=u+Math.imul(q,_t)|0;var ee=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ee>>>26)|0,ee&=67108863,o=Math.imul(X,et),e=Math.imul(X,yt),e=e+Math.imul(mt,et)|0,u=Math.imul(mt,yt),o=o+Math.imul(J,rt)|0,e=e+Math.imul(J,Mt)|0,e=e+Math.imul(pt,rt)|0,u=u+Math.imul(pt,Mt)|0,o=o+Math.imul(F,it)|0,e=e+Math.imul(F,wt)|0,e=e+Math.imul(V,it)|0,u=u+Math.imul(V,wt)|0,o=o+Math.imul(D,nt)|0,e=e+Math.imul(D,xt)|0,e=e+Math.imul(z,nt)|0,u=u+Math.imul(z,xt)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(N,_t)|0,e=e+Math.imul(E,at)|0,u=u+Math.imul(E,_t)|0,o=o+Math.imul($,st)|0,e=e+Math.imul($,$t)|0,e=e+Math.imul(q,st)|0,u=u+Math.imul(q,$t)|0;var re=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(re>>>26)|0,re&=67108863,o=Math.imul(Y,et),e=Math.imul(Y,yt),e=e+Math.imul(vt,et)|0,u=Math.imul(vt,yt),o=o+Math.imul(X,rt)|0,e=e+Math.imul(X,Mt)|0,e=e+Math.imul(mt,rt)|0,u=u+Math.imul(mt,Mt)|0,o=o+Math.imul(J,it)|0,e=e+Math.imul(J,wt)|0,e=e+Math.imul(pt,it)|0,u=u+Math.imul(pt,wt)|0,o=o+Math.imul(F,nt)|0,e=e+Math.imul(F,xt)|0,e=e+Math.imul(V,nt)|0,u=u+Math.imul(V,xt)|0,o=o+Math.imul(D,at)|0,e=e+Math.imul(D,_t)|0,e=e+Math.imul(z,at)|0,u=u+Math.imul(z,_t)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(N,$t)|0,e=e+Math.imul(E,st)|0,u=u+Math.imul(E,$t)|0,o=o+Math.imul($,ht)|0,e=e+Math.imul($,Bt)|0,e=e+Math.imul(q,ht)|0,u=u+Math.imul(q,Bt)|0;var ie=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ie>>>26)|0,ie&=67108863,o=Math.imul(j,et),e=Math.imul(j,yt),e=e+Math.imul(ct,et)|0,u=Math.imul(ct,yt),o=o+Math.imul(Y,rt)|0,e=e+Math.imul(Y,Mt)|0,e=e+Math.imul(vt,rt)|0,u=u+Math.imul(vt,Mt)|0,o=o+Math.imul(X,it)|0,e=e+Math.imul(X,wt)|0,e=e+Math.imul(mt,it)|0,u=u+Math.imul(mt,wt)|0,o=o+Math.imul(J,nt)|0,e=e+Math.imul(J,xt)|0,e=e+Math.imul(pt,nt)|0,u=u+Math.imul(pt,xt)|0,o=o+Math.imul(F,at)|0,e=e+Math.imul(F,_t)|0,e=e+Math.imul(V,at)|0,u=u+Math.imul(V,_t)|0,o=o+Math.imul(D,st)|0,e=e+Math.imul(D,$t)|0,e=e+Math.imul(z,st)|0,u=u+Math.imul(z,$t)|0,o=o+Math.imul(N,ht)|0,e=e+Math.imul(N,Bt)|0,e=e+Math.imul(E,ht)|0,u=u+Math.imul(E,Bt)|0,o=o+Math.imul($,ot)|0,e=e+Math.imul($,St)|0,e=e+Math.imul(q,ot)|0,u=u+Math.imul(q,St)|0;var fe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(fe>>>26)|0,fe&=67108863,o=Math.imul(Q,et),e=Math.imul(Q,yt),e=e+Math.imul(bt,et)|0,u=Math.imul(bt,yt),o=o+Math.imul(j,rt)|0,e=e+Math.imul(j,Mt)|0,e=e+Math.imul(ct,rt)|0,u=u+Math.imul(ct,Mt)|0,o=o+Math.imul(Y,it)|0,e=e+Math.imul(Y,wt)|0,e=e+Math.imul(vt,it)|0,u=u+Math.imul(vt,wt)|0,o=o+Math.imul(X,nt)|0,e=e+Math.imul(X,xt)|0,e=e+Math.imul(mt,nt)|0,u=u+Math.imul(mt,xt)|0,o=o+Math.imul(J,at)|0,e=e+Math.imul(J,_t)|0,e=e+Math.imul(pt,at)|0,u=u+Math.imul(pt,_t)|0,o=o+Math.imul(F,st)|0,e=e+Math.imul(F,$t)|0,e=e+Math.imul(V,st)|0,u=u+Math.imul(V,$t)|0,o=o+Math.imul(D,ht)|0,e=e+Math.imul(D,Bt)|0,e=e+Math.imul(z,ht)|0,u=u+Math.imul(z,Bt)|0,o=o+Math.imul(N,ot)|0,e=e+Math.imul(N,St)|0,e=e+Math.imul(E,ot)|0,u=u+Math.imul(E,St)|0,o=o+Math.imul($,ut)|0,e=e+Math.imul($,At)|0,e=e+Math.imul(q,ut)|0,u=u+Math.imul(q,At)|0;var ne=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ne>>>26)|0,ne&=67108863,o=Math.imul(tt,et),e=Math.imul(tt,yt),e=e+Math.imul(gt,et)|0,u=Math.imul(gt,yt),o=o+Math.imul(Q,rt)|0,e=e+Math.imul(Q,Mt)|0,e=e+Math.imul(bt,rt)|0,u=u+Math.imul(bt,Mt)|0,o=o+Math.imul(j,it)|0,e=e+Math.imul(j,wt)|0,e=e+Math.imul(ct,it)|0,u=u+Math.imul(ct,wt)|0,o=o+Math.imul(Y,nt)|0,e=e+Math.imul(Y,xt)|0,e=e+Math.imul(vt,nt)|0,u=u+Math.imul(vt,xt)|0,o=o+Math.imul(X,at)|0,e=e+Math.imul(X,_t)|0,e=e+Math.imul(mt,at)|0,u=u+Math.imul(mt,_t)|0,o=o+Math.imul(J,st)|0,e=e+Math.imul(J,$t)|0,e=e+Math.imul(pt,st)|0,u=u+Math.imul(pt,$t)|0,o=o+Math.imul(F,ht)|0,e=e+Math.imul(F,Bt)|0,e=e+Math.imul(V,ht)|0,u=u+Math.imul(V,Bt)|0,o=o+Math.imul(D,ot)|0,e=e+Math.imul(D,St)|0,e=e+Math.imul(z,ot)|0,u=u+Math.imul(z,St)|0,o=o+Math.imul(N,ut)|0,e=e+Math.imul(N,At)|0,e=e+Math.imul(E,ut)|0,u=u+Math.imul(E,At)|0,o=o+Math.imul($,lt)|0,e=e+Math.imul($,Et)|0,e=e+Math.imul(q,lt)|0,u=u+Math.imul(q,Et)|0;var ae=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ae>>>26)|0,ae&=67108863,o=Math.imul(tt,rt),e=Math.imul(tt,Mt),e=e+Math.imul(gt,rt)|0,u=Math.imul(gt,Mt),o=o+Math.imul(Q,it)|0,e=e+Math.imul(Q,wt)|0,e=e+Math.imul(bt,it)|0,u=u+Math.imul(bt,wt)|0,o=o+Math.imul(j,nt)|0,e=e+Math.imul(j,xt)|0,e=e+Math.imul(ct,nt)|0,u=u+Math.imul(ct,xt)|0,o=o+Math.imul(Y,at)|0,e=e+Math.imul(Y,_t)|0,e=e+Math.imul(vt,at)|0,u=u+Math.imul(vt,_t)|0,o=o+Math.imul(X,st)|0,e=e+Math.imul(X,$t)|0,e=e+Math.imul(mt,st)|0,u=u+Math.imul(mt,$t)|0,o=o+Math.imul(J,ht)|0,e=e+Math.imul(J,Bt)|0,e=e+Math.imul(pt,ht)|0,u=u+Math.imul(pt,Bt)|0,o=o+Math.imul(F,ot)|0,e=e+Math.imul(F,St)|0,e=e+Math.imul(V,ot)|0,u=u+Math.imul(V,St)|0,o=o+Math.imul(D,ut)|0,e=e+Math.imul(D,At)|0,e=e+Math.imul(z,ut)|0,u=u+Math.imul(z,At)|0,o=o+Math.imul(N,lt)|0,e=e+Math.imul(N,Et)|0,e=e+Math.imul(E,lt)|0,u=u+Math.imul(E,Et)|0;var se=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(se>>>26)|0,se&=67108863,o=Math.imul(tt,it),e=Math.imul(tt,wt),e=e+Math.imul(gt,it)|0,u=Math.imul(gt,wt),o=o+Math.imul(Q,nt)|0,e=e+Math.imul(Q,xt)|0,e=e+Math.imul(bt,nt)|0,u=u+Math.imul(bt,xt)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(j,_t)|0,e=e+Math.imul(ct,at)|0,u=u+Math.imul(ct,_t)|0,o=o+Math.imul(Y,st)|0,e=e+Math.imul(Y,$t)|0,e=e+Math.imul(vt,st)|0,u=u+Math.imul(vt,$t)|0,o=o+Math.imul(X,ht)|0,e=e+Math.imul(X,Bt)|0,e=e+Math.imul(mt,ht)|0,u=u+Math.imul(mt,Bt)|0,o=o+Math.imul(J,ot)|0,e=e+Math.imul(J,St)|0,e=e+Math.imul(pt,ot)|0,u=u+Math.imul(pt,St)|0,o=o+Math.imul(F,ut)|0,e=e+Math.imul(F,At)|0,e=e+Math.imul(V,ut)|0,u=u+Math.imul(V,At)|0,o=o+Math.imul(D,lt)|0,e=e+Math.imul(D,Et)|0,e=e+Math.imul(z,lt)|0,u=u+Math.imul(z,Et)|0;var he=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(he>>>26)|0,he&=67108863,o=Math.imul(tt,nt),e=Math.imul(tt,xt),e=e+Math.imul(gt,nt)|0,u=Math.imul(gt,xt),o=o+Math.imul(Q,at)|0,e=e+Math.imul(Q,_t)|0,e=e+Math.imul(bt,at)|0,u=u+Math.imul(bt,_t)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(j,$t)|0,e=e+Math.imul(ct,st)|0,u=u+Math.imul(ct,$t)|0,o=o+Math.imul(Y,ht)|0,e=e+Math.imul(Y,Bt)|0,e=e+Math.imul(vt,ht)|0,u=u+Math.imul(vt,Bt)|0,o=o+Math.imul(X,ot)|0,e=e+Math.imul(X,St)|0,e=e+Math.imul(mt,ot)|0,u=u+Math.imul(mt,St)|0,o=o+Math.imul(J,ut)|0,e=e+Math.imul(J,At)|0,e=e+Math.imul(pt,ut)|0,u=u+Math.imul(pt,At)|0,o=o+Math.imul(F,lt)|0,e=e+Math.imul(F,Et)|0,e=e+Math.imul(V,lt)|0,u=u+Math.imul(V,Et)|0;var oe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(oe>>>26)|0,oe&=67108863,o=Math.imul(tt,at),e=Math.imul(tt,_t),e=e+Math.imul(gt,at)|0,u=Math.imul(gt,_t),o=o+Math.imul(Q,st)|0,e=e+Math.imul(Q,$t)|0,e=e+Math.imul(bt,st)|0,u=u+Math.imul(bt,$t)|0,o=o+Math.imul(j,ht)|0,e=e+Math.imul(j,Bt)|0,e=e+Math.imul(ct,ht)|0,u=u+Math.imul(ct,Bt)|0,o=o+Math.imul(Y,ot)|0,e=e+Math.imul(Y,St)|0,e=e+Math.imul(vt,ot)|0,u=u+Math.imul(vt,St)|0,o=o+Math.imul(X,ut)|0,e=e+Math.imul(X,At)|0,e=e+Math.imul(mt,ut)|0,u=u+Math.imul(mt,At)|0,o=o+Math.imul(J,lt)|0,e=e+Math.imul(J,Et)|0,e=e+Math.imul(pt,lt)|0,u=u+Math.imul(pt,Et)|0;var ue=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ue>>>26)|0,ue&=67108863,o=Math.imul(tt,st),e=Math.imul(tt,$t),e=e+Math.imul(gt,st)|0,u=Math.imul(gt,$t),o=o+Math.imul(Q,ht)|0,e=e+Math.imul(Q,Bt)|0,e=e+Math.imul(bt,ht)|0,u=u+Math.imul(bt,Bt)|0,o=o+Math.imul(j,ot)|0,e=e+Math.imul(j,St)|0,e=e+Math.imul(ct,ot)|0,u=u+Math.imul(ct,St)|0,o=o+Math.imul(Y,ut)|0,e=e+Math.imul(Y,At)|0,e=e+Math.imul(vt,ut)|0,u=u+Math.imul(vt,At)|0,o=o+Math.imul(X,lt)|0,e=e+Math.imul(X,Et)|0,e=e+Math.imul(mt,lt)|0,u=u+Math.imul(mt,Et)|0;var le=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(le>>>26)|0,le&=67108863,o=Math.imul(tt,ht),e=Math.imul(tt,Bt),e=e+Math.imul(gt,ht)|0,u=Math.imul(gt,Bt),o=o+Math.imul(Q,ot)|0,e=e+Math.imul(Q,St)|0,e=e+Math.imul(bt,ot)|0,u=u+Math.imul(bt,St)|0,o=o+Math.imul(j,ut)|0,e=e+Math.imul(j,At)|0,e=e+Math.imul(ct,ut)|0,u=u+Math.imul(ct,At)|0,o=o+Math.imul(Y,lt)|0,e=e+Math.imul(Y,Et)|0,e=e+Math.imul(vt,lt)|0,u=u+Math.imul(vt,Et)|0;var de=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(de>>>26)|0,de&=67108863,o=Math.imul(tt,ot),e=Math.imul(tt,St),e=e+Math.imul(gt,ot)|0,u=Math.imul(gt,St),o=o+Math.imul(Q,ut)|0,e=e+Math.imul(Q,At)|0,e=e+Math.imul(bt,ut)|0,u=u+Math.imul(bt,At)|0,o=o+Math.imul(j,lt)|0,e=e+Math.imul(j,Et)|0,e=e+Math.imul(ct,lt)|0,u=u+Math.imul(ct,Et)|0;var ce=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ce>>>26)|0,ce&=67108863,o=Math.imul(tt,ut),e=Math.imul(tt,At),e=e+Math.imul(gt,ut)|0,u=Math.imul(gt,At),o=o+Math.imul(Q,lt)|0,e=e+Math.imul(Q,Et)|0,e=e+Math.imul(bt,lt)|0,u=u+Math.imul(bt,Et)|0;var ve=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(tt,lt),e=Math.imul(tt,Et),e=e+Math.imul(gt,lt)|0,u=Math.imul(gt,Et);var pe=(m+o|0)+((e&8191)<<13)|0;return m=(u+(e>>>13)|0)+(pe>>>26)|0,pe&=67108863,v[0]=Tt,v[1]=Nt,v[2]=Qt,v[3]=te,v[4]=ee,v[5]=re,v[6]=ie,v[7]=fe,v[8]=ne,v[9]=ae,v[10]=se,v[11]=he,v[12]=oe,v[13]=ue,v[14]=le,v[15]=de,v[16]=ce,v[17]=ve,v[18]=pe,m!==0&&(v[19]=m,n.length++),n};Math.imul||(H=C);function U(b,t,i){i.negative=t.negative^b.negative,i.length=b.length+t.length;for(var n=0,a=0,l=0;l>>26)|0,a+=v>>>26,v&=67108863}i.words[l]=m,n=v,v=a}return n!==0?i.words[l]=n:i.length--,i.strip()}function L(b,t,i){var n=new T;return n.mulp(b,t,i)}h.prototype.mulTo=function(t,i){var n,a=this.length+t.length;return this.length===10&&t.length===10?n=H(this,t,i):a<63?n=C(this,t,i):a<1024?n=U(this,t,i):n=L(this,t,i),n};function T(b,t){this.x=b,this.y=t}T.prototype.makeRBT=function(t){for(var i=new Array(t),n=h.prototype._countBits(t)-1,a=0;a>=1;return a},T.prototype.permute=function(t,i,n,a,l,v){for(var m=0;m>>1)l++;return 1<>>13,n[2*v+1]=l&8191,l=l>>>13;for(v=2*i;v>=26,i+=a/67108864|0,i+=l>>>26,this.words[n]=l&67108863}return i!==0&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=R(t);if(i.length===0)return new h(1);for(var n=this,a=0;a=0);var i=t%26,n=(t-i)/26,a=67108863>>>26-i<<26-i,l;if(i!==0){var v=0;for(l=0;l>>26-i}v&&(this.words[l]=v,this.length++)}if(n!==0){for(l=this.length-1;l>=0;l--)this.words[l+n]=this.words[l];for(l=0;l=0);var a;i?a=(i-i%26)/26:a=0;var l=t%26,v=Math.min((t-l)/26,this.length),m=67108863^67108863>>>l<v)for(this.length-=v,e=0;e=0&&(u!==0||e>=a);e--){var M=this.words[e]|0;this.words[e]=u<<26-l|M>>>l,u=M&m}return o&&u!==0&&(o.words[o.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return p(this.negative===0),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){p(typeof t=="number"&&t>=0);var i=t%26,n=(t-i)/26,a=1<=0);var i=t%26,n=(t-i)/26;if(p(this.negative===0,"imaskn works only with positive numbers"),this.length<=n)return this;if(i!==0&&n++,this.length=Math.min(n,this.length),i!==0){var a=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(p(typeof t=="number"),p(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(o/67108864|0),this.words[l+n]=v&67108863}for(;l>26,this.words[l+n]=v&67108863;if(m===0)return this.strip();for(p(m===-1),m=0,l=0;l>26,this.words[l]=v&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var n=this.length-t.length,a=this.clone(),l=t,v=l.words[l.length-1]|0,m=this._countBits(v);n=26-m,n!==0&&(l=l.ushln(n),a.iushln(n),v=l.words[l.length-1]|0);var o=a.length-l.length,e;if(i!=="mod"){e=new h(null),e.length=o+1,e.words=new Array(e.length);for(var u=0;u=0;$--){var q=(a.words[l.length+$]|0)*67108864+(a.words[l.length+$-1]|0);for(q=Math.min(q/v|0,67108863),a._ishlnsubmul(l,q,$);a.negative!==0;)q--,a.negative=0,a._ishlnsubmul(l,1,$),a.isZero()||(a.negative^=1);e&&(e.words[$]=q)}return e&&e.strip(),a.strip(),i!=="div"&&n!==0&&a.iushrn(n),{div:e||null,mod:a}},h.prototype.divmod=function(t,i,n){if(p(!t.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var a,l,v;return this.negative!==0&&t.negative===0?(v=this.neg().divmod(t,i),i!=="mod"&&(a=v.div.neg()),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.iadd(t)),{div:a,mod:l}):this.negative===0&&t.negative!==0?(v=this.divmod(t.neg(),i),i!=="mod"&&(a=v.div.neg()),{div:a,mod:v.mod}):this.negative&t.negative?(v=this.neg().divmod(t.neg(),i),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.isub(t)),{div:v.div,mod:l}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i)},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var n=i.div.negative!==0?i.mod.isub(t):i.mod,a=t.ushrn(1),l=t.andln(1),v=n.cmp(a);return v<0||l===1&&v===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){p(t<=67108863);for(var i=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(i*n+(this.words[a]|0))%t;return n},h.prototype.idivn=function(t){p(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var a=(this.words[n]|0)+i*67108864;this.words[n]=a/t|0,i=a%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=new h(0),m=new h(1),o=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++o;for(var e=n.clone(),u=i.clone();!i.isZero();){for(var M=0,$=1;!(i.words[0]&$)&&M<26;++M,$<<=1);if(M>0)for(i.iushrn(M);M-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(e),l.isub(u)),a.iushrn(1),l.iushrn(1);for(var q=0,I=1;!(n.words[0]&I)&&q<26;++q,I<<=1);if(q>0)for(n.iushrn(q);q-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(e),m.isub(u)),v.iushrn(1),m.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(v),l.isub(m)):(n.isub(i),v.isub(a),m.isub(l))}return{a:v,b:m,gcd:n.iushln(o)}},h.prototype._invmp=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var m=0,o=1;!(i.words[0]&o)&&m<26;++m,o<<=1);if(m>0)for(i.iushrn(m);m-- >0;)a.isOdd()&&a.iadd(v),a.iushrn(1);for(var e=0,u=1;!(n.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(n.iushrn(e);e-- >0;)l.isOdd()&&l.iadd(v),l.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(l)):(n.isub(i),l.isub(a))}var M;return i.cmpn(1)===0?M=a:M=l,M.cmpn(0)<0&&M.iadd(t),M},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),n=t.clone();i.negative=0,n.negative=0;for(var a=0;i.isEven()&&n.isEven();a++)i.iushrn(1),n.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;n.isEven();)n.iushrn(1);var l=i.cmp(n);if(l<0){var v=i;i=n,n=v}else if(l===0||n.cmpn(1)===0)break;i.isub(n)}while(!0);return n.iushln(a)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){p(typeof t=="number");var i=t%26,n=(t-i)/26,a=1<>>26,m&=67108863,this.words[v]=m}return l!==0&&(this.words[v]=l,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var n;if(this.length>1)n=1;else{i&&(t=-t),p(t<=67108863,"Number is too big");var a=this.words[0]|0;n=a===t?0:at.length)return 1;if(this.length=0;n--){var a=this.words[n]|0,l=t.words[n]|0;if(a!==l){al&&(i=1);break}}return i},h.prototype.gtn=function(t){return this.cmpn(t)===1},h.prototype.gt=function(t){return this.cmp(t)===1},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return this.cmpn(t)===-1},h.prototype.lt=function(t){return this.cmp(t)===-1},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return this.cmpn(t)===0},h.prototype.eq=function(t){return this.cmp(t)===0},h.red=function(t){return new Z(t)},h.prototype.toRed=function(t){return p(!this.red,"Already a number in reduction context"),p(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return p(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return p(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return p(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return p(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return p(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return p(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return p(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return p(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return p(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return p(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return p(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return p(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return p(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var dt={k256:null,p224:null,p192:null,p25519:null};function O(b,t){this.name=b,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,n;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),n=i.bitLength();while(n>this.n);var a=n0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function kt(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}y(kt,O),kt.prototype.split=function(t,i){for(var n=4194303,a=Math.min(t.length,9),l=0;l>>22,v=m}v>>>=22,t.words[l-10]=v,v===0&&t.length>10?t.length-=10:t.length-=9},kt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,n=0;n>>=26,t.words[n]=l,i=a}return i!==0&&(t.words[t.length++]=i),t},h._prime=function(t){if(dt[t])return dt[t];var i;if(t==="k256")i=new kt;else if(t==="p224")i=new Rt;else if(t==="p192")i=new Ct;else if(t==="p25519")i=new qt;else throw new Error("Unknown prime "+t);return dt[t]=i,i};function Z(b){if(typeof b=="string"){var t=h._prime(b);this.m=t.p,this.prime=t}else p(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Z.prototype._verify1=function(t){p(t.negative===0,"red works only with positives"),p(t.red,"red works only with red numbers")},Z.prototype._verify2=function(t,i){p((t.negative|i.negative)===0,"red works only with positives"),p(t.red&&t.red===i.red,"red works only with red numbers")},Z.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Z.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Z.prototype.add=function(t,i){this._verify2(t,i);var n=t.add(i);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},Z.prototype.iadd=function(t,i){this._verify2(t,i);var n=t.iadd(i);return n.cmp(this.m)>=0&&n.isub(this.m),n},Z.prototype.sub=function(t,i){this._verify2(t,i);var n=t.sub(i);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},Z.prototype.isub=function(t,i){this._verify2(t,i);var n=t.isub(i);return n.cmpn(0)<0&&n.iadd(this.m),n},Z.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},Z.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Z.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Z.prototype.isqr=function(t){return this.imul(t,t.clone())},Z.prototype.sqr=function(t){return this.mul(t,t)},Z.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(p(i%2===1),i===3){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var a=this.m.subn(1),l=0;!a.isZero()&&a.andln(1)===0;)l++,a.iushrn(1);p(!a.isZero());var v=new h(1).toRed(this),m=v.redNeg(),o=this.m.subn(1).iushrn(1),e=this.m.bitLength();for(e=new h(2*e*e).toRed(this);this.pow(e,o).cmp(m)!==0;)e.redIAdd(m);for(var u=this.pow(e,a),M=this.pow(t,a.addn(1).iushrn(1)),$=this.pow(t,a),q=l;$.cmp(v)!==0;){for(var I=$,N=0;I.cmp(v)!==0;N++)I=I.redSqr();p(N=0;l--){for(var u=i.words[l],M=e-1;M>=0;M--){var $=u>>M&1;if(v!==a[0]&&(v=this.sqr(v)),$===0&&m===0){o=0;continue}m<<=1,m|=$,o++,!(o!==n&&(l!==0||M!==0))&&(v=this.mul(v,a[m]),o=0,m=0)}e=26}return v},Z.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},Z.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new Pt(t)};function Pt(b){Z.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}y(Pt,Z),Pt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Pt.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Pt.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var n=t.mul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(c,commonjsGlobal)})(bn$3);var bnExports$3=bn$3.exports,utils$k={};(function(c){var d=c;function g(h,w){if(Array.isArray(h))return h.slice();if(!h)return[];var _=[];if(typeof h!="string"){for(var S=0;S>8,B=A&255;x?_.push(x,B):_.push(B)}return _}d.toArray=g;function p(h){return h.length===1?"0"+h:h}d.zero2=p;function y(h){for(var w="",_=0;_(H>>1)-1?L=(H>>1)-T:L=T,U.isubn(L)):L=0,R[C]=L,U.iushrn(1)}return R}d.getNAF=h;function w(x,B){var k=[[],[]];x=x.clone(),B=B.clone();for(var R=0,C=0,H;x.cmpn(-R)>0||B.cmpn(-C)>0;){var U=x.andln(3)+R&3,L=B.andln(3)+C&3;U===3&&(U=-1),L===3&&(L=-1);var T;U&1?(H=x.andln(7)+R&7,(H===3||H===5)&&L===2?T=-U:T=U):T=0,k[0].push(T);var dt;L&1?(H=B.andln(7)+C&7,(H===3||H===5)&&U===2?dt=-L:dt=L):dt=0,k[1].push(dt),2*R===T+1&&(R=1-R),2*C===dt+1&&(C=1-C),x.iushrn(1),B.iushrn(1)}return k}d.getJSF=w;function _(x,B,k){var R="_"+B;x.prototype[B]=function(){return this[R]!==void 0?this[R]:this[R]=k.call(this)}}d.cachedProperty=_;function S(x){return typeof x=="string"?d.toArray(x,"hex"):x}d.parseBytes=S;function A(x){return new g(x,"hex","le")}d.intFromLE=A})(utils$l);var curve={},BN$9=bnExports$3,utils$j=utils$l,getNAF=utils$j.getNAF,getJSF=utils$j.getJSF,assert$d=utils$j.assert;function BaseCurve(c,d){this.type=c,this.p=new BN$9(d.p,16),this.red=d.prime?BN$9.red(d.prime):BN$9.mont(this.p),this.zero=new BN$9(0).toRed(this.red),this.one=new BN$9(1).toRed(this.red),this.two=new BN$9(2).toRed(this.red),this.n=d.n&&new BN$9(d.n,16),this.g=d.g&&this.pointFromJSON(d.g,d.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 g=this.n&&this.p.div(this.n);!g||g.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve;BaseCurve.prototype.point=function(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function(d,g){assert$d(d.precomputed);var p=d._getDoubles(),y=getNAF(g,1,this._bitLength),h=(1<=_;A--)S=(S<<1)+y[A];w.push(S)}for(var x=this.jpoint(null,null,null),B=this.jpoint(null,null,null),k=h;k>0;k--){for(_=0;_=0;S--){for(var A=0;S>=0&&w[S]===0;S--)A++;if(S>=0&&A++,_=_.dblp(A),S<0)break;var x=w[S];assert$d(x!==0),d.type==="affine"?x>0?_=_.mixedAdd(h[x-1>>1]):_=_.mixedAdd(h[-x-1>>1].neg()):x>0?_=_.add(h[x-1>>1]):_=_.add(h[-x-1>>1].neg())}return d.type==="affine"?_.toP():_};BaseCurve.prototype._wnafMulAdd=function(d,g,p,y,h){var w=this._wnafT1,_=this._wnafT2,S=this._wnafT3,A=0,x,B,k;for(x=0;x=1;x-=2){var C=x-1,H=x;if(w[C]!==1||w[H]!==1){S[C]=getNAF(p[C],w[C],this._bitLength),S[H]=getNAF(p[H],w[H],this._bitLength),A=Math.max(S[C].length,A),A=Math.max(S[H].length,A);continue}var U=[g[C],null,null,g[H]];g[C].y.cmp(g[H].y)===0?(U[1]=g[C].add(g[H]),U[2]=g[C].toJ().mixedAdd(g[H].neg())):g[C].y.cmp(g[H].y.redNeg())===0?(U[1]=g[C].toJ().mixedAdd(g[H]),U[2]=g[C].add(g[H].neg())):(U[1]=g[C].toJ().mixedAdd(g[H]),U[2]=g[C].toJ().mixedAdd(g[H].neg()));var L=[-3,-1,-5,-7,0,7,5,1,3],T=getJSF(p[C],p[H]);for(A=Math.max(T[0].length,A),S[C]=new Array(A),S[H]=new Array(A),B=0;B=0;x--){for(var Ct=0;x>=0;){var qt=!0;for(B=0;B=0&&Ct++,kt=kt.dblp(Ct),x<0)break;for(B=0;B0?k=_[B][Z-1>>1]:Z<0&&(k=_[B][-Z-1>>1].neg()),k.type==="affine"?kt=kt.mixedAdd(k):kt=kt.add(k))}}for(x=0;x=Math.ceil((d.bitLength()+1)/g.step):!1};BasePoint.prototype._getDoubles=function(d,g){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var p=[this],y=this,h=0;h=0&&(R=A,C=x),B.negative&&(B=B.neg(),k=k.neg()),R.negative&&(R=R.neg(),C=C.neg()),[{a:B,b:k},{a:R,b:C}]};ShortCurve.prototype._endoSplit=function(d){var g=this.endo.basis,p=g[0],y=g[1],h=y.b.mul(d).divRound(this.n),w=p.b.neg().mul(d).divRound(this.n),_=h.mul(p.a),S=w.mul(y.a),A=h.mul(p.b),x=w.mul(y.b),B=d.sub(_).sub(S),k=A.add(x).neg();return{k1:B,k2:k}};ShortCurve.prototype.pointFromX=function(d,g){d=new BN$8(d,16),d.red||(d=d.toRed(this.red));var p=d.redSqr().redMul(d).redIAdd(d.redMul(this.a)).redIAdd(this.b),y=p.redSqrt();if(y.redSqr().redSub(p).cmp(this.zero)!==0)throw new Error("invalid point");var h=y.fromRed().isOdd();return(g&&!h||!g&&h)&&(y=y.redNeg()),this.point(d,y)};ShortCurve.prototype.validate=function(d){if(d.inf)return!0;var g=d.x,p=d.y,y=this.a.redMul(g),h=g.redSqr().redMul(g).redIAdd(y).redIAdd(this.b);return p.redSqr().redISub(h).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function(d,g,p){for(var y=this._endoWnafT1,h=this._endoWnafT2,w=0;w":""};Point$2.prototype.isInfinity=function(){return this.inf};Point$2.prototype.add=function(d){if(this.inf)return d;if(d.inf)return this;if(this.eq(d))return this.dbl();if(this.neg().eq(d))return this.curve.point(null,null);if(this.x.cmp(d.x)===0)return this.curve.point(null,null);var g=this.y.redSub(d.y);g.cmpn(0)!==0&&(g=g.redMul(this.x.redSub(d.x).redInvm()));var p=g.redSqr().redISub(this.x).redISub(d.x),y=g.redMul(this.x.redSub(p)).redISub(this.y);return this.curve.point(p,y)};Point$2.prototype.dbl=function(){if(this.inf)return this;var d=this.y.redAdd(this.y);if(d.cmpn(0)===0)return this.curve.point(null,null);var g=this.curve.a,p=this.x.redSqr(),y=d.redInvm(),h=p.redAdd(p).redIAdd(p).redIAdd(g).redMul(y),w=h.redSqr().redISub(this.x.redAdd(this.x)),_=h.redMul(this.x.redSub(w)).redISub(this.y);return this.curve.point(w,_)};Point$2.prototype.getX=function(){return this.x.fromRed()};Point$2.prototype.getY=function(){return this.y.fromRed()};Point$2.prototype.mul=function(d){return d=new BN$8(d,16),this.isInfinity()?this:this._hasDoubles(d)?this.curve._fixedNafMul(this,d):this.curve.endo?this.curve._endoWnafMulAdd([this],[d]):this.curve._wnafMul(this,d)};Point$2.prototype.mulAdd=function(d,g,p){var y=[this,g],h=[d,p];return this.curve.endo?this.curve._endoWnafMulAdd(y,h):this.curve._wnafMulAdd(1,y,h,2)};Point$2.prototype.jmulAdd=function(d,g,p){var y=[this,g],h=[d,p];return this.curve.endo?this.curve._endoWnafMulAdd(y,h,!0):this.curve._wnafMulAdd(1,y,h,2,!0)};Point$2.prototype.eq=function(d){return this===d||this.inf===d.inf&&(this.inf||this.x.cmp(d.x)===0&&this.y.cmp(d.y)===0)};Point$2.prototype.neg=function(d){if(this.inf)return this;var g=this.curve.point(this.x,this.y.redNeg());if(d&&this.precomputed){var p=this.precomputed,y=function(h){return h.neg()};g.precomputed={naf:p.naf&&{wnd:p.naf.wnd,points:p.naf.points.map(y)},doubles:p.doubles&&{step:p.doubles.step,points:p.doubles.points.map(y)}}}return g};Point$2.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var d=this.curve.jpoint(this.x,this.y,this.curve.one);return d};function JPoint(c,d,g,p){Base$2.BasePoint.call(this,c,"jacobian"),d===null&&g===null&&p===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$8(0)):(this.x=new BN$8(d,16),this.y=new BN$8(g,16),this.z=new BN$8(p,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}inherits$4(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function(d,g,p){return new JPoint(this,d,g,p)};JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var d=this.z.redInvm(),g=d.redSqr(),p=this.x.redMul(g),y=this.y.redMul(g).redMul(d);return this.curve.point(p,y)};JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function(d){if(this.isInfinity())return d;if(d.isInfinity())return this;var g=d.z.redSqr(),p=this.z.redSqr(),y=this.x.redMul(g),h=d.x.redMul(p),w=this.y.redMul(g.redMul(d.z)),_=d.y.redMul(p.redMul(this.z)),S=y.redSub(h),A=w.redSub(_);if(S.cmpn(0)===0)return A.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var x=S.redSqr(),B=x.redMul(S),k=y.redMul(x),R=A.redSqr().redIAdd(B).redISub(k).redISub(k),C=A.redMul(k.redISub(R)).redISub(w.redMul(B)),H=this.z.redMul(d.z).redMul(S);return this.curve.jpoint(R,C,H)};JPoint.prototype.mixedAdd=function(d){if(this.isInfinity())return d.toJ();if(d.isInfinity())return this;var g=this.z.redSqr(),p=this.x,y=d.x.redMul(g),h=this.y,w=d.y.redMul(g).redMul(this.z),_=p.redSub(y),S=h.redSub(w);if(_.cmpn(0)===0)return S.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=_.redSqr(),x=A.redMul(_),B=p.redMul(A),k=S.redSqr().redIAdd(x).redISub(B).redISub(B),R=S.redMul(B.redISub(k)).redISub(h.redMul(x)),C=this.z.redMul(_);return this.curve.jpoint(k,R,C)};JPoint.prototype.dblp=function(d){if(d===0)return this;if(this.isInfinity())return this;if(!d)return this.dbl();var g;if(this.curve.zeroA||this.curve.threeA){var p=this;for(g=0;g=0)return!1;if(p.redIAdd(h),this.x.cmp(p)===0)return!0}};JPoint.prototype.inspect=function(){return this.isInfinity()?"":""};JPoint.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var BN$7=bnExports$3,inherits$3=inherits_browserExports,Base$1=base$1,utils$h=utils$l;function MontCurve(c){Base$1.call(this,"mont",c),this.a=new BN$7(c.a,16).toRed(this.red),this.b=new BN$7(c.b,16).toRed(this.red),this.i4=new BN$7(4).toRed(this.red).redInvm(),this.two=new BN$7(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$3(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function(d){var g=d.normalize().x,p=g.redSqr(),y=p.redMul(g).redAdd(p.redMul(this.a)).redAdd(g),h=y.redSqrt();return h.redSqr().cmp(y)===0};function Point$1(c,d,g){Base$1.BasePoint.call(this,c,"projective"),d===null&&g===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$7(d,16),this.z=new BN$7(g,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$3(Point$1,Base$1.BasePoint);MontCurve.prototype.decodePoint=function(d,g){return this.point(utils$h.toArray(d,g),1)};MontCurve.prototype.point=function(d,g){return new Point$1(this,d,g)};MontCurve.prototype.pointFromJSON=function(d){return Point$1.fromJSON(this,d)};Point$1.prototype.precompute=function(){};Point$1.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function(d,g){return new Point$1(d,g[0],g[1]||d.one)};Point$1.prototype.inspect=function(){return this.isInfinity()?"":""};Point$1.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function(){var d=this.x.redAdd(this.z),g=d.redSqr(),p=this.x.redSub(this.z),y=p.redSqr(),h=g.redSub(y),w=g.redMul(y),_=h.redMul(y.redAdd(this.curve.a24.redMul(h)));return this.curve.point(w,_)};Point$1.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.diffAdd=function(d,g){var p=this.x.redAdd(this.z),y=this.x.redSub(this.z),h=d.x.redAdd(d.z),w=d.x.redSub(d.z),_=w.redMul(p),S=h.redMul(y),A=g.z.redMul(_.redAdd(S).redSqr()),x=g.x.redMul(_.redISub(S).redSqr());return this.curve.point(A,x)};Point$1.prototype.mul=function(d){for(var g=d.clone(),p=this,y=this.curve.point(null,null),h=this,w=[];g.cmpn(0)!==0;g.iushrn(1))w.push(g.andln(1));for(var _=w.length-1;_>=0;_--)w[_]===0?(p=p.diffAdd(y,h),y=y.dbl()):(y=p.diffAdd(y,h),p=p.dbl());return y};Point$1.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function(d){return this.getX().cmp(d.getX())===0};Point$1.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$g=utils$l,BN$6=bnExports$3,inherits$2=inherits_browserExports,Base=base$1,assert$b=utils$g.assert;function EdwardsCurve(c){this.twisted=(c.a|0)!==1,this.mOneA=this.twisted&&(c.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",c),this.a=new BN$6(c.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$6(c.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$6(c.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$b(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(c.c|0)===1}inherits$2(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function(d){return this.mOneA?d.redNeg():this.a.redMul(d)};EdwardsCurve.prototype._mulC=function(d){return this.oneC?d:this.c.redMul(d)};EdwardsCurve.prototype.jpoint=function(d,g,p,y){return this.point(d,g,p,y)};EdwardsCurve.prototype.pointFromX=function(d,g){d=new BN$6(d,16),d.red||(d=d.toRed(this.red));var p=d.redSqr(),y=this.c2.redSub(this.a.redMul(p)),h=this.one.redSub(this.c2.redMul(this.d).redMul(p)),w=y.redMul(h.redInvm()),_=w.redSqrt();if(_.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");var S=_.fromRed().isOdd();return(g&&!S||!g&&S)&&(_=_.redNeg()),this.point(d,_)};EdwardsCurve.prototype.pointFromY=function(d,g){d=new BN$6(d,16),d.red||(d=d.toRed(this.red));var p=d.redSqr(),y=p.redSub(this.c2),h=p.redMul(this.d).redMul(this.c2).redSub(this.a),w=y.redMul(h.redInvm());if(w.cmp(this.zero)===0){if(g)throw new Error("invalid point");return this.point(this.zero,d)}var _=w.redSqrt();if(_.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");return _.fromRed().isOdd()!==g&&(_=_.redNeg()),this.point(_,d)};EdwardsCurve.prototype.validate=function(d){if(d.isInfinity())return!0;d.normalize();var g=d.x.redSqr(),p=d.y.redSqr(),y=g.redMul(this.a).redAdd(p),h=this.c2.redMul(this.one.redAdd(this.d.redMul(g).redMul(p)));return y.cmp(h)===0};function Point(c,d,g,p,y){Base.BasePoint.call(this,c,"projective"),d===null&&g===null&&p===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 BN$6(d,16),this.y=new BN$6(g,16),this.z=p?new BN$6(p,16):this.curve.one,this.t=y&&new BN$6(y,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()))))}inherits$2(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function(d){return Point.fromJSON(this,d)};EdwardsCurve.prototype.point=function(d,g,p,y){return new Point(this,d,g,p,y)};Point.fromJSON=function(d,g){return new Point(d,g[0],g[1],g[2])};Point.prototype.inspect=function(){return this.isInfinity()?"":""};Point.prototype.isInfinity=function(){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(){var d=this.x.redSqr(),g=this.y.redSqr(),p=this.z.redSqr();p=p.redIAdd(p);var y=this.curve._mulA(d),h=this.x.redAdd(this.y).redSqr().redISub(d).redISub(g),w=y.redAdd(g),_=w.redSub(p),S=y.redSub(g),A=h.redMul(_),x=w.redMul(S),B=h.redMul(S),k=_.redMul(w);return this.curve.point(A,x,k,B)};Point.prototype._projDbl=function(){var d=this.x.redAdd(this.y).redSqr(),g=this.x.redSqr(),p=this.y.redSqr(),y,h,w,_,S,A;if(this.curve.twisted){_=this.curve._mulA(g);var x=_.redAdd(p);this.zOne?(y=d.redSub(g).redSub(p).redMul(x.redSub(this.curve.two)),h=x.redMul(_.redSub(p)),w=x.redSqr().redSub(x).redSub(x)):(S=this.z.redSqr(),A=x.redSub(S).redISub(S),y=d.redSub(g).redISub(p).redMul(A),h=x.redMul(_.redSub(p)),w=x.redMul(A))}else _=g.redAdd(p),S=this.curve._mulC(this.z).redSqr(),A=_.redSub(S).redSub(S),y=this.curve._mulC(d.redISub(_)).redMul(A),h=this.curve._mulC(_).redMul(g.redISub(p)),w=_.redMul(A);return this.curve.point(y,h,w)};Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function(d){var g=this.y.redSub(this.x).redMul(d.y.redSub(d.x)),p=this.y.redAdd(this.x).redMul(d.y.redAdd(d.x)),y=this.t.redMul(this.curve.dd).redMul(d.t),h=this.z.redMul(d.z.redAdd(d.z)),w=p.redSub(g),_=h.redSub(y),S=h.redAdd(y),A=p.redAdd(g),x=w.redMul(_),B=S.redMul(A),k=w.redMul(A),R=_.redMul(S);return this.curve.point(x,B,R,k)};Point.prototype._projAdd=function(d){var g=this.z.redMul(d.z),p=g.redSqr(),y=this.x.redMul(d.x),h=this.y.redMul(d.y),w=this.curve.d.redMul(y).redMul(h),_=p.redSub(w),S=p.redAdd(w),A=this.x.redAdd(this.y).redMul(d.x.redAdd(d.y)).redISub(y).redISub(h),x=g.redMul(_).redMul(A),B,k;return this.curve.twisted?(B=g.redMul(S).redMul(h.redSub(this.curve._mulA(y))),k=_.redMul(S)):(B=g.redMul(S).redMul(h.redSub(y)),k=this.curve._mulC(_).redMul(S)),this.curve.point(x,B,k)};Point.prototype.add=function(d){return this.isInfinity()?d:d.isInfinity()?this:this.curve.extended?this._extAdd(d):this._projAdd(d)};Point.prototype.mul=function(d){return this._hasDoubles(d)?this.curve._fixedNafMul(this,d):this.curve._wnafMul(this,d)};Point.prototype.mulAdd=function(d,g,p){return this.curve._wnafMulAdd(1,[this,g],[d,p],2,!1)};Point.prototype.jmulAdd=function(d,g,p){return this.curve._wnafMulAdd(1,[this,g],[d,p],2,!0)};Point.prototype.normalize=function(){if(this.zOne)return this;var d=this.z.redInvm();return this.x=this.x.redMul(d),this.y=this.y.redMul(d),this.t&&(this.t=this.t.redMul(d)),this.z=this.curve.one,this.zOne=!0,this};Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function(d){return this===d||this.getX().cmp(d.getX())===0&&this.getY().cmp(d.getY())===0};Point.prototype.eqXToP=function(d){var g=d.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(g)===0)return!0;for(var p=d.clone(),y=this.curve.redN.redMul(this.z);;){if(p.iadd(this.curve.n),p.cmp(this.curve.p)>=0)return!1;if(g.redIAdd(y),this.x.cmp(g)===0)return!0}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;(function(c){var d=c;d.base=base$1,d.short=short,d.mont=mont,d.edwards=edwards})(curve);var curves$1={},hash$2={},utils$f={},assert$a=minimalisticAssert,inherits$1=inherits_browserExports;utils$f.inherits=inherits$1;function isSurrogatePair(c,d){return(c.charCodeAt(d)&64512)!==55296||d<0||d+1>=c.length?!1:(c.charCodeAt(d+1)&64512)===56320}function toArray(c,d){if(Array.isArray(c))return c.slice();if(!c)return[];var g=[];if(typeof c=="string")if(d){if(d==="hex")for(c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c),y=0;y>6|192,g[p++]=h&63|128):isSurrogatePair(c,y)?(h=65536+((h&1023)<<10)+(c.charCodeAt(++y)&1023),g[p++]=h>>18|240,g[p++]=h>>12&63|128,g[p++]=h>>6&63|128,g[p++]=h&63|128):(g[p++]=h>>12|224,g[p++]=h>>6&63|128,g[p++]=h&63|128)}else for(y=0;y>>24|c>>>8&65280|c<<8&16711680|(c&255)<<24;return d>>>0}utils$f.htonl=htonl;function toHex32(c,d){for(var g="",p=0;p>>0}return h}utils$f.join32=join32;function split32(c,d){for(var g=new Array(c.length*4),p=0,y=0;p>>24,g[y+1]=h>>>16&255,g[y+2]=h>>>8&255,g[y+3]=h&255):(g[y+3]=h>>>24,g[y+2]=h>>>16&255,g[y+1]=h>>>8&255,g[y]=h&255)}return g}utils$f.split32=split32;function rotr32$1(c,d){return c>>>d|c<<32-d}utils$f.rotr32=rotr32$1;function rotl32$2(c,d){return c<>>32-d}utils$f.rotl32=rotl32$2;function sum32$3(c,d){return c+d>>>0}utils$f.sum32=sum32$3;function sum32_3$1(c,d,g){return c+d+g>>>0}utils$f.sum32_3=sum32_3$1;function sum32_4$2(c,d,g,p){return c+d+g+p>>>0}utils$f.sum32_4=sum32_4$2;function sum32_5$2(c,d,g,p,y){return c+d+g+p+y>>>0}utils$f.sum32_5=sum32_5$2;function sum64$1(c,d,g,p){var y=c[d],h=c[d+1],w=p+h>>>0,_=(w>>0,c[d+1]=w}utils$f.sum64=sum64$1;function sum64_hi$1(c,d,g,p){var y=d+p>>>0,h=(y>>0}utils$f.sum64_hi=sum64_hi$1;function sum64_lo$1(c,d,g,p){var y=d+p;return y>>>0}utils$f.sum64_lo=sum64_lo$1;function sum64_4_hi$1(c,d,g,p,y,h,w,_){var S=0,A=d;A=A+p>>>0,S+=A>>0,S+=A>>0,S+=A<_?1:0;var x=c+g+y+w+S;return x>>>0}utils$f.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(c,d,g,p,y,h,w,_){var S=d+p+h+_;return S>>>0}utils$f.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(c,d,g,p,y,h,w,_,S,A){var x=0,B=d;B=B+p>>>0,x+=B>>0,x+=B>>0,x+=B<_?1:0,B=B+A>>>0,x+=B>>0}utils$f.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(c,d,g,p,y,h,w,_,S,A){var x=d+p+h+_+A;return x>>>0}utils$f.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(c,d,g){var p=d<<32-g|c>>>g;return p>>>0}utils$f.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(c,d,g){var p=c<<32-g|d>>>g;return p>>>0}utils$f.rotr64_lo=rotr64_lo$1;function shr64_hi$1(c,d,g){return c>>>g}utils$f.shr64_hi=shr64_hi$1;function shr64_lo$1(c,d,g){var p=c<<32-g|d>>>g;return p>>>0}utils$f.shr64_lo=shr64_lo$1;var common$5={},utils$e=utils$f,assert$9=minimalisticAssert;function BlockHash$4(){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}common$5.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function(d,g){if(d=utils$e.toArray(d,g),this.pending?this.pending=this.pending.concat(d):this.pending=d,this.pendingTotal+=d.length,this.pending.length>=this._delta8){d=this.pending;var p=d.length%this._delta8;this.pending=d.slice(d.length-p,d.length),this.pending.length===0&&(this.pending=null),d=utils$e.join32(d,0,d.length-p,this.endian);for(var y=0;y>>24&255,y[h++]=d>>>16&255,y[h++]=d>>>8&255,y[h++]=d&255}else for(y[h++]=d&255,y[h++]=d>>>8&255,y[h++]=d>>>16&255,y[h++]=d>>>24&255,y[h++]=0,y[h++]=0,y[h++]=0,y[h++]=0,w=8;w>>3}common$4.g0_256=g0_256$1;function g1_256$1(c){return rotr32(c,17)^rotr32(c,19)^c>>>10}common$4.g1_256=g1_256$1;var utils$c=utils$f,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$c.rotl32,sum32$2=utils$c.sum32,sum32_5$1=utils$c.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$c.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function(d,g){for(var p=this.W,y=0;y<16;y++)p[y]=d[g+y];for(;ythis.blockSize&&(d=new this.Hash().update(d).digest()),assert$6(d.length<=this.blockSize);for(var g=d.length;g=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(d,g,p)}var hmacDrbg=HmacDRBG;HmacDRBG.prototype._init=function(d,g,p){var y=d.concat(g).concat(p);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(d.concat(p||[])),this._reseed=1};HmacDRBG.prototype.generate=function(d,g,p,y){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof g!="string"&&(y=p,p=g,g=null),p&&(p=utils$5.toArray(p,y||"hex"),this._update(p));for(var h=[];h.length"};var BN$4=bnExports$3,utils$3=utils$l,assert$3=utils$3.assert;function Signature$2(c,d){if(c instanceof Signature$2)return c;this._importDER(c,d)||(assert$3(c.r&&c.s,"Signature without r or s"),this.r=new BN$4(c.r,16),this.s=new BN$4(c.s,16),c.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=c.recoveryParam)}var signature$1=Signature$2;function Position(){this.place=0}function getLength(c,d){var g=c[d.place++];if(!(g&128))return g;var p=g&15;if(p===0||p>4||c[d.place]===0)return!1;for(var y=0,h=0,w=d.place;h>>=0;return y<=127?!1:(d.place=w,y)}function rmPadding(c){for(var d=0,g=c.length-1;!c[d]&&!(c[d+1]&128)&&d>>3);for(c.push(g|128);--g;)c.push(d>>>(g<<3)&255);c.push(d)}Signature$2.prototype.toDER=function(d){var g=this.r.toArray(),p=this.s.toArray();for(g[0]&128&&(g=[0].concat(g)),p[0]&128&&(p=[0].concat(p)),g=rmPadding(g),p=rmPadding(p);!p[0]&&!(p[1]&128);)p=p.slice(1);var y=[2];constructLength(y,g.length),y=y.concat(g),y.push(2),constructLength(y,p.length);var h=y.concat(p),w=[48];return constructLength(w,h.length),w=w.concat(h),utils$3.encode(w,d)};var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var c=bnExports$3,d=hmacDrbg,g=utils$l,p=curves$1,y=requireBrorand(),h=g.assert,w=key$1,_=signature$1;function S(A){if(!(this instanceof S))return new S(A);typeof A=="string"&&(h(Object.prototype.hasOwnProperty.call(p,A),"Unknown curve "+A),A=p[A]),A instanceof p.PresetCurve&&(A={curve:A}),this.curve=A.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=A.curve.g,this.g.precompute(A.curve.n.bitLength()+1),this.hash=A.hash||A.curve.hash}return ec=S,S.prototype.keyPair=function(x){return new w(this,x)},S.prototype.keyFromPrivate=function(x,B){return w.fromPrivate(this,x,B)},S.prototype.keyFromPublic=function(x,B){return w.fromPublic(this,x,B)},S.prototype.genKeyPair=function(x){x||(x={});for(var B=new d({hash:this.hash,pers:x.pers,persEnc:x.persEnc||"utf8",entropy:x.entropy||y(this.hash.hmacStrength),entropyEnc:x.entropy&&x.entropyEnc||"utf8",nonce:this.n.toArray()}),k=this.n.byteLength(),R=this.n.sub(new c(2));;){var C=new c(B.generate(k));if(!(C.cmp(R)>0))return C.iaddn(1),this.keyFromPrivate(C)}},S.prototype._truncateToN=function(x,B,k){var R;if(c.isBN(x)||typeof x=="number")x=new c(x,16),R=x.byteLength();else if(typeof x=="object")R=x.length,x=new c(x,16);else{var C=x.toString();R=C.length+1>>>1,x=new c(C,16)}typeof k!="number"&&(k=R*8);var H=k-this.n.bitLength();return H>0&&(x=x.ushrn(H)),!B&&x.cmp(this.n)>=0?x.sub(this.n):x},S.prototype.sign=function(x,B,k,R){if(typeof k=="object"&&(R=k,k=null),R||(R={}),typeof x!="string"&&typeof x!="number"&&!c.isBN(x)){h(typeof x=="object"&&x&&typeof x.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),h(x.length>>>0===x.length);for(var C=0;C=0)){var Rt=this.g.mul(kt);if(!Rt.isInfinity()){var Ct=Rt.getX(),qt=Ct.umod(this.n);if(qt.cmpn(0)!==0){var Z=kt.invm(this.n).mul(qt.mul(B.getPrivate()).iadd(x));if(Z=Z.umod(this.n),Z.cmpn(0)!==0){var Pt=(Rt.getY().isOdd()?1:0)|(Ct.cmp(qt)!==0?2:0);return R.canonical&&Z.cmp(this.nh)>0&&(Z=this.n.sub(Z),Pt^=1),new _({r:qt,s:Z,recoveryParam:Pt})}}}}}},S.prototype.verify=function(x,B,k,R,C){C||(C={}),x=this._truncateToN(x,!1,C.msgBitLength),k=this.keyFromPublic(k,R),B=new _(B,"hex");var H=B.r,U=B.s;if(H.cmpn(1)<0||H.cmp(this.n)>=0||U.cmpn(1)<0||U.cmp(this.n)>=0)return!1;var L=U.invm(this.n),T=L.mul(x).umod(this.n),dt=L.mul(H).umod(this.n),O;return this.curve._maxwellTrick?(O=this.g.jmulAdd(T,k.getPublic(),dt),O.isInfinity()?!1:O.eqXToP(H)):(O=this.g.mulAdd(T,k.getPublic(),dt),O.isInfinity()?!1:O.getX().umod(this.n).cmp(H)===0)},S.prototype.recoverPubKey=function(A,x,B,k){h((3&B)===B,"The recovery param is more than two bits"),x=new _(x,k);var R=this.n,C=new c(A),H=x.r,U=x.s,L=B&1,T=B>>1;if(H.cmp(this.curve.p.umod(this.curve.n))>=0&&T)throw new Error("Unable to find sencond key candinate");T?H=this.curve.pointFromX(H.add(this.curve.n),L):H=this.curve.pointFromX(H,L);var dt=x.r.invm(R),O=R.sub(C).mul(dt).umod(R),kt=U.mul(dt).umod(R);return this.g.mulAdd(O,H,kt)},S.prototype.getKeyRecoveryParam=function(A,x,B,k){if(x=new _(x,k),x.recoveryParam!==null)return x.recoveryParam;for(var R=0;R<4;R++){var C;try{C=this.recoverPubKey(A,x,R)}catch{continue}if(C.eq(B))return R}throw new Error("Unable to find valid recovery factor")},ec}var utils$2=utils$l,assert$2=utils$2.assert,parseBytes$2=utils$2.parseBytes,cachedProperty$1=utils$2.cachedProperty;function KeyPair$1(c,d){this.eddsa=c,this._secret=parseBytes$2(d.secret),c.isPoint(d.pub)?this._pub=d.pub:this._pubBytes=parseBytes$2(d.pub)}KeyPair$1.fromPublic=function(d,g){return g instanceof KeyPair$1?g:new KeyPair$1(d,{pub:g})};KeyPair$1.fromSecret=function(d,g){return g instanceof KeyPair$1?g:new KeyPair$1(d,{secret:g})};KeyPair$1.prototype.secret=function(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function(){var d=this.eddsa,g=this.hash(),p=d.encodingLength-1,y=g.slice(0,d.encodingLength);return y[0]&=248,y[p]&=127,y[p]|=64,y});cachedProperty$1(KeyPair$1,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function(d){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(d,this)};KeyPair$1.prototype.verify=function(d,g){return this.eddsa.verify(d,g,this)};KeyPair$1.prototype.getSecret=function(d){return assert$2(this._secret,"KeyPair is public only"),utils$2.encode(this.secret(),d)};KeyPair$1.prototype.getPublic=function(d){return utils$2.encode(this.pubBytes(),d)};var key=KeyPair$1,BN$3=bnExports$3,utils$1=utils$l,assert$1=utils$1.assert,cachedProperty=utils$1.cachedProperty,parseBytes$1=utils$1.parseBytes;function Signature$1(c,d){this.eddsa=c,typeof d!="object"&&(d=parseBytes$1(d)),Array.isArray(d)&&(assert$1(d.length===c.encodingLength*2,"Signature has invalid size"),d={R:d.slice(0,c.encodingLength),S:d.slice(c.encodingLength)}),assert$1(d.R&&d.S,"Signature without R or S"),c.isPoint(d.R)&&(this._R=d.R),d.S instanceof BN$3&&(this._S=d.S),this._Rencoded=Array.isArray(d.R)?d.R:d.Rencoded,this._Sencoded=Array.isArray(d.S)?d.S:d.Sencoded}cachedProperty(Signature$1,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function(){return utils$1.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash=hash$2,curves=curves$1,utils=utils$l,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=key,Signature=signature;function EDDSA(c){if(assert(c==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(c);c=curves[c].curve,this.curve=c,this.g=c.g,this.g.precompute(c.n.bitLength()+1),this.pointClass=c.point().constructor,this.encodingLength=Math.ceil(c.n.bitLength()/8),this.hash=hash.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function(d,g){d=parseBytes(d);var p=this.keyFromSecret(g),y=this.hashInt(p.messagePrefix(),d),h=this.g.mul(y),w=this.encodePoint(h),_=this.hashInt(w,p.pubBytes(),d).mul(p.priv()),S=y.add(_).umod(this.curve.n);return this.makeSignature({R:h,S,Rencoded:w})};EDDSA.prototype.verify=function(d,g,p){if(d=parseBytes(d),g=this.makeSignature(g),g.S().gte(g.eddsa.curve.n)||g.S().isNeg())return!1;var y=this.keyFromPublic(p),h=this.hashInt(g.Rencoded(),y.pubBytes(),d),w=this.g.mul(g.S()),_=g.R().add(y.pub().mul(h));return _.eq(w)};EDDSA.prototype.hashInt=function(){for(var d=this.hash(),g=0;g0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if(typeof t=="number")return this._initNumber(t,i,n);if(typeof t=="object")return this._initArray(t,i,n);i==="hex"&&(i=16),p(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var a=0;t[0]==="-"&&(a++,this.negative=1),a=0;a-=3)v=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[l]|=v<>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);else if(n==="le")for(a=0,l=0;a>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);return this.strip()};function _(b,t){var i=b.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function S(b,t,i){var n=_(b,i);return i-1>=t&&(n|=_(b,i-1)<<4),n}h.prototype._parseHex=function(t,i,n){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a=i;a-=2)m=S(t,i,a)<=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8;else{var o=t.length-i;for(a=o%2===0?i+1:i;a=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8}this.strip()};function A(b,t,i,n){for(var a=0,l=Math.min(b.length,i),v=t;v=49?a+=m-49+10:m>=17?a+=m-17+10:a+=m}return a}h.prototype._parseBase=function(t,i,n){this.words=[0],this.length=1;for(var a=0,l=1;l<=67108863;l*=i)a++;a--,l=l/i|0;for(var v=t.length-n,m=v%a,o=Math.min(v,v-m)+n,e=0,u=n;u1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var x=["","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"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){t=t||10,i=i|0||1;var n;if(t===16||t==="hex"){n="";for(var a=0,l=0,v=0;v>>24-a&16777215,a+=2,a>=26&&(a-=26,v--),l!==0||v!==this.length-1?n=x[6-o.length]+o+n:n=o+n}for(l!==0&&(n=l.toString(16)+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}if(t===(t|0)&&t>=2&&t<=36){var e=B[t],u=k[t];n="";var M=this.clone();for(M.negative=0;!M.isZero();){var $=M.modn(u).toString(t);M=M.idivn(u),M.isZero()?n=$+n:n=x[e-$.length]+$+n}for(this.isZero()&&(n="0"+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}p(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&p(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return p(typeof w<"u"),this.toArrayLike(w,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var a=this.byteLength(),l=n||Math.max(1,a);p(a<=l,"byte array longer than desired length"),p(l>0,"Requested array length <= 0"),this.strip();var v=i==="le",m=new t(l),o,e,u=this.clone();if(v){for(e=0;!u.isZero();e++)o=u.andln(255),u.iushrn(8),m[e]=o;for(;e=4096&&(n+=13,i>>>=13),i>=64&&(n+=7,i>>>=7),i>=8&&(n+=4,i>>>=4),i>=2&&(n+=2,i>>>=2),n+i},h.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,n=0;return i&8191||(n+=13,i>>>=13),i&127||(n+=7,i>>>=7),i&15||(n+=4,i>>>=4),i&3||(n+=2,i>>>=2),i&1||n++,n},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function R(b){for(var t=new Array(b.bitLength()),i=0;i>>a}return t}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,n;this.length>t.length?(i=this,n=t):(i=t,n=this);for(var a=0;at.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){p(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,n=t%26;this._expand(i),n>0&&i--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){p(typeof t=="number"&&t>=0);var n=t/26|0,a=t%26;return this._expand(n+1),i?this.words[n]=this.words[n]|1<t.length?(n=this,a=t):(n=t,a=this);for(var l=0,v=0;v>>26;for(;l!==0&&v>>26;if(this.length=n.length,l!==0)this.words[this.length]=l,this.length++;else if(n!==this)for(;vt.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,l;n>0?(a=this,l=t):(a=t,l=this);for(var v=0,m=0;m>26,this.words[m]=i&67108863;for(;v!==0&&m>26,this.words[m]=i&67108863;if(v===0&&m>>26,M=o&67108863,$=Math.min(e,t.length-1),q=Math.max(0,e-b.length+1);q<=$;q++){var I=e-q|0;a=b.words[I]|0,l=t.words[q]|0,v=a*l+M,u+=v/67108864|0,M=v&67108863}i.words[e]=M|0,o=u|0}return o!==0?i.words[e]=o|0:i.length--,i.strip()}var H=function(t,i,n){var a=t.words,l=i.words,v=n.words,m=0,o,e,u,M=a[0]|0,$=M&8191,q=M>>>13,I=a[1]|0,N=I&8191,E=I>>>13,P=a[2]|0,D=P&8191,z=P>>>13,It=a[3]|0,F=It&8191,V=It>>>13,Ht=a[4]|0,J=Ht&8191,pt=Ht>>>13,zt=a[5]|0,X=zt&8191,mt=zt>>>13,Lt=a[6]|0,Y=Lt&8191,vt=Lt>>>13,Dt=a[7]|0,j=Dt&8191,ct=Dt>>>13,Ot=a[8]|0,Q=Ot&8191,bt=Ot>>>13,Kt=a[9]|0,tt=Kt&8191,gt=Kt>>>13,Ft=l[0]|0,et=Ft&8191,yt=Ft>>>13,Ut=l[1]|0,rt=Ut&8191,Mt=Ut>>>13,Zt=l[2]|0,it=Zt&8191,wt=Zt>>>13,Gt=l[3]|0,nt=Gt&8191,xt=Gt>>>13,Wt=l[4]|0,at=Wt&8191,_t=Wt>>>13,Vt=l[5]|0,st=Vt&8191,$t=Vt>>>13,jt=l[6]|0,ht=jt&8191,Bt=jt>>>13,Jt=l[7]|0,ot=Jt&8191,St=Jt>>>13,Xt=l[8]|0,ut=Xt&8191,At=Xt>>>13,Yt=l[9]|0,lt=Yt&8191,Et=Yt>>>13;n.negative=t.negative^i.negative,n.length=19,o=Math.imul($,et),e=Math.imul($,yt),e=e+Math.imul(q,et)|0,u=Math.imul(q,yt);var Tt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,o=Math.imul(N,et),e=Math.imul(N,yt),e=e+Math.imul(E,et)|0,u=Math.imul(E,yt),o=o+Math.imul($,rt)|0,e=e+Math.imul($,Mt)|0,e=e+Math.imul(q,rt)|0,u=u+Math.imul(q,Mt)|0;var Nt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,o=Math.imul(D,et),e=Math.imul(D,yt),e=e+Math.imul(z,et)|0,u=Math.imul(z,yt),o=o+Math.imul(N,rt)|0,e=e+Math.imul(N,Mt)|0,e=e+Math.imul(E,rt)|0,u=u+Math.imul(E,Mt)|0,o=o+Math.imul($,it)|0,e=e+Math.imul($,wt)|0,e=e+Math.imul(q,it)|0,u=u+Math.imul(q,wt)|0;var Qt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,o=Math.imul(F,et),e=Math.imul(F,yt),e=e+Math.imul(V,et)|0,u=Math.imul(V,yt),o=o+Math.imul(D,rt)|0,e=e+Math.imul(D,Mt)|0,e=e+Math.imul(z,rt)|0,u=u+Math.imul(z,Mt)|0,o=o+Math.imul(N,it)|0,e=e+Math.imul(N,wt)|0,e=e+Math.imul(E,it)|0,u=u+Math.imul(E,wt)|0,o=o+Math.imul($,nt)|0,e=e+Math.imul($,xt)|0,e=e+Math.imul(q,nt)|0,u=u+Math.imul(q,xt)|0;var te=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(te>>>26)|0,te&=67108863,o=Math.imul(J,et),e=Math.imul(J,yt),e=e+Math.imul(pt,et)|0,u=Math.imul(pt,yt),o=o+Math.imul(F,rt)|0,e=e+Math.imul(F,Mt)|0,e=e+Math.imul(V,rt)|0,u=u+Math.imul(V,Mt)|0,o=o+Math.imul(D,it)|0,e=e+Math.imul(D,wt)|0,e=e+Math.imul(z,it)|0,u=u+Math.imul(z,wt)|0,o=o+Math.imul(N,nt)|0,e=e+Math.imul(N,xt)|0,e=e+Math.imul(E,nt)|0,u=u+Math.imul(E,xt)|0,o=o+Math.imul($,at)|0,e=e+Math.imul($,_t)|0,e=e+Math.imul(q,at)|0,u=u+Math.imul(q,_t)|0;var ee=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ee>>>26)|0,ee&=67108863,o=Math.imul(X,et),e=Math.imul(X,yt),e=e+Math.imul(mt,et)|0,u=Math.imul(mt,yt),o=o+Math.imul(J,rt)|0,e=e+Math.imul(J,Mt)|0,e=e+Math.imul(pt,rt)|0,u=u+Math.imul(pt,Mt)|0,o=o+Math.imul(F,it)|0,e=e+Math.imul(F,wt)|0,e=e+Math.imul(V,it)|0,u=u+Math.imul(V,wt)|0,o=o+Math.imul(D,nt)|0,e=e+Math.imul(D,xt)|0,e=e+Math.imul(z,nt)|0,u=u+Math.imul(z,xt)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(N,_t)|0,e=e+Math.imul(E,at)|0,u=u+Math.imul(E,_t)|0,o=o+Math.imul($,st)|0,e=e+Math.imul($,$t)|0,e=e+Math.imul(q,st)|0,u=u+Math.imul(q,$t)|0;var re=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(re>>>26)|0,re&=67108863,o=Math.imul(Y,et),e=Math.imul(Y,yt),e=e+Math.imul(vt,et)|0,u=Math.imul(vt,yt),o=o+Math.imul(X,rt)|0,e=e+Math.imul(X,Mt)|0,e=e+Math.imul(mt,rt)|0,u=u+Math.imul(mt,Mt)|0,o=o+Math.imul(J,it)|0,e=e+Math.imul(J,wt)|0,e=e+Math.imul(pt,it)|0,u=u+Math.imul(pt,wt)|0,o=o+Math.imul(F,nt)|0,e=e+Math.imul(F,xt)|0,e=e+Math.imul(V,nt)|0,u=u+Math.imul(V,xt)|0,o=o+Math.imul(D,at)|0,e=e+Math.imul(D,_t)|0,e=e+Math.imul(z,at)|0,u=u+Math.imul(z,_t)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(N,$t)|0,e=e+Math.imul(E,st)|0,u=u+Math.imul(E,$t)|0,o=o+Math.imul($,ht)|0,e=e+Math.imul($,Bt)|0,e=e+Math.imul(q,ht)|0,u=u+Math.imul(q,Bt)|0;var ie=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ie>>>26)|0,ie&=67108863,o=Math.imul(j,et),e=Math.imul(j,yt),e=e+Math.imul(ct,et)|0,u=Math.imul(ct,yt),o=o+Math.imul(Y,rt)|0,e=e+Math.imul(Y,Mt)|0,e=e+Math.imul(vt,rt)|0,u=u+Math.imul(vt,Mt)|0,o=o+Math.imul(X,it)|0,e=e+Math.imul(X,wt)|0,e=e+Math.imul(mt,it)|0,u=u+Math.imul(mt,wt)|0,o=o+Math.imul(J,nt)|0,e=e+Math.imul(J,xt)|0,e=e+Math.imul(pt,nt)|0,u=u+Math.imul(pt,xt)|0,o=o+Math.imul(F,at)|0,e=e+Math.imul(F,_t)|0,e=e+Math.imul(V,at)|0,u=u+Math.imul(V,_t)|0,o=o+Math.imul(D,st)|0,e=e+Math.imul(D,$t)|0,e=e+Math.imul(z,st)|0,u=u+Math.imul(z,$t)|0,o=o+Math.imul(N,ht)|0,e=e+Math.imul(N,Bt)|0,e=e+Math.imul(E,ht)|0,u=u+Math.imul(E,Bt)|0,o=o+Math.imul($,ot)|0,e=e+Math.imul($,St)|0,e=e+Math.imul(q,ot)|0,u=u+Math.imul(q,St)|0;var fe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(fe>>>26)|0,fe&=67108863,o=Math.imul(Q,et),e=Math.imul(Q,yt),e=e+Math.imul(bt,et)|0,u=Math.imul(bt,yt),o=o+Math.imul(j,rt)|0,e=e+Math.imul(j,Mt)|0,e=e+Math.imul(ct,rt)|0,u=u+Math.imul(ct,Mt)|0,o=o+Math.imul(Y,it)|0,e=e+Math.imul(Y,wt)|0,e=e+Math.imul(vt,it)|0,u=u+Math.imul(vt,wt)|0,o=o+Math.imul(X,nt)|0,e=e+Math.imul(X,xt)|0,e=e+Math.imul(mt,nt)|0,u=u+Math.imul(mt,xt)|0,o=o+Math.imul(J,at)|0,e=e+Math.imul(J,_t)|0,e=e+Math.imul(pt,at)|0,u=u+Math.imul(pt,_t)|0,o=o+Math.imul(F,st)|0,e=e+Math.imul(F,$t)|0,e=e+Math.imul(V,st)|0,u=u+Math.imul(V,$t)|0,o=o+Math.imul(D,ht)|0,e=e+Math.imul(D,Bt)|0,e=e+Math.imul(z,ht)|0,u=u+Math.imul(z,Bt)|0,o=o+Math.imul(N,ot)|0,e=e+Math.imul(N,St)|0,e=e+Math.imul(E,ot)|0,u=u+Math.imul(E,St)|0,o=o+Math.imul($,ut)|0,e=e+Math.imul($,At)|0,e=e+Math.imul(q,ut)|0,u=u+Math.imul(q,At)|0;var ne=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ne>>>26)|0,ne&=67108863,o=Math.imul(tt,et),e=Math.imul(tt,yt),e=e+Math.imul(gt,et)|0,u=Math.imul(gt,yt),o=o+Math.imul(Q,rt)|0,e=e+Math.imul(Q,Mt)|0,e=e+Math.imul(bt,rt)|0,u=u+Math.imul(bt,Mt)|0,o=o+Math.imul(j,it)|0,e=e+Math.imul(j,wt)|0,e=e+Math.imul(ct,it)|0,u=u+Math.imul(ct,wt)|0,o=o+Math.imul(Y,nt)|0,e=e+Math.imul(Y,xt)|0,e=e+Math.imul(vt,nt)|0,u=u+Math.imul(vt,xt)|0,o=o+Math.imul(X,at)|0,e=e+Math.imul(X,_t)|0,e=e+Math.imul(mt,at)|0,u=u+Math.imul(mt,_t)|0,o=o+Math.imul(J,st)|0,e=e+Math.imul(J,$t)|0,e=e+Math.imul(pt,st)|0,u=u+Math.imul(pt,$t)|0,o=o+Math.imul(F,ht)|0,e=e+Math.imul(F,Bt)|0,e=e+Math.imul(V,ht)|0,u=u+Math.imul(V,Bt)|0,o=o+Math.imul(D,ot)|0,e=e+Math.imul(D,St)|0,e=e+Math.imul(z,ot)|0,u=u+Math.imul(z,St)|0,o=o+Math.imul(N,ut)|0,e=e+Math.imul(N,At)|0,e=e+Math.imul(E,ut)|0,u=u+Math.imul(E,At)|0,o=o+Math.imul($,lt)|0,e=e+Math.imul($,Et)|0,e=e+Math.imul(q,lt)|0,u=u+Math.imul(q,Et)|0;var ae=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ae>>>26)|0,ae&=67108863,o=Math.imul(tt,rt),e=Math.imul(tt,Mt),e=e+Math.imul(gt,rt)|0,u=Math.imul(gt,Mt),o=o+Math.imul(Q,it)|0,e=e+Math.imul(Q,wt)|0,e=e+Math.imul(bt,it)|0,u=u+Math.imul(bt,wt)|0,o=o+Math.imul(j,nt)|0,e=e+Math.imul(j,xt)|0,e=e+Math.imul(ct,nt)|0,u=u+Math.imul(ct,xt)|0,o=o+Math.imul(Y,at)|0,e=e+Math.imul(Y,_t)|0,e=e+Math.imul(vt,at)|0,u=u+Math.imul(vt,_t)|0,o=o+Math.imul(X,st)|0,e=e+Math.imul(X,$t)|0,e=e+Math.imul(mt,st)|0,u=u+Math.imul(mt,$t)|0,o=o+Math.imul(J,ht)|0,e=e+Math.imul(J,Bt)|0,e=e+Math.imul(pt,ht)|0,u=u+Math.imul(pt,Bt)|0,o=o+Math.imul(F,ot)|0,e=e+Math.imul(F,St)|0,e=e+Math.imul(V,ot)|0,u=u+Math.imul(V,St)|0,o=o+Math.imul(D,ut)|0,e=e+Math.imul(D,At)|0,e=e+Math.imul(z,ut)|0,u=u+Math.imul(z,At)|0,o=o+Math.imul(N,lt)|0,e=e+Math.imul(N,Et)|0,e=e+Math.imul(E,lt)|0,u=u+Math.imul(E,Et)|0;var se=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(se>>>26)|0,se&=67108863,o=Math.imul(tt,it),e=Math.imul(tt,wt),e=e+Math.imul(gt,it)|0,u=Math.imul(gt,wt),o=o+Math.imul(Q,nt)|0,e=e+Math.imul(Q,xt)|0,e=e+Math.imul(bt,nt)|0,u=u+Math.imul(bt,xt)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(j,_t)|0,e=e+Math.imul(ct,at)|0,u=u+Math.imul(ct,_t)|0,o=o+Math.imul(Y,st)|0,e=e+Math.imul(Y,$t)|0,e=e+Math.imul(vt,st)|0,u=u+Math.imul(vt,$t)|0,o=o+Math.imul(X,ht)|0,e=e+Math.imul(X,Bt)|0,e=e+Math.imul(mt,ht)|0,u=u+Math.imul(mt,Bt)|0,o=o+Math.imul(J,ot)|0,e=e+Math.imul(J,St)|0,e=e+Math.imul(pt,ot)|0,u=u+Math.imul(pt,St)|0,o=o+Math.imul(F,ut)|0,e=e+Math.imul(F,At)|0,e=e+Math.imul(V,ut)|0,u=u+Math.imul(V,At)|0,o=o+Math.imul(D,lt)|0,e=e+Math.imul(D,Et)|0,e=e+Math.imul(z,lt)|0,u=u+Math.imul(z,Et)|0;var he=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(he>>>26)|0,he&=67108863,o=Math.imul(tt,nt),e=Math.imul(tt,xt),e=e+Math.imul(gt,nt)|0,u=Math.imul(gt,xt),o=o+Math.imul(Q,at)|0,e=e+Math.imul(Q,_t)|0,e=e+Math.imul(bt,at)|0,u=u+Math.imul(bt,_t)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(j,$t)|0,e=e+Math.imul(ct,st)|0,u=u+Math.imul(ct,$t)|0,o=o+Math.imul(Y,ht)|0,e=e+Math.imul(Y,Bt)|0,e=e+Math.imul(vt,ht)|0,u=u+Math.imul(vt,Bt)|0,o=o+Math.imul(X,ot)|0,e=e+Math.imul(X,St)|0,e=e+Math.imul(mt,ot)|0,u=u+Math.imul(mt,St)|0,o=o+Math.imul(J,ut)|0,e=e+Math.imul(J,At)|0,e=e+Math.imul(pt,ut)|0,u=u+Math.imul(pt,At)|0,o=o+Math.imul(F,lt)|0,e=e+Math.imul(F,Et)|0,e=e+Math.imul(V,lt)|0,u=u+Math.imul(V,Et)|0;var oe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(oe>>>26)|0,oe&=67108863,o=Math.imul(tt,at),e=Math.imul(tt,_t),e=e+Math.imul(gt,at)|0,u=Math.imul(gt,_t),o=o+Math.imul(Q,st)|0,e=e+Math.imul(Q,$t)|0,e=e+Math.imul(bt,st)|0,u=u+Math.imul(bt,$t)|0,o=o+Math.imul(j,ht)|0,e=e+Math.imul(j,Bt)|0,e=e+Math.imul(ct,ht)|0,u=u+Math.imul(ct,Bt)|0,o=o+Math.imul(Y,ot)|0,e=e+Math.imul(Y,St)|0,e=e+Math.imul(vt,ot)|0,u=u+Math.imul(vt,St)|0,o=o+Math.imul(X,ut)|0,e=e+Math.imul(X,At)|0,e=e+Math.imul(mt,ut)|0,u=u+Math.imul(mt,At)|0,o=o+Math.imul(J,lt)|0,e=e+Math.imul(J,Et)|0,e=e+Math.imul(pt,lt)|0,u=u+Math.imul(pt,Et)|0;var ue=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ue>>>26)|0,ue&=67108863,o=Math.imul(tt,st),e=Math.imul(tt,$t),e=e+Math.imul(gt,st)|0,u=Math.imul(gt,$t),o=o+Math.imul(Q,ht)|0,e=e+Math.imul(Q,Bt)|0,e=e+Math.imul(bt,ht)|0,u=u+Math.imul(bt,Bt)|0,o=o+Math.imul(j,ot)|0,e=e+Math.imul(j,St)|0,e=e+Math.imul(ct,ot)|0,u=u+Math.imul(ct,St)|0,o=o+Math.imul(Y,ut)|0,e=e+Math.imul(Y,At)|0,e=e+Math.imul(vt,ut)|0,u=u+Math.imul(vt,At)|0,o=o+Math.imul(X,lt)|0,e=e+Math.imul(X,Et)|0,e=e+Math.imul(mt,lt)|0,u=u+Math.imul(mt,Et)|0;var le=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(le>>>26)|0,le&=67108863,o=Math.imul(tt,ht),e=Math.imul(tt,Bt),e=e+Math.imul(gt,ht)|0,u=Math.imul(gt,Bt),o=o+Math.imul(Q,ot)|0,e=e+Math.imul(Q,St)|0,e=e+Math.imul(bt,ot)|0,u=u+Math.imul(bt,St)|0,o=o+Math.imul(j,ut)|0,e=e+Math.imul(j,At)|0,e=e+Math.imul(ct,ut)|0,u=u+Math.imul(ct,At)|0,o=o+Math.imul(Y,lt)|0,e=e+Math.imul(Y,Et)|0,e=e+Math.imul(vt,lt)|0,u=u+Math.imul(vt,Et)|0;var de=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(de>>>26)|0,de&=67108863,o=Math.imul(tt,ot),e=Math.imul(tt,St),e=e+Math.imul(gt,ot)|0,u=Math.imul(gt,St),o=o+Math.imul(Q,ut)|0,e=e+Math.imul(Q,At)|0,e=e+Math.imul(bt,ut)|0,u=u+Math.imul(bt,At)|0,o=o+Math.imul(j,lt)|0,e=e+Math.imul(j,Et)|0,e=e+Math.imul(ct,lt)|0,u=u+Math.imul(ct,Et)|0;var ce=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ce>>>26)|0,ce&=67108863,o=Math.imul(tt,ut),e=Math.imul(tt,At),e=e+Math.imul(gt,ut)|0,u=Math.imul(gt,At),o=o+Math.imul(Q,lt)|0,e=e+Math.imul(Q,Et)|0,e=e+Math.imul(bt,lt)|0,u=u+Math.imul(bt,Et)|0;var ve=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(tt,lt),e=Math.imul(tt,Et),e=e+Math.imul(gt,lt)|0,u=Math.imul(gt,Et);var pe=(m+o|0)+((e&8191)<<13)|0;return m=(u+(e>>>13)|0)+(pe>>>26)|0,pe&=67108863,v[0]=Tt,v[1]=Nt,v[2]=Qt,v[3]=te,v[4]=ee,v[5]=re,v[6]=ie,v[7]=fe,v[8]=ne,v[9]=ae,v[10]=se,v[11]=he,v[12]=oe,v[13]=ue,v[14]=le,v[15]=de,v[16]=ce,v[17]=ve,v[18]=pe,m!==0&&(v[19]=m,n.length++),n};Math.imul||(H=C);function U(b,t,i){i.negative=t.negative^b.negative,i.length=b.length+t.length;for(var n=0,a=0,l=0;l>>26)|0,a+=v>>>26,v&=67108863}i.words[l]=m,n=v,v=a}return n!==0?i.words[l]=n:i.length--,i.strip()}function L(b,t,i){var n=new T;return n.mulp(b,t,i)}h.prototype.mulTo=function(t,i){var n,a=this.length+t.length;return this.length===10&&t.length===10?n=H(this,t,i):a<63?n=C(this,t,i):a<1024?n=U(this,t,i):n=L(this,t,i),n};function T(b,t){this.x=b,this.y=t}T.prototype.makeRBT=function(t){for(var i=new Array(t),n=h.prototype._countBits(t)-1,a=0;a>=1;return a},T.prototype.permute=function(t,i,n,a,l,v){for(var m=0;m>>1)l++;return 1<>>13,n[2*v+1]=l&8191,l=l>>>13;for(v=2*i;v>=26,i+=a/67108864|0,i+=l>>>26,this.words[n]=l&67108863}return i!==0&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=R(t);if(i.length===0)return new h(1);for(var n=this,a=0;a=0);var i=t%26,n=(t-i)/26,a=67108863>>>26-i<<26-i,l;if(i!==0){var v=0;for(l=0;l>>26-i}v&&(this.words[l]=v,this.length++)}if(n!==0){for(l=this.length-1;l>=0;l--)this.words[l+n]=this.words[l];for(l=0;l=0);var a;i?a=(i-i%26)/26:a=0;var l=t%26,v=Math.min((t-l)/26,this.length),m=67108863^67108863>>>l<v)for(this.length-=v,e=0;e=0&&(u!==0||e>=a);e--){var M=this.words[e]|0;this.words[e]=u<<26-l|M>>>l,u=M&m}return o&&u!==0&&(o.words[o.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return p(this.negative===0),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){p(typeof t=="number"&&t>=0);var i=t%26,n=(t-i)/26,a=1<=0);var i=t%26,n=(t-i)/26;if(p(this.negative===0,"imaskn works only with positive numbers"),this.length<=n)return this;if(i!==0&&n++,this.length=Math.min(n,this.length),i!==0){var a=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(p(typeof t=="number"),p(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(o/67108864|0),this.words[l+n]=v&67108863}for(;l>26,this.words[l+n]=v&67108863;if(m===0)return this.strip();for(p(m===-1),m=0,l=0;l>26,this.words[l]=v&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var n=this.length-t.length,a=this.clone(),l=t,v=l.words[l.length-1]|0,m=this._countBits(v);n=26-m,n!==0&&(l=l.ushln(n),a.iushln(n),v=l.words[l.length-1]|0);var o=a.length-l.length,e;if(i!=="mod"){e=new h(null),e.length=o+1,e.words=new Array(e.length);for(var u=0;u=0;$--){var q=(a.words[l.length+$]|0)*67108864+(a.words[l.length+$-1]|0);for(q=Math.min(q/v|0,67108863),a._ishlnsubmul(l,q,$);a.negative!==0;)q--,a.negative=0,a._ishlnsubmul(l,1,$),a.isZero()||(a.negative^=1);e&&(e.words[$]=q)}return e&&e.strip(),a.strip(),i!=="div"&&n!==0&&a.iushrn(n),{div:e||null,mod:a}},h.prototype.divmod=function(t,i,n){if(p(!t.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var a,l,v;return this.negative!==0&&t.negative===0?(v=this.neg().divmod(t,i),i!=="mod"&&(a=v.div.neg()),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.iadd(t)),{div:a,mod:l}):this.negative===0&&t.negative!==0?(v=this.divmod(t.neg(),i),i!=="mod"&&(a=v.div.neg()),{div:a,mod:v.mod}):this.negative&t.negative?(v=this.neg().divmod(t.neg(),i),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.isub(t)),{div:v.div,mod:l}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i)},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var n=i.div.negative!==0?i.mod.isub(t):i.mod,a=t.ushrn(1),l=t.andln(1),v=n.cmp(a);return v<0||l===1&&v===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){p(t<=67108863);for(var i=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(i*n+(this.words[a]|0))%t;return n},h.prototype.idivn=function(t){p(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var a=(this.words[n]|0)+i*67108864;this.words[n]=a/t|0,i=a%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=new h(0),m=new h(1),o=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++o;for(var e=n.clone(),u=i.clone();!i.isZero();){for(var M=0,$=1;!(i.words[0]&$)&&M<26;++M,$<<=1);if(M>0)for(i.iushrn(M);M-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(e),l.isub(u)),a.iushrn(1),l.iushrn(1);for(var q=0,I=1;!(n.words[0]&I)&&q<26;++q,I<<=1);if(q>0)for(n.iushrn(q);q-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(e),m.isub(u)),v.iushrn(1),m.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(v),l.isub(m)):(n.isub(i),v.isub(a),m.isub(l))}return{a:v,b:m,gcd:n.iushln(o)}},h.prototype._invmp=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var m=0,o=1;!(i.words[0]&o)&&m<26;++m,o<<=1);if(m>0)for(i.iushrn(m);m-- >0;)a.isOdd()&&a.iadd(v),a.iushrn(1);for(var e=0,u=1;!(n.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(n.iushrn(e);e-- >0;)l.isOdd()&&l.iadd(v),l.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(l)):(n.isub(i),l.isub(a))}var M;return i.cmpn(1)===0?M=a:M=l,M.cmpn(0)<0&&M.iadd(t),M},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),n=t.clone();i.negative=0,n.negative=0;for(var a=0;i.isEven()&&n.isEven();a++)i.iushrn(1),n.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;n.isEven();)n.iushrn(1);var l=i.cmp(n);if(l<0){var v=i;i=n,n=v}else if(l===0||n.cmpn(1)===0)break;i.isub(n)}while(!0);return n.iushln(a)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){p(typeof t=="number");var i=t%26,n=(t-i)/26,a=1<>>26,m&=67108863,this.words[v]=m}return l!==0&&(this.words[v]=l,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var n;if(this.length>1)n=1;else{i&&(t=-t),p(t<=67108863,"Number is too big");var a=this.words[0]|0;n=a===t?0:at.length)return 1;if(this.length=0;n--){var a=this.words[n]|0,l=t.words[n]|0;if(a!==l){al&&(i=1);break}}return i},h.prototype.gtn=function(t){return this.cmpn(t)===1},h.prototype.gt=function(t){return this.cmp(t)===1},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return this.cmpn(t)===-1},h.prototype.lt=function(t){return this.cmp(t)===-1},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return this.cmpn(t)===0},h.prototype.eq=function(t){return this.cmp(t)===0},h.red=function(t){return new Z(t)},h.prototype.toRed=function(t){return p(!this.red,"Already a number in reduction context"),p(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return p(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return p(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return p(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return p(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return p(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return p(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return p(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return p(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return p(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return p(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return p(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return p(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return p(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var dt={k256:null,p224:null,p192:null,p25519:null};function O(b,t){this.name=b,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,n;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),n=i.bitLength();while(n>this.n);var a=n0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function kt(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}y(kt,O),kt.prototype.split=function(t,i){for(var n=4194303,a=Math.min(t.length,9),l=0;l>>22,v=m}v>>>=22,t.words[l-10]=v,v===0&&t.length>10?t.length-=10:t.length-=9},kt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,n=0;n>>=26,t.words[n]=l,i=a}return i!==0&&(t.words[t.length++]=i),t},h._prime=function(t){if(dt[t])return dt[t];var i;if(t==="k256")i=new kt;else if(t==="p224")i=new Rt;else if(t==="p192")i=new Ct;else if(t==="p25519")i=new qt;else throw new Error("Unknown prime "+t);return dt[t]=i,i};function Z(b){if(typeof b=="string"){var t=h._prime(b);this.m=t.p,this.prime=t}else p(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Z.prototype._verify1=function(t){p(t.negative===0,"red works only with positives"),p(t.red,"red works only with red numbers")},Z.prototype._verify2=function(t,i){p((t.negative|i.negative)===0,"red works only with positives"),p(t.red&&t.red===i.red,"red works only with red numbers")},Z.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Z.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Z.prototype.add=function(t,i){this._verify2(t,i);var n=t.add(i);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},Z.prototype.iadd=function(t,i){this._verify2(t,i);var n=t.iadd(i);return n.cmp(this.m)>=0&&n.isub(this.m),n},Z.prototype.sub=function(t,i){this._verify2(t,i);var n=t.sub(i);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},Z.prototype.isub=function(t,i){this._verify2(t,i);var n=t.isub(i);return n.cmpn(0)<0&&n.iadd(this.m),n},Z.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},Z.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Z.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Z.prototype.isqr=function(t){return this.imul(t,t.clone())},Z.prototype.sqr=function(t){return this.mul(t,t)},Z.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(p(i%2===1),i===3){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var a=this.m.subn(1),l=0;!a.isZero()&&a.andln(1)===0;)l++,a.iushrn(1);p(!a.isZero());var v=new h(1).toRed(this),m=v.redNeg(),o=this.m.subn(1).iushrn(1),e=this.m.bitLength();for(e=new h(2*e*e).toRed(this);this.pow(e,o).cmp(m)!==0;)e.redIAdd(m);for(var u=this.pow(e,a),M=this.pow(t,a.addn(1).iushrn(1)),$=this.pow(t,a),q=l;$.cmp(v)!==0;){for(var I=$,N=0;I.cmp(v)!==0;N++)I=I.redSqr();p(N=0;l--){for(var u=i.words[l],M=e-1;M>=0;M--){var $=u>>M&1;if(v!==a[0]&&(v=this.sqr(v)),$===0&&m===0){o=0;continue}m<<=1,m|=$,o++,!(o!==n&&(l!==0||M!==0))&&(v=this.mul(v,a[m]),o=0,m=0)}e=26}return v},Z.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},Z.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new Pt(t)};function Pt(b){Z.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}y(Pt,Z),Pt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Pt.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Pt.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var n=t.mul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(c,commonjsGlobal)})(bn$2);var bnExports$2=bn$2.exports,api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(c,d){if(c.indexOf)return c.indexOf(d);for(var g=0;g>6],R=(B&32)===0;if((B&31)===31){var C=B;for(B=0;(C&128)===128;){if(C=A.readUInt8(x),A.isError(C))return C;B<<=7,B|=C&127}}else B&=31;var H=y.tag[B];return{cls:k,primitive:R,tag:B,tagStr:H}}function S(A,x,B){var k=A.readUInt8(B);if(A.isError(k))return k;if(!x&&k===128)return null;if(!(k&128))return k;var R=k&127;if(R>4)return A.error("length octect is too long");k=0;for(var C=0;C=256;U>>=8)H++;var L=new d(2+H);L[0]=C,L[1]=128|H;for(var U=1+H,T=R.length;T>0;U--,T>>=8)L[U]=T&255;return this._createEncoderBuffer([L,R])},w.prototype._encodeStr=function(x,B){if(B==="bitstr")return this._createEncoderBuffer([x.unused|0,x.data]);if(B==="bmpstr"){for(var k=new d(x.length*2),R=0;R=40)return this.reporter.error("Second objid identifier OOB");x.splice(0,2,x[0]*40+x[1])}for(var C=0,R=0;R=128;H>>=7)C++}for(var U=new d(C),L=U.length-1,R=x.length-1;R>=0;R--){var H=x[R];for(U[L--]=H&127;(H>>=7)>0;)U[L--]=128|H&127}return this._createEncoderBuffer(U)};function _(A){return A<10?"0"+A:A}w.prototype._encodeTime=function(x,B){var k,R=new Date(x);return B==="gentime"?k=[_(R.getFullYear()),_(R.getUTCMonth()+1),_(R.getUTCDate()),_(R.getUTCHours()),_(R.getUTCMinutes()),_(R.getUTCSeconds()),"Z"].join(""):B==="utctime"?k=[_(R.getFullYear()%100),_(R.getUTCMonth()+1),_(R.getUTCDate()),_(R.getUTCHours()),_(R.getUTCMinutes()),_(R.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+B+" time is not supported yet"),this._encodeStr(k,"octstr")},w.prototype._encodeNull=function(){return this._createEncoderBuffer("")},w.prototype._encodeInt=function(x,B){if(typeof x=="string"){if(!B)return this.reporter.error("String int or enum given, but no values map");if(!B.hasOwnProperty(x))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(x));x=B[x]}if(typeof x!="number"&&!d.isBuffer(x)){var k=x.toArray();!x.sign&&k[0]&128&&k.unshift(0),x=new d(k)}if(d.isBuffer(x)){var R=x.length;x.length===0&&R++;var H=new d(R);return x.copy(H),x.length===0&&(H[0]=0),this._createEncoderBuffer(H)}if(x<128)return this._createEncoderBuffer(x);if(x<256)return this._createEncoderBuffer([0,x]);for(var R=1,C=x;C>=256;C>>=8)R++;for(var H=new Array(R),C=H.length-1;C>=0;C--)H[C]=x&255,x>>=8;return H[0]&128&&H.unshift(0),this._createEncoderBuffer(new d(H))},w.prototype._encodeBool=function(x){return this._createEncoderBuffer(x?255:0)},w.prototype._use=function(x,B){return typeof x=="function"&&(x=x(B)),x._getEncoder("der").tree},w.prototype._skipDefault=function(x,B,k){var R=this._baseState,C;if(R.default===null)return!1;var H=x.join();if(R.defaultBuffer===void 0&&(R.defaultBuffer=this._encodeValue(R.default,B,k).join()),H.length!==R.defaultBuffer.length)return!1;for(C=0;C=31?k.error("Multi-octet tag encoding unsupported"):(x||(R|=32),R|=y.tagClassByName[B||"universal"]<<6,R)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var c=inherits_browserExports,d=requireDer();function g(p){d.call(this,p),this.enc="pem"}return c(g,d),pem=g,g.prototype.encode=function(y,h){for(var w=d.prototype.encode.call(this,y),_=w.toString("base64"),S=["-----BEGIN "+h.label+"-----"],A=0;A<_.length;A+=64)S.push(_.slice(A,A+64));return S.push("-----END "+h.label+"-----"),S.join(` -`)},pem}var hasRequiredEncoders;function requireEncoders(){return hasRequiredEncoders||(hasRequiredEncoders=1,function(c){var d=c;d.der=requireDer(),d.pem=requirePem()}(encoders)),encoders}var hasRequiredAsn1;function requireAsn1(){return hasRequiredAsn1||(hasRequiredAsn1=1,function(c){var d=c;d.bignum=bnExports$2,d.define=requireApi().define,d.base=requireBase(),d.constants=requireConstants(),d.decoders=requireDecoders(),d.encoders=requireEncoders()}(asn1$2)),asn1$2}var asn=requireAsn1(),Time=asn.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),AttributeTypeValue=asn.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),AlgorithmIdentifier$1=asn.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier$1),this.key("subjectPublicKey").bitstr())}),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",function(){this.setof(AttributeTypeValue)}),RDNSequence=asn.define("RDNSequence",function(){this.seqof(RelativeDistinguishedName)}),Name=asn.define("Name",function(){this.choice({rdnSequence:this.use(RDNSequence)})}),Validity=asn.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Time),this.key("notAfter").use(Time))}),Extension=asn.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),TBSCertificate=asn.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier$1),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())}),X509Certificate=asn.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier$1),this.key("signatureValue").bitstr())}),certificate=X509Certificate,asn1$1=requireAsn1();asn1$3.certificate=certificate;var RSAPrivateKey=asn1$1.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});asn1$3.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=asn1$1.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});asn1$3.RSAPublicKey=RSAPublicKey;var AlgorithmIdentifier=asn1$1.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),PublicKey=asn1$1.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())});asn1$3.PublicKey=PublicKey;var PrivateKeyInfo=asn1$1.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPrivateKey").octstr())});asn1$3.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=asn1$1.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});asn1$3.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=asn1$1.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});asn1$3.DSAPrivateKey=DSAPrivateKey;asn1$3.DSAparam=asn1$1.define("DSAparam",function(){this.int()});var ECParameters=asn1$1.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),ECPrivateKey=asn1$1.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())});asn1$3.ECPrivateKey=ECPrivateKey;asn1$3.signature=asn1$1.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())});const require$$1={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"};var findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,evp=evp_bytestokey,ciphers$1=browser$5,Buffer$6=safeBufferExports$1.Buffer,fixProc$1=function(c,d){var g=c.toString(),p=g.match(findProc),y;if(p){var w="aes"+p[1],_=Buffer$6.from(p[2],"hex"),S=Buffer$6.from(p[3].replace(/[\r\n]/g,""),"base64"),A=evp(d,_.slice(0,8),parseInt(p[1],10)).key,x=[],B=ciphers$1.createDecipheriv(w,A,_);x.push(B.update(S)),x.push(B.final()),y=Buffer$6.concat(x)}else{var h=g.match(fullRegex);y=Buffer$6.from(h[2].replace(/[\r\n]/g,""),"base64")}var k=g.match(startRegex)[1];return{tag:k,data:y}},asn1=asn1$3,aesid=require$$1,fixProc=fixProc$1,ciphers=browser$5,compat=browser$7,Buffer$5=safeBufferExports$1.Buffer;function decrypt(c,d){var g=c.algorithm.decrypt.kde.kdeparams.salt,p=parseInt(c.algorithm.decrypt.kde.kdeparams.iters.toString(),10),y=aesid[c.algorithm.decrypt.cipher.algo.join(".")],h=c.algorithm.decrypt.cipher.iv,w=c.subjectPrivateKey,_=parseInt(y.split("-")[1],10)/8,S=compat.pbkdf2Sync(d,g,p,_,"sha1"),A=ciphers.createDecipheriv(y,S,h),x=[];return x.push(A.update(w)),x.push(A.final()),Buffer$5.concat(x)}function parseKeys$2(c){var d;typeof c=="object"&&!Buffer$5.isBuffer(c)&&(d=c.passphrase,c=c.key),typeof c=="string"&&(c=Buffer$5.from(c));var g=fixProc(c,d),p=g.tag,y=g.data,h,w;switch(p){case"CERTIFICATE":w=asn1.certificate.decode(y,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(w||(w=asn1.PublicKey.decode(y,"der")),h=w.algorithm.algorithm.join("."),h){case"1.2.840.113549.1.1.1":return asn1.RSAPublicKey.decode(w.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return w.subjectPrivateKey=w.subjectPublicKey,{type:"ec",data:w};case"1.2.840.10040.4.1":return w.algorithm.params.pub_key=asn1.DSAparam.decode(w.subjectPublicKey.data,"der"),{type:"dsa",data:w.algorithm.params};default:throw new Error("unknown key id "+h)}case"ENCRYPTED PRIVATE KEY":y=asn1.EncryptedPrivateKey.decode(y,"der"),y=decrypt(y,d);case"PRIVATE KEY":switch(w=asn1.PrivateKey.decode(y,"der"),h=w.algorithm.algorithm.join("."),h){case"1.2.840.113549.1.1.1":return asn1.RSAPrivateKey.decode(w.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:w.algorithm.curve,privateKey:asn1.ECPrivateKey.decode(w.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return w.algorithm.params.priv_key=asn1.DSAparam.decode(w.subjectPrivateKey,"der"),{type:"dsa",params:w.algorithm.params};default:throw new Error("unknown key id "+h)}case"RSA PUBLIC KEY":return asn1.RSAPublicKey.decode(y,"der");case"RSA PRIVATE KEY":return asn1.RSAPrivateKey.decode(y,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:asn1.DSAPrivateKey.decode(y,"der")};case"EC PRIVATE KEY":return y=asn1.ECPrivateKey.decode(y,"der"),{curve:y.parameters.value,privateKey:y.privateKey};default:throw new Error("unknown key type "+p)}}parseKeys$2.signature=asn1.signature;var parseAsn1=parseKeys$2;const require$$4={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};var hasRequiredSign;function requireSign(){if(hasRequiredSign)return sign.exports;hasRequiredSign=1;var c=safeBufferExports$1.Buffer,d=browser$8,g=browserifyRsa,p=requireElliptic().ec,y=bnExports$4,h=parseAsn1,w=require$$4,_=1;function S(L,T,dt,O,kt){var Rt=h(T);if(Rt.curve){if(O!=="ecdsa"&&O!=="ecdsa/rsa")throw new Error("wrong private key type");return A(L,Rt)}else if(Rt.type==="dsa"){if(O!=="dsa")throw new Error("wrong private key type");return x(L,Rt,dt)}if(O!=="rsa"&&O!=="ecdsa/rsa")throw new Error("wrong private key type");if(T.padding!==void 0&&T.padding!==_)throw new Error("illegal or unsupported padding mode");L=c.concat([kt,L]);for(var Ct=Rt.modulus.byteLength(),qt=[0,1];L.length+qt.length+10&&dt.ishrn(O),dt}function C(L,T){L=R(L,T),L=L.mod(T);var dt=c.from(L.toArray());if(dt.length=0)throw new Error("invalid sig")}return verify_1=h,verify_1}var browser$3,hasRequiredBrowser$1;function requireBrowser$1(){if(hasRequiredBrowser$1)return browser$3;hasRequiredBrowser$1=1;var c=safeBufferExports$1.Buffer,d=browser$9,g=readableBrowserExports,p=inherits_browserExports,y=requireSign(),h=requireVerify(),w=require$$6;Object.keys(w).forEach(function(B){w[B].id=c.from(w[B].id,"hex"),w[B.toLowerCase()]=w[B]});function _(B){g.Writable.call(this);var k=w[B];if(!k)throw new Error("Unknown message digest");this._hashType=k.hash,this._hash=d(k.hash),this._tag=k.id,this._signType=k.sign}p(_,g.Writable),_.prototype._write=function(k,R,C){this._hash.update(k),C()},_.prototype.update=function(k,R){return this._hash.update(typeof k=="string"?c.from(k,R):k),this},_.prototype.sign=function(k,R){this.end();var C=this._hash.digest(),H=y(C,k,this._hashType,this._signType,this._tag);return R?H.toString(R):H};function S(B){g.Writable.call(this);var k=w[B];if(!k)throw new Error("Unknown message digest");this._hash=d(k.hash),this._tag=k.id,this._signType=k.sign}p(S,g.Writable),S.prototype._write=function(k,R,C){this._hash.update(k),C()},S.prototype.update=function(k,R){return this._hash.update(typeof k=="string"?c.from(k,R):k),this},S.prototype.verify=function(k,R,C){var H=typeof R=="string"?c.from(R,C):R;this.end();var U=this._hash.digest();return h(H,U,k,this._signType,this._tag)};function A(B){return new _(B)}function x(B){return new S(B)}return browser$3={Sign:A,Verify:x,createSign:A,createVerify:x},browser$3}var bn$1={exports:{}};bn$1.exports;(function(c){(function(d,g){function p(b,t){if(!b)throw new Error(t||"Assertion failed")}function y(b,t){b.super_=t;var i=function(){};i.prototype=t.prototype,b.prototype=new i,b.prototype.constructor=b}function h(b,t,i){if(h.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((t==="le"||t==="be")&&(i=t,t=10),this._init(b||0,t||10,i||"be"))}typeof d=="object"?d.exports=h:g.BN=h,h.BN=h,h.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=require$$0$1.Buffer}catch{}h.isBN=function(t){return t instanceof h?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if(typeof t=="number")return this._initNumber(t,i,n);if(typeof t=="object")return this._initArray(t,i,n);i==="hex"&&(i=16),p(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var a=0;t[0]==="-"&&(a++,this.negative=1),a=0;a-=3)v=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[l]|=v<>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);else if(n==="le")for(a=0,l=0;a>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);return this.strip()};function _(b,t){var i=b.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function S(b,t,i){var n=_(b,i);return i-1>=t&&(n|=_(b,i-1)<<4),n}h.prototype._parseHex=function(t,i,n){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a=i;a-=2)m=S(t,i,a)<=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8;else{var o=t.length-i;for(a=o%2===0?i+1:i;a=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8}this.strip()};function A(b,t,i,n){for(var a=0,l=Math.min(b.length,i),v=t;v=49?a+=m-49+10:m>=17?a+=m-17+10:a+=m}return a}h.prototype._parseBase=function(t,i,n){this.words=[0],this.length=1;for(var a=0,l=1;l<=67108863;l*=i)a++;a--,l=l/i|0;for(var v=t.length-n,m=v%a,o=Math.min(v,v-m)+n,e=0,u=n;u1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var x=["","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"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){t=t||10,i=i|0||1;var n;if(t===16||t==="hex"){n="";for(var a=0,l=0,v=0;v>>24-a&16777215,a+=2,a>=26&&(a-=26,v--),l!==0||v!==this.length-1?n=x[6-o.length]+o+n:n=o+n}for(l!==0&&(n=l.toString(16)+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}if(t===(t|0)&&t>=2&&t<=36){var e=B[t],u=k[t];n="";var M=this.clone();for(M.negative=0;!M.isZero();){var $=M.modn(u).toString(t);M=M.idivn(u),M.isZero()?n=$+n:n=x[e-$.length]+$+n}for(this.isZero()&&(n="0"+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}p(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&p(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return p(typeof w<"u"),this.toArrayLike(w,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var a=this.byteLength(),l=n||Math.max(1,a);p(a<=l,"byte array longer than desired length"),p(l>0,"Requested array length <= 0"),this.strip();var v=i==="le",m=new t(l),o,e,u=this.clone();if(v){for(e=0;!u.isZero();e++)o=u.andln(255),u.iushrn(8),m[e]=o;for(;e=4096&&(n+=13,i>>>=13),i>=64&&(n+=7,i>>>=7),i>=8&&(n+=4,i>>>=4),i>=2&&(n+=2,i>>>=2),n+i},h.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,n=0;return i&8191||(n+=13,i>>>=13),i&127||(n+=7,i>>>=7),i&15||(n+=4,i>>>=4),i&3||(n+=2,i>>>=2),i&1||n++,n},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function R(b){for(var t=new Array(b.bitLength()),i=0;i>>a}return t}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,n;this.length>t.length?(i=this,n=t):(i=t,n=this);for(var a=0;at.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){p(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,n=t%26;this._expand(i),n>0&&i--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){p(typeof t=="number"&&t>=0);var n=t/26|0,a=t%26;return this._expand(n+1),i?this.words[n]=this.words[n]|1<t.length?(n=this,a=t):(n=t,a=this);for(var l=0,v=0;v>>26;for(;l!==0&&v>>26;if(this.length=n.length,l!==0)this.words[this.length]=l,this.length++;else if(n!==this)for(;vt.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,l;n>0?(a=this,l=t):(a=t,l=this);for(var v=0,m=0;m>26,this.words[m]=i&67108863;for(;v!==0&&m>26,this.words[m]=i&67108863;if(v===0&&m>>26,M=o&67108863,$=Math.min(e,t.length-1),q=Math.max(0,e-b.length+1);q<=$;q++){var I=e-q|0;a=b.words[I]|0,l=t.words[q]|0,v=a*l+M,u+=v/67108864|0,M=v&67108863}i.words[e]=M|0,o=u|0}return o!==0?i.words[e]=o|0:i.length--,i.strip()}var H=function(t,i,n){var a=t.words,l=i.words,v=n.words,m=0,o,e,u,M=a[0]|0,$=M&8191,q=M>>>13,I=a[1]|0,N=I&8191,E=I>>>13,P=a[2]|0,D=P&8191,z=P>>>13,It=a[3]|0,F=It&8191,V=It>>>13,Ht=a[4]|0,J=Ht&8191,pt=Ht>>>13,zt=a[5]|0,X=zt&8191,mt=zt>>>13,Lt=a[6]|0,Y=Lt&8191,vt=Lt>>>13,Dt=a[7]|0,j=Dt&8191,ct=Dt>>>13,Ot=a[8]|0,Q=Ot&8191,bt=Ot>>>13,Kt=a[9]|0,tt=Kt&8191,gt=Kt>>>13,Ft=l[0]|0,et=Ft&8191,yt=Ft>>>13,Ut=l[1]|0,rt=Ut&8191,Mt=Ut>>>13,Zt=l[2]|0,it=Zt&8191,wt=Zt>>>13,Gt=l[3]|0,nt=Gt&8191,xt=Gt>>>13,Wt=l[4]|0,at=Wt&8191,_t=Wt>>>13,Vt=l[5]|0,st=Vt&8191,$t=Vt>>>13,jt=l[6]|0,ht=jt&8191,Bt=jt>>>13,Jt=l[7]|0,ot=Jt&8191,St=Jt>>>13,Xt=l[8]|0,ut=Xt&8191,At=Xt>>>13,Yt=l[9]|0,lt=Yt&8191,Et=Yt>>>13;n.negative=t.negative^i.negative,n.length=19,o=Math.imul($,et),e=Math.imul($,yt),e=e+Math.imul(q,et)|0,u=Math.imul(q,yt);var Tt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,o=Math.imul(N,et),e=Math.imul(N,yt),e=e+Math.imul(E,et)|0,u=Math.imul(E,yt),o=o+Math.imul($,rt)|0,e=e+Math.imul($,Mt)|0,e=e+Math.imul(q,rt)|0,u=u+Math.imul(q,Mt)|0;var Nt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,o=Math.imul(D,et),e=Math.imul(D,yt),e=e+Math.imul(z,et)|0,u=Math.imul(z,yt),o=o+Math.imul(N,rt)|0,e=e+Math.imul(N,Mt)|0,e=e+Math.imul(E,rt)|0,u=u+Math.imul(E,Mt)|0,o=o+Math.imul($,it)|0,e=e+Math.imul($,wt)|0,e=e+Math.imul(q,it)|0,u=u+Math.imul(q,wt)|0;var Qt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,o=Math.imul(F,et),e=Math.imul(F,yt),e=e+Math.imul(V,et)|0,u=Math.imul(V,yt),o=o+Math.imul(D,rt)|0,e=e+Math.imul(D,Mt)|0,e=e+Math.imul(z,rt)|0,u=u+Math.imul(z,Mt)|0,o=o+Math.imul(N,it)|0,e=e+Math.imul(N,wt)|0,e=e+Math.imul(E,it)|0,u=u+Math.imul(E,wt)|0,o=o+Math.imul($,nt)|0,e=e+Math.imul($,xt)|0,e=e+Math.imul(q,nt)|0,u=u+Math.imul(q,xt)|0;var te=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(te>>>26)|0,te&=67108863,o=Math.imul(J,et),e=Math.imul(J,yt),e=e+Math.imul(pt,et)|0,u=Math.imul(pt,yt),o=o+Math.imul(F,rt)|0,e=e+Math.imul(F,Mt)|0,e=e+Math.imul(V,rt)|0,u=u+Math.imul(V,Mt)|0,o=o+Math.imul(D,it)|0,e=e+Math.imul(D,wt)|0,e=e+Math.imul(z,it)|0,u=u+Math.imul(z,wt)|0,o=o+Math.imul(N,nt)|0,e=e+Math.imul(N,xt)|0,e=e+Math.imul(E,nt)|0,u=u+Math.imul(E,xt)|0,o=o+Math.imul($,at)|0,e=e+Math.imul($,_t)|0,e=e+Math.imul(q,at)|0,u=u+Math.imul(q,_t)|0;var ee=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ee>>>26)|0,ee&=67108863,o=Math.imul(X,et),e=Math.imul(X,yt),e=e+Math.imul(mt,et)|0,u=Math.imul(mt,yt),o=o+Math.imul(J,rt)|0,e=e+Math.imul(J,Mt)|0,e=e+Math.imul(pt,rt)|0,u=u+Math.imul(pt,Mt)|0,o=o+Math.imul(F,it)|0,e=e+Math.imul(F,wt)|0,e=e+Math.imul(V,it)|0,u=u+Math.imul(V,wt)|0,o=o+Math.imul(D,nt)|0,e=e+Math.imul(D,xt)|0,e=e+Math.imul(z,nt)|0,u=u+Math.imul(z,xt)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(N,_t)|0,e=e+Math.imul(E,at)|0,u=u+Math.imul(E,_t)|0,o=o+Math.imul($,st)|0,e=e+Math.imul($,$t)|0,e=e+Math.imul(q,st)|0,u=u+Math.imul(q,$t)|0;var re=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(re>>>26)|0,re&=67108863,o=Math.imul(Y,et),e=Math.imul(Y,yt),e=e+Math.imul(vt,et)|0,u=Math.imul(vt,yt),o=o+Math.imul(X,rt)|0,e=e+Math.imul(X,Mt)|0,e=e+Math.imul(mt,rt)|0,u=u+Math.imul(mt,Mt)|0,o=o+Math.imul(J,it)|0,e=e+Math.imul(J,wt)|0,e=e+Math.imul(pt,it)|0,u=u+Math.imul(pt,wt)|0,o=o+Math.imul(F,nt)|0,e=e+Math.imul(F,xt)|0,e=e+Math.imul(V,nt)|0,u=u+Math.imul(V,xt)|0,o=o+Math.imul(D,at)|0,e=e+Math.imul(D,_t)|0,e=e+Math.imul(z,at)|0,u=u+Math.imul(z,_t)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(N,$t)|0,e=e+Math.imul(E,st)|0,u=u+Math.imul(E,$t)|0,o=o+Math.imul($,ht)|0,e=e+Math.imul($,Bt)|0,e=e+Math.imul(q,ht)|0,u=u+Math.imul(q,Bt)|0;var ie=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ie>>>26)|0,ie&=67108863,o=Math.imul(j,et),e=Math.imul(j,yt),e=e+Math.imul(ct,et)|0,u=Math.imul(ct,yt),o=o+Math.imul(Y,rt)|0,e=e+Math.imul(Y,Mt)|0,e=e+Math.imul(vt,rt)|0,u=u+Math.imul(vt,Mt)|0,o=o+Math.imul(X,it)|0,e=e+Math.imul(X,wt)|0,e=e+Math.imul(mt,it)|0,u=u+Math.imul(mt,wt)|0,o=o+Math.imul(J,nt)|0,e=e+Math.imul(J,xt)|0,e=e+Math.imul(pt,nt)|0,u=u+Math.imul(pt,xt)|0,o=o+Math.imul(F,at)|0,e=e+Math.imul(F,_t)|0,e=e+Math.imul(V,at)|0,u=u+Math.imul(V,_t)|0,o=o+Math.imul(D,st)|0,e=e+Math.imul(D,$t)|0,e=e+Math.imul(z,st)|0,u=u+Math.imul(z,$t)|0,o=o+Math.imul(N,ht)|0,e=e+Math.imul(N,Bt)|0,e=e+Math.imul(E,ht)|0,u=u+Math.imul(E,Bt)|0,o=o+Math.imul($,ot)|0,e=e+Math.imul($,St)|0,e=e+Math.imul(q,ot)|0,u=u+Math.imul(q,St)|0;var fe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(fe>>>26)|0,fe&=67108863,o=Math.imul(Q,et),e=Math.imul(Q,yt),e=e+Math.imul(bt,et)|0,u=Math.imul(bt,yt),o=o+Math.imul(j,rt)|0,e=e+Math.imul(j,Mt)|0,e=e+Math.imul(ct,rt)|0,u=u+Math.imul(ct,Mt)|0,o=o+Math.imul(Y,it)|0,e=e+Math.imul(Y,wt)|0,e=e+Math.imul(vt,it)|0,u=u+Math.imul(vt,wt)|0,o=o+Math.imul(X,nt)|0,e=e+Math.imul(X,xt)|0,e=e+Math.imul(mt,nt)|0,u=u+Math.imul(mt,xt)|0,o=o+Math.imul(J,at)|0,e=e+Math.imul(J,_t)|0,e=e+Math.imul(pt,at)|0,u=u+Math.imul(pt,_t)|0,o=o+Math.imul(F,st)|0,e=e+Math.imul(F,$t)|0,e=e+Math.imul(V,st)|0,u=u+Math.imul(V,$t)|0,o=o+Math.imul(D,ht)|0,e=e+Math.imul(D,Bt)|0,e=e+Math.imul(z,ht)|0,u=u+Math.imul(z,Bt)|0,o=o+Math.imul(N,ot)|0,e=e+Math.imul(N,St)|0,e=e+Math.imul(E,ot)|0,u=u+Math.imul(E,St)|0,o=o+Math.imul($,ut)|0,e=e+Math.imul($,At)|0,e=e+Math.imul(q,ut)|0,u=u+Math.imul(q,At)|0;var ne=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ne>>>26)|0,ne&=67108863,o=Math.imul(tt,et),e=Math.imul(tt,yt),e=e+Math.imul(gt,et)|0,u=Math.imul(gt,yt),o=o+Math.imul(Q,rt)|0,e=e+Math.imul(Q,Mt)|0,e=e+Math.imul(bt,rt)|0,u=u+Math.imul(bt,Mt)|0,o=o+Math.imul(j,it)|0,e=e+Math.imul(j,wt)|0,e=e+Math.imul(ct,it)|0,u=u+Math.imul(ct,wt)|0,o=o+Math.imul(Y,nt)|0,e=e+Math.imul(Y,xt)|0,e=e+Math.imul(vt,nt)|0,u=u+Math.imul(vt,xt)|0,o=o+Math.imul(X,at)|0,e=e+Math.imul(X,_t)|0,e=e+Math.imul(mt,at)|0,u=u+Math.imul(mt,_t)|0,o=o+Math.imul(J,st)|0,e=e+Math.imul(J,$t)|0,e=e+Math.imul(pt,st)|0,u=u+Math.imul(pt,$t)|0,o=o+Math.imul(F,ht)|0,e=e+Math.imul(F,Bt)|0,e=e+Math.imul(V,ht)|0,u=u+Math.imul(V,Bt)|0,o=o+Math.imul(D,ot)|0,e=e+Math.imul(D,St)|0,e=e+Math.imul(z,ot)|0,u=u+Math.imul(z,St)|0,o=o+Math.imul(N,ut)|0,e=e+Math.imul(N,At)|0,e=e+Math.imul(E,ut)|0,u=u+Math.imul(E,At)|0,o=o+Math.imul($,lt)|0,e=e+Math.imul($,Et)|0,e=e+Math.imul(q,lt)|0,u=u+Math.imul(q,Et)|0;var ae=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ae>>>26)|0,ae&=67108863,o=Math.imul(tt,rt),e=Math.imul(tt,Mt),e=e+Math.imul(gt,rt)|0,u=Math.imul(gt,Mt),o=o+Math.imul(Q,it)|0,e=e+Math.imul(Q,wt)|0,e=e+Math.imul(bt,it)|0,u=u+Math.imul(bt,wt)|0,o=o+Math.imul(j,nt)|0,e=e+Math.imul(j,xt)|0,e=e+Math.imul(ct,nt)|0,u=u+Math.imul(ct,xt)|0,o=o+Math.imul(Y,at)|0,e=e+Math.imul(Y,_t)|0,e=e+Math.imul(vt,at)|0,u=u+Math.imul(vt,_t)|0,o=o+Math.imul(X,st)|0,e=e+Math.imul(X,$t)|0,e=e+Math.imul(mt,st)|0,u=u+Math.imul(mt,$t)|0,o=o+Math.imul(J,ht)|0,e=e+Math.imul(J,Bt)|0,e=e+Math.imul(pt,ht)|0,u=u+Math.imul(pt,Bt)|0,o=o+Math.imul(F,ot)|0,e=e+Math.imul(F,St)|0,e=e+Math.imul(V,ot)|0,u=u+Math.imul(V,St)|0,o=o+Math.imul(D,ut)|0,e=e+Math.imul(D,At)|0,e=e+Math.imul(z,ut)|0,u=u+Math.imul(z,At)|0,o=o+Math.imul(N,lt)|0,e=e+Math.imul(N,Et)|0,e=e+Math.imul(E,lt)|0,u=u+Math.imul(E,Et)|0;var se=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(se>>>26)|0,se&=67108863,o=Math.imul(tt,it),e=Math.imul(tt,wt),e=e+Math.imul(gt,it)|0,u=Math.imul(gt,wt),o=o+Math.imul(Q,nt)|0,e=e+Math.imul(Q,xt)|0,e=e+Math.imul(bt,nt)|0,u=u+Math.imul(bt,xt)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(j,_t)|0,e=e+Math.imul(ct,at)|0,u=u+Math.imul(ct,_t)|0,o=o+Math.imul(Y,st)|0,e=e+Math.imul(Y,$t)|0,e=e+Math.imul(vt,st)|0,u=u+Math.imul(vt,$t)|0,o=o+Math.imul(X,ht)|0,e=e+Math.imul(X,Bt)|0,e=e+Math.imul(mt,ht)|0,u=u+Math.imul(mt,Bt)|0,o=o+Math.imul(J,ot)|0,e=e+Math.imul(J,St)|0,e=e+Math.imul(pt,ot)|0,u=u+Math.imul(pt,St)|0,o=o+Math.imul(F,ut)|0,e=e+Math.imul(F,At)|0,e=e+Math.imul(V,ut)|0,u=u+Math.imul(V,At)|0,o=o+Math.imul(D,lt)|0,e=e+Math.imul(D,Et)|0,e=e+Math.imul(z,lt)|0,u=u+Math.imul(z,Et)|0;var he=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(he>>>26)|0,he&=67108863,o=Math.imul(tt,nt),e=Math.imul(tt,xt),e=e+Math.imul(gt,nt)|0,u=Math.imul(gt,xt),o=o+Math.imul(Q,at)|0,e=e+Math.imul(Q,_t)|0,e=e+Math.imul(bt,at)|0,u=u+Math.imul(bt,_t)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(j,$t)|0,e=e+Math.imul(ct,st)|0,u=u+Math.imul(ct,$t)|0,o=o+Math.imul(Y,ht)|0,e=e+Math.imul(Y,Bt)|0,e=e+Math.imul(vt,ht)|0,u=u+Math.imul(vt,Bt)|0,o=o+Math.imul(X,ot)|0,e=e+Math.imul(X,St)|0,e=e+Math.imul(mt,ot)|0,u=u+Math.imul(mt,St)|0,o=o+Math.imul(J,ut)|0,e=e+Math.imul(J,At)|0,e=e+Math.imul(pt,ut)|0,u=u+Math.imul(pt,At)|0,o=o+Math.imul(F,lt)|0,e=e+Math.imul(F,Et)|0,e=e+Math.imul(V,lt)|0,u=u+Math.imul(V,Et)|0;var oe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(oe>>>26)|0,oe&=67108863,o=Math.imul(tt,at),e=Math.imul(tt,_t),e=e+Math.imul(gt,at)|0,u=Math.imul(gt,_t),o=o+Math.imul(Q,st)|0,e=e+Math.imul(Q,$t)|0,e=e+Math.imul(bt,st)|0,u=u+Math.imul(bt,$t)|0,o=o+Math.imul(j,ht)|0,e=e+Math.imul(j,Bt)|0,e=e+Math.imul(ct,ht)|0,u=u+Math.imul(ct,Bt)|0,o=o+Math.imul(Y,ot)|0,e=e+Math.imul(Y,St)|0,e=e+Math.imul(vt,ot)|0,u=u+Math.imul(vt,St)|0,o=o+Math.imul(X,ut)|0,e=e+Math.imul(X,At)|0,e=e+Math.imul(mt,ut)|0,u=u+Math.imul(mt,At)|0,o=o+Math.imul(J,lt)|0,e=e+Math.imul(J,Et)|0,e=e+Math.imul(pt,lt)|0,u=u+Math.imul(pt,Et)|0;var ue=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ue>>>26)|0,ue&=67108863,o=Math.imul(tt,st),e=Math.imul(tt,$t),e=e+Math.imul(gt,st)|0,u=Math.imul(gt,$t),o=o+Math.imul(Q,ht)|0,e=e+Math.imul(Q,Bt)|0,e=e+Math.imul(bt,ht)|0,u=u+Math.imul(bt,Bt)|0,o=o+Math.imul(j,ot)|0,e=e+Math.imul(j,St)|0,e=e+Math.imul(ct,ot)|0,u=u+Math.imul(ct,St)|0,o=o+Math.imul(Y,ut)|0,e=e+Math.imul(Y,At)|0,e=e+Math.imul(vt,ut)|0,u=u+Math.imul(vt,At)|0,o=o+Math.imul(X,lt)|0,e=e+Math.imul(X,Et)|0,e=e+Math.imul(mt,lt)|0,u=u+Math.imul(mt,Et)|0;var le=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(le>>>26)|0,le&=67108863,o=Math.imul(tt,ht),e=Math.imul(tt,Bt),e=e+Math.imul(gt,ht)|0,u=Math.imul(gt,Bt),o=o+Math.imul(Q,ot)|0,e=e+Math.imul(Q,St)|0,e=e+Math.imul(bt,ot)|0,u=u+Math.imul(bt,St)|0,o=o+Math.imul(j,ut)|0,e=e+Math.imul(j,At)|0,e=e+Math.imul(ct,ut)|0,u=u+Math.imul(ct,At)|0,o=o+Math.imul(Y,lt)|0,e=e+Math.imul(Y,Et)|0,e=e+Math.imul(vt,lt)|0,u=u+Math.imul(vt,Et)|0;var de=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(de>>>26)|0,de&=67108863,o=Math.imul(tt,ot),e=Math.imul(tt,St),e=e+Math.imul(gt,ot)|0,u=Math.imul(gt,St),o=o+Math.imul(Q,ut)|0,e=e+Math.imul(Q,At)|0,e=e+Math.imul(bt,ut)|0,u=u+Math.imul(bt,At)|0,o=o+Math.imul(j,lt)|0,e=e+Math.imul(j,Et)|0,e=e+Math.imul(ct,lt)|0,u=u+Math.imul(ct,Et)|0;var ce=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ce>>>26)|0,ce&=67108863,o=Math.imul(tt,ut),e=Math.imul(tt,At),e=e+Math.imul(gt,ut)|0,u=Math.imul(gt,At),o=o+Math.imul(Q,lt)|0,e=e+Math.imul(Q,Et)|0,e=e+Math.imul(bt,lt)|0,u=u+Math.imul(bt,Et)|0;var ve=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(tt,lt),e=Math.imul(tt,Et),e=e+Math.imul(gt,lt)|0,u=Math.imul(gt,Et);var pe=(m+o|0)+((e&8191)<<13)|0;return m=(u+(e>>>13)|0)+(pe>>>26)|0,pe&=67108863,v[0]=Tt,v[1]=Nt,v[2]=Qt,v[3]=te,v[4]=ee,v[5]=re,v[6]=ie,v[7]=fe,v[8]=ne,v[9]=ae,v[10]=se,v[11]=he,v[12]=oe,v[13]=ue,v[14]=le,v[15]=de,v[16]=ce,v[17]=ve,v[18]=pe,m!==0&&(v[19]=m,n.length++),n};Math.imul||(H=C);function U(b,t,i){i.negative=t.negative^b.negative,i.length=b.length+t.length;for(var n=0,a=0,l=0;l>>26)|0,a+=v>>>26,v&=67108863}i.words[l]=m,n=v,v=a}return n!==0?i.words[l]=n:i.length--,i.strip()}function L(b,t,i){var n=new T;return n.mulp(b,t,i)}h.prototype.mulTo=function(t,i){var n,a=this.length+t.length;return this.length===10&&t.length===10?n=H(this,t,i):a<63?n=C(this,t,i):a<1024?n=U(this,t,i):n=L(this,t,i),n};function T(b,t){this.x=b,this.y=t}T.prototype.makeRBT=function(t){for(var i=new Array(t),n=h.prototype._countBits(t)-1,a=0;a>=1;return a},T.prototype.permute=function(t,i,n,a,l,v){for(var m=0;m>>1)l++;return 1<>>13,n[2*v+1]=l&8191,l=l>>>13;for(v=2*i;v>=26,i+=a/67108864|0,i+=l>>>26,this.words[n]=l&67108863}return i!==0&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=R(t);if(i.length===0)return new h(1);for(var n=this,a=0;a=0);var i=t%26,n=(t-i)/26,a=67108863>>>26-i<<26-i,l;if(i!==0){var v=0;for(l=0;l>>26-i}v&&(this.words[l]=v,this.length++)}if(n!==0){for(l=this.length-1;l>=0;l--)this.words[l+n]=this.words[l];for(l=0;l=0);var a;i?a=(i-i%26)/26:a=0;var l=t%26,v=Math.min((t-l)/26,this.length),m=67108863^67108863>>>l<v)for(this.length-=v,e=0;e=0&&(u!==0||e>=a);e--){var M=this.words[e]|0;this.words[e]=u<<26-l|M>>>l,u=M&m}return o&&u!==0&&(o.words[o.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return p(this.negative===0),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){p(typeof t=="number"&&t>=0);var i=t%26,n=(t-i)/26,a=1<=0);var i=t%26,n=(t-i)/26;if(p(this.negative===0,"imaskn works only with positive numbers"),this.length<=n)return this;if(i!==0&&n++,this.length=Math.min(n,this.length),i!==0){var a=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(p(typeof t=="number"),p(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(o/67108864|0),this.words[l+n]=v&67108863}for(;l>26,this.words[l+n]=v&67108863;if(m===0)return this.strip();for(p(m===-1),m=0,l=0;l>26,this.words[l]=v&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var n=this.length-t.length,a=this.clone(),l=t,v=l.words[l.length-1]|0,m=this._countBits(v);n=26-m,n!==0&&(l=l.ushln(n),a.iushln(n),v=l.words[l.length-1]|0);var o=a.length-l.length,e;if(i!=="mod"){e=new h(null),e.length=o+1,e.words=new Array(e.length);for(var u=0;u=0;$--){var q=(a.words[l.length+$]|0)*67108864+(a.words[l.length+$-1]|0);for(q=Math.min(q/v|0,67108863),a._ishlnsubmul(l,q,$);a.negative!==0;)q--,a.negative=0,a._ishlnsubmul(l,1,$),a.isZero()||(a.negative^=1);e&&(e.words[$]=q)}return e&&e.strip(),a.strip(),i!=="div"&&n!==0&&a.iushrn(n),{div:e||null,mod:a}},h.prototype.divmod=function(t,i,n){if(p(!t.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var a,l,v;return this.negative!==0&&t.negative===0?(v=this.neg().divmod(t,i),i!=="mod"&&(a=v.div.neg()),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.iadd(t)),{div:a,mod:l}):this.negative===0&&t.negative!==0?(v=this.divmod(t.neg(),i),i!=="mod"&&(a=v.div.neg()),{div:a,mod:v.mod}):this.negative&t.negative?(v=this.neg().divmod(t.neg(),i),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.isub(t)),{div:v.div,mod:l}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i)},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var n=i.div.negative!==0?i.mod.isub(t):i.mod,a=t.ushrn(1),l=t.andln(1),v=n.cmp(a);return v<0||l===1&&v===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){p(t<=67108863);for(var i=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(i*n+(this.words[a]|0))%t;return n},h.prototype.idivn=function(t){p(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var a=(this.words[n]|0)+i*67108864;this.words[n]=a/t|0,i=a%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=new h(0),m=new h(1),o=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++o;for(var e=n.clone(),u=i.clone();!i.isZero();){for(var M=0,$=1;!(i.words[0]&$)&&M<26;++M,$<<=1);if(M>0)for(i.iushrn(M);M-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(e),l.isub(u)),a.iushrn(1),l.iushrn(1);for(var q=0,I=1;!(n.words[0]&I)&&q<26;++q,I<<=1);if(q>0)for(n.iushrn(q);q-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(e),m.isub(u)),v.iushrn(1),m.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(v),l.isub(m)):(n.isub(i),v.isub(a),m.isub(l))}return{a:v,b:m,gcd:n.iushln(o)}},h.prototype._invmp=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var m=0,o=1;!(i.words[0]&o)&&m<26;++m,o<<=1);if(m>0)for(i.iushrn(m);m-- >0;)a.isOdd()&&a.iadd(v),a.iushrn(1);for(var e=0,u=1;!(n.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(n.iushrn(e);e-- >0;)l.isOdd()&&l.iadd(v),l.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(l)):(n.isub(i),l.isub(a))}var M;return i.cmpn(1)===0?M=a:M=l,M.cmpn(0)<0&&M.iadd(t),M},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),n=t.clone();i.negative=0,n.negative=0;for(var a=0;i.isEven()&&n.isEven();a++)i.iushrn(1),n.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;n.isEven();)n.iushrn(1);var l=i.cmp(n);if(l<0){var v=i;i=n,n=v}else if(l===0||n.cmpn(1)===0)break;i.isub(n)}while(!0);return n.iushln(a)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){p(typeof t=="number");var i=t%26,n=(t-i)/26,a=1<>>26,m&=67108863,this.words[v]=m}return l!==0&&(this.words[v]=l,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var n;if(this.length>1)n=1;else{i&&(t=-t),p(t<=67108863,"Number is too big");var a=this.words[0]|0;n=a===t?0:at.length)return 1;if(this.length=0;n--){var a=this.words[n]|0,l=t.words[n]|0;if(a!==l){al&&(i=1);break}}return i},h.prototype.gtn=function(t){return this.cmpn(t)===1},h.prototype.gt=function(t){return this.cmp(t)===1},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return this.cmpn(t)===-1},h.prototype.lt=function(t){return this.cmp(t)===-1},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return this.cmpn(t)===0},h.prototype.eq=function(t){return this.cmp(t)===0},h.red=function(t){return new Z(t)},h.prototype.toRed=function(t){return p(!this.red,"Already a number in reduction context"),p(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return p(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return p(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return p(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return p(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return p(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return p(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return p(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return p(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return p(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return p(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return p(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return p(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return p(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var dt={k256:null,p224:null,p192:null,p25519:null};function O(b,t){this.name=b,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,n;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),n=i.bitLength();while(n>this.n);var a=n0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function kt(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}y(kt,O),kt.prototype.split=function(t,i){for(var n=4194303,a=Math.min(t.length,9),l=0;l>>22,v=m}v>>>=22,t.words[l-10]=v,v===0&&t.length>10?t.length-=10:t.length-=9},kt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,n=0;n>>=26,t.words[n]=l,i=a}return i!==0&&(t.words[t.length++]=i),t},h._prime=function(t){if(dt[t])return dt[t];var i;if(t==="k256")i=new kt;else if(t==="p224")i=new Rt;else if(t==="p192")i=new Ct;else if(t==="p25519")i=new qt;else throw new Error("Unknown prime "+t);return dt[t]=i,i};function Z(b){if(typeof b=="string"){var t=h._prime(b);this.m=t.p,this.prime=t}else p(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Z.prototype._verify1=function(t){p(t.negative===0,"red works only with positives"),p(t.red,"red works only with red numbers")},Z.prototype._verify2=function(t,i){p((t.negative|i.negative)===0,"red works only with positives"),p(t.red&&t.red===i.red,"red works only with red numbers")},Z.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Z.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Z.prototype.add=function(t,i){this._verify2(t,i);var n=t.add(i);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},Z.prototype.iadd=function(t,i){this._verify2(t,i);var n=t.iadd(i);return n.cmp(this.m)>=0&&n.isub(this.m),n},Z.prototype.sub=function(t,i){this._verify2(t,i);var n=t.sub(i);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},Z.prototype.isub=function(t,i){this._verify2(t,i);var n=t.isub(i);return n.cmpn(0)<0&&n.iadd(this.m),n},Z.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},Z.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Z.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Z.prototype.isqr=function(t){return this.imul(t,t.clone())},Z.prototype.sqr=function(t){return this.mul(t,t)},Z.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(p(i%2===1),i===3){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var a=this.m.subn(1),l=0;!a.isZero()&&a.andln(1)===0;)l++,a.iushrn(1);p(!a.isZero());var v=new h(1).toRed(this),m=v.redNeg(),o=this.m.subn(1).iushrn(1),e=this.m.bitLength();for(e=new h(2*e*e).toRed(this);this.pow(e,o).cmp(m)!==0;)e.redIAdd(m);for(var u=this.pow(e,a),M=this.pow(t,a.addn(1).iushrn(1)),$=this.pow(t,a),q=l;$.cmp(v)!==0;){for(var I=$,N=0;I.cmp(v)!==0;N++)I=I.redSqr();p(N=0;l--){for(var u=i.words[l],M=e-1;M>=0;M--){var $=u>>M&1;if(v!==a[0]&&(v=this.sqr(v)),$===0&&m===0){o=0;continue}m<<=1,m|=$,o++,!(o!==n&&(l!==0||M!==0))&&(v=this.mul(v,a[m]),o=0,m=0)}e=26}return v},Z.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},Z.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new Pt(t)};function Pt(b){Z.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}y(Pt,Z),Pt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Pt.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Pt.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var n=t.mul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(c,commonjsGlobal)})(bn$1);var bnExports$1=bn$1.exports,browser$2,hasRequiredBrowser;function requireBrowser(){if(hasRequiredBrowser)return browser$2;hasRequiredBrowser=1;var c=requireElliptic(),d=bnExports$1;browser$2=function(w){return new p(w)};var g={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};g.p224=g.secp224r1,g.p256=g.secp256r1=g.prime256v1,g.p192=g.secp192r1=g.prime192v1,g.p384=g.secp384r1,g.p521=g.secp521r1;function p(h){this.curveType=g[h],this.curveType||(this.curveType={name:h}),this.curve=new c.ec(this.curveType.name),this.keys=void 0}p.prototype.generateKeys=function(h,w){return this.keys=this.curve.genKeyPair(),this.getPublicKey(h,w)},p.prototype.computeSecret=function(h,w,_){w=w||"utf8",Buffer$B.isBuffer(h)||(h=new Buffer$B(h,w));var S=this.curve.keyFromPublic(h).getPublic(),A=S.mul(this.keys.getPrivate()).getX();return y(A,_,this.curveType.byteLength)},p.prototype.getPublicKey=function(h,w){var _=this.keys.getPublic(w==="compressed",!0);return w==="hybrid"&&(_[_.length-1]%2?_[0]=7:_[0]=6),y(_,h)},p.prototype.getPrivateKey=function(h){return y(this.keys.getPrivate(),h)},p.prototype.setPublicKey=function(h,w){return w=w||"utf8",Buffer$B.isBuffer(h)||(h=new Buffer$B(h,w)),this.keys._importPublic(h),this},p.prototype.setPrivateKey=function(h,w){w=w||"utf8",Buffer$B.isBuffer(h)||(h=new Buffer$B(h,w));var _=new d(h);return _=_.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(_),this};function y(h,w,_){Array.isArray(h)||(h=h.toArray());var S=new Buffer$B(h);if(_&&S.length<_){var A=new Buffer$B(_-S.length);A.fill(0),S=Buffer$B.concat([A,S])}return w?S.toString(w):S}return browser$2}var browser$1={},createHash$2=browser$9,Buffer$4=safeBufferExports$1.Buffer,mgf$2=function(c,d){for(var g=Buffer$4.alloc(0),p=0,y;g.length0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if(typeof t=="number")return this._initNumber(t,i,n);if(typeof t=="object")return this._initArray(t,i,n);i==="hex"&&(i=16),p(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var a=0;t[0]==="-"&&(a++,this.negative=1),a=0;a-=3)v=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[l]|=v<>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);else if(n==="le")for(a=0,l=0;a>>26-m&67108863,m+=24,m>=26&&(m-=26,l++);return this.strip()};function _(b,t){var i=b.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function S(b,t,i){var n=_(b,i);return i-1>=t&&(n|=_(b,i-1)<<4),n}h.prototype._parseHex=function(t,i,n){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a=i;a-=2)m=S(t,i,a)<=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8;else{var o=t.length-i;for(a=o%2===0?i+1:i;a=18?(l-=18,v+=1,this.words[v]|=m>>>26):l+=8}this.strip()};function A(b,t,i,n){for(var a=0,l=Math.min(b.length,i),v=t;v=49?a+=m-49+10:m>=17?a+=m-17+10:a+=m}return a}h.prototype._parseBase=function(t,i,n){this.words=[0],this.length=1;for(var a=0,l=1;l<=67108863;l*=i)a++;a--,l=l/i|0;for(var v=t.length-n,m=v%a,o=Math.min(v,v-m)+n,e=0,u=n;u1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var x=["","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"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){t=t||10,i=i|0||1;var n;if(t===16||t==="hex"){n="";for(var a=0,l=0,v=0;v>>24-a&16777215,a+=2,a>=26&&(a-=26,v--),l!==0||v!==this.length-1?n=x[6-o.length]+o+n:n=o+n}for(l!==0&&(n=l.toString(16)+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}if(t===(t|0)&&t>=2&&t<=36){var e=B[t],u=k[t];n="";var M=this.clone();for(M.negative=0;!M.isZero();){var $=M.modn(u).toString(t);M=M.idivn(u),M.isZero()?n=$+n:n=x[e-$.length]+$+n}for(this.isZero()&&(n="0"+n);n.length%i!==0;)n="0"+n;return this.negative!==0&&(n="-"+n),n}p(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&p(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return p(typeof w<"u"),this.toArrayLike(w,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var a=this.byteLength(),l=n||Math.max(1,a);p(a<=l,"byte array longer than desired length"),p(l>0,"Requested array length <= 0"),this.strip();var v=i==="le",m=new t(l),o,e,u=this.clone();if(v){for(e=0;!u.isZero();e++)o=u.andln(255),u.iushrn(8),m[e]=o;for(;e=4096&&(n+=13,i>>>=13),i>=64&&(n+=7,i>>>=7),i>=8&&(n+=4,i>>>=4),i>=2&&(n+=2,i>>>=2),n+i},h.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,n=0;return i&8191||(n+=13,i>>>=13),i&127||(n+=7,i>>>=7),i&15||(n+=4,i>>>=4),i&3||(n+=2,i>>>=2),i&1||n++,n},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function R(b){for(var t=new Array(b.bitLength()),i=0;i>>a}return t}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,n;this.length>t.length?(i=this,n=t):(i=t,n=this);for(var a=0;at.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){p(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,n=t%26;this._expand(i),n>0&&i--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){p(typeof t=="number"&&t>=0);var n=t/26|0,a=t%26;return this._expand(n+1),i?this.words[n]=this.words[n]|1<t.length?(n=this,a=t):(n=t,a=this);for(var l=0,v=0;v>>26;for(;l!==0&&v>>26;if(this.length=n.length,l!==0)this.words[this.length]=l,this.length++;else if(n!==this)for(;vt.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,l;n>0?(a=this,l=t):(a=t,l=this);for(var v=0,m=0;m>26,this.words[m]=i&67108863;for(;v!==0&&m>26,this.words[m]=i&67108863;if(v===0&&m>>26,M=o&67108863,$=Math.min(e,t.length-1),q=Math.max(0,e-b.length+1);q<=$;q++){var I=e-q|0;a=b.words[I]|0,l=t.words[q]|0,v=a*l+M,u+=v/67108864|0,M=v&67108863}i.words[e]=M|0,o=u|0}return o!==0?i.words[e]=o|0:i.length--,i.strip()}var H=function(t,i,n){var a=t.words,l=i.words,v=n.words,m=0,o,e,u,M=a[0]|0,$=M&8191,q=M>>>13,I=a[1]|0,N=I&8191,E=I>>>13,P=a[2]|0,D=P&8191,z=P>>>13,It=a[3]|0,F=It&8191,V=It>>>13,Ht=a[4]|0,J=Ht&8191,pt=Ht>>>13,zt=a[5]|0,X=zt&8191,mt=zt>>>13,Lt=a[6]|0,Y=Lt&8191,vt=Lt>>>13,Dt=a[7]|0,j=Dt&8191,ct=Dt>>>13,Ot=a[8]|0,Q=Ot&8191,bt=Ot>>>13,Kt=a[9]|0,tt=Kt&8191,gt=Kt>>>13,Ft=l[0]|0,et=Ft&8191,yt=Ft>>>13,Ut=l[1]|0,rt=Ut&8191,Mt=Ut>>>13,Zt=l[2]|0,it=Zt&8191,wt=Zt>>>13,Gt=l[3]|0,nt=Gt&8191,xt=Gt>>>13,Wt=l[4]|0,at=Wt&8191,_t=Wt>>>13,Vt=l[5]|0,st=Vt&8191,$t=Vt>>>13,jt=l[6]|0,ht=jt&8191,Bt=jt>>>13,Jt=l[7]|0,ot=Jt&8191,St=Jt>>>13,Xt=l[8]|0,ut=Xt&8191,At=Xt>>>13,Yt=l[9]|0,lt=Yt&8191,Et=Yt>>>13;n.negative=t.negative^i.negative,n.length=19,o=Math.imul($,et),e=Math.imul($,yt),e=e+Math.imul(q,et)|0,u=Math.imul(q,yt);var Tt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,o=Math.imul(N,et),e=Math.imul(N,yt),e=e+Math.imul(E,et)|0,u=Math.imul(E,yt),o=o+Math.imul($,rt)|0,e=e+Math.imul($,Mt)|0,e=e+Math.imul(q,rt)|0,u=u+Math.imul(q,Mt)|0;var Nt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,o=Math.imul(D,et),e=Math.imul(D,yt),e=e+Math.imul(z,et)|0,u=Math.imul(z,yt),o=o+Math.imul(N,rt)|0,e=e+Math.imul(N,Mt)|0,e=e+Math.imul(E,rt)|0,u=u+Math.imul(E,Mt)|0,o=o+Math.imul($,it)|0,e=e+Math.imul($,wt)|0,e=e+Math.imul(q,it)|0,u=u+Math.imul(q,wt)|0;var Qt=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,o=Math.imul(F,et),e=Math.imul(F,yt),e=e+Math.imul(V,et)|0,u=Math.imul(V,yt),o=o+Math.imul(D,rt)|0,e=e+Math.imul(D,Mt)|0,e=e+Math.imul(z,rt)|0,u=u+Math.imul(z,Mt)|0,o=o+Math.imul(N,it)|0,e=e+Math.imul(N,wt)|0,e=e+Math.imul(E,it)|0,u=u+Math.imul(E,wt)|0,o=o+Math.imul($,nt)|0,e=e+Math.imul($,xt)|0,e=e+Math.imul(q,nt)|0,u=u+Math.imul(q,xt)|0;var te=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(te>>>26)|0,te&=67108863,o=Math.imul(J,et),e=Math.imul(J,yt),e=e+Math.imul(pt,et)|0,u=Math.imul(pt,yt),o=o+Math.imul(F,rt)|0,e=e+Math.imul(F,Mt)|0,e=e+Math.imul(V,rt)|0,u=u+Math.imul(V,Mt)|0,o=o+Math.imul(D,it)|0,e=e+Math.imul(D,wt)|0,e=e+Math.imul(z,it)|0,u=u+Math.imul(z,wt)|0,o=o+Math.imul(N,nt)|0,e=e+Math.imul(N,xt)|0,e=e+Math.imul(E,nt)|0,u=u+Math.imul(E,xt)|0,o=o+Math.imul($,at)|0,e=e+Math.imul($,_t)|0,e=e+Math.imul(q,at)|0,u=u+Math.imul(q,_t)|0;var ee=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ee>>>26)|0,ee&=67108863,o=Math.imul(X,et),e=Math.imul(X,yt),e=e+Math.imul(mt,et)|0,u=Math.imul(mt,yt),o=o+Math.imul(J,rt)|0,e=e+Math.imul(J,Mt)|0,e=e+Math.imul(pt,rt)|0,u=u+Math.imul(pt,Mt)|0,o=o+Math.imul(F,it)|0,e=e+Math.imul(F,wt)|0,e=e+Math.imul(V,it)|0,u=u+Math.imul(V,wt)|0,o=o+Math.imul(D,nt)|0,e=e+Math.imul(D,xt)|0,e=e+Math.imul(z,nt)|0,u=u+Math.imul(z,xt)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(N,_t)|0,e=e+Math.imul(E,at)|0,u=u+Math.imul(E,_t)|0,o=o+Math.imul($,st)|0,e=e+Math.imul($,$t)|0,e=e+Math.imul(q,st)|0,u=u+Math.imul(q,$t)|0;var re=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(re>>>26)|0,re&=67108863,o=Math.imul(Y,et),e=Math.imul(Y,yt),e=e+Math.imul(vt,et)|0,u=Math.imul(vt,yt),o=o+Math.imul(X,rt)|0,e=e+Math.imul(X,Mt)|0,e=e+Math.imul(mt,rt)|0,u=u+Math.imul(mt,Mt)|0,o=o+Math.imul(J,it)|0,e=e+Math.imul(J,wt)|0,e=e+Math.imul(pt,it)|0,u=u+Math.imul(pt,wt)|0,o=o+Math.imul(F,nt)|0,e=e+Math.imul(F,xt)|0,e=e+Math.imul(V,nt)|0,u=u+Math.imul(V,xt)|0,o=o+Math.imul(D,at)|0,e=e+Math.imul(D,_t)|0,e=e+Math.imul(z,at)|0,u=u+Math.imul(z,_t)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(N,$t)|0,e=e+Math.imul(E,st)|0,u=u+Math.imul(E,$t)|0,o=o+Math.imul($,ht)|0,e=e+Math.imul($,Bt)|0,e=e+Math.imul(q,ht)|0,u=u+Math.imul(q,Bt)|0;var ie=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ie>>>26)|0,ie&=67108863,o=Math.imul(j,et),e=Math.imul(j,yt),e=e+Math.imul(ct,et)|0,u=Math.imul(ct,yt),o=o+Math.imul(Y,rt)|0,e=e+Math.imul(Y,Mt)|0,e=e+Math.imul(vt,rt)|0,u=u+Math.imul(vt,Mt)|0,o=o+Math.imul(X,it)|0,e=e+Math.imul(X,wt)|0,e=e+Math.imul(mt,it)|0,u=u+Math.imul(mt,wt)|0,o=o+Math.imul(J,nt)|0,e=e+Math.imul(J,xt)|0,e=e+Math.imul(pt,nt)|0,u=u+Math.imul(pt,xt)|0,o=o+Math.imul(F,at)|0,e=e+Math.imul(F,_t)|0,e=e+Math.imul(V,at)|0,u=u+Math.imul(V,_t)|0,o=o+Math.imul(D,st)|0,e=e+Math.imul(D,$t)|0,e=e+Math.imul(z,st)|0,u=u+Math.imul(z,$t)|0,o=o+Math.imul(N,ht)|0,e=e+Math.imul(N,Bt)|0,e=e+Math.imul(E,ht)|0,u=u+Math.imul(E,Bt)|0,o=o+Math.imul($,ot)|0,e=e+Math.imul($,St)|0,e=e+Math.imul(q,ot)|0,u=u+Math.imul(q,St)|0;var fe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(fe>>>26)|0,fe&=67108863,o=Math.imul(Q,et),e=Math.imul(Q,yt),e=e+Math.imul(bt,et)|0,u=Math.imul(bt,yt),o=o+Math.imul(j,rt)|0,e=e+Math.imul(j,Mt)|0,e=e+Math.imul(ct,rt)|0,u=u+Math.imul(ct,Mt)|0,o=o+Math.imul(Y,it)|0,e=e+Math.imul(Y,wt)|0,e=e+Math.imul(vt,it)|0,u=u+Math.imul(vt,wt)|0,o=o+Math.imul(X,nt)|0,e=e+Math.imul(X,xt)|0,e=e+Math.imul(mt,nt)|0,u=u+Math.imul(mt,xt)|0,o=o+Math.imul(J,at)|0,e=e+Math.imul(J,_t)|0,e=e+Math.imul(pt,at)|0,u=u+Math.imul(pt,_t)|0,o=o+Math.imul(F,st)|0,e=e+Math.imul(F,$t)|0,e=e+Math.imul(V,st)|0,u=u+Math.imul(V,$t)|0,o=o+Math.imul(D,ht)|0,e=e+Math.imul(D,Bt)|0,e=e+Math.imul(z,ht)|0,u=u+Math.imul(z,Bt)|0,o=o+Math.imul(N,ot)|0,e=e+Math.imul(N,St)|0,e=e+Math.imul(E,ot)|0,u=u+Math.imul(E,St)|0,o=o+Math.imul($,ut)|0,e=e+Math.imul($,At)|0,e=e+Math.imul(q,ut)|0,u=u+Math.imul(q,At)|0;var ne=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ne>>>26)|0,ne&=67108863,o=Math.imul(tt,et),e=Math.imul(tt,yt),e=e+Math.imul(gt,et)|0,u=Math.imul(gt,yt),o=o+Math.imul(Q,rt)|0,e=e+Math.imul(Q,Mt)|0,e=e+Math.imul(bt,rt)|0,u=u+Math.imul(bt,Mt)|0,o=o+Math.imul(j,it)|0,e=e+Math.imul(j,wt)|0,e=e+Math.imul(ct,it)|0,u=u+Math.imul(ct,wt)|0,o=o+Math.imul(Y,nt)|0,e=e+Math.imul(Y,xt)|0,e=e+Math.imul(vt,nt)|0,u=u+Math.imul(vt,xt)|0,o=o+Math.imul(X,at)|0,e=e+Math.imul(X,_t)|0,e=e+Math.imul(mt,at)|0,u=u+Math.imul(mt,_t)|0,o=o+Math.imul(J,st)|0,e=e+Math.imul(J,$t)|0,e=e+Math.imul(pt,st)|0,u=u+Math.imul(pt,$t)|0,o=o+Math.imul(F,ht)|0,e=e+Math.imul(F,Bt)|0,e=e+Math.imul(V,ht)|0,u=u+Math.imul(V,Bt)|0,o=o+Math.imul(D,ot)|0,e=e+Math.imul(D,St)|0,e=e+Math.imul(z,ot)|0,u=u+Math.imul(z,St)|0,o=o+Math.imul(N,ut)|0,e=e+Math.imul(N,At)|0,e=e+Math.imul(E,ut)|0,u=u+Math.imul(E,At)|0,o=o+Math.imul($,lt)|0,e=e+Math.imul($,Et)|0,e=e+Math.imul(q,lt)|0,u=u+Math.imul(q,Et)|0;var ae=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ae>>>26)|0,ae&=67108863,o=Math.imul(tt,rt),e=Math.imul(tt,Mt),e=e+Math.imul(gt,rt)|0,u=Math.imul(gt,Mt),o=o+Math.imul(Q,it)|0,e=e+Math.imul(Q,wt)|0,e=e+Math.imul(bt,it)|0,u=u+Math.imul(bt,wt)|0,o=o+Math.imul(j,nt)|0,e=e+Math.imul(j,xt)|0,e=e+Math.imul(ct,nt)|0,u=u+Math.imul(ct,xt)|0,o=o+Math.imul(Y,at)|0,e=e+Math.imul(Y,_t)|0,e=e+Math.imul(vt,at)|0,u=u+Math.imul(vt,_t)|0,o=o+Math.imul(X,st)|0,e=e+Math.imul(X,$t)|0,e=e+Math.imul(mt,st)|0,u=u+Math.imul(mt,$t)|0,o=o+Math.imul(J,ht)|0,e=e+Math.imul(J,Bt)|0,e=e+Math.imul(pt,ht)|0,u=u+Math.imul(pt,Bt)|0,o=o+Math.imul(F,ot)|0,e=e+Math.imul(F,St)|0,e=e+Math.imul(V,ot)|0,u=u+Math.imul(V,St)|0,o=o+Math.imul(D,ut)|0,e=e+Math.imul(D,At)|0,e=e+Math.imul(z,ut)|0,u=u+Math.imul(z,At)|0,o=o+Math.imul(N,lt)|0,e=e+Math.imul(N,Et)|0,e=e+Math.imul(E,lt)|0,u=u+Math.imul(E,Et)|0;var se=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(se>>>26)|0,se&=67108863,o=Math.imul(tt,it),e=Math.imul(tt,wt),e=e+Math.imul(gt,it)|0,u=Math.imul(gt,wt),o=o+Math.imul(Q,nt)|0,e=e+Math.imul(Q,xt)|0,e=e+Math.imul(bt,nt)|0,u=u+Math.imul(bt,xt)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(j,_t)|0,e=e+Math.imul(ct,at)|0,u=u+Math.imul(ct,_t)|0,o=o+Math.imul(Y,st)|0,e=e+Math.imul(Y,$t)|0,e=e+Math.imul(vt,st)|0,u=u+Math.imul(vt,$t)|0,o=o+Math.imul(X,ht)|0,e=e+Math.imul(X,Bt)|0,e=e+Math.imul(mt,ht)|0,u=u+Math.imul(mt,Bt)|0,o=o+Math.imul(J,ot)|0,e=e+Math.imul(J,St)|0,e=e+Math.imul(pt,ot)|0,u=u+Math.imul(pt,St)|0,o=o+Math.imul(F,ut)|0,e=e+Math.imul(F,At)|0,e=e+Math.imul(V,ut)|0,u=u+Math.imul(V,At)|0,o=o+Math.imul(D,lt)|0,e=e+Math.imul(D,Et)|0,e=e+Math.imul(z,lt)|0,u=u+Math.imul(z,Et)|0;var he=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(he>>>26)|0,he&=67108863,o=Math.imul(tt,nt),e=Math.imul(tt,xt),e=e+Math.imul(gt,nt)|0,u=Math.imul(gt,xt),o=o+Math.imul(Q,at)|0,e=e+Math.imul(Q,_t)|0,e=e+Math.imul(bt,at)|0,u=u+Math.imul(bt,_t)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(j,$t)|0,e=e+Math.imul(ct,st)|0,u=u+Math.imul(ct,$t)|0,o=o+Math.imul(Y,ht)|0,e=e+Math.imul(Y,Bt)|0,e=e+Math.imul(vt,ht)|0,u=u+Math.imul(vt,Bt)|0,o=o+Math.imul(X,ot)|0,e=e+Math.imul(X,St)|0,e=e+Math.imul(mt,ot)|0,u=u+Math.imul(mt,St)|0,o=o+Math.imul(J,ut)|0,e=e+Math.imul(J,At)|0,e=e+Math.imul(pt,ut)|0,u=u+Math.imul(pt,At)|0,o=o+Math.imul(F,lt)|0,e=e+Math.imul(F,Et)|0,e=e+Math.imul(V,lt)|0,u=u+Math.imul(V,Et)|0;var oe=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(oe>>>26)|0,oe&=67108863,o=Math.imul(tt,at),e=Math.imul(tt,_t),e=e+Math.imul(gt,at)|0,u=Math.imul(gt,_t),o=o+Math.imul(Q,st)|0,e=e+Math.imul(Q,$t)|0,e=e+Math.imul(bt,st)|0,u=u+Math.imul(bt,$t)|0,o=o+Math.imul(j,ht)|0,e=e+Math.imul(j,Bt)|0,e=e+Math.imul(ct,ht)|0,u=u+Math.imul(ct,Bt)|0,o=o+Math.imul(Y,ot)|0,e=e+Math.imul(Y,St)|0,e=e+Math.imul(vt,ot)|0,u=u+Math.imul(vt,St)|0,o=o+Math.imul(X,ut)|0,e=e+Math.imul(X,At)|0,e=e+Math.imul(mt,ut)|0,u=u+Math.imul(mt,At)|0,o=o+Math.imul(J,lt)|0,e=e+Math.imul(J,Et)|0,e=e+Math.imul(pt,lt)|0,u=u+Math.imul(pt,Et)|0;var ue=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ue>>>26)|0,ue&=67108863,o=Math.imul(tt,st),e=Math.imul(tt,$t),e=e+Math.imul(gt,st)|0,u=Math.imul(gt,$t),o=o+Math.imul(Q,ht)|0,e=e+Math.imul(Q,Bt)|0,e=e+Math.imul(bt,ht)|0,u=u+Math.imul(bt,Bt)|0,o=o+Math.imul(j,ot)|0,e=e+Math.imul(j,St)|0,e=e+Math.imul(ct,ot)|0,u=u+Math.imul(ct,St)|0,o=o+Math.imul(Y,ut)|0,e=e+Math.imul(Y,At)|0,e=e+Math.imul(vt,ut)|0,u=u+Math.imul(vt,At)|0,o=o+Math.imul(X,lt)|0,e=e+Math.imul(X,Et)|0,e=e+Math.imul(mt,lt)|0,u=u+Math.imul(mt,Et)|0;var le=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(le>>>26)|0,le&=67108863,o=Math.imul(tt,ht),e=Math.imul(tt,Bt),e=e+Math.imul(gt,ht)|0,u=Math.imul(gt,Bt),o=o+Math.imul(Q,ot)|0,e=e+Math.imul(Q,St)|0,e=e+Math.imul(bt,ot)|0,u=u+Math.imul(bt,St)|0,o=o+Math.imul(j,ut)|0,e=e+Math.imul(j,At)|0,e=e+Math.imul(ct,ut)|0,u=u+Math.imul(ct,At)|0,o=o+Math.imul(Y,lt)|0,e=e+Math.imul(Y,Et)|0,e=e+Math.imul(vt,lt)|0,u=u+Math.imul(vt,Et)|0;var de=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(de>>>26)|0,de&=67108863,o=Math.imul(tt,ot),e=Math.imul(tt,St),e=e+Math.imul(gt,ot)|0,u=Math.imul(gt,St),o=o+Math.imul(Q,ut)|0,e=e+Math.imul(Q,At)|0,e=e+Math.imul(bt,ut)|0,u=u+Math.imul(bt,At)|0,o=o+Math.imul(j,lt)|0,e=e+Math.imul(j,Et)|0,e=e+Math.imul(ct,lt)|0,u=u+Math.imul(ct,Et)|0;var ce=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ce>>>26)|0,ce&=67108863,o=Math.imul(tt,ut),e=Math.imul(tt,At),e=e+Math.imul(gt,ut)|0,u=Math.imul(gt,At),o=o+Math.imul(Q,lt)|0,e=e+Math.imul(Q,Et)|0,e=e+Math.imul(bt,lt)|0,u=u+Math.imul(bt,Et)|0;var ve=(m+o|0)+((e&8191)<<13)|0;m=(u+(e>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(tt,lt),e=Math.imul(tt,Et),e=e+Math.imul(gt,lt)|0,u=Math.imul(gt,Et);var pe=(m+o|0)+((e&8191)<<13)|0;return m=(u+(e>>>13)|0)+(pe>>>26)|0,pe&=67108863,v[0]=Tt,v[1]=Nt,v[2]=Qt,v[3]=te,v[4]=ee,v[5]=re,v[6]=ie,v[7]=fe,v[8]=ne,v[9]=ae,v[10]=se,v[11]=he,v[12]=oe,v[13]=ue,v[14]=le,v[15]=de,v[16]=ce,v[17]=ve,v[18]=pe,m!==0&&(v[19]=m,n.length++),n};Math.imul||(H=C);function U(b,t,i){i.negative=t.negative^b.negative,i.length=b.length+t.length;for(var n=0,a=0,l=0;l>>26)|0,a+=v>>>26,v&=67108863}i.words[l]=m,n=v,v=a}return n!==0?i.words[l]=n:i.length--,i.strip()}function L(b,t,i){var n=new T;return n.mulp(b,t,i)}h.prototype.mulTo=function(t,i){var n,a=this.length+t.length;return this.length===10&&t.length===10?n=H(this,t,i):a<63?n=C(this,t,i):a<1024?n=U(this,t,i):n=L(this,t,i),n};function T(b,t){this.x=b,this.y=t}T.prototype.makeRBT=function(t){for(var i=new Array(t),n=h.prototype._countBits(t)-1,a=0;a>=1;return a},T.prototype.permute=function(t,i,n,a,l,v){for(var m=0;m>>1)l++;return 1<>>13,n[2*v+1]=l&8191,l=l>>>13;for(v=2*i;v>=26,i+=a/67108864|0,i+=l>>>26,this.words[n]=l&67108863}return i!==0&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=R(t);if(i.length===0)return new h(1);for(var n=this,a=0;a=0);var i=t%26,n=(t-i)/26,a=67108863>>>26-i<<26-i,l;if(i!==0){var v=0;for(l=0;l>>26-i}v&&(this.words[l]=v,this.length++)}if(n!==0){for(l=this.length-1;l>=0;l--)this.words[l+n]=this.words[l];for(l=0;l=0);var a;i?a=(i-i%26)/26:a=0;var l=t%26,v=Math.min((t-l)/26,this.length),m=67108863^67108863>>>l<v)for(this.length-=v,e=0;e=0&&(u!==0||e>=a);e--){var M=this.words[e]|0;this.words[e]=u<<26-l|M>>>l,u=M&m}return o&&u!==0&&(o.words[o.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return p(this.negative===0),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){p(typeof t=="number"&&t>=0);var i=t%26,n=(t-i)/26,a=1<=0);var i=t%26,n=(t-i)/26;if(p(this.negative===0,"imaskn works only with positive numbers"),this.length<=n)return this;if(i!==0&&n++,this.length=Math.min(n,this.length),i!==0){var a=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(p(typeof t=="number"),p(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(o/67108864|0),this.words[l+n]=v&67108863}for(;l>26,this.words[l+n]=v&67108863;if(m===0)return this.strip();for(p(m===-1),m=0,l=0;l>26,this.words[l]=v&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var n=this.length-t.length,a=this.clone(),l=t,v=l.words[l.length-1]|0,m=this._countBits(v);n=26-m,n!==0&&(l=l.ushln(n),a.iushln(n),v=l.words[l.length-1]|0);var o=a.length-l.length,e;if(i!=="mod"){e=new h(null),e.length=o+1,e.words=new Array(e.length);for(var u=0;u=0;$--){var q=(a.words[l.length+$]|0)*67108864+(a.words[l.length+$-1]|0);for(q=Math.min(q/v|0,67108863),a._ishlnsubmul(l,q,$);a.negative!==0;)q--,a.negative=0,a._ishlnsubmul(l,1,$),a.isZero()||(a.negative^=1);e&&(e.words[$]=q)}return e&&e.strip(),a.strip(),i!=="div"&&n!==0&&a.iushrn(n),{div:e||null,mod:a}},h.prototype.divmod=function(t,i,n){if(p(!t.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var a,l,v;return this.negative!==0&&t.negative===0?(v=this.neg().divmod(t,i),i!=="mod"&&(a=v.div.neg()),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.iadd(t)),{div:a,mod:l}):this.negative===0&&t.negative!==0?(v=this.divmod(t.neg(),i),i!=="mod"&&(a=v.div.neg()),{div:a,mod:v.mod}):this.negative&t.negative?(v=this.neg().divmod(t.neg(),i),i!=="div"&&(l=v.mod.neg(),n&&l.negative!==0&&l.isub(t)),{div:v.div,mod:l}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i)},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var n=i.div.negative!==0?i.mod.isub(t):i.mod,a=t.ushrn(1),l=t.andln(1),v=n.cmp(a);return v<0||l===1&&v===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){p(t<=67108863);for(var i=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(i*n+(this.words[a]|0))%t;return n},h.prototype.idivn=function(t){p(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var a=(this.words[n]|0)+i*67108864;this.words[n]=a/t|0,i=a%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=new h(0),m=new h(1),o=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++o;for(var e=n.clone(),u=i.clone();!i.isZero();){for(var M=0,$=1;!(i.words[0]&$)&&M<26;++M,$<<=1);if(M>0)for(i.iushrn(M);M-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(e),l.isub(u)),a.iushrn(1),l.iushrn(1);for(var q=0,I=1;!(n.words[0]&I)&&q<26;++q,I<<=1);if(q>0)for(n.iushrn(q);q-- >0;)(v.isOdd()||m.isOdd())&&(v.iadd(e),m.isub(u)),v.iushrn(1),m.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(v),l.isub(m)):(n.isub(i),v.isub(a),m.isub(l))}return{a:v,b:m,gcd:n.iushln(o)}},h.prototype._invmp=function(t){p(t.negative===0),p(!t.isZero());var i=this,n=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var a=new h(1),l=new h(0),v=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var m=0,o=1;!(i.words[0]&o)&&m<26;++m,o<<=1);if(m>0)for(i.iushrn(m);m-- >0;)a.isOdd()&&a.iadd(v),a.iushrn(1);for(var e=0,u=1;!(n.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(n.iushrn(e);e-- >0;)l.isOdd()&&l.iadd(v),l.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(l)):(n.isub(i),l.isub(a))}var M;return i.cmpn(1)===0?M=a:M=l,M.cmpn(0)<0&&M.iadd(t),M},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),n=t.clone();i.negative=0,n.negative=0;for(var a=0;i.isEven()&&n.isEven();a++)i.iushrn(1),n.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;n.isEven();)n.iushrn(1);var l=i.cmp(n);if(l<0){var v=i;i=n,n=v}else if(l===0||n.cmpn(1)===0)break;i.isub(n)}while(!0);return n.iushln(a)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){p(typeof t=="number");var i=t%26,n=(t-i)/26,a=1<>>26,m&=67108863,this.words[v]=m}return l!==0&&(this.words[v]=l,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var n;if(this.length>1)n=1;else{i&&(t=-t),p(t<=67108863,"Number is too big");var a=this.words[0]|0;n=a===t?0:at.length)return 1;if(this.length=0;n--){var a=this.words[n]|0,l=t.words[n]|0;if(a!==l){al&&(i=1);break}}return i},h.prototype.gtn=function(t){return this.cmpn(t)===1},h.prototype.gt=function(t){return this.cmp(t)===1},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return this.cmpn(t)===-1},h.prototype.lt=function(t){return this.cmp(t)===-1},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return this.cmpn(t)===0},h.prototype.eq=function(t){return this.cmp(t)===0},h.red=function(t){return new Z(t)},h.prototype.toRed=function(t){return p(!this.red,"Already a number in reduction context"),p(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return p(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return p(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return p(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return p(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return p(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return p(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return p(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return p(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return p(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return p(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return p(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return p(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return p(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return p(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var dt={k256:null,p224:null,p192:null,p25519:null};function O(b,t){this.name=b,this.p=new h(t,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,n;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),n=i.bitLength();while(n>this.n);var a=n0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function kt(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}y(kt,O),kt.prototype.split=function(t,i){for(var n=4194303,a=Math.min(t.length,9),l=0;l>>22,v=m}v>>>=22,t.words[l-10]=v,v===0&&t.length>10?t.length-=10:t.length-=9},kt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,n=0;n>>=26,t.words[n]=l,i=a}return i!==0&&(t.words[t.length++]=i),t},h._prime=function(t){if(dt[t])return dt[t];var i;if(t==="k256")i=new kt;else if(t==="p224")i=new Rt;else if(t==="p192")i=new Ct;else if(t==="p25519")i=new qt;else throw new Error("Unknown prime "+t);return dt[t]=i,i};function Z(b){if(typeof b=="string"){var t=h._prime(b);this.m=t.p,this.prime=t}else p(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Z.prototype._verify1=function(t){p(t.negative===0,"red works only with positives"),p(t.red,"red works only with red numbers")},Z.prototype._verify2=function(t,i){p((t.negative|i.negative)===0,"red works only with positives"),p(t.red&&t.red===i.red,"red works only with red numbers")},Z.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Z.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Z.prototype.add=function(t,i){this._verify2(t,i);var n=t.add(i);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},Z.prototype.iadd=function(t,i){this._verify2(t,i);var n=t.iadd(i);return n.cmp(this.m)>=0&&n.isub(this.m),n},Z.prototype.sub=function(t,i){this._verify2(t,i);var n=t.sub(i);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},Z.prototype.isub=function(t,i){this._verify2(t,i);var n=t.isub(i);return n.cmpn(0)<0&&n.iadd(this.m),n},Z.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},Z.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Z.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Z.prototype.isqr=function(t){return this.imul(t,t.clone())},Z.prototype.sqr=function(t){return this.mul(t,t)},Z.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(p(i%2===1),i===3){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var a=this.m.subn(1),l=0;!a.isZero()&&a.andln(1)===0;)l++,a.iushrn(1);p(!a.isZero());var v=new h(1).toRed(this),m=v.redNeg(),o=this.m.subn(1).iushrn(1),e=this.m.bitLength();for(e=new h(2*e*e).toRed(this);this.pow(e,o).cmp(m)!==0;)e.redIAdd(m);for(var u=this.pow(e,a),M=this.pow(t,a.addn(1).iushrn(1)),$=this.pow(t,a),q=l;$.cmp(v)!==0;){for(var I=$,N=0;I.cmp(v)!==0;N++)I=I.redSqr();p(N=0;l--){for(var u=i.words[l],M=e-1;M>=0;M--){var $=u>>M&1;if(v!==a[0]&&(v=this.sqr(v)),$===0&&m===0){o=0;continue}m<<=1,m|=$,o++,!(o!==n&&(l!==0||M!==0))&&(v=this.mul(v,a[m]),o=0,m=0)}e=26}return v},Z.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},Z.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new Pt(t)};function Pt(b){Z.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}y(Pt,Z),Pt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Pt.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Pt.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var n=t.mul(i),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=n.isub(a).iushrn(this.shift),v=l;return l.cmp(this.m)>=0?v=l.isub(this.m):l.cmpn(0)<0&&(v=l.iadd(this.m)),v._forceRed(this)},Pt.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(c,commonjsGlobal)})(bn);var bnExports=bn.exports,BN$2=bnExports,Buffer$3=safeBufferExports$1.Buffer;function withPublic$2(c,d){return Buffer$3.from(c.toRed(BN$2.mont(d.modulus)).redPow(new BN$2(d.publicExponent)).fromRed().toArray())}var withPublic_1=withPublic$2,parseKeys$1=parseAsn1,randomBytes=browserExports,createHash$1=browser$9,mgf$1=mgf$2,xor$1=xor$2,BN$1=bnExports,withPublic$1=withPublic_1,crt$1=browserifyRsa,Buffer$2=safeBufferExports$1.Buffer,publicEncrypt=function c(d,g,p){var y;d.padding?y=d.padding:p?y=1:y=4;var h=parseKeys$1(d),w;if(y===4)w=oaep$1(h,g);else if(y===1)w=pkcs1$1(h,g,p);else if(y===3){if(w=new BN$1(g),w.cmp(h.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return p?crt$1(w,h):withPublic$1(w,h)};function oaep$1(c,d){var g=c.modulus.byteLength(),p=d.length,y=createHash$1("sha1").update(Buffer$2.alloc(0)).digest(),h=y.length,w=2*h;if(p>g-w-2)throw new Error("message too long");var _=Buffer$2.alloc(g-p-w-2),S=g-h-1,A=randomBytes(h),x=xor$1(Buffer$2.concat([y,_,Buffer$2.alloc(1,1),d],S),mgf$1(A,S)),B=xor$1(A,mgf$1(x,h));return new BN$1(Buffer$2.concat([Buffer$2.alloc(1),B,x],g))}function pkcs1$1(c,d,g){var p=d.length,y=c.modulus.byteLength();if(p>y-11)throw new Error("message too long");var h;return g?h=Buffer$2.alloc(y-p-3,255):h=nonZero(y-p-3),new BN$1(Buffer$2.concat([Buffer$2.from([0,g?1:2]),h,Buffer$2.alloc(1),d],y))}function nonZero(c){for(var d=Buffer$2.allocUnsafe(c),g=0,p=randomBytes(c*2),y=0,h;gw||new BN(g).cmp(h.modulus)>=0)throw new Error("decryption error");var _;p?_=withPublic(new BN(g),h):_=crt(g,h);var S=Buffer$1.alloc(w-_.length);if(_=Buffer$1.concat([S,_],w),y===4)return oaep(h,_);if(y===1)return pkcs1(h,_,p);if(y===3)return _;throw new Error("unknown padding")};function oaep(c,d){var g=c.modulus.byteLength(),p=createHash("sha1").update(Buffer$1.alloc(0)).digest(),y=p.length;if(d[0]!==0)throw new Error("decryption error");var h=d.slice(1,y+1),w=d.slice(y+1),_=xor(h,mgf(w,y)),S=xor(w,mgf(_,g-y-1));if(compare(p,S.slice(0,y)))throw new Error("decryption error");for(var A=y;S[A]===0;)A++;if(S[A++]!==1)throw new Error("decryption error");return S.slice(A)}function pkcs1(c,d,g){for(var p=d.slice(0,2),y=2,h=0;d[y++]!==0;)if(y>=d.length){h++;break}var w=d.slice(2,y-1);if((p.toString("hex")!=="0002"&&!g||p.toString("hex")!=="0001"&&g)&&h++,w.length<8&&h++,h)throw new Error("decryption error");return d.slice(y)}function compare(c,d){c=Buffer$1.from(c),d=Buffer$1.from(d);var g=0,p=c.length;c.length!==d.length&&(g++,p=Math.min(c.length,d.length));for(var y=-1;++ykMaxUint32||c<0)throw new TypeError("offset must be a uint32");if(c>kBufferMaxLength||c>d)throw new RangeError("offset out of range")}function assertSize(c,d,g){if(typeof c!="number"||c!==c)throw new TypeError("size must be a number");if(c>kMaxUint32||c<0)throw new TypeError("size must be a uint32");if(c+d>g||c>kBufferMaxLength)throw new RangeError("buffer too small")}crypto&&crypto.getRandomValues||!process$1.browser?(browser.randomFill=randomFill,browser.randomFillSync=randomFillSync):(browser.randomFill=oldBrowser,browser.randomFillSync=oldBrowser);function randomFill(c,d,g,p){if(!Buffer.isBuffer(c)&&!(c instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof d=="function")p=d,d=0,g=c.length;else if(typeof g=="function")p=g,g=c.length-d;else if(typeof p!="function")throw new TypeError('"cb" argument must be a function');return assertOffset(d,c.length),assertSize(g,d,c.length),actualFill(c,d,g,p)}function actualFill(c,d,g,p){if(process$1.browser){var y=c.buffer,h=new Uint8Array(y,d,g);if(crypto.getRandomValues(h),p){process$1.nextTick(function(){p(null,c)});return}return c}if(p){randombytes(g,function(_,S){if(_)return p(_);S.copy(c,d),p(null,c)});return}var w=randombytes(g);return w.copy(c,d),c}function randomFillSync(c,d,g){if(typeof d>"u"&&(d=0),!Buffer.isBuffer(c)&&!(c instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return assertOffset(d,c.length),g===void 0&&(g=c.length-d),assertSize(g,d,c.length),actualFill(c,d,g)}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=browserExports,cryptoBrowserify.createHash=cryptoBrowserify.Hash=browser$9,cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=browser$8;var c=algos,d=Object.keys(c),g=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(d);cryptoBrowserify.getHashes=function(){return g};var p=browser$7;cryptoBrowserify.pbkdf2=p.pbkdf2,cryptoBrowserify.pbkdf2Sync=p.pbkdf2Sync;var y=browser$6;cryptoBrowserify.Cipher=y.Cipher,cryptoBrowserify.createCipher=y.createCipher,cryptoBrowserify.Cipheriv=y.Cipheriv,cryptoBrowserify.createCipheriv=y.createCipheriv,cryptoBrowserify.Decipher=y.Decipher,cryptoBrowserify.createDecipher=y.createDecipher,cryptoBrowserify.Decipheriv=y.Decipheriv,cryptoBrowserify.createDecipheriv=y.createDecipheriv,cryptoBrowserify.getCiphers=y.getCiphers,cryptoBrowserify.listCiphers=y.listCiphers;var h=requireBrowser$2();cryptoBrowserify.DiffieHellmanGroup=h.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=h.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=h.getDiffieHellman,cryptoBrowserify.createDiffieHellman=h.createDiffieHellman,cryptoBrowserify.DiffieHellman=h.DiffieHellman;var w=requireBrowser$1();cryptoBrowserify.createSign=w.createSign,cryptoBrowserify.Sign=w.Sign,cryptoBrowserify.createVerify=w.createVerify,cryptoBrowserify.Verify=w.Verify,cryptoBrowserify.createECDH=requireBrowser();var _=browser$1;cryptoBrowserify.publicEncrypt=_.publicEncrypt,cryptoBrowserify.privateEncrypt=_.privateEncrypt,cryptoBrowserify.publicDecrypt=_.publicDecrypt,cryptoBrowserify.privateDecrypt=_.privateDecrypt;var S=browser;return cryptoBrowserify.randomFill=S.randomFill,cryptoBrowserify.randomFillSync=S.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet -we accept pull requests -https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}requireCryptoBrowserify()});export default ye(); diff --git a/assets/index-tHDsgEDA.css b/assets/index-tHDsgEDA.css new file mode 100644 index 0000000..80b29b3 --- /dev/null +++ b/assets/index-tHDsgEDA.css @@ -0,0 +1 @@ +:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html,body{width:100%;min-height:100vh;background-color:#f5f5f5}body{margin:0;padding:0;color:#213547;background-color:#f5f5f5}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#512da8;color:#fff;cursor:pointer;transition:all .25s}.error-message{color:#f44;background-color:#ffe0e0;padding:10px;border-radius:4px;margin-bottom:16px}.success-message{color:#4caf50;background-color:#e8f5e9;padding:10px;border-radius:4px;margin-bottom:16px}.create-amm-container{max-width:500px;margin:0 auto;padding:20px}.amm-item{border:1px solid #ddd;border-radius:4px;padding:16px;margin-bottom:12px;background-color:#fff}.amm-details{display:flex;justify-content:space-between;margin-bottom:8px}.amm-details:last-child{margin-bottom:0}.amm-label{font-weight:500;color:#666}.amm-value{word-break:break-all}.pool-item{border:1px solid #ddd;border-radius:4px;padding:16px;margin-bottom:12px;background-color:#fff}.pool-details{display:flex;justify-content:space-between;margin-bottom:8px}.pool-details:last-child{margin-bottom:0}.pool-label{font-weight:500;color:#666}.pool-value{word-break:break-all;max-width:70%;text-align:right}.swap-direction{display:flex;gap:8px;margin-bottom:16px}.direction-button{flex:1;padding:8px;border:1px solid #646cff;background:none;color:#646cff;border-radius:4px;cursor:pointer}.direction-button.active{background:#646cff;color:#fff}.pool-actions{display:flex;gap:8px}.pool-list-container{max-width:800px;margin:0 auto;padding:20px}.pool-list{display:flex;flex-direction:column;gap:16px}.pool-item{background:#fff;border-radius:8px;padding:20px;box-shadow:0 2px 4px #0000001a}.pool-details{display:flex;justify-content:space-between;margin-bottom:8px;font-size:14px}.pool-label{color:#666;font-weight:500}.pool-value{color:#333;word-break:break-all;max-width:70%;text-align:right}.pool-actions{display:flex;gap:8px;margin-top:16px}.action-button{flex:1;background-color:#646cff;color:#fff;border:none;padding:8px 16px;border-radius:4px;cursor:pointer;font-size:14px;transition:background-color .2s}.action-button:hover{background-color:#747bff}.action-button:disabled{background-color:#ccc;cursor:not-allowed}.form-container{margin-top:16px;padding-top:16px;border-top:1px solid #eee}.success-message{background-color:#e6ffe6;border:1px solid #b3ffb3;color:green;padding:12px;border-radius:4px;margin-bottom:16px}.success-message a:hover{text-decoration:underline}.error-message{background-color:#ffe6e6;border:1px solid #ffb3b3;color:#c00;padding:12px;border-radius:4px;margin-bottom:16px}.loading{text-align:center;color:#666;padding:20px}.empty-state{text-align:center;color:#666;padding:40px;background:#f9f9f9;border-radius:8px}.form-group input:focus{border-color:#646cff;outline:none}.pool-price-info{margin:16px 0;padding:16px;background-color:#f8f9fa;border-radius:4px}.pool-price-info h4{margin:0 0 12px;color:#333;font-size:14px}.loading-prices{color:#666;font-size:14px;text-align:center;padding:8px 0}.pool-details .pool-value{font-family:monospace}.lending-pool-item{background:#fff;border:1px solid #e0e0e0;border-radius:8px;padding:20px;margin-bottom:20px;box-shadow:0 2px 4px #0000000d}.pool-info-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:20px;margin-bottom:20px}.info-section{background:#f8f9fa;border:1px solid #e9ecef;border-radius:6px;padding:15px}.info-section h4{margin:0 0 15px;color:#343a40;font-size:1rem;font-weight:600}.info-row{margin-bottom:10px}.info-row:last-child{margin-bottom:0}.info-label{display:block;font-size:.875rem;color:#6c757d;margin-bottom:4px}.info-value{display:block;font-weight:500;color:#212529}.pool-actions{display:flex;justify-content:space-between;align-items:center;padding-top:15px;border-top:1px solid #e9ecef}.action-buttons{display:flex;gap:10px}.action-button{padding:8px 16px;border:none;border-radius:4px;background-color:#0d6efd;color:#fff;font-weight:500;cursor:pointer;transition:background-color .2s}.action-button:hover{background-color:#0b5ed7}.refresh-button{padding:6px 12px;border:1px solid #dee2e6;border-radius:4px;background-color:#fff;color:#212529;cursor:pointer;transition:all .2s}.refresh-button:hover:not(:disabled){background-color:#f8f9fa;border-color:#ced4da}.refresh-button:disabled{opacity:.65;cursor:not-allowed}.form-container{margin-top:20px;padding-top:20px;border-top:1px solid #e9ecef}.form-wrapper{background:#fff;border-radius:8px;padding:20px;box-shadow:0 2px 4px #0000001a}.error-message{background-color:#ffe6e6;color:#d63031;padding:10px;border-radius:4px;margin-bottom:15px}.warning-message{background-color:#fff3cd;color:#856404;padding:10px;border-radius:4px;margin:15px 0}.lending-pool-info-summary{background:#f8f9fa;border:1px solid #e9ecef;border-radius:6px;padding:15px;margin:15px 0;font-size:.9rem}.lending-pool-info-summary>div{margin:5px 0;color:#495057}.action-button{width:100%;padding:12px;background-color:#0d6efd;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:1rem;transition:background-color .2s}.action-button:hover:not(:disabled){background-color:#0b5ed7}.action-button:disabled{background-color:#6c757d;cursor:not-allowed}.liquidate-container{max-width:500px;margin:0 auto;padding:20px}.error-message{color:red;margin-bottom:15px;padding:10px;border:1px solid red;border-radius:4px}.success-message a{color:green;margin-left:5px;text-decoration:underline}.input-field{padding:8px;border:1px solid #ccc;border-radius:4px;font-size:16px}.input-field:focus{outline:none;border-color:#4caf50;box-shadow:0 0 0 2px #4caf5033}.submit-button:disabled{background-color:#ccc;cursor:not-allowed}.submit-button:hover:not(:disabled){background-color:#45a049}*{margin:0;padding:0;box-sizing:border-box}.container{min-height:100vh;width:100%;background-color:#f5f5f5;display:flex;flex-direction:column}.navbar{width:100%;background-color:#fff;padding:1rem 0;box-shadow:0 2px 4px #0000001a}.navbar-content{width:100%;max-width:1200px;margin:0 auto;display:flex;justify-content:space-between;align-items:center;padding:0 2rem}.main-content{width:100%;flex:1;padding:2rem;display:flex;flex-direction:column;align-items:center}.defi-dashboard{width:100%;max-width:1200px;background:#fff;border-radius:8px;padding:2rem;margin:20px auto;box-shadow:0 2px 4px #0000001a}.tabs{display:flex;gap:10px;margin-bottom:20px;justify-content:center}.form{max-width:400px;margin:0 auto;padding:0 20px;display:flex;flex-direction:column;gap:15px}.connect-prompt{text-align:center;margin-top:5rem}.title{font-size:1.5rem;font-weight:700;color:#333}.form-group{margin-bottom:20px;display:flex;flex-direction:column;gap:5px}.form-group label{display:block;margin-bottom:8px;color:#666}.form-group input{width:100%;padding:10px;border:1px solid #ddd;border-radius:4px;font-size:16px}.submit-button{width:100%;padding:12px;background:#512da8;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background-color .2s;font-size:16px}.submit-button:hover{background:#4527a0}#root{width:100%;display:flex;flex-direction:column;min-height:100vh}.solana-network-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#1c1c1c;border:1px solid #383838;border-radius:12px;padding:8px 36px 8px 12px;font-size:14px;font-weight:500;color:#fff;cursor:pointer;transition:all .2s ease;min-width:160px;height:40px}.solana-network-select:hover{border-color:#4e44ce;background-color:#232323}.solana-network-select:focus{outline:none;border-color:#9945ff;box-shadow:0 0 0 2px #9945ff1a}.solana-network-status{display:flex;align-items:center;gap:12px;padding:12px 16px;background-color:#1c1c1c;border-radius:12px;border:1px solid #383838;margin-bottom:16px}.solana-network-label{font-size:14px;font-weight:500;color:#777}.solana-network-value{font-size:14px;font-weight:600;color:#fff;padding:4px 12px;background-color:#232323;border-radius:8px;border:1px solid #383838}.solana-network-value[data-network=mainnet-beta]{color:#14f195}.solana-network-value[data-network=devnet]{color:#9945ff}.solana-network-value[data-network=testnet]{color:#00c2ff}.solana-network-value[data-network=localnet]{color:#f6c343}.solana-content{max-width:1200px;margin:0 auto;padding:24px}.wallet-adapter-button{height:40px!important;padding:0 16px!important;border-radius:12px!important;background-color:#4e44ce!important;transition:all .2s ease!important}.wallet-adapter-button:hover{background-color:#5a50d8!important}.navbar-content{width:100%;max-width:1200px;margin:0 auto;padding:0 2rem;display:flex;justify-content:space-between;align-items:center;height:64px}.solana-network-select-container{align-items:center;position:relative;display:inline-block}.solana-network-select-container:after{content:"";position:absolute;right:12px;top:50%;transform:translateY(-50%);width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #FFFFFF;pointer-events:none}.action-button:hover,.lending-pool-action-button:hover,.lending-pool-refresh-button:hover{background-color:#45a049;transform:translateY(-2px);box-shadow:0 2px 5px #0003;border-color:transparent}.pool-actions,.lending-pool-actions{display:flex;gap:10px;margin:15px 0;flex-wrap:wrap;justify-content:center}.lending-pool-action-buttons{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;width:100%}.action-button[onClick*=initPool]{background-color:#9c27b0}.action-button[onClick*=deposit]{background-color:#2196f3}.action-button[onClick*=swap]{background-color:#ff9800}.lending-pool-action-button[onClick*=lend]{background-color:#514caf}.lending-pool-action-button[onClick*=borrow]{background-color:#f44336}.lending-pool-action-button[onClick*=repay]{background-color:#795548}.lending-pool-action-button[onClick*=depositCollateral]{background-color:#607d8b}.lending-pool-refresh-button{background-color:#6e21f3}.lending-pool-refresh-button:hover{background-color:#7919d2}.action-button,.lending-pool-action-button,.lending-pool-refresh-button{background-color:#512da8;color:#fff;padding:10px 20px;border:none;border-radius:5px;cursor:pointer;font-size:14px;margin:5px;transition:all .3s ease;width:auto}.action-button:disabled,.lending-pool-action-button:disabled,.lending-pool-refresh-button:disabled{background-color:#ccc;cursor:not-allowed;transform:none;box-shadow:none;opacity:.7}.form-container{background-color:#f5f5f5;padding:15px;border-radius:8px;margin:10px 0;box-shadow:0 2px 4px #0000001a} diff --git a/assets/util-1Y60FSNK.js b/assets/util-1Y60FSNK.js deleted file mode 100644 index d1d3829..0000000 --- a/assets/util-1Y60FSNK.js +++ /dev/null @@ -1,10 +0,0 @@ -var Gr={exports:{}};typeof Object.create=="function"?Gr.exports=function(r,t){t&&(r.super_=t,r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:Gr.exports=function(r,t){if(t){r.super_=t;var a=function(){};a.prototype=t.prototype,r.prototype=new a,r.prototype.constructor=r}};var ke=Gr.exports;function Me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pe={exports:{}},A=pe.exports={},U,D;function Wr(){throw new Error("setTimeout has not been defined")}function zr(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?U=setTimeout:U=Wr}catch{U=Wr}try{typeof clearTimeout=="function"?D=clearTimeout:D=zr}catch{D=zr}})();function ge(e){if(U===setTimeout)return setTimeout(e,0);if((U===Wr||!U)&&setTimeout)return U=setTimeout,setTimeout(e,0);try{return U(e,0)}catch{try{return U.call(null,e,0)}catch{return U.call(this,e,0)}}}function Ce(e){if(D===clearTimeout)return clearTimeout(e);if((D===zr||!D)&&clearTimeout)return D=clearTimeout,clearTimeout(e);try{return D(e)}catch{try{return D.call(null,e)}catch{return D.call(this,e)}}}var _=[],tr=!1,z,br=-1;function Ne(){!tr||!z||(tr=!1,z.length?_=z.concat(_):br=-1,_.length&&de())}function de(){if(!tr){var e=ge(Ne);tr=!0;for(var r=_.length;r;){for(z=_,_=[];++br1)for(var t=1;t"u"||!S?l:S(Uint8Array),L={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?l:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?l:ArrayBuffer,"%ArrayIteratorPrototype%":X&&S?S([][Symbol.iterator]()):l,"%AsyncFromSyncIteratorPrototype%":l,"%AsyncFunction%":rr,"%AsyncGenerator%":rr,"%AsyncGeneratorFunction%":rr,"%AsyncIteratorPrototype%":rr,"%Atomics%":typeof Atomics>"u"?l:Atomics,"%BigInt%":typeof BigInt>"u"?l:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?l:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?l:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?l:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":yt,"%eval%":eval,"%EvalError%":st,"%Float32Array%":typeof Float32Array>"u"?l:Float32Array,"%Float64Array%":typeof Float64Array>"u"?l:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?l:FinalizationRegistry,"%Function%":Ae,"%GeneratorFunction%":rr,"%Int8Array%":typeof Int8Array>"u"?l:Int8Array,"%Int16Array%":typeof Int16Array>"u"?l:Int16Array,"%Int32Array%":typeof Int32Array>"u"?l:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":X&&S?S(S([][Symbol.iterator]())):l,"%JSON%":typeof JSON=="object"?JSON:l,"%Map%":typeof Map>"u"?l:Map,"%MapIteratorPrototype%":typeof Map>"u"||!X||!S?l:S(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?l:Promise,"%Proxy%":typeof Proxy>"u"?l:Proxy,"%RangeError%":lt,"%ReferenceError%":pt,"%Reflect%":typeof Reflect>"u"?l:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?l:Set,"%SetIteratorPrototype%":typeof Set>"u"||!X||!S?l:S(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?l:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":X&&S?S(""[Symbol.iterator]()):l,"%Symbol%":X?Symbol:l,"%SyntaxError%":or,"%ThrowTypeError%":dt,"%TypedArray%":vt,"%TypeError%":nr,"%Uint8Array%":typeof Uint8Array>"u"?l:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?l:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?l:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?l:Uint32Array,"%URIError%":gt,"%WeakMap%":typeof WeakMap>"u"?l:WeakMap,"%WeakRef%":typeof WeakRef>"u"?l:WeakRef,"%WeakSet%":typeof WeakSet>"u"?l:WeakSet};if(S)try{null.error}catch(e){var mt=S(S(e));L["%Error.prototype%"]=mt}var ht=function e(r){var t;if(r==="%AsyncFunction%")t=Ur("async function () {}");else if(r==="%GeneratorFunction%")t=Ur("function* () {}");else if(r==="%AsyncGeneratorFunction%")t=Ur("async function* () {}");else if(r==="%AsyncGenerator%"){var a=e("%AsyncGeneratorFunction%");a&&(t=a.prototype)}else if(r==="%AsyncIteratorPrototype%"){var u=e("%AsyncGenerator%");u&&S&&(t=S(u.prototype))}return L[r]=t,t},ne={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ur=Yr,Sr=ct,At=ur.call(Function.call,Array.prototype.concat),St=ur.call(Function.apply,Array.prototype.splice),oe=ur.call(Function.call,String.prototype.replace),wr=ur.call(Function.call,String.prototype.slice),wt=ur.call(Function.call,RegExp.prototype.exec),Ot=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Pt=/\\(\\)?/g,jt=function(r){var t=wr(r,0,1),a=wr(r,-1);if(t==="%"&&a!=="%")throw new or("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&t!=="%")throw new or("invalid intrinsic syntax, expected opening `%`");var u=[];return oe(r,Ot,function(c,b,p,g){u[u.length]=p?oe(g,Pt,"$1"):b||c}),u},Et=function(r,t){var a=r,u;if(Sr(ne,a)&&(u=ne[a],a="%"+u[0]+"%"),Sr(L,a)){var c=L[a];if(c===rr&&(c=ht(a)),typeof c>"u"&&!t)throw new nr("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:u,name:a,value:c}}throw new or("intrinsic "+r+" does not exist!")},cr=function(r,t){if(typeof r!="string"||r.length===0)throw new nr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new nr('"allowMissing" argument must be a boolean');if(wt(/^%?[^%]*%?$/,r)===null)throw new or("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=jt(r),u=a.length>0?a[0]:"",c=Et("%"+u+"%",t),b=c.name,p=c.value,g=!1,E=c.alias;E&&(u=E[0],St(a,At([0,1],E)));for(var w=1,j=!0;w=a.length){var B=V(p,O);j=!!B,j&&"get"in B&&!("originalValue"in B.get)?p=B.get:p=p[O]}else j=Sr(p,O),p=p[O];j&&!g&&(L[b]=p)}}return p},Se={exports:{}},Rr,ie;function Kr(){if(ie)return Rr;ie=1;var e=cr,r=e("%Object.defineProperty%",!0)||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return Rr=r,Rr}var Tt=cr,vr=Tt("%Object.getOwnPropertyDescriptor%",!0);if(vr)try{vr([],"length")}catch{vr=null}var Xr=vr,ae=Kr(),Ft=he,x=jr,fe=Xr,It=function(r,t,a){if(!r||typeof r!="object"&&typeof r!="function")throw new x("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new x("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new x("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new x("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new x("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new x("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,b=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,g=!!fe&&fe(r,t);if(ae)ae(r,t,{configurable:b===null&&g?g.configurable:!b,enumerable:u===null&&g?g.enumerable:!u,value:a,writable:c===null&&g?g.writable:!c});else if(p||!u&&!c&&!b)r[t]=a;else throw new Ft("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Vr=Kr(),we=function(){return!!Vr};we.hasArrayLengthDefineBug=function(){if(!Vr)return null;try{return Vr([],"length",{value:1}).length!==1}catch{return!0}};var Bt=we,$t=cr,ue=It,Ut=Bt(),ce=Xr,ye=jr,Dt=$t("%Math.floor%"),Rt=function(r,t){if(typeof r!="function")throw new ye("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Dt(t)!==t)throw new ye("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],u=!0,c=!0;if("length"in r&&ce){var b=ce(r,"length");b&&!b.configurable&&(u=!1),b&&!b.writable&&(c=!1)}return(u||c||!a)&&(Ut?ue(r,"length",t,!0,!0):ue(r,"length",t)),r};(function(e){var r=Yr,t=cr,a=Rt,u=jr,c=t("%Function.prototype.apply%"),b=t("%Function.prototype.call%"),p=t("%Reflect.apply%",!0)||r.call(b,c),g=Kr(),E=t("%Math.max%");e.exports=function(O){if(typeof O!="function")throw new u("a function is required");var T=p(r,b,arguments);return a(T,1+E(0,O.length-(arguments.length-1)),!0)};var w=function(){return p(r,c,arguments)};g?g(e.exports,"apply",{value:w}):e.exports.apply=w})(Se);var Oe=Se.exports,Pe=cr,je=Oe,_t=je(Pe("String.prototype.indexOf")),Ee=function(r,t){var a=Pe(r,!!t);return typeof a=="function"&&_t(r,".prototype.")>-1?je(a):a},kt=Zr(),Mt=Ee,Lr=Mt("Object.prototype.toString"),Er=function(r){return kt&&r&&typeof r=="object"&&Symbol.toStringTag in r?!1:Lr(r)==="[object Arguments]"},Te=function(r){return Er(r)?!0:r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&Lr(r)!=="[object Array]"&&Lr(r.callee)==="[object Function]"},Ct=function(){return Er(arguments)}();Er.isLegacyArguments=Te;var Nt=Ct?Er:Te,Gt=Object.prototype.toString,Wt=Function.prototype.toString,zt=/^\s*(?:function)?\*/,Fe=Zr(),_r=Object.getPrototypeOf,Vt=function(){if(!Fe)return!1;try{return Function("return function*() {}")()}catch{}},kr,Lt=function(r){if(typeof r!="function")return!1;if(zt.test(Wt.call(r)))return!0;if(!Fe){var t=Gt.call(r);return t==="[object GeneratorFunction]"}if(!_r)return!1;if(typeof kr>"u"){var a=Vt();kr=a?_r(a):!1}return _r(r)===kr},Ie=Function.prototype.toString,er=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Jr,mr;if(typeof er=="function"&&typeof Object.defineProperty=="function")try{Jr=Object.defineProperty({},"length",{get:function(){throw mr}}),mr={},er(function(){throw 42},null,Jr)}catch(e){e!==mr&&(er=null)}else er=null;var Jt=/^\s*class\b/,Hr=function(r){try{var t=Ie.call(r);return Jt.test(t)}catch{return!1}},Mr=function(r){try{return Hr(r)?!1:(Ie.call(r),!0)}catch{return!1}},hr=Object.prototype.toString,Ht="[object Object]",qt="[object Function]",Qt="[object GeneratorFunction]",Zt="[object HTMLAllCollection]",Yt="[object HTML document.all class]",Kt="[object HTMLCollection]",Xt=typeof Symbol=="function"&&!!Symbol.toStringTag,xt=!(0 in[,]),qr=function(){return!1};if(typeof document=="object"){var rn=document.all;hr.call(rn)===hr.call(document.all)&&(qr=function(r){if((xt||!r)&&(typeof r>"u"||typeof r=="object"))try{var t=hr.call(r);return(t===Zt||t===Yt||t===Kt||t===Ht)&&r("")==null}catch{}return!1})}var en=er?function(r){if(qr(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;try{er(r,null,Jr)}catch(t){if(t!==mr)return!1}return!Hr(r)&&Mr(r)}:function(r){if(qr(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;if(Xt)return Mr(r);if(Hr(r))return!1;var t=hr.call(r);return t!==qt&&t!==Qt&&!/^\[object HTML/.test(t)?!1:Mr(r)},tn=en,nn=Object.prototype.toString,Be=Object.prototype.hasOwnProperty,on=function(r,t,a){for(var u=0,c=r.length;u=3&&(u=a),nn.call(r)==="[object Array]"?on(r,t,u):typeof r=="string"?an(r,t,u):fn(r,t,u)},cn=un,yn=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Cr=yn,sn=globalThis,ln=function(){for(var r=[],t=0;t-1?t:t!=="Object"?!1:vn(r)}return Ar?bn(r):null},mn=Ue,hn=function(r){return!!mn(r)};(function(e){var r=Nt,t=Lt,a=Ue,u=hn;function c(i){return i.call.bind(i)}var b=typeof BigInt<"u",p=typeof Symbol<"u",g=c(Object.prototype.toString),E=c(Number.prototype.valueOf),w=c(String.prototype.valueOf),j=c(Boolean.prototype.valueOf);if(b)var O=c(BigInt.prototype.valueOf);if(p)var T=c(Symbol.prototype.valueOf);function F(i,_e){if(typeof i!="object")return!1;try{return _e(i),!0}catch{return!1}}e.isArgumentsObject=r,e.isGeneratorFunction=t,e.isTypedArray=u;function B(i){return typeof Promise<"u"&&i instanceof Promise||i!==null&&typeof i=="object"&&typeof i.then=="function"&&typeof i.catch=="function"}e.isPromise=B;function Tr(i){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(i):u(i)||n(i)}e.isArrayBufferView=Tr;function yr(i){return a(i)==="Uint8Array"}e.isUint8Array=yr;function ir(i){return a(i)==="Uint8ClampedArray"}e.isUint8ClampedArray=ir;function J(i){return a(i)==="Uint16Array"}e.isUint16Array=J;function Fr(i){return a(i)==="Uint32Array"}e.isUint32Array=Fr;function sr(i){return a(i)==="Int8Array"}e.isInt8Array=sr;function H(i){return a(i)==="Int16Array"}e.isInt16Array=H;function Ir(i){return a(i)==="Int32Array"}e.isInt32Array=Ir;function R(i){return a(i)==="Float32Array"}e.isFloat32Array=R;function G(i){return a(i)==="Float64Array"}e.isFloat64Array=G;function M(i){return a(i)==="BigInt64Array"}e.isBigInt64Array=M;function q(i){return a(i)==="BigUint64Array"}e.isBigUint64Array=q;function $(i){return g(i)==="[object Map]"}$.working=typeof Map<"u"&&$(new Map);function Q(i){return typeof Map>"u"?!1:$.working?$(i):i instanceof Map}e.isMap=Q;function Z(i){return g(i)==="[object Set]"}Z.working=typeof Set<"u"&&Z(new Set);function ar(i){return typeof Set>"u"?!1:Z.working?Z(i):i instanceof Set}e.isSet=ar;function C(i){return g(i)==="[object WeakMap]"}C.working=typeof WeakMap<"u"&&C(new WeakMap);function Br(i){return typeof WeakMap>"u"?!1:C.working?C(i):i instanceof WeakMap}e.isWeakMap=Br;function fr(i){return g(i)==="[object WeakSet]"}fr.working=typeof WeakSet<"u"&&fr(new WeakSet);function lr(i){return fr(i)}e.isWeakSet=lr;function I(i){return g(i)==="[object ArrayBuffer]"}I.working=typeof ArrayBuffer<"u"&&I(new ArrayBuffer);function pr(i){return typeof ArrayBuffer>"u"?!1:I.working?I(i):i instanceof ArrayBuffer}e.isArrayBuffer=pr;function Y(i){return g(i)==="[object DataView]"}Y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Y(new DataView(new ArrayBuffer(1),0,1));function n(i){return typeof DataView>"u"?!1:Y.working?Y(i):i instanceof DataView}e.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function f(i){return g(i)==="[object SharedArrayBuffer]"}function y(i){return typeof o>"u"?!1:(typeof f.working>"u"&&(f.working=f(new o)),f.working?f(i):i instanceof o)}e.isSharedArrayBuffer=y;function v(i){return g(i)==="[object AsyncFunction]"}e.isAsyncFunction=v;function m(i){return g(i)==="[object Map Iterator]"}e.isMapIterator=m;function s(i){return g(i)==="[object Set Iterator]"}e.isSetIterator=s;function d(i){return g(i)==="[object Generator]"}e.isGeneratorObject=d;function h(i){return g(i)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=h;function P(i){return F(i,E)}e.isNumberObject=P;function W(i){return F(i,w)}e.isStringObject=W;function gr(i){return F(i,j)}e.isBooleanObject=gr;function K(i){return b&&F(i,O)}e.isBigIntObject=K;function dr(i){return p&&F(i,T)}e.isSymbolObject=dr;function De(i){return P(i)||W(i)||gr(i)||K(i)||dr(i)}e.isBoxedPrimitive=De;function Re(i){return typeof Uint8Array<"u"&&(pr(i)||y(i))}e.isAnyArrayBuffer=Re,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(i){Object.defineProperty(e,i,{enumerable:!1,value:function(){throw new Error(i+" is not supported in userland")}})})})(ve);var An=function(r){return r&&typeof r=="object"&&typeof r.copy=="function"&&typeof r.fill=="function"&&typeof r.readUInt8=="function"};(function(e){var r={},t=Object.getOwnPropertyDescriptors||function(o){for(var f=Object.keys(o),y={},v=0;v=v)return d;switch(d){case"%s":return String(y[f++]);case"%d":return Number(y[f++]);case"%j":try{return JSON.stringify(y[f++])}catch{return"[Circular]"}default:return d}}),s=y[f];f"u")return function(){return e.deprecate(n,o).apply(this,arguments)};var f=!1;function y(){if(!f){if(N.throwDeprecation)throw new Error(o);N.traceDeprecation?console.trace(o):console.error(o),f=!0}return n.apply(this,arguments)}return y};var u={},c=/^$/;if(r.NODE_DEBUG){var b=r.NODE_DEBUG;b=b.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),c=new RegExp("^"+b+"$","i")}e.debuglog=function(n){if(n=n.toUpperCase(),!u[n])if(c.test(n)){var o=N.pid;u[n]=function(){var f=e.format.apply(e,arguments);console.error("%s %d: %s",n,o,f)}}else u[n]=function(){};return u[n]};function p(n,o){var f={seen:[],stylize:E};return arguments.length>=3&&(f.depth=arguments[2]),arguments.length>=4&&(f.colors=arguments[3]),ir(o)?f.showHidden=o:o&&e._extend(f,o),R(f.showHidden)&&(f.showHidden=!1),R(f.depth)&&(f.depth=2),R(f.colors)&&(f.colors=!1),R(f.customInspect)&&(f.customInspect=!0),f.colors&&(f.stylize=g),j(f,n,f.depth)}e.inspect=p,p.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},p.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function g(n,o){var f=p.styles[o];return f?"\x1B["+p.colors[f][0]+"m"+n+"\x1B["+p.colors[f][1]+"m":n}function E(n,o){return n}function w(n){var o={};return n.forEach(function(f,y){o[f]=!0}),o}function j(n,o,f){if(n.customInspect&&o&&Q(o.inspect)&&o.inspect!==e.inspect&&!(o.constructor&&o.constructor.prototype===o)){var y=o.inspect(f,n);return H(y)||(y=j(n,y,f)),y}var v=O(n,o);if(v)return v;var m=Object.keys(o),s=w(m);if(n.showHidden&&(m=Object.getOwnPropertyNames(o)),$(o)&&(m.indexOf("message")>=0||m.indexOf("description")>=0))return T(o);if(m.length===0){if(Q(o)){var d=o.name?": "+o.name:"";return n.stylize("[Function"+d+"]","special")}if(G(o))return n.stylize(RegExp.prototype.toString.call(o),"regexp");if(q(o))return n.stylize(Date.prototype.toString.call(o),"date");if($(o))return T(o)}var h="",P=!1,W=["{","}"];if(yr(o)&&(P=!0,W=["[","]"]),Q(o)){var gr=o.name?": "+o.name:"";h=" [Function"+gr+"]"}if(G(o)&&(h=" "+RegExp.prototype.toString.call(o)),q(o)&&(h=" "+Date.prototype.toUTCString.call(o)),$(o)&&(h=" "+T(o)),m.length===0&&(!P||o.length==0))return W[0]+h+W[1];if(f<0)return G(o)?n.stylize(RegExp.prototype.toString.call(o),"regexp"):n.stylize("[Object]","special");n.seen.push(o);var K;return P?K=F(n,o,f,s,m):K=m.map(function(dr){return B(n,o,f,s,dr,P)}),n.seen.pop(),Tr(K,h,W)}function O(n,o){if(R(o))return n.stylize("undefined","undefined");if(H(o)){var f="'"+JSON.stringify(o).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return n.stylize(f,"string")}if(sr(o))return n.stylize(""+o,"number");if(ir(o))return n.stylize(""+o,"boolean");if(J(o))return n.stylize("null","null")}function T(n){return"["+Error.prototype.toString.call(n)+"]"}function F(n,o,f,y,v){for(var m=[],s=0,d=o.length;s-1&&(m?d=d.split(` -`).map(function(P){return" "+P}).join(` -`).slice(2):d=` -`+d.split(` -`).map(function(P){return" "+P}).join(` -`))):d=n.stylize("[Circular]","special")),R(s)){if(m&&v.match(/^\d+$/))return d;s=JSON.stringify(""+v),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.slice(1,-1),s=n.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=n.stylize(s,"string"))}return s+": "+d}function Tr(n,o,f){var y=n.reduce(function(v,m){return m.indexOf(` -`)>=0,v+m.replace(/\u001b\[\d\d?m/g,"").length+1},0);return y>60?f[0]+(o===""?"":o+` - `)+" "+n.join(`, - `)+" "+f[1]:f[0]+o+" "+n.join(", ")+" "+f[1]}e.types=ve;function yr(n){return Array.isArray(n)}e.isArray=yr;function ir(n){return typeof n=="boolean"}e.isBoolean=ir;function J(n){return n===null}e.isNull=J;function Fr(n){return n==null}e.isNullOrUndefined=Fr;function sr(n){return typeof n=="number"}e.isNumber=sr;function H(n){return typeof n=="string"}e.isString=H;function Ir(n){return typeof n=="symbol"}e.isSymbol=Ir;function R(n){return n===void 0}e.isUndefined=R;function G(n){return M(n)&&ar(n)==="[object RegExp]"}e.isRegExp=G,e.types.isRegExp=G;function M(n){return typeof n=="object"&&n!==null}e.isObject=M;function q(n){return M(n)&&ar(n)==="[object Date]"}e.isDate=q,e.types.isDate=q;function $(n){return M(n)&&(ar(n)==="[object Error]"||n instanceof Error)}e.isError=$,e.types.isNativeError=$;function Q(n){return typeof n=="function"}e.isFunction=Q;function Z(n){return n===null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||typeof n=="symbol"||typeof n>"u"}e.isPrimitive=Z,e.isBuffer=An;function ar(n){return Object.prototype.toString.call(n)}function C(n){return n<10?"0"+n.toString(10):n.toString(10)}var Br=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fr(){var n=new Date,o=[C(n.getHours()),C(n.getMinutes()),C(n.getSeconds())].join(":");return[n.getDate(),Br[n.getMonth()],o].join(" ")}e.log=function(){console.log("%s - %s",fr(),e.format.apply(e,arguments))},e.inherits=ke,e._extend=function(n,o){if(!o||!M(o))return n;for(var f=Object.keys(o),y=f.length;y--;)n[f[y]]=o[f[y]];return n};function lr(n,o){return Object.prototype.hasOwnProperty.call(n,o)}var I=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(o){if(typeof o!="function")throw new TypeError('The "original" argument must be of type Function');if(I&&o[I]){var f=o[I];if(typeof f!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(f,I,{value:f,enumerable:!1,writable:!1,configurable:!0}),f}function f(){for(var y,v,m=new Promise(function(h,P){y=h,v=P}),s=[],d=0;de in o?cn(o,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[e]=a;var nn=(o,e,a)=>hn(o,typeof e!="symbol"?e+"":e,a);var commonjsGlobal$2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function getDefaultExportFromCjs$3(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function getAugmentedNamespace(o){if(o.__esModule)return o;var e=o.default;if(typeof e=="function"){var a=function c(){return this instanceof c?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};a.prototype=e.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(o).forEach(function(c){var d=Object.getOwnPropertyDescriptor(o,c);Object.defineProperty(a,c,d.get?d:{enumerable:!0,get:function(){return o[c]}})}),a}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var l$1=Symbol.for("react.element"),n$1=Symbol.for("react.portal"),p$2=Symbol.for("react.fragment"),q$1=Symbol.for("react.strict_mode"),r$1=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v$1=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z$1=Symbol.iterator;function A$1(o){return o===null||typeof o!="object"?null:(o=z$1&&o[z$1]||o["@@iterator"],typeof o=="function"?o:null)}var B$1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C$1=Object.assign,D$1={};function E$1(o,e,a){this.props=o,this.context=e,this.refs=D$1,this.updater=a||B$1}E$1.prototype.isReactComponent={};E$1.prototype.setState=function(o,e){if(typeof o!="object"&&typeof o!="function"&&o!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,o,e,"setState")};E$1.prototype.forceUpdate=function(o){this.updater.enqueueForceUpdate(this,o,"forceUpdate")};function F(){}F.prototype=E$1.prototype;function G$2(o,e,a){this.props=o,this.context=e,this.refs=D$1,this.updater=a||B$1}var H$1=G$2.prototype=new F;H$1.constructor=G$2;C$1(H$1,E$1.prototype);H$1.isPureReactComponent=!0;var I$1=Array.isArray,J=Object.prototype.hasOwnProperty,K$6={current:null},L$1={key:!0,ref:!0,__self:!0,__source:!0};function M$1(o,e,a){var c,d={},h=null,j=null;if(e!=null)for(c in e.ref!==void 0&&(j=e.ref),e.key!==void 0&&(h=""+e.key),e)J.call(e,c)&&!L$1.hasOwnProperty(c)&&(d[c]=e[c]);var et=arguments.length-2;if(et===1)d.children=a;else if(1>>1,yt=lt[it];if(0>>1;itd(Tt,_))Mtd(At,Tt)?(lt[it]=At,lt[Mt]=_,it=Mt):(lt[it]=Tt,lt[Rt]=_,it=Rt);else if(Mtd(At,_))lt[it]=At,lt[Mt]=_,it=Mt;else break e}}return tt}function d(lt,tt){var _=lt.sortIndex-tt.sortIndex;return _!==0?_:lt.id-tt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;o.unstable_now=function(){return h.now()}}else{var j=Date,et=j.now();o.unstable_now=function(){return j.now()-et}}var nt=[],st=[],ot=1,ht=null,pt=3,dt=!1,gt=!1,wt=!1,St=typeof setTimeout=="function"?setTimeout:null,_t=typeof clearTimeout=="function"?clearTimeout:null,mt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function bt(lt){for(var tt=a(st);tt!==null;){if(tt.callback===null)c(st);else if(tt.startTime<=lt)c(st),tt.sortIndex=tt.expirationTime,e(nt,tt);else break;tt=a(st)}}function $t(lt){if(wt=!1,bt(lt),!gt)if(a(nt)!==null)gt=!0,rt(Bt);else{var tt=a(st);tt!==null&&at($t,tt.startTime-lt)}}function Bt(lt,tt){gt=!1,wt&&(wt=!1,_t(qt),qt=-1),dt=!0;var _=pt;try{for(bt(tt),ht=a(nt);ht!==null&&(!(ht.expirationTime>tt)||lt&&!ct());){var it=ht.callback;if(typeof it=="function"){ht.callback=null,pt=ht.priorityLevel;var yt=it(ht.expirationTime<=tt);tt=o.unstable_now(),typeof yt=="function"?ht.callback=yt:ht===a(nt)&&c(nt),bt(tt)}else c(nt);ht=a(nt)}if(ht!==null)var vt=!0;else{var Rt=a(st);Rt!==null&&at($t,Rt.startTime-tt),vt=!1}return vt}finally{ht=null,pt=_,dt=!1}}var Dt=!1,Ht=null,qt=-1,Pt=5,Gt=-1;function ct(){return!(o.unstable_now()-Gtlt||125it?(lt.sortIndex=_,e(st,lt),a(nt)===null&<===a(st)&&(wt?(_t(qt),qt=-1):wt=!0,at($t,_-it))):(lt.sortIndex=yt,e(nt,lt),gt||dt||(gt=!0,rt(Bt))),lt},o.unstable_shouldYield=ct,o.unstable_wrapCallback=function(lt){var tt=pt;return function(){var _=pt;pt=tt;try{return lt.apply(this,arguments)}finally{pt=_}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var aa=reactExports,ca=schedulerExports;function p(o){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+o,a=1;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ja=Object.prototype.hasOwnProperty,ka=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,la={},ma={};function oa(o){return ja.call(ma,o)?!0:ja.call(la,o)?!1:ka.test(o)?ma[o]=!0:(la[o]=!0,!1)}function pa(o,e,a,c){if(a!==null&&a.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return c?!1:a!==null?!a.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function qa(o,e,a,c){if(e===null||typeof e>"u"||pa(o,e,a,c))return!0;if(c)return!1;if(a!==null)switch(a.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function v(o,e,a,c,d,h,j){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=c,this.attributeNamespace=d,this.mustUseProperty=a,this.propertyName=o,this.type=e,this.sanitizeURL=h,this.removeEmptyString=j}var z={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){z[o]=new v(o,0,!1,o,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var e=o[0];z[e]=new v(e,1,!1,o[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(o){z[o]=new v(o,2,!1,o.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){z[o]=new v(o,2,!1,o,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){z[o]=new v(o,3,!1,o.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(o){z[o]=new v(o,3,!0,o,null,!1,!1)});["capture","download"].forEach(function(o){z[o]=new v(o,4,!1,o,null,!1,!1)});["cols","rows","size","span"].forEach(function(o){z[o]=new v(o,6,!1,o,null,!1,!1)});["rowSpan","start"].forEach(function(o){z[o]=new v(o,5,!1,o.toLowerCase(),null,!1,!1)});var ra=/[\-:]([a-z])/g;function sa(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var e=o.replace(ra,sa);z[e]=new v(e,1,!1,o,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var e=o.replace(ra,sa);z[e]=new v(e,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(o){var e=o.replace(ra,sa);z[e]=new v(e,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(o){z[o]=new v(o,1,!1,o.toLowerCase(),null,!1,!1)});z.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(o){z[o]=new v(o,1,!1,o.toLowerCase(),null,!0,!0)});function ta(o,e,a,c){var d=z.hasOwnProperty(e)?z[e]:null;(d!==null?d.type!==0:c||!(2et||d[j]!==h[et]){var nt=` +`+d[j].replace(" at new "," at ");return o.displayName&&nt.includes("")&&(nt=nt.replace("",o.displayName)),nt}while(1<=j&&0<=et);break}}}finally{Na=!1,Error.prepareStackTrace=a}return(o=o?o.displayName||o.name:"")?Ma(o):""}function Pa(o){switch(o.tag){case 5:return Ma(o.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return o=Oa(o.type,!1),o;case 11:return o=Oa(o.type.render,!1),o;case 1:return o=Oa(o.type,!0),o;default:return""}}function Qa(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case Ca:return(o.displayName||"Context")+".Consumer";case Ba:return(o._context.displayName||"Context")+".Provider";case Da:var e=o.render;return o=o.displayName,o||(o=e.displayName||e.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case Ga:return e=o.displayName||null,e!==null?e:Qa(o.type)||"Memo";case Ha:e=o._payload,o=o._init;try{return Qa(o(e))}catch{}}return null}function Ra(o){var e=o.type;switch(o.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=e.render,o=o.displayName||o.name||"",e.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(e);case 8:return e===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Sa(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ta(o){var e=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Ua(o){var e=Ta(o)?"checked":"value",a=Object.getOwnPropertyDescriptor(o.constructor.prototype,e),c=""+o[e];if(!o.hasOwnProperty(e)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var d=a.get,h=a.set;return Object.defineProperty(o,e,{configurable:!0,get:function(){return d.call(this)},set:function(j){c=""+j,h.call(this,j)}}),Object.defineProperty(o,e,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(j){c=""+j},stopTracking:function(){o._valueTracker=null,delete o[e]}}}}function Va(o){o._valueTracker||(o._valueTracker=Ua(o))}function Wa(o){if(!o)return!1;var e=o._valueTracker;if(!e)return!0;var a=e.getValue(),c="";return o&&(c=Ta(o)?o.checked?"true":"false":o.value),o=c,o!==a?(e.setValue(o),!0):!1}function Xa(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function Ya(o,e){var a=e.checked;return A({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??o._wrapperState.initialChecked})}function Za(o,e){var a=e.defaultValue==null?"":e.defaultValue,c=e.checked!=null?e.checked:e.defaultChecked;a=Sa(e.value!=null?e.value:a),o._wrapperState={initialChecked:c,initialValue:a,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function ab(o,e){e=e.checked,e!=null&&ta(o,"checked",e,!1)}function bb(o,e){ab(o,e);var a=Sa(e.value),c=e.type;if(a!=null)c==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+a):o.value!==""+a&&(o.value=""+a);else if(c==="submit"||c==="reset"){o.removeAttribute("value");return}e.hasOwnProperty("value")?cb(o,e.type,a):e.hasOwnProperty("defaultValue")&&cb(o,e.type,Sa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(o.defaultChecked=!!e.defaultChecked)}function db(o,e,a){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var c=e.type;if(!(c!=="submit"&&c!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+o._wrapperState.initialValue,a||e===o.value||(o.value=e),o.defaultValue=e}a=o.name,a!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,a!==""&&(o.name=a)}function cb(o,e,a){(e!=="number"||Xa(o.ownerDocument)!==o)&&(a==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+a&&(o.defaultValue=""+a))}var eb=Array.isArray;function fb(o,e,a,c){if(o=o.options,e){e={};for(var d=0;d"+e.valueOf().toString()+"",e=mb.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;e.firstChild;)o.appendChild(e.firstChild)}});function ob(o,e){if(e){var a=o.firstChild;if(a&&a===o.lastChild&&a.nodeType===3){a.nodeValue=e;return}}o.textContent=e}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(o){qb.forEach(function(e){e=e+o.charAt(0).toUpperCase()+o.substring(1),pb[e]=pb[o]})});function rb(o,e,a){return e==null||typeof e=="boolean"||e===""?"":a||typeof e!="number"||e===0||pb.hasOwnProperty(o)&&pb[o]?(""+e).trim():e+"px"}function sb(o,e){o=o.style;for(var a in e)if(e.hasOwnProperty(a)){var c=a.indexOf("--")===0,d=rb(a,e[a],c);a==="float"&&(a="cssFloat"),c?o.setProperty(a,d):o[a]=d}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(o,e){if(e){if(tb[o]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(p(137,o));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(p(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(p(61))}if(e.style!=null&&typeof e.style!="object")throw Error(p(62))}}function vb(o,e){if(o.indexOf("-")===-1)return typeof e.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var yb=null,zb=null,Ab=null;function Bb(o){if(o=Cb(o)){if(typeof yb!="function")throw Error(p(280));var e=o.stateNode;e&&(e=Db(e),yb(o.stateNode,o.type,e))}}function Eb(o){zb?Ab?Ab.push(o):Ab=[o]:zb=o}function Fb(){if(zb){var o=zb,e=Ab;if(Ab=zb=null,Bb(o),e)for(o=0;o>>=0,o===0?32:31-(pc(o)/qc|0)|0}var rc=64,sc=4194304;function tc(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function uc(o,e){var a=o.pendingLanes;if(a===0)return 0;var c=0,d=o.suspendedLanes,h=o.pingedLanes,j=a&268435455;if(j!==0){var et=j&~d;et!==0?c=tc(et):(h&=j,h!==0&&(c=tc(h)))}else j=a&~d,j!==0?c=tc(j):h!==0&&(c=tc(h));if(c===0)return 0;if(e!==0&&e!==c&&!(e&d)&&(d=c&-c,h=e&-e,d>=h||d===16&&(h&4194240)!==0))return e;if(c&4&&(c|=a&16),e=o.entangledLanes,e!==0)for(o=o.entanglements,e&=c;0a;a++)e.push(o);return e}function Ac(o,e,a){o.pendingLanes|=e,e!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,e=31-oc(e),o[e]=a}function Bc(o,e){var a=o.pendingLanes&~e;o.pendingLanes=e,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=e,o.mutableReadLanes&=e,o.entangledLanes&=e,e=o.entanglements;var c=o.eventTimes;for(o=o.expirationTimes;0=be),ee=" ",fe=!1;function ge(o,e){switch(o){case"keyup":return $d.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ie=!1;function je(o,e){switch(o){case"compositionend":return he(e);case"keypress":return e.which!==32?null:(fe=!0,ee);case"textInput":return o=e.data,o===ee&&fe?null:o;default:return null}}function ke(o,e){if(ie)return o==="compositionend"||!ae&&ge(o,e)?(o=nd(),md=ld=kd=null,ie=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:a,offset:e-o};o=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Je(a)}}function Le(o,e){return o&&e?o===e?!0:o&&o.nodeType===3?!1:e&&e.nodeType===3?Le(o,e.parentNode):"contains"in o?o.contains(e):o.compareDocumentPosition?!!(o.compareDocumentPosition(e)&16):!1:!1}function Me(){for(var o=window,e=Xa();e instanceof o.HTMLIFrameElement;){try{var a=typeof e.contentWindow.location.href=="string"}catch{a=!1}if(a)o=e.contentWindow;else break;e=Xa(o.document)}return e}function Ne(o){var e=o&&o.nodeName&&o.nodeName.toLowerCase();return e&&(e==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||e==="textarea"||o.contentEditable==="true")}function Oe(o){var e=Me(),a=o.focusedElem,c=o.selectionRange;if(e!==a&&a&&a.ownerDocument&&Le(a.ownerDocument.documentElement,a)){if(c!==null&&Ne(a)){if(e=c.start,o=c.end,o===void 0&&(o=e),"selectionStart"in a)a.selectionStart=e,a.selectionEnd=Math.min(o,a.value.length);else if(o=(e=a.ownerDocument||document)&&e.defaultView||window,o.getSelection){o=o.getSelection();var d=a.textContent.length,h=Math.min(c.start,d);c=c.end===void 0?h:Math.min(c.end,d),!o.extend&&h>c&&(d=c,c=h,h=d),d=Ke(a,h);var j=Ke(a,c);d&&j&&(o.rangeCount!==1||o.anchorNode!==d.node||o.anchorOffset!==d.offset||o.focusNode!==j.node||o.focusOffset!==j.offset)&&(e=e.createRange(),e.setStart(d.node,d.offset),o.removeAllRanges(),h>c?(o.addRange(e),o.extend(j.node,j.offset)):(e.setEnd(j.node,j.offset),o.addRange(e)))}}for(e=[],o=a;o=o.parentNode;)o.nodeType===1&&e.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(o,e,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Te||Qe==null||Qe!==Xa(c)||(c=Qe,"selectionStart"in c&&Ne(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Se&&Ie(Se,c)||(Se=c,c=oe(Re,"onSelect"),0Tf||(o.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(o,e){Tf++,Sf[Tf]=o.current,o.current=e}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(o,e){var a=o.type.contextTypes;if(!a)return Vf;var c=o.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===e)return c.__reactInternalMemoizedMaskedChildContext;var d={},h;for(h in a)d[h]=e[h];return c&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=e,o.__reactInternalMemoizedMaskedChildContext=d),d}function Zf(o){return o=o.childContextTypes,o!=null}function $f(){E(Wf),E(H)}function ag(o,e,a){if(H.current!==Vf)throw Error(p(168));G$1(H,e),G$1(Wf,a)}function bg(o,e,a){var c=o.stateNode;if(e=e.childContextTypes,typeof c.getChildContext!="function")return a;c=c.getChildContext();for(var d in c)if(!(d in e))throw Error(p(108,Ra(o)||"Unknown",d));return A({},a,c)}function cg(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Vf,Xf=H.current,G$1(H,o),G$1(Wf,Wf.current),!0}function dg(o,e,a){var c=o.stateNode;if(!c)throw Error(p(169));a?(o=bg(o,e,Xf),c.__reactInternalMemoizedMergedChildContext=o,E(Wf),E(H),G$1(H,o)):E(Wf),G$1(Wf,a)}var eg=null,fg=!1,gg=!1;function hg(o){eg===null?eg=[o]:eg.push(o)}function ig(o){fg=!0,hg(o)}function jg(){if(!gg&&eg!==null){gg=!0;var o=0,e=C;try{var a=eg;for(C=1;o>=j,d-=j,rg=1<<32-oc(e)+d|a<qt?(Pt=Ht,Ht=null):Pt=Ht.sibling;var Gt=pt(_t,Ht,bt[qt],$t);if(Gt===null){Ht===null&&(Ht=Pt);break}o&&Ht&&Gt.alternate===null&&e(_t,Ht),mt=h(Gt,mt,qt),Dt===null?Bt=Gt:Dt.sibling=Gt,Dt=Gt,Ht=Pt}if(qt===bt.length)return a(_t,Ht),I&&tg(_t,qt),Bt;if(Ht===null){for(;qtqt?(Pt=Ht,Ht=null):Pt=Ht.sibling;var ct=pt(_t,Ht,Gt.value,$t);if(ct===null){Ht===null&&(Ht=Pt);break}o&&Ht&&ct.alternate===null&&e(_t,Ht),mt=h(ct,mt,qt),Dt===null?Bt=ct:Dt.sibling=ct,Dt=ct,Ht=Pt}if(Gt.done)return a(_t,Ht),I&&tg(_t,qt),Bt;if(Ht===null){for(;!Gt.done;qt++,Gt=bt.next())Gt=ht(_t,Gt.value,$t),Gt!==null&&(mt=h(Gt,mt,qt),Dt===null?Bt=Gt:Dt.sibling=Gt,Dt=Gt);return I&&tg(_t,qt),Bt}for(Ht=c(_t,Ht);!Gt.done;qt++,Gt=bt.next())Gt=dt(Ht,_t,qt,Gt.value,$t),Gt!==null&&(o&&Gt.alternate!==null&&Ht.delete(Gt.key===null?qt:Gt.key),mt=h(Gt,mt,qt),Dt===null?Bt=Gt:Dt.sibling=Gt,Dt=Gt);return o&&Ht.forEach(function(g){return e(_t,g)}),I&&tg(_t,qt),Bt}function St(_t,mt,bt,$t){if(typeof bt=="object"&&bt!==null&&bt.type===ya&&bt.key===null&&(bt=bt.props.children),typeof bt=="object"&&bt!==null){switch(bt.$$typeof){case va:e:{for(var Bt=bt.key,Dt=mt;Dt!==null;){if(Dt.key===Bt){if(Bt=bt.type,Bt===ya){if(Dt.tag===7){a(_t,Dt.sibling),mt=d(Dt,bt.props.children),mt.return=_t,_t=mt;break e}}else if(Dt.elementType===Bt||typeof Bt=="object"&&Bt!==null&&Bt.$$typeof===Ha&&Ng(Bt)===Dt.type){a(_t,Dt.sibling),mt=d(Dt,bt.props),mt.ref=Lg(_t,Dt,bt),mt.return=_t,_t=mt;break e}a(_t,Dt);break}else e(_t,Dt);Dt=Dt.sibling}bt.type===ya?(mt=Tg(bt.props.children,_t.mode,$t,bt.key),mt.return=_t,_t=mt):($t=Rg(bt.type,bt.key,bt.props,null,_t.mode,$t),$t.ref=Lg(_t,mt,bt),$t.return=_t,_t=$t)}return j(_t);case wa:e:{for(Dt=bt.key;mt!==null;){if(mt.key===Dt)if(mt.tag===4&&mt.stateNode.containerInfo===bt.containerInfo&&mt.stateNode.implementation===bt.implementation){a(_t,mt.sibling),mt=d(mt,bt.children||[]),mt.return=_t,_t=mt;break e}else{a(_t,mt);break}else e(_t,mt);mt=mt.sibling}mt=Sg(bt,_t.mode,$t),mt.return=_t,_t=mt}return j(_t);case Ha:return Dt=bt._init,St(_t,mt,Dt(bt._payload),$t)}if(eb(bt))return gt(_t,mt,bt,$t);if(Ka(bt))return wt(_t,mt,bt,$t);Mg(_t,bt)}return typeof bt=="string"&&bt!==""||typeof bt=="number"?(bt=""+bt,mt!==null&&mt.tag===6?(a(_t,mt.sibling),mt=d(mt,bt),mt.return=_t,_t=mt):(a(_t,mt),mt=Qg(bt,_t.mode,$t),mt.return=_t,_t=mt),j(_t)):a(_t,mt)}return St}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(o){var e=Wg.current;E(Wg),o._currentValue=e}function bh(o,e,a){for(;o!==null;){var c=o.alternate;if((o.childLanes&e)!==e?(o.childLanes|=e,c!==null&&(c.childLanes|=e)):c!==null&&(c.childLanes&e)!==e&&(c.childLanes|=e),o===a)break;o=o.return}}function ch$1(o,e){Xg=o,Zg=Yg=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&e&&(dh$1=!0),o.firstContext=null)}function eh(o){var e=o._currentValue;if(Zg!==o)if(o={context:o,memoizedValue:e,next:null},Yg===null){if(Xg===null)throw Error(p(308));Yg=o,Xg.dependencies={lanes:0,firstContext:o}}else Yg=Yg.next=o;return e}var fh=null;function gh(o){fh===null?fh=[o]:fh.push(o)}function hh(o,e,a,c){var d=e.interleaved;return d===null?(a.next=a,gh(e)):(a.next=d.next,d.next=a),e.interleaved=a,ih(o,c)}function ih(o,e){o.lanes|=e;var a=o.alternate;for(a!==null&&(a.lanes|=e),a=o,o=o.return;o!==null;)o.childLanes|=e,a=o.alternate,a!==null&&(a.childLanes|=e),a=o,o=o.return;return a.tag===3?a.stateNode:null}var jh=!1;function kh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(o,e){o=o.updateQueue,e.updateQueue===o&&(e.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function mh(o,e){return{eventTime:o,lane:e,tag:0,payload:null,callback:null,next:null}}function nh(o,e,a){var c=o.updateQueue;if(c===null)return null;if(c=c.shared,K$5&2){var d=c.pending;return d===null?e.next=e:(e.next=d.next,d.next=e),c.pending=e,ih(o,a)}return d=c.interleaved,d===null?(e.next=e,gh(c)):(e.next=d.next,d.next=e),c.interleaved=e,ih(o,a)}function oh(o,e,a){if(e=e.updateQueue,e!==null&&(e=e.shared,(a&4194240)!==0)){var c=e.lanes;c&=o.pendingLanes,a|=c,e.lanes=a,Cc(o,a)}}function ph(o,e){var a=o.updateQueue,c=o.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var d=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var j={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};h===null?d=h=j:h=h.next=j,a=a.next}while(a!==null);h===null?d=h=e:h=h.next=e}else d=h=e;a={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:c.shared,effects:c.effects},o.updateQueue=a;return}o=a.lastBaseUpdate,o===null?a.firstBaseUpdate=e:o.next=e,a.lastBaseUpdate=e}function qh(o,e,a,c){var d=o.updateQueue;jh=!1;var h=d.firstBaseUpdate,j=d.lastBaseUpdate,et=d.shared.pending;if(et!==null){d.shared.pending=null;var nt=et,st=nt.next;nt.next=null,j===null?h=st:j.next=st,j=nt;var ot=o.alternate;ot!==null&&(ot=ot.updateQueue,et=ot.lastBaseUpdate,et!==j&&(et===null?ot.firstBaseUpdate=st:et.next=st,ot.lastBaseUpdate=nt))}if(h!==null){var ht=d.baseState;j=0,ot=st=nt=null,et=h;do{var pt=et.lane,dt=et.eventTime;if((c&pt)===pt){ot!==null&&(ot=ot.next={eventTime:dt,lane:0,tag:et.tag,payload:et.payload,callback:et.callback,next:null});e:{var gt=o,wt=et;switch(pt=e,dt=a,wt.tag){case 1:if(gt=wt.payload,typeof gt=="function"){ht=gt.call(dt,ht,pt);break e}ht=gt;break e;case 3:gt.flags=gt.flags&-65537|128;case 0:if(gt=wt.payload,pt=typeof gt=="function"?gt.call(dt,ht,pt):gt,pt==null)break e;ht=A({},ht,pt);break e;case 2:jh=!0}}et.callback!==null&&et.lane!==0&&(o.flags|=64,pt=d.effects,pt===null?d.effects=[et]:pt.push(et))}else dt={eventTime:dt,lane:pt,tag:et.tag,payload:et.payload,callback:et.callback,next:null},ot===null?(st=ot=dt,nt=ht):ot=ot.next=dt,j|=pt;if(et=et.next,et===null){if(et=d.shared.pending,et===null)break;pt=et,et=pt.next,pt.next=null,d.lastBaseUpdate=pt,d.shared.pending=null}}while(!0);if(ot===null&&(nt=ht),d.baseState=nt,d.firstBaseUpdate=st,d.lastBaseUpdate=ot,e=d.shared.interleaved,e!==null){d=e;do j|=d.lane,d=d.next;while(d!==e)}else h===null&&(d.shared.lanes=0);rh$1|=j,o.lanes=j,o.memoizedState=ht}}function sh$1(o,e,a){if(o=e.effects,e.effects=null,o!==null)for(e=0;ea?a:4,o(!0);var c=Gh.transition;Gh.transition={};try{o(!1),e()}finally{C=a,Gh.transition=c}}function wi(){return Uh().memoizedState}function xi(o,e,a){var c=yi(o);if(a={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null},zi(o))Ai(e,a);else if(a=hh(o,e,a,c),a!==null){var d=R$1();gi(a,o,c,d),Bi(a,e,c)}}function ii(o,e,a){var c=yi(o),d={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null};if(zi(o))Ai(e,d);else{var h=o.alternate;if(o.lanes===0&&(h===null||h.lanes===0)&&(h=e.lastRenderedReducer,h!==null))try{var j=e.lastRenderedState,et=h(j,a);if(d.hasEagerState=!0,d.eagerState=et,He(et,j)){var nt=e.interleaved;nt===null?(d.next=d,gh(e)):(d.next=nt.next,nt.next=d),e.interleaved=d;return}}catch{}finally{}a=hh(o,e,d,c),a!==null&&(d=R$1(),gi(a,o,c,d),Bi(a,e,c))}}function zi(o){var e=o.alternate;return o===M||e!==null&&e===M}function Ai(o,e){Jh=Ih=!0;var a=o.pending;a===null?e.next=e:(e.next=a.next,a.next=e),o.pending=e}function Bi(o,e,a){if(a&4194240){var c=e.lanes;c&=o.pendingLanes,a|=c,e.lanes=a,Cc(o,a)}}var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(o,e){return Th().memoizedState=[o,e===void 0?null:e],o},useContext:eh,useEffect:mi,useImperativeHandle:function(o,e,a){return a=a!=null?a.concat([o]):null,ki(4194308,4,pi.bind(null,e,o),a)},useLayoutEffect:function(o,e){return ki(4194308,4,o,e)},useInsertionEffect:function(o,e){return ki(4,2,o,e)},useMemo:function(o,e){var a=Th();return e=e===void 0?null:e,o=o(),a.memoizedState=[o,e],o},useReducer:function(o,e,a){var c=Th();return e=a!==void 0?a(e):e,c.memoizedState=c.baseState=e,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:e},c.queue=o,o=o.dispatch=xi.bind(null,M,o),[c.memoizedState,o]},useRef:function(o){var e=Th();return o={current:o},e.memoizedState=o},useState:hi,useDebugValue:ri,useDeferredValue:function(o){return Th().memoizedState=o},useTransition:function(){var o=hi(!1),e=o[0];return o=vi.bind(null,o[1]),Th().memoizedState=o,[e,o]},useMutableSource:function(){},useSyncExternalStore:function(o,e,a){var c=M,d=Th();if(I){if(a===void 0)throw Error(p(407));a=a()}else{if(a=e(),Q===null)throw Error(p(349));Hh&30||di(c,e,a)}d.memoizedState=a;var h={value:a,getSnapshot:e};return d.queue=h,mi(ai.bind(null,c,h,o),[o]),c.flags|=2048,bi(9,ci.bind(null,c,h,a,e),void 0,null),a},useId:function(){var o=Th(),e=Q.identifierPrefix;if(I){var a=sg,c=rg;a=(c&~(1<<32-oc(c)-1)).toString(32)+a,e=":"+e+"R"+a,a=Kh$1++,0<\/script>",o=o.removeChild(o.firstChild)):typeof c.is=="string"?o=j.createElement(a,{is:c.is}):(o=j.createElement(a),a==="select"&&(j=o,c.multiple?j.multiple=!0:c.size&&(j.size=c.size))):o=j.createElementNS(o,a),o[Of]=e,o[Pf]=c,zj(o,e,!1,!1),e.stateNode=o;e:{switch(j=vb(a,c),a){case"dialog":D("cancel",o),D("close",o),d=c;break;case"iframe":case"object":case"embed":D("load",o),d=c;break;case"video":case"audio":for(d=0;dGj&&(e.flags|=128,c=!0,Dj(h,!1),e.lanes=4194304)}else{if(!c)if(o=Ch$1(j),o!==null){if(e.flags|=128,c=!0,a=o.updateQueue,a!==null&&(e.updateQueue=a,e.flags|=4),Dj(h,!0),h.tail===null&&h.tailMode==="hidden"&&!j.alternate&&!I)return S(e),null}else 2*B()-h.renderingStartTime>Gj&&a!==1073741824&&(e.flags|=128,c=!0,Dj(h,!1),e.lanes=4194304);h.isBackwards?(j.sibling=e.child,e.child=j):(a=h.last,a!==null?a.sibling=j:e.child=j,h.last=j)}return h.tail!==null?(e=h.tail,h.rendering=e,h.tail=e.sibling,h.renderingStartTime=B(),e.sibling=null,a=L.current,G$1(L,c?a&1|2:a&1),e):(S(e),null);case 22:case 23:return Hj(),c=e.memoizedState!==null,o!==null&&o.memoizedState!==null!==c&&(e.flags|=8192),c&&e.mode&1?fj&1073741824&&(S(e),e.subtreeFlags&6&&(e.flags|=8192)):S(e),null;case 24:return null;case 25:return null}throw Error(p(156,e.tag))}function Ij(o,e){switch(wg(e),e.tag){case 1:return Zf(e.type)&&$f(),o=e.flags,o&65536?(e.flags=o&-65537|128,e):null;case 3:return zh(),E(Wf),E(H),Eh(),o=e.flags,o&65536&&!(o&128)?(e.flags=o&-65537|128,e):null;case 5:return Bh(e),null;case 13:if(E(L),o=e.memoizedState,o!==null&&o.dehydrated!==null){if(e.alternate===null)throw Error(p(340));Ig()}return o=e.flags,o&65536?(e.flags=o&-65537|128,e):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(e.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Lj(o,e){var a=o.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){W$6(o,e,c)}else a.current=null}function Mj(o,e,a){try{a()}catch(c){W$6(o,e,c)}}var Nj=!1;function Oj(o,e){if(Cf=dd,o=Me(),Ne(o)){if("selectionStart"in o)var a={start:o.selectionStart,end:o.selectionEnd};else e:{a=(a=o.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var d=c.anchorOffset,h=c.focusNode;c=c.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var j=0,et=-1,nt=-1,st=0,ot=0,ht=o,pt=null;t:for(;;){for(var dt;ht!==a||d!==0&&ht.nodeType!==3||(et=j+d),ht!==h||c!==0&&ht.nodeType!==3||(nt=j+c),ht.nodeType===3&&(j+=ht.nodeValue.length),(dt=ht.firstChild)!==null;)pt=ht,ht=dt;for(;;){if(ht===o)break t;if(pt===a&&++st===d&&(et=j),pt===h&&++ot===c&&(nt=j),(dt=ht.nextSibling)!==null)break;ht=pt,pt=ht.parentNode}ht=dt}a=et===-1||nt===-1?null:{start:et,end:nt}}else a=null}a=a||{start:0,end:0}}else a=null;for(Df={focusedElem:o,selectionRange:a},dd=!1,V=e;V!==null;)if(e=V,o=e.child,(e.subtreeFlags&1028)!==0&&o!==null)o.return=e,V=o;else for(;V!==null;){e=V;try{var gt=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(gt!==null){var wt=gt.memoizedProps,St=gt.memoizedState,_t=e.stateNode,mt=_t.getSnapshotBeforeUpdate(e.elementType===e.type?wt:Ci(e.type,wt),St);_t.__reactInternalSnapshotBeforeUpdate=mt}break;case 3:var bt=e.stateNode.containerInfo;bt.nodeType===1?bt.textContent="":bt.nodeType===9&&bt.documentElement&&bt.removeChild(bt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch($t){W$6(e,e.return,$t)}if(o=e.sibling,o!==null){o.return=e.return,V=o;break}V=e.return}return gt=Nj,Nj=!1,gt}function Pj(o,e,a){var c=e.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var d=c=c.next;do{if((d.tag&o)===o){var h=d.destroy;d.destroy=void 0,h!==void 0&&Mj(e,a,h)}d=d.next}while(d!==c)}}function Qj(o,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var a=e=e.next;do{if((a.tag&o)===o){var c=a.create;a.destroy=c()}a=a.next}while(a!==e)}}function Rj(o){var e=o.ref;if(e!==null){var a=o.stateNode;switch(o.tag){case 5:o=a;break;default:o=a}typeof e=="function"?e(o):e.current=o}}function Sj(o){var e=o.alternate;e!==null&&(o.alternate=null,Sj(e)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(e=o.stateNode,e!==null&&(delete e[Of],delete e[Pf],delete e[of],delete e[Qf],delete e[Rf])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Tj(o){return o.tag===5||o.tag===3||o.tag===4}function Uj(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Tj(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Vj(o,e,a){var c=o.tag;if(c===5||c===6)o=o.stateNode,e?a.nodeType===8?a.parentNode.insertBefore(o,e):a.insertBefore(o,e):(a.nodeType===8?(e=a.parentNode,e.insertBefore(o,a)):(e=a,e.appendChild(o)),a=a._reactRootContainer,a!=null||e.onclick!==null||(e.onclick=Bf));else if(c!==4&&(o=o.child,o!==null))for(Vj(o,e,a),o=o.sibling;o!==null;)Vj(o,e,a),o=o.sibling}function Wj(o,e,a){var c=o.tag;if(c===5||c===6)o=o.stateNode,e?a.insertBefore(o,e):a.appendChild(o);else if(c!==4&&(o=o.child,o!==null))for(Wj(o,e,a),o=o.sibling;o!==null;)Wj(o,e,a),o=o.sibling}var X=null,Xj=!1;function Yj(o,e,a){for(a=a.child;a!==null;)Zj(o,e,a),a=a.sibling}function Zj(o,e,a){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,a)}catch{}switch(a.tag){case 5:U||Lj(a,e);case 6:var c=X,d=Xj;X=null,Yj(o,e,a),X=c,Xj=d,X!==null&&(Xj?(o=X,a=a.stateNode,o.nodeType===8?o.parentNode.removeChild(a):o.removeChild(a)):X.removeChild(a.stateNode));break;case 18:X!==null&&(Xj?(o=X,a=a.stateNode,o.nodeType===8?Kf(o.parentNode,a):o.nodeType===1&&Kf(o,a),bd(o)):Kf(X,a.stateNode));break;case 4:c=X,d=Xj,X=a.stateNode.containerInfo,Xj=!0,Yj(o,e,a),X=c,Xj=d;break;case 0:case 11:case 14:case 15:if(!U&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){d=c=c.next;do{var h=d,j=h.destroy;h=h.tag,j!==void 0&&(h&2||h&4)&&Mj(a,e,j),d=d.next}while(d!==c)}Yj(o,e,a);break;case 1:if(!U&&(Lj(a,e),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(et){W$6(a,e,et)}Yj(o,e,a);break;case 21:Yj(o,e,a);break;case 22:a.mode&1?(U=(c=U)||a.memoizedState!==null,Yj(o,e,a),U=c):Yj(o,e,a);break;default:Yj(o,e,a)}}function ak(o){var e=o.updateQueue;if(e!==null){o.updateQueue=null;var a=o.stateNode;a===null&&(a=o.stateNode=new Kj),e.forEach(function(c){var d=bk.bind(null,o,c);a.has(c)||(a.add(c),c.then(d,d))})}}function ck(o,e){var a=e.deletions;if(a!==null)for(var c=0;cd&&(d=j),c&=~h}if(c=d,c=B()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*lk(c/1960))-c,10o?16:o,wk===null)var c=!1;else{if(o=wk,wk=null,xk=0,K$5&6)throw Error(p(331));var d=K$5;for(K$5|=4,V=o.current;V!==null;){var h=V,j=h.child;if(V.flags&16){var et=h.deletions;if(et!==null){for(var nt=0;ntB()-fk?Kk(o,0):rk|=a),Dk(o,e)}function Yk(o,e){e===0&&(o.mode&1?(e=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):e=1);var a=R$1();o=ih(o,e),o!==null&&(Ac(o,e,a),Dk(o,a))}function uj(o){var e=o.memoizedState,a=0;e!==null&&(a=e.retryLane),Yk(o,a)}function bk(o,e){var a=0;switch(o.tag){case 13:var c=o.stateNode,d=o.memoizedState;d!==null&&(a=d.retryLane);break;case 19:c=o.stateNode;break;default:throw Error(p(314))}c!==null&&c.delete(e),Yk(o,a)}var Vk;Vk=function(o,e,a){if(o!==null)if(o.memoizedProps!==e.pendingProps||Wf.current)dh$1=!0;else{if(!(o.lanes&a)&&!(e.flags&128))return dh$1=!1,yj(o,e,a);dh$1=!!(o.flags&131072)}else dh$1=!1,I&&e.flags&1048576&&ug(e,ng,e.index);switch(e.lanes=0,e.tag){case 2:var c=e.type;ij(o,e),o=e.pendingProps;var d=Yf(e,H.current);ch$1(e,a),d=Nh(null,e,c,o,d,a);var h=Sh();return e.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Zf(c)?(h=!0,cg(e)):h=!1,e.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,kh(e),d.updater=Ei,e.stateNode=d,d._reactInternals=e,Ii(e,c,o,a),e=jj(null,e,c,!0,h,a)):(e.tag=0,I&&h&&vg(e),Xi(null,e,d,a),e=e.child),e;case 16:c=e.elementType;e:{switch(ij(o,e),o=e.pendingProps,d=c._init,c=d(c._payload),e.type=c,d=e.tag=Zk(c),o=Ci(c,o),d){case 0:e=cj(null,e,c,o,a);break e;case 1:e=hj(null,e,c,o,a);break e;case 11:e=Yi(null,e,c,o,a);break e;case 14:e=$i(null,e,c,Ci(c.type,o),a);break e}throw Error(p(306,c,""))}return e;case 0:return c=e.type,d=e.pendingProps,d=e.elementType===c?d:Ci(c,d),cj(o,e,c,d,a);case 1:return c=e.type,d=e.pendingProps,d=e.elementType===c?d:Ci(c,d),hj(o,e,c,d,a);case 3:e:{if(kj(e),o===null)throw Error(p(387));c=e.pendingProps,h=e.memoizedState,d=h.element,lh(o,e),qh(e,c,null,a);var j=e.memoizedState;if(c=j.element,h.isDehydrated)if(h={element:c,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},e.updateQueue.baseState=h,e.memoizedState=h,e.flags&256){d=Ji(Error(p(423)),e),e=lj(o,e,c,a,d);break e}else if(c!==d){d=Ji(Error(p(424)),e),e=lj(o,e,c,a,d);break e}else for(yg=Lf(e.stateNode.containerInfo.firstChild),xg=e,I=!0,zg=null,a=Vg(e,null,c,a),e.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Ig(),c===d){e=Zi(o,e,a);break e}Xi(o,e,c,a)}e=e.child}return e;case 5:return Ah(e),o===null&&Eg(e),c=e.type,d=e.pendingProps,h=o!==null?o.memoizedProps:null,j=d.children,Ef(c,d)?j=null:h!==null&&Ef(c,h)&&(e.flags|=32),gj(o,e),Xi(o,e,j,a),e.child;case 6:return o===null&&Eg(e),null;case 13:return oj(o,e,a);case 4:return yh(e,e.stateNode.containerInfo),c=e.pendingProps,o===null?e.child=Ug(e,null,c,a):Xi(o,e,c,a),e.child;case 11:return c=e.type,d=e.pendingProps,d=e.elementType===c?d:Ci(c,d),Yi(o,e,c,d,a);case 7:return Xi(o,e,e.pendingProps,a),e.child;case 8:return Xi(o,e,e.pendingProps.children,a),e.child;case 12:return Xi(o,e,e.pendingProps.children,a),e.child;case 10:e:{if(c=e.type._context,d=e.pendingProps,h=e.memoizedProps,j=d.value,G$1(Wg,c._currentValue),c._currentValue=j,h!==null)if(He(h.value,j)){if(h.children===d.children&&!Wf.current){e=Zi(o,e,a);break e}}else for(h=e.child,h!==null&&(h.return=e);h!==null;){var et=h.dependencies;if(et!==null){j=h.child;for(var nt=et.firstContext;nt!==null;){if(nt.context===c){if(h.tag===1){nt=mh(-1,a&-a),nt.tag=2;var st=h.updateQueue;if(st!==null){st=st.shared;var ot=st.pending;ot===null?nt.next=nt:(nt.next=ot.next,ot.next=nt),st.pending=nt}}h.lanes|=a,nt=h.alternate,nt!==null&&(nt.lanes|=a),bh(h.return,a,e),et.lanes|=a;break}nt=nt.next}}else if(h.tag===10)j=h.type===e.type?null:h.child;else if(h.tag===18){if(j=h.return,j===null)throw Error(p(341));j.lanes|=a,et=j.alternate,et!==null&&(et.lanes|=a),bh(j,a,e),j=h.sibling}else j=h.child;if(j!==null)j.return=h;else for(j=h;j!==null;){if(j===e){j=null;break}if(h=j.sibling,h!==null){h.return=j.return,j=h;break}j=j.return}h=j}Xi(o,e,d.children,a),e=e.child}return e;case 9:return d=e.type,c=e.pendingProps.children,ch$1(e,a),d=eh(d),c=c(d),e.flags|=1,Xi(o,e,c,a),e.child;case 14:return c=e.type,d=Ci(c,e.pendingProps),d=Ci(c.type,d),$i(o,e,c,d,a);case 15:return bj(o,e,e.type,e.pendingProps,a);case 17:return c=e.type,d=e.pendingProps,d=e.elementType===c?d:Ci(c,d),ij(o,e),e.tag=1,Zf(c)?(o=!0,cg(e)):o=!1,ch$1(e,a),Gi(e,c,d),Ii(e,c,d,a),jj(null,e,c,!0,o,a);case 19:return xj(o,e,a);case 22:return dj(o,e,a)}throw Error(p(156,e.tag))};function Fk(o,e){return ac(o,e)}function $k(o,e,a,c){this.tag=o,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(o,e,a,c){return new $k(o,e,a,c)}function aj(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Zk(o){if(typeof o=="function")return aj(o)?1:0;if(o!=null){if(o=o.$$typeof,o===Da)return 11;if(o===Ga)return 14}return 2}function Pg(o,e){var a=o.alternate;return a===null?(a=Bg(o.tag,e,o.key,o.mode),a.elementType=o.elementType,a.type=o.type,a.stateNode=o.stateNode,a.alternate=o,o.alternate=a):(a.pendingProps=e,a.type=o.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=o.flags&14680064,a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},a.sibling=o.sibling,a.index=o.index,a.ref=o.ref,a}function Rg(o,e,a,c,d,h){var j=2;if(c=o,typeof o=="function")aj(o)&&(j=1);else if(typeof o=="string")j=5;else e:switch(o){case ya:return Tg(a.children,d,h,e);case za:j=8,d|=8;break;case Aa:return o=Bg(12,a,e,d|2),o.elementType=Aa,o.lanes=h,o;case Ea:return o=Bg(13,a,e,d),o.elementType=Ea,o.lanes=h,o;case Fa:return o=Bg(19,a,e,d),o.elementType=Fa,o.lanes=h,o;case Ia:return pj(a,d,h,e);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case Ba:j=10;break e;case Ca:j=9;break e;case Da:j=11;break e;case Ga:j=14;break e;case Ha:j=16,c=null;break e}throw Error(p(130,o==null?o:typeof o,""))}return e=Bg(j,a,e,d),e.elementType=o,e.type=c,e.lanes=h,e}function Tg(o,e,a,c){return o=Bg(7,o,c,e),o.lanes=a,o}function pj(o,e,a,c){return o=Bg(22,o,c,e),o.elementType=Ia,o.lanes=a,o.stateNode={isHidden:!1},o}function Qg(o,e,a){return o=Bg(6,o,null,e),o.lanes=a,o}function Sg(o,e,a){return e=Bg(4,o.children!==null?o.children:[],o.key,e),e.lanes=a,e.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},e}function al(o,e,a,c,d){this.tag=e,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=c,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function bl(o,e,a,c,d,h,j,et,nt){return o=new al(o,e,a,et,nt),e===1?(e=1,h===!0&&(e|=8)):e=0,h=Bg(3,null,null,e),o.current=h,h.stateNode=o,h.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(h),o}function cl(o,e,a){var c=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(o){console.error(o)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports,m=reactDomExports;client.createRoot=m.createRoot,client.hydrateRoot=m.hydrateRoot;const DEFAULT_CONTEXT$1={setVisible(o){console.error(constructMissingProviderErrorMessage("call","setVisible"))},visible:!1};Object.defineProperty(DEFAULT_CONTEXT$1,"visible",{get(){return console.error(constructMissingProviderErrorMessage("read","visible")),!1}});function constructMissingProviderErrorMessage(o,e){return`You have tried to ${o} "${e}" on a WalletModalContext without providing one. Make sure to render a WalletModalProvider as an ancestor of the component that uses WalletModalContext`}const WalletModalContext=reactExports.createContext(DEFAULT_CONTEXT$1);function useWalletModal(){return reactExports.useContext(WalletModalContext)}var buffer$1={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$1=0,len=code.length;i$10)throw new Error("Invalid string. Length must be a multiple of 4");var a=o.indexOf("=");a===-1&&(a=e);var c=a===e?0:4-a%4;return[a,c]}function byteLength(o){var e=getLens(o),a=e[0],c=e[1];return(a+c)*3/4-c}function _byteLength(o,e,a){return(e+a)*3/4-a}function toByteArray(o){var e,a=getLens(o),c=a[0],d=a[1],h=new Arr(_byteLength(o,c,d)),j=0,et=d>0?c-4:c,nt;for(nt=0;nt>16&255,h[j++]=e>>8&255,h[j++]=e&255;return d===2&&(e=revLookup[o.charCodeAt(nt)]<<2|revLookup[o.charCodeAt(nt+1)]>>4,h[j++]=e&255),d===1&&(e=revLookup[o.charCodeAt(nt)]<<10|revLookup[o.charCodeAt(nt+1)]<<4|revLookup[o.charCodeAt(nt+2)]>>2,h[j++]=e>>8&255,h[j++]=e&255),h}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[o&63]}function encodeChunk(o,e,a){for(var c,d=[],h=e;het?et:j+h));return c===1?(e=o[a-1],d.push(lookup[e>>2]+lookup[e<<4&63]+"==")):c===2&&(e=(o[a-2]<<8)+o[a-1],d.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),d.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(o,e,a,c,d){var h,j,et=d*8-c-1,nt=(1<>1,ot=-7,ht=a?d-1:0,pt=a?-1:1,dt=o[e+ht];for(ht+=pt,h=dt&(1<<-ot)-1,dt>>=-ot,ot+=et;ot>0;h=h*256+o[e+ht],ht+=pt,ot-=8);for(j=h&(1<<-ot)-1,h>>=-ot,ot+=c;ot>0;j=j*256+o[e+ht],ht+=pt,ot-=8);if(h===0)h=1-st;else{if(h===nt)return j?NaN:(dt?-1:1)*(1/0);j=j+Math.pow(2,c),h=h-st}return(dt?-1:1)*j*Math.pow(2,h-c)};ieee754.write=function(o,e,a,c,d,h){var j,et,nt,st=h*8-d-1,ot=(1<>1,pt=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,dt=c?0:h-1,gt=c?1:-1,wt=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(et=isNaN(e)?1:0,j=ot):(j=Math.floor(Math.log(e)/Math.LN2),e*(nt=Math.pow(2,-j))<1&&(j--,nt*=2),j+ht>=1?e+=pt/nt:e+=pt*Math.pow(2,1-ht),e*nt>=2&&(j++,nt/=2),j+ht>=ot?(et=0,j=ot):j+ht>=1?(et=(e*nt-1)*Math.pow(2,d),j=j+ht):(et=e*Math.pow(2,ht-1)*Math.pow(2,d),j=0));d>=8;o[a+dt]=et&255,dt+=gt,et/=256,d-=8);for(j=j<0;o[a+dt]=j&255,dt+=gt,j/=256,st-=8);o[a+dt-gt]|=wt*128};/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */(function(o){const e=base64Js,a=ieee754,c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=ot,o.SlowBuffer=Bt,o.INSPECT_MAX_BYTES=50;const d=2147483647;o.kMaxLength=d;const{Uint8Array:h,ArrayBuffer:j,SharedArrayBuffer:et}=globalThis;ot.TYPED_ARRAY_SUPPORT=nt(),!ot.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 nt(){try{const It=new h(1),Et={foo:function(){return 42}};return Object.setPrototypeOf(Et,h.prototype),Object.setPrototypeOf(It,Et),It.foo()===42}catch{return!1}}Object.defineProperty(ot.prototype,"parent",{enumerable:!0,get:function(){if(ot.isBuffer(this))return this.buffer}}),Object.defineProperty(ot.prototype,"offset",{enumerable:!0,get:function(){if(ot.isBuffer(this))return this.byteOffset}});function st(It){if(It>d)throw new RangeError('The value "'+It+'" is invalid for option "size"');const Et=new h(It);return Object.setPrototypeOf(Et,ot.prototype),Et}function ot(It,Et,xt){if(typeof It=="number"){if(typeof Et=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return gt(It)}return ht(It,Et,xt)}ot.poolSize=8192;function ht(It,Et,xt){if(typeof It=="string")return wt(It,Et);if(j.isView(It))return _t(It);if(It==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof It);if(jt(It,j)||It&&jt(It.buffer,j)||typeof et<"u"&&(jt(It,et)||It&&jt(It.buffer,et)))return mt(It,Et,xt);if(typeof It=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const kt=It.valueOf&&It.valueOf();if(kt!=null&&kt!==It)return ot.from(kt,Et,xt);const zt=bt(It);if(zt)return zt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof It[Symbol.toPrimitive]=="function")return ot.from(It[Symbol.toPrimitive]("string"),Et,xt);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof It)}ot.from=function(It,Et,xt){return ht(It,Et,xt)},Object.setPrototypeOf(ot.prototype,h.prototype),Object.setPrototypeOf(ot,h);function pt(It){if(typeof It!="number")throw new TypeError('"size" argument must be of type number');if(It<0)throw new RangeError('The value "'+It+'" is invalid for option "size"')}function dt(It,Et,xt){return pt(It),It<=0?st(It):Et!==void 0?typeof xt=="string"?st(It).fill(Et,xt):st(It).fill(Et):st(It)}ot.alloc=function(It,Et,xt){return dt(It,Et,xt)};function gt(It){return pt(It),st(It<0?0:$t(It)|0)}ot.allocUnsafe=function(It){return gt(It)},ot.allocUnsafeSlow=function(It){return gt(It)};function wt(It,Et){if((typeof Et!="string"||Et==="")&&(Et="utf8"),!ot.isEncoding(Et))throw new TypeError("Unknown encoding: "+Et);const xt=Dt(It,Et)|0;let kt=st(xt);const zt=kt.write(It,Et);return zt!==xt&&(kt=kt.slice(0,zt)),kt}function St(It){const Et=It.length<0?0:$t(It.length)|0,xt=st(Et);for(let kt=0;kt=d)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d.toString(16)+" bytes");return It|0}function Bt(It){return+It!=It&&(It=0),ot.alloc(+It)}ot.isBuffer=function(Et){return Et!=null&&Et._isBuffer===!0&&Et!==ot.prototype},ot.compare=function(Et,xt){if(jt(Et,h)&&(Et=ot.from(Et,Et.offset,Et.byteLength)),jt(xt,h)&&(xt=ot.from(xt,xt.offset,xt.byteLength)),!ot.isBuffer(Et)||!ot.isBuffer(xt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Et===xt)return 0;let kt=Et.length,zt=xt.length;for(let Qt=0,Wt=Math.min(kt,zt);Qtzt.length?(ot.isBuffer(Wt)||(Wt=ot.from(Wt)),Wt.copy(zt,Qt)):h.prototype.set.call(zt,Wt,Qt);else if(ot.isBuffer(Wt))Wt.copy(zt,Qt);else throw new TypeError('"list" argument must be an Array of Buffers');Qt+=Wt.length}return zt};function Dt(It,Et){if(ot.isBuffer(It))return It.length;if(j.isView(It)||jt(It,j))return It.byteLength;if(typeof It!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof It);const xt=It.length,kt=arguments.length>2&&arguments[2]===!0;if(!kt&&xt===0)return 0;let zt=!1;for(;;)switch(Et){case"ascii":case"latin1":case"binary":return xt;case"utf8":case"utf-8":return Ir(It).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xt*2;case"hex":return xt>>>1;case"base64":return xr(It).length;default:if(zt)return kt?-1:Ir(It).length;Et=(""+Et).toLowerCase(),zt=!0}}ot.byteLength=Dt;function Ht(It,Et,xt){let kt=!1;if((Et===void 0||Et<0)&&(Et=0),Et>this.length||((xt===void 0||xt>this.length)&&(xt=this.length),xt<=0)||(xt>>>=0,Et>>>=0,xt<=Et))return"";for(It||(It="utf8");;)switch(It){case"hex":return yt(this,Et,xt);case"utf8":case"utf-8":return at(this,Et,xt);case"ascii":return _(this,Et,xt);case"latin1":case"binary":return it(this,Et,xt);case"base64":return rt(this,Et,xt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vt(this,Et,xt);default:if(kt)throw new TypeError("Unknown encoding: "+It);It=(It+"").toLowerCase(),kt=!0}}ot.prototype._isBuffer=!0;function qt(It,Et,xt){const kt=It[Et];It[Et]=It[xt],It[xt]=kt}ot.prototype.swap16=function(){const Et=this.length;if(Et%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let xt=0;xtxt&&(Et+=" ... "),""},c&&(ot.prototype[c]=ot.prototype.inspect),ot.prototype.compare=function(Et,xt,kt,zt,Qt){if(jt(Et,h)&&(Et=ot.from(Et,Et.offset,Et.byteLength)),!ot.isBuffer(Et))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Et);if(xt===void 0&&(xt=0),kt===void 0&&(kt=Et?Et.length:0),zt===void 0&&(zt=0),Qt===void 0&&(Qt=this.length),xt<0||kt>Et.length||zt<0||Qt>this.length)throw new RangeError("out of range index");if(zt>=Qt&&xt>=kt)return 0;if(zt>=Qt)return-1;if(xt>=kt)return 1;if(xt>>>=0,kt>>>=0,zt>>>=0,Qt>>>=0,this===Et)return 0;let Wt=Qt-zt,rr=kt-xt;const Mr=Math.min(Wt,rr),tr=this.slice(zt,Qt),ir=Et.slice(xt,kt);for(let Tr=0;Tr2147483647?xt=2147483647:xt<-2147483648&&(xt=-2147483648),xt=+xt,Rr(xt)&&(xt=zt?0:It.length-1),xt<0&&(xt=It.length+xt),xt>=It.length){if(zt)return-1;xt=It.length-1}else if(xt<0)if(zt)xt=0;else return-1;if(typeof Et=="string"&&(Et=ot.from(Et,kt)),ot.isBuffer(Et))return Et.length===0?-1:Gt(It,Et,xt,kt,zt);if(typeof Et=="number")return Et=Et&255,typeof h.prototype.indexOf=="function"?zt?h.prototype.indexOf.call(It,Et,xt):h.prototype.lastIndexOf.call(It,Et,xt):Gt(It,[Et],xt,kt,zt);throw new TypeError("val must be string, number or Buffer")}function Gt(It,Et,xt,kt,zt){let Qt=1,Wt=It.length,rr=Et.length;if(kt!==void 0&&(kt=String(kt).toLowerCase(),kt==="ucs2"||kt==="ucs-2"||kt==="utf16le"||kt==="utf-16le")){if(It.length<2||Et.length<2)return-1;Qt=2,Wt/=2,rr/=2,xt/=2}function Mr(ir,Tr){return Qt===1?ir[Tr]:ir.readUInt16BE(Tr*Qt)}let tr;if(zt){let ir=-1;for(tr=xt;trWt&&(xt=Wt-rr),tr=xt;tr>=0;tr--){let ir=!0;for(let Tr=0;Trzt&&(kt=zt)):kt=zt;const Qt=Et.length;kt>Qt/2&&(kt=Qt/2);let Wt;for(Wt=0;Wt>>0,isFinite(kt)?(kt=kt>>>0,zt===void 0&&(zt="utf8")):(zt=kt,kt=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Qt=this.length-xt;if((kt===void 0||kt>Qt)&&(kt=Qt),Et.length>0&&(kt<0||xt<0)||xt>this.length)throw new RangeError("Attempt to write outside buffer bounds");zt||(zt="utf8");let Wt=!1;for(;;)switch(zt){case"hex":return ct(this,Et,xt,kt);case"utf8":case"utf-8":return g(this,Et,xt,kt);case"ascii":case"latin1":case"binary":return b(this,Et,xt,kt);case"base64":return $(this,Et,xt,kt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _e(this,Et,xt,kt);default:if(Wt)throw new TypeError("Unknown encoding: "+zt);zt=(""+zt).toLowerCase(),Wt=!0}},ot.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rt(It,Et,xt){return Et===0&&xt===It.length?e.fromByteArray(It):e.fromByteArray(It.slice(Et,xt))}function at(It,Et,xt){xt=Math.min(It.length,xt);const kt=[];let zt=Et;for(;zt239?4:Qt>223?3:Qt>191?2:1;if(zt+rr<=xt){let Mr,tr,ir,Tr;switch(rr){case 1:Qt<128&&(Wt=Qt);break;case 2:Mr=It[zt+1],(Mr&192)===128&&(Tr=(Qt&31)<<6|Mr&63,Tr>127&&(Wt=Tr));break;case 3:Mr=It[zt+1],tr=It[zt+2],(Mr&192)===128&&(tr&192)===128&&(Tr=(Qt&15)<<12|(Mr&63)<<6|tr&63,Tr>2047&&(Tr<55296||Tr>57343)&&(Wt=Tr));break;case 4:Mr=It[zt+1],tr=It[zt+2],ir=It[zt+3],(Mr&192)===128&&(tr&192)===128&&(ir&192)===128&&(Tr=(Qt&15)<<18|(Mr&63)<<12|(tr&63)<<6|ir&63,Tr>65535&&Tr<1114112&&(Wt=Tr))}}Wt===null?(Wt=65533,rr=1):Wt>65535&&(Wt-=65536,kt.push(Wt>>>10&1023|55296),Wt=56320|Wt&1023),kt.push(Wt),zt+=rr}return tt(kt)}const lt=4096;function tt(It){const Et=It.length;if(Et<=lt)return String.fromCharCode.apply(String,It);let xt="",kt=0;for(;ktkt)&&(xt=kt);let zt="";for(let Qt=Et;Qtkt&&(Et=kt),xt<0?(xt+=kt,xt<0&&(xt=0)):xt>kt&&(xt=kt),xtxt)throw new RangeError("Trying to access beyond buffer length")}ot.prototype.readUintLE=ot.prototype.readUIntLE=function(Et,xt,kt){Et=Et>>>0,xt=xt>>>0,kt||Rt(Et,xt,this.length);let zt=this[Et],Qt=1,Wt=0;for(;++Wt>>0,xt=xt>>>0,kt||Rt(Et,xt,this.length);let zt=this[Et+--xt],Qt=1;for(;xt>0&&(Qt*=256);)zt+=this[Et+--xt]*Qt;return zt},ot.prototype.readUint8=ot.prototype.readUInt8=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,1,this.length),this[Et]},ot.prototype.readUint16LE=ot.prototype.readUInt16LE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,2,this.length),this[Et]|this[Et+1]<<8},ot.prototype.readUint16BE=ot.prototype.readUInt16BE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,2,this.length),this[Et]<<8|this[Et+1]},ot.prototype.readUint32LE=ot.prototype.readUInt32LE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,4,this.length),(this[Et]|this[Et+1]<<8|this[Et+2]<<16)+this[Et+3]*16777216},ot.prototype.readUint32BE=ot.prototype.readUInt32BE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,4,this.length),this[Et]*16777216+(this[Et+1]<<16|this[Et+2]<<8|this[Et+3])},ot.prototype.readBigUInt64LE=Zt(function(Et){Et=Et>>>0,Jt(Et,"offset");const xt=this[Et],kt=this[Et+7];(xt===void 0||kt===void 0)&&Ar(Et,this.length-8);const zt=xt+this[++Et]*2**8+this[++Et]*2**16+this[++Et]*2**24,Qt=this[++Et]+this[++Et]*2**8+this[++Et]*2**16+kt*2**24;return BigInt(zt)+(BigInt(Qt)<>>0,Jt(Et,"offset");const xt=this[Et],kt=this[Et+7];(xt===void 0||kt===void 0)&&Ar(Et,this.length-8);const zt=xt*2**24+this[++Et]*2**16+this[++Et]*2**8+this[++Et],Qt=this[++Et]*2**24+this[++Et]*2**16+this[++Et]*2**8+kt;return(BigInt(zt)<>>0,xt=xt>>>0,kt||Rt(Et,xt,this.length);let zt=this[Et],Qt=1,Wt=0;for(;++Wt=Qt&&(zt-=Math.pow(2,8*xt)),zt},ot.prototype.readIntBE=function(Et,xt,kt){Et=Et>>>0,xt=xt>>>0,kt||Rt(Et,xt,this.length);let zt=xt,Qt=1,Wt=this[Et+--zt];for(;zt>0&&(Qt*=256);)Wt+=this[Et+--zt]*Qt;return Qt*=128,Wt>=Qt&&(Wt-=Math.pow(2,8*xt)),Wt},ot.prototype.readInt8=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,1,this.length),this[Et]&128?(255-this[Et]+1)*-1:this[Et]},ot.prototype.readInt16LE=function(Et,xt){Et=Et>>>0,xt||Rt(Et,2,this.length);const kt=this[Et]|this[Et+1]<<8;return kt&32768?kt|4294901760:kt},ot.prototype.readInt16BE=function(Et,xt){Et=Et>>>0,xt||Rt(Et,2,this.length);const kt=this[Et+1]|this[Et]<<8;return kt&32768?kt|4294901760:kt},ot.prototype.readInt32LE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,4,this.length),this[Et]|this[Et+1]<<8|this[Et+2]<<16|this[Et+3]<<24},ot.prototype.readInt32BE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,4,this.length),this[Et]<<24|this[Et+1]<<16|this[Et+2]<<8|this[Et+3]},ot.prototype.readBigInt64LE=Zt(function(Et){Et=Et>>>0,Jt(Et,"offset");const xt=this[Et],kt=this[Et+7];(xt===void 0||kt===void 0)&&Ar(Et,this.length-8);const zt=this[Et+4]+this[Et+5]*2**8+this[Et+6]*2**16+(kt<<24);return(BigInt(zt)<>>0,Jt(Et,"offset");const xt=this[Et],kt=this[Et+7];(xt===void 0||kt===void 0)&&Ar(Et,this.length-8);const zt=(xt<<24)+this[++Et]*2**16+this[++Et]*2**8+this[++Et];return(BigInt(zt)<>>0,xt||Rt(Et,4,this.length),a.read(this,Et,!0,23,4)},ot.prototype.readFloatBE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,4,this.length),a.read(this,Et,!1,23,4)},ot.prototype.readDoubleLE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,8,this.length),a.read(this,Et,!0,52,8)},ot.prototype.readDoubleBE=function(Et,xt){return Et=Et>>>0,xt||Rt(Et,8,this.length),a.read(this,Et,!1,52,8)};function Tt(It,Et,xt,kt,zt,Qt){if(!ot.isBuffer(It))throw new TypeError('"buffer" argument must be a Buffer instance');if(Et>zt||EtIt.length)throw new RangeError("Index out of range")}ot.prototype.writeUintLE=ot.prototype.writeUIntLE=function(Et,xt,kt,zt){if(Et=+Et,xt=xt>>>0,kt=kt>>>0,!zt){const rr=Math.pow(2,8*kt)-1;Tt(this,Et,xt,kt,rr,0)}let Qt=1,Wt=0;for(this[xt]=Et&255;++Wt>>0,kt=kt>>>0,!zt){const rr=Math.pow(2,8*kt)-1;Tt(this,Et,xt,kt,rr,0)}let Qt=kt-1,Wt=1;for(this[xt+Qt]=Et&255;--Qt>=0&&(Wt*=256);)this[xt+Qt]=Et/Wt&255;return xt+kt},ot.prototype.writeUint8=ot.prototype.writeUInt8=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,1,255,0),this[xt]=Et&255,xt+1},ot.prototype.writeUint16LE=ot.prototype.writeUInt16LE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,2,65535,0),this[xt]=Et&255,this[xt+1]=Et>>>8,xt+2},ot.prototype.writeUint16BE=ot.prototype.writeUInt16BE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,2,65535,0),this[xt]=Et>>>8,this[xt+1]=Et&255,xt+2},ot.prototype.writeUint32LE=ot.prototype.writeUInt32LE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,4,4294967295,0),this[xt+3]=Et>>>24,this[xt+2]=Et>>>16,this[xt+1]=Et>>>8,this[xt]=Et&255,xt+4},ot.prototype.writeUint32BE=ot.prototype.writeUInt32BE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,4,4294967295,0),this[xt]=Et>>>24,this[xt+1]=Et>>>16,this[xt+2]=Et>>>8,this[xt+3]=Et&255,xt+4};function Mt(It,Et,xt,kt,zt){Xt(Et,kt,zt,It,xt,7);let Qt=Number(Et&BigInt(4294967295));It[xt++]=Qt,Qt=Qt>>8,It[xt++]=Qt,Qt=Qt>>8,It[xt++]=Qt,Qt=Qt>>8,It[xt++]=Qt;let Wt=Number(Et>>BigInt(32)&BigInt(4294967295));return It[xt++]=Wt,Wt=Wt>>8,It[xt++]=Wt,Wt=Wt>>8,It[xt++]=Wt,Wt=Wt>>8,It[xt++]=Wt,xt}function At(It,Et,xt,kt,zt){Xt(Et,kt,zt,It,xt,7);let Qt=Number(Et&BigInt(4294967295));It[xt+7]=Qt,Qt=Qt>>8,It[xt+6]=Qt,Qt=Qt>>8,It[xt+5]=Qt,Qt=Qt>>8,It[xt+4]=Qt;let Wt=Number(Et>>BigInt(32)&BigInt(4294967295));return It[xt+3]=Wt,Wt=Wt>>8,It[xt+2]=Wt,Wt=Wt>>8,It[xt+1]=Wt,Wt=Wt>>8,It[xt]=Wt,xt+8}ot.prototype.writeBigUInt64LE=Zt(function(Et,xt=0){return Mt(this,Et,xt,BigInt(0),BigInt("0xffffffffffffffff"))}),ot.prototype.writeBigUInt64BE=Zt(function(Et,xt=0){return At(this,Et,xt,BigInt(0),BigInt("0xffffffffffffffff"))}),ot.prototype.writeIntLE=function(Et,xt,kt,zt){if(Et=+Et,xt=xt>>>0,!zt){const Mr=Math.pow(2,8*kt-1);Tt(this,Et,xt,kt,Mr-1,-Mr)}let Qt=0,Wt=1,rr=0;for(this[xt]=Et&255;++Qt>0)-rr&255;return xt+kt},ot.prototype.writeIntBE=function(Et,xt,kt,zt){if(Et=+Et,xt=xt>>>0,!zt){const Mr=Math.pow(2,8*kt-1);Tt(this,Et,xt,kt,Mr-1,-Mr)}let Qt=kt-1,Wt=1,rr=0;for(this[xt+Qt]=Et&255;--Qt>=0&&(Wt*=256);)Et<0&&rr===0&&this[xt+Qt+1]!==0&&(rr=1),this[xt+Qt]=(Et/Wt>>0)-rr&255;return xt+kt},ot.prototype.writeInt8=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,1,127,-128),Et<0&&(Et=255+Et+1),this[xt]=Et&255,xt+1},ot.prototype.writeInt16LE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,2,32767,-32768),this[xt]=Et&255,this[xt+1]=Et>>>8,xt+2},ot.prototype.writeInt16BE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,2,32767,-32768),this[xt]=Et>>>8,this[xt+1]=Et&255,xt+2},ot.prototype.writeInt32LE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,4,2147483647,-2147483648),this[xt]=Et&255,this[xt+1]=Et>>>8,this[xt+2]=Et>>>16,this[xt+3]=Et>>>24,xt+4},ot.prototype.writeInt32BE=function(Et,xt,kt){return Et=+Et,xt=xt>>>0,kt||Tt(this,Et,xt,4,2147483647,-2147483648),Et<0&&(Et=4294967295+Et+1),this[xt]=Et>>>24,this[xt+1]=Et>>>16,this[xt+2]=Et>>>8,this[xt+3]=Et&255,xt+4},ot.prototype.writeBigInt64LE=Zt(function(Et,xt=0){return Mt(this,Et,xt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),ot.prototype.writeBigInt64BE=Zt(function(Et,xt=0){return At(this,Et,xt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ot(It,Et,xt,kt,zt,Qt){if(xt+kt>It.length)throw new RangeError("Index out of range");if(xt<0)throw new RangeError("Index out of range")}function Ct(It,Et,xt,kt,zt){return Et=+Et,xt=xt>>>0,zt||Ot(It,Et,xt,4),a.write(It,Et,xt,kt,23,4),xt+4}ot.prototype.writeFloatLE=function(Et,xt,kt){return Ct(this,Et,xt,!0,kt)},ot.prototype.writeFloatBE=function(Et,xt,kt){return Ct(this,Et,xt,!1,kt)};function Ut(It,Et,xt,kt,zt){return Et=+Et,xt=xt>>>0,zt||Ot(It,Et,xt,8),a.write(It,Et,xt,kt,52,8),xt+8}ot.prototype.writeDoubleLE=function(Et,xt,kt){return Ut(this,Et,xt,!0,kt)},ot.prototype.writeDoubleBE=function(Et,xt,kt){return Ut(this,Et,xt,!1,kt)},ot.prototype.copy=function(Et,xt,kt,zt){if(!ot.isBuffer(Et))throw new TypeError("argument should be a Buffer");if(kt||(kt=0),!zt&&zt!==0&&(zt=this.length),xt>=Et.length&&(xt=Et.length),xt||(xt=0),zt>0&&zt=this.length)throw new RangeError("Index out of range");if(zt<0)throw new RangeError("sourceEnd out of bounds");zt>this.length&&(zt=this.length),Et.length-xt>>0,kt=kt===void 0?this.length:kt>>>0,Et||(Et=0);let Qt;if(typeof Et=="number")for(Qt=xt;Qt2**32?zt=Kt(String(xt)):typeof xt=="bigint"&&(zt=String(xt),(xt>BigInt(2)**BigInt(32)||xt<-(BigInt(2)**BigInt(32)))&&(zt=Kt(zt)),zt+="n"),kt+=` It must be ${Et}. Received ${zt}`,kt},RangeError);function Kt(It){let Et="",xt=It.length;const kt=It[0]==="-"?1:0;for(;xt>=kt+4;xt-=3)Et=`_${It.slice(xt-3,xt)}${Et}`;return`${It.slice(0,xt)}${Et}`}function yr(It,Et,xt){Jt(Et,"offset"),(It[Et]===void 0||It[Et+xt]===void 0)&&Ar(Et,It.length-(xt+1))}function Xt(It,Et,xt,kt,zt,Qt){if(It>xt||It= 0${Wt} and < 2${Wt} ** ${(Qt+1)*8}${Wt}`:rr=`>= -(2${Wt} ** ${(Qt+1)*8-1}${Wt}) and < 2 ** ${(Qt+1)*8-1}${Wt}`,new Lt.ERR_OUT_OF_RANGE("value",rr,It)}yr(kt,zt,Qt)}function Jt(It,Et){if(typeof It!="number")throw new Lt.ERR_INVALID_ARG_TYPE(Et,"number",It)}function Ar(It,Et,xt){throw Math.floor(It)!==It?(Jt(It,xt),new Lt.ERR_OUT_OF_RANGE("offset","an integer",It)):Et<0?new Lt.ERR_BUFFER_OUT_OF_BOUNDS:new Lt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Et}`,It)}const er=/[^+/0-9A-Za-z-_]/g;function Vt(It){if(It=It.split("=")[0],It=It.trim().replace(er,""),It.length<2)return"";for(;It.length%4!==0;)It=It+"=";return It}function Ir(It,Et){Et=Et||1/0;let xt;const kt=It.length;let zt=null;const Qt=[];for(let Wt=0;Wt55295&&xt<57344){if(!zt){if(xt>56319){(Et-=3)>-1&&Qt.push(239,191,189);continue}else if(Wt+1===kt){(Et-=3)>-1&&Qt.push(239,191,189);continue}zt=xt;continue}if(xt<56320){(Et-=3)>-1&&Qt.push(239,191,189),zt=xt;continue}xt=(zt-55296<<10|xt-56320)+65536}else zt&&(Et-=3)>-1&&Qt.push(239,191,189);if(zt=null,xt<128){if((Et-=1)<0)break;Qt.push(xt)}else if(xt<2048){if((Et-=2)<0)break;Qt.push(xt>>6|192,xt&63|128)}else if(xt<65536){if((Et-=3)<0)break;Qt.push(xt>>12|224,xt>>6&63|128,xt&63|128)}else if(xt<1114112){if((Et-=4)<0)break;Qt.push(xt>>18|240,xt>>12&63|128,xt>>6&63|128,xt&63|128)}else throw new Error("Invalid code point")}return Qt}function nr(It){const Et=[];for(let xt=0;xt>8,zt=xt%256,Qt.push(zt),Qt.push(kt);return Qt}function xr(It){return e.toByteArray(Vt(It))}function Ft(It,Et,xt,kt){let zt;for(zt=0;zt=Et.length||zt>=It.length);++zt)Et[zt+xt]=It[zt];return zt}function jt(It,Et){return It instanceof Et||It!=null&&It.constructor!=null&&It.constructor.name!=null&&It.constructor.name===Et.name}function Rr(It){return It!==It}const Yt=function(){const It="0123456789abcdef",Et=new Array(256);for(let xt=0;xt<16;++xt){const kt=xt*16;for(let zt=0;zt<16;++zt)Et[kt+zt]=It[xt]+It[zt]}return Et}();function Zt(It){return typeof BigInt>"u"?$r:It}function $r(){throw new Error("BigInt not supported")}})(buffer$1);const Buffer$C=buffer$1.Buffer,Blob$4=buffer$1.Blob,BlobOptions=buffer$1.BlobOptions,Buffer$1$1=buffer$1.Buffer,File=buffer$1.File,FileOptions=buffer$1.FileOptions,INSPECT_MAX_BYTES=buffer$1.INSPECT_MAX_BYTES,SlowBuffer=buffer$1.SlowBuffer,TranscodeEncoding=buffer$1.TranscodeEncoding,atob=buffer$1.atob,btoa=buffer$1.btoa,constants$3=buffer$1.constants,isAscii=buffer$1.isAscii,isUtf8=buffer$1.isUtf8,kMaxLength=buffer$1.kMaxLength,kStringMaxLength=buffer$1.kStringMaxLength,resolveObjectURL=buffer$1.resolveObjectURL,transcode=buffer$1.transcode,dist$3=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$4,BlobOptions,Buffer:Buffer$1$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob,btoa,constants:constants$3,default:Buffer$C,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode},Symbol.toStringTag,{value:"Module"}));function anumber(o){if(!Number.isSafeInteger(o)||o<0)throw new Error("positive integer expected, got "+o)}function isBytes$1(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function abytes$1(o,...e){if(!isBytes$1(o))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(o.length))throw new Error("Uint8Array expected of length "+e+", got length="+o.length)}function ahash(o){if(typeof o!="function"||typeof o.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");anumber(o.outputLen),anumber(o.blockLen)}function aexists(o,e=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(e&&o.finished)throw new Error("Hash#digest() has already been called")}function aoutput(o,e){abytes$1(o);const a=e.outputLen;if(o.lengthnew Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)),createView=o=>new DataView(o.buffer,o.byteOffset,o.byteLength),rotr=(o,e)=>o<<32-e|o>>>e,isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=o=>o<<24&4278190080|o<<8&16711680|o>>>8&65280|o>>>24&255;function byteSwap32(o){for(let e=0;eo().update(toBytes(c)).digest(),a=o();return e.outputLen=a.outputLen,e.blockLen=a.blockLen,e.create=()=>o(),e}function randomBytes$3(o=32){if(crypto$3&&typeof crypto$3.getRandomValues=="function")return crypto$3.getRandomValues(new Uint8Array(o));if(crypto$3&&typeof crypto$3.randomBytes=="function")return crypto$3.randomBytes(o);throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(o,e,a,c){if(typeof o.setBigUint64=="function")return o.setBigUint64(e,a,c);const d=BigInt(32),h=BigInt(4294967295),j=Number(a>>d&h),et=Number(a&h),nt=c?4:0,st=c?0:4;o.setUint32(e+nt,j,c),o.setUint32(e+st,et,c)}const Chi=(o,e,a)=>o&e^~o&a,Maj=(o,e,a)=>o&e^o&a^e&a;class HashMD extends Hash$8{constructor(e,a,c,d){super(),this.blockLen=e,this.outputLen=a,this.padOffset=c,this.isLE=d,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){aexists(this);const{view:a,buffer:c,blockLen:d}=this;e=toBytes(e);const h=e.length;for(let j=0;jd-j&&(this.process(c,0),j=0);for(let ht=j;htot.length)throw new Error("_sha2: outputLen bigger than state");for(let ht=0;ht>_32n&U32_MASK64)}:{h:Number(o>>_32n&U32_MASK64)|0,l:Number(o&U32_MASK64)|0}}function split(o,e=!1){let a=new Uint32Array(o.length),c=new Uint32Array(o.length);for(let d=0;dBigInt(o>>>0)<<_32n|BigInt(e>>>0),shrSH=(o,e,a)=>o>>>a,shrSL=(o,e,a)=>o<<32-a|e>>>a,rotrSH=(o,e,a)=>o>>>a|e<<32-a,rotrSL=(o,e,a)=>o<<32-a|e>>>a,rotrBH=(o,e,a)=>o<<64-a|e>>>a-32,rotrBL=(o,e,a)=>o>>>a-32|e<<64-a,rotr32H=(o,e)=>e,rotr32L=(o,e)=>o,rotlSH=(o,e,a)=>o<>>32-a,rotlSL=(o,e,a)=>e<>>32-a,rotlBH=(o,e,a)=>e<>>64-a,rotlBL=(o,e,a)=>o<>>64-a;function add(o,e,a,c){const d=(e>>>0)+(c>>>0);return{h:o+a+(d/2**32|0)|0,l:d|0}}const add3L=(o,e,a)=>(o>>>0)+(e>>>0)+(a>>>0),add3H=(o,e,a,c)=>e+a+c+(o/2**32|0)|0,add4L=(o,e,a,c)=>(o>>>0)+(e>>>0)+(a>>>0)+(c>>>0),add4H=(o,e,a,c,d)=>e+a+c+d+(o/2**32|0)|0,add5L=(o,e,a,c,d)=>(o>>>0)+(e>>>0)+(a>>>0)+(c>>>0)+(d>>>0),add5H=(o,e,a,c,d,h)=>e+a+c+d+h+(o/2**32|0)|0,u64$4={fromBig,split,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},[SHA512_Kh,SHA512_Kl]=u64$4.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(o=>BigInt(o))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);let SHA512$3=class extends HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:a,Bh:c,Bl:d,Ch:h,Cl:j,Dh:et,Dl:nt,Eh:st,El:ot,Fh:ht,Fl:pt,Gh:dt,Gl:gt,Hh:wt,Hl:St}=this;return[e,a,c,d,h,j,et,nt,st,ot,ht,pt,dt,gt,wt,St]}set(e,a,c,d,h,j,et,nt,st,ot,ht,pt,dt,gt,wt,St){this.Ah=e|0,this.Al=a|0,this.Bh=c|0,this.Bl=d|0,this.Ch=h|0,this.Cl=j|0,this.Dh=et|0,this.Dl=nt|0,this.Eh=st|0,this.El=ot|0,this.Fh=ht|0,this.Fl=pt|0,this.Gh=dt|0,this.Gl=gt|0,this.Hh=wt|0,this.Hl=St|0}process(e,a){for(let bt=0;bt<16;bt++,a+=4)SHA512_W_H[bt]=e.getUint32(a),SHA512_W_L[bt]=e.getUint32(a+=4);for(let bt=16;bt<80;bt++){const $t=SHA512_W_H[bt-15]|0,Bt=SHA512_W_L[bt-15]|0,Dt=u64$4.rotrSH($t,Bt,1)^u64$4.rotrSH($t,Bt,8)^u64$4.shrSH($t,Bt,7),Ht=u64$4.rotrSL($t,Bt,1)^u64$4.rotrSL($t,Bt,8)^u64$4.shrSL($t,Bt,7),qt=SHA512_W_H[bt-2]|0,Pt=SHA512_W_L[bt-2]|0,Gt=u64$4.rotrSH(qt,Pt,19)^u64$4.rotrBH(qt,Pt,61)^u64$4.shrSH(qt,Pt,6),ct=u64$4.rotrSL(qt,Pt,19)^u64$4.rotrBL(qt,Pt,61)^u64$4.shrSL(qt,Pt,6),g=u64$4.add4L(Ht,ct,SHA512_W_L[bt-7],SHA512_W_L[bt-16]),b=u64$4.add4H(g,Dt,Gt,SHA512_W_H[bt-7],SHA512_W_H[bt-16]);SHA512_W_H[bt]=b|0,SHA512_W_L[bt]=g|0}let{Ah:c,Al:d,Bh:h,Bl:j,Ch:et,Cl:nt,Dh:st,Dl:ot,Eh:ht,El:pt,Fh:dt,Fl:gt,Gh:wt,Gl:St,Hh:_t,Hl:mt}=this;for(let bt=0;bt<80;bt++){const $t=u64$4.rotrSH(ht,pt,14)^u64$4.rotrSH(ht,pt,18)^u64$4.rotrBH(ht,pt,41),Bt=u64$4.rotrSL(ht,pt,14)^u64$4.rotrSL(ht,pt,18)^u64$4.rotrBL(ht,pt,41),Dt=ht&dt^~ht&wt,Ht=pt>^~pt&St,qt=u64$4.add5L(mt,Bt,Ht,SHA512_Kl[bt],SHA512_W_L[bt]),Pt=u64$4.add5H(qt,_t,$t,Dt,SHA512_Kh[bt],SHA512_W_H[bt]),Gt=qt|0,ct=u64$4.rotrSH(c,d,28)^u64$4.rotrBH(c,d,34)^u64$4.rotrBH(c,d,39),g=u64$4.rotrSL(c,d,28)^u64$4.rotrBL(c,d,34)^u64$4.rotrBL(c,d,39),b=c&h^c&et^h&et,$=d&j^d&nt^j&nt;_t=wt|0,mt=St|0,wt=dt|0,St=gt|0,dt=ht|0,gt=pt|0,{h:ht,l:pt}=u64$4.add(st|0,ot|0,Pt|0,Gt|0),st=et|0,ot=nt|0,et=h|0,nt=j|0,h=c|0,j=d|0;const _e=u64$4.add3L(Gt,g,$);c=u64$4.add3H(_e,Pt,ct,b),d=_e|0}({h:c,l:d}=u64$4.add(this.Ah|0,this.Al|0,c|0,d|0)),{h,l:j}=u64$4.add(this.Bh|0,this.Bl|0,h|0,j|0),{h:et,l:nt}=u64$4.add(this.Ch|0,this.Cl|0,et|0,nt|0),{h:st,l:ot}=u64$4.add(this.Dh|0,this.Dl|0,st|0,ot|0),{h:ht,l:pt}=u64$4.add(this.Eh|0,this.El|0,ht|0,pt|0),{h:dt,l:gt}=u64$4.add(this.Fh|0,this.Fl|0,dt|0,gt|0),{h:wt,l:St}=u64$4.add(this.Gh|0,this.Gl|0,wt|0,St|0),{h:_t,l:mt}=u64$4.add(this.Hh|0,this.Hl|0,_t|0,mt|0),this.set(c,d,h,j,et,nt,st,ot,ht,pt,dt,gt,wt,St,_t,mt)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const sha512$2=wrapConstructor(()=>new SHA512$3);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$7=BigInt(1),_2n$5=BigInt(2);function isBytes(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function abytes(o){if(!isBytes(o))throw new Error("Uint8Array expected")}function abool(o,e){if(typeof e!="boolean")throw new Error(o+" boolean expected, got "+e)}const hexes=Array.from({length:256},(o,e)=>e.toString(16).padStart(2,"0"));function bytesToHex(o){abytes(o);let e="";for(let a=0;a=asciis._0&&o<=asciis._9)return o-asciis._0;if(o>=asciis.A&&o<=asciis.F)return o-(asciis.A-10);if(o>=asciis.a&&o<=asciis.f)return o-(asciis.a-10)}function hexToBytes(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const e=o.length,a=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const c=new Uint8Array(a);for(let d=0,h=0;dtypeof o=="bigint"&&_0n$5<=o;function inRange$1(o,e,a){return isPosBig(o)&&isPosBig(e)&&isPosBig(a)&&e<=o&&o_0n$5;o>>=_1n$7,e+=1);return e}function bitGet(o,e){return o>>BigInt(e)&_1n$7}function bitSet(o,e,a){return o|(a?_1n$7:_0n$5)<(_2n$5<new Uint8Array(o),u8fr=o=>Uint8Array.from(o);function createHmacDrbg(o,e,a){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof a!="function")throw new Error("hmacFn must be a function");let c=u8n(o),d=u8n(o),h=0;const j=()=>{c.fill(1),d.fill(0),h=0},et=(...ht)=>a(d,c,...ht),nt=(ht=u8n())=>{d=et(u8fr([0]),ht),c=et(),ht.length!==0&&(d=et(u8fr([1]),ht),c=et())},st=()=>{if(h++>=1e3)throw new Error("drbg: tried 1000 values");let ht=0;const pt=[];for(;ht{j(),nt(ht);let dt;for(;!(dt=pt(st()));)nt();return j(),dt}}const validatorFns={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||isBytes(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,e)=>e.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function validateObject(o,e,a={}){const c=(d,h,j)=>{const et=validatorFns[h];if(typeof et!="function")throw new Error("invalid validator function");const nt=o[d];if(!(j&&nt===void 0)&&!et(nt,o))throw new Error("param "+String(d)+" is invalid. Expected "+h+", got "+nt)};for(const[d,h]of Object.entries(e))c(d,h,!1);for(const[d,h]of Object.entries(a))c(d,h,!0);return o}const notImplemented=()=>{throw new Error("not implemented")};function memoized(o){const e=new WeakMap;return(a,...c)=>{const d=e.get(a);if(d!==void 0)return d;const h=o(a,...c);return e.set(a,h),h}}const ut=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex,bytesToNumberBE,bytesToNumberLE,concatBytes,createHmacDrbg,ensureBytes,equalBytes,hexToBytes,hexToNumber,inRange:inRange$1,isBytes,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded,numberToVarBytesBE,utf8ToBytes,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),_2n$4=BigInt(2),_3n$1=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$2=BigInt(8);function mod(o,e){const a=o%e;return a>=_0n$4?a:e+a}function pow(o,e,a){if(e<_0n$4)throw new Error("invalid exponent, negatives unsupported");if(a<=_0n$4)throw new Error("invalid modulus");if(a===_1n$6)return _0n$4;let c=_1n$6;for(;e>_0n$4;)e&_1n$6&&(c=c*o%a),o=o*o%a,e>>=_1n$6;return c}function pow2(o,e,a){let c=o;for(;e-- >_0n$4;)c*=c,c%=a;return c}function invert(o,e){if(o===_0n$4)throw new Error("invert: expected non-zero number");if(e<=_0n$4)throw new Error("invert: expected positive modulus, got "+e);let a=mod(o,e),c=e,d=_0n$4,h=_1n$6;for(;a!==_0n$4;){const et=c/a,nt=c%a,st=d-h*et;c=a,a=nt,d=h,h=st}if(c!==_1n$6)throw new Error("invert: does not exist");return mod(d,e)}function tonelliShanks(o){const e=(o-_1n$6)/_2n$4;let a,c,d;for(a=o-_1n$6,c=0;a%_2n$4===_0n$4;a/=_2n$4,c++);for(d=_2n$4;d1e3)throw new Error("Cannot find square root: likely non-prime P");if(c===1){const j=(o+_1n$6)/_4n;return function(nt,st){const ot=nt.pow(st,j);if(!nt.eql(nt.sqr(ot),st))throw new Error("Cannot find square root");return ot}}const h=(a+_1n$6)/_2n$4;return function(et,nt){if(et.pow(nt,e)===et.neg(et.ONE))throw new Error("Cannot find square root");let st=c,ot=et.pow(et.mul(et.ONE,d),a),ht=et.pow(nt,h),pt=et.pow(nt,a);for(;!et.eql(pt,et.ONE);){if(et.eql(pt,et.ZERO))return et.ZERO;let dt=1;for(let wt=et.sqr(pt);dt(mod(o,e)&_1n$6)===_1n$6,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(o){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},a=FIELD_FIELDS.reduce((c,d)=>(c[d]="function",c),e);return validateObject(o,a)}function FpPow(o,e,a){if(a<_0n$4)throw new Error("invalid exponent, negatives unsupported");if(a===_0n$4)return o.ONE;if(a===_1n$6)return e;let c=o.ONE,d=e;for(;a>_0n$4;)a&_1n$6&&(c=o.mul(c,d)),d=o.sqr(d),a>>=_1n$6;return c}function FpInvertBatch(o,e){const a=new Array(e.length),c=e.reduce((h,j,et)=>o.is0(j)?h:(a[et]=h,o.mul(h,j)),o.ONE),d=o.inv(c);return e.reduceRight((h,j,et)=>o.is0(j)?h:(a[et]=o.mul(h,a[et]),o.mul(h,j)),d),a}function nLength(o,e){const a=e!==void 0?e:o.toString(2).length,c=Math.ceil(a/8);return{nBitLength:a,nByteLength:c}}function Field(o,e,a=!1,c={}){if(o<=_0n$4)throw new Error("invalid field: expected ORDER > 0, got "+o);const{nBitLength:d,nByteLength:h}=nLength(o,e);if(h>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let j;const et=Object.freeze({ORDER:o,BITS:d,BYTES:h,MASK:bitMask(d),ZERO:_0n$4,ONE:_1n$6,create:nt=>mod(nt,o),isValid:nt=>{if(typeof nt!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof nt);return _0n$4<=nt&&ntnt===_0n$4,isOdd:nt=>(nt&_1n$6)===_1n$6,neg:nt=>mod(-nt,o),eql:(nt,st)=>nt===st,sqr:nt=>mod(nt*nt,o),add:(nt,st)=>mod(nt+st,o),sub:(nt,st)=>mod(nt-st,o),mul:(nt,st)=>mod(nt*st,o),pow:(nt,st)=>FpPow(et,nt,st),div:(nt,st)=>mod(nt*invert(st,o),o),sqrN:nt=>nt*nt,addN:(nt,st)=>nt+st,subN:(nt,st)=>nt-st,mulN:(nt,st)=>nt*st,inv:nt=>invert(nt,o),sqrt:c.sqrt||(nt=>(j||(j=FpSqrt(o)),j(et,nt))),invertBatch:nt=>FpInvertBatch(et,nt),cmov:(nt,st,ot)=>ot?st:nt,toBytes:nt=>a?numberToBytesLE(nt,h):numberToBytesBE(nt,h),fromBytes:nt=>{if(nt.length!==h)throw new Error("Field.fromBytes: expected "+h+" bytes, got "+nt.length);return a?bytesToNumberLE(nt):bytesToNumberBE(nt)}});return Object.freeze(et)}function getFieldBytesLength(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const e=o.toString(2).length;return Math.ceil(e/8)}function getMinHashLength(o){const e=getFieldBytesLength(o);return e+Math.ceil(e/2)}function mapHashToField(o,e,a=!1){const c=o.length,d=getFieldBytesLength(e),h=getMinHashLength(e);if(c<16||c1024)throw new Error("expected "+h+"-1024 bytes of input, got "+c);const j=a?bytesToNumberBE(o):bytesToNumberLE(o),et=mod(j,e-_1n$6)+_1n$6;return a?numberToBytesLE(et,d):numberToBytesBE(et,d)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$5=BigInt(1);function constTimeNegate(o,e){const a=e.negate();return o?a:e}function validateW(o,e){if(!Number.isSafeInteger(o)||o<=0||o>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+o)}function calcWOpts(o,e){validateW(o,e);const a=Math.ceil(e/o)+1,c=2**(o-1);return{windows:a,windowSize:c}}function validateMSMPoints(o,e){if(!Array.isArray(o))throw new Error("array expected");o.forEach((a,c)=>{if(!(a instanceof e))throw new Error("invalid point at index "+c)})}function validateMSMScalars(o,e){if(!Array.isArray(o))throw new Error("array of scalars expected");o.forEach((a,c)=>{if(!e.isValid(a))throw new Error("invalid scalar at index "+c)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(o){return pointWindowSizes.get(o)||1}function wNAF(o,e){return{constTimeNegate,hasPrecomputes(a){return getW(a)!==1},unsafeLadder(a,c,d=o.ZERO){let h=a;for(;c>_0n$3;)c&_1n$5&&(d=d.add(h)),h=h.double(),c>>=_1n$5;return d},precomputeWindow(a,c){const{windows:d,windowSize:h}=calcWOpts(c,e),j=[];let et=a,nt=et;for(let st=0;st>=ht,gt>j&&(gt-=ot,d+=_1n$5);const wt=dt,St=dt+Math.abs(gt)-1,_t=pt%2!==0,mt=gt<0;gt===0?nt=nt.add(constTimeNegate(_t,c[wt])):et=et.add(constTimeNegate(mt,c[St]))}return{p:et,f:nt}},wNAFUnsafe(a,c,d,h=o.ZERO){const{windows:j,windowSize:et}=calcWOpts(a,e),nt=BigInt(2**a-1),st=2**a,ot=BigInt(a);for(let ht=0;ht>=ot,dt>et&&(dt-=st,d+=_1n$5),dt===0)continue;let gt=c[pt+Math.abs(dt)-1];dt<0&&(gt=gt.negate()),h=h.add(gt)}return h},getPrecomputes(a,c,d){let h=pointPrecomputes.get(c);return h||(h=this.precomputeWindow(c,a),a!==1&&pointPrecomputes.set(c,d(h))),h},wNAFCached(a,c,d){const h=getW(a);return this.wNAF(h,this.getPrecomputes(h,a,d),c)},wNAFCachedUnsafe(a,c,d,h){const j=getW(a);return j===1?this.unsafeLadder(a,c,h):this.wNAFUnsafe(j,this.getPrecomputes(j,a,d),c,h)},setWindowSize(a,c){validateW(c,e),pointWindowSizes.set(a,c),pointPrecomputes.delete(a)}}}function pippenger(o,e,a,c){if(validateMSMPoints(a,o),validateMSMScalars(c,e),a.length!==c.length)throw new Error("arrays of points and scalars must have equal length");const d=o.ZERO,h=bitLen(BigInt(a.length)),j=h>12?h-3:h>4?h-2:h?2:1,et=(1<=0;ht-=j){nt.fill(d);for(let dt=0;dt>BigInt(ht)&BigInt(et));nt[wt]=nt[wt].add(a[dt])}let pt=d;for(let dt=nt.length-1,gt=d;dt>0;dt--)gt=gt.add(nt[dt]),pt=pt.add(gt);if(ot=ot.add(pt),ht!==0)for(let dt=0;dt{try{return{isValid:!0,value:a.sqrt(rt*a.inv(at))}}catch{return{isValid:!1,value:_0n$2}}}),dt=e.adjustScalarBytes||(rt=>rt),gt=e.domain||((rt,at,lt)=>{if(abool("phflag",lt),at.length||lt)throw new Error("Contexts/pre-hash are not supported");return rt});function wt(rt,at){aInRange("coordinate "+rt,at,_0n$2,st)}function St(rt){if(!(rt instanceof bt))throw new Error("ExtendedPoint expected")}const _t=memoized((rt,at)=>{const{ex:lt,ey:tt,ez:_}=rt,it=rt.is0();at==null&&(at=it?_8n$1:a.inv(_));const yt=ot(lt*at),vt=ot(tt*at),Rt=ot(_*at);if(it)return{x:_0n$2,y:_1n$4};if(Rt!==_1n$4)throw new Error("invZ was invalid");return{x:yt,y:vt}}),mt=memoized(rt=>{const{a:at,d:lt}=e;if(rt.is0())throw new Error("bad point: ZERO");const{ex:tt,ey:_,ez:it,et:yt}=rt,vt=ot(tt*tt),Rt=ot(_*_),Tt=ot(it*it),Mt=ot(Tt*Tt),At=ot(vt*at),Ot=ot(Tt*ot(At+Rt)),Ct=ot(Mt+ot(lt*ot(vt*Rt)));if(Ot!==Ct)throw new Error("bad point: equation left != right (1)");const Ut=ot(tt*_),Lt=ot(it*yt);if(Ut!==Lt)throw new Error("bad point: equation left != right (2)");return!0});class bt{constructor(at,lt,tt,_){this.ex=at,this.ey=lt,this.ez=tt,this.et=_,wt("x",at),wt("y",lt),wt("z",tt),wt("t",_),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(at){if(at instanceof bt)throw new Error("extended point not allowed");const{x:lt,y:tt}=at||{};return wt("x",lt),wt("y",tt),new bt(lt,tt,_1n$4,ot(lt*tt))}static normalizeZ(at){const lt=a.invertBatch(at.map(tt=>tt.ez));return at.map((tt,_)=>tt.toAffine(lt[_])).map(bt.fromAffine)}static msm(at,lt){return pippenger(bt,ht,at,lt)}_setWindowSize(at){Dt.setWindowSize(this,at)}assertValidity(){mt(this)}equals(at){St(at);const{ex:lt,ey:tt,ez:_}=this,{ex:it,ey:yt,ez:vt}=at,Rt=ot(lt*vt),Tt=ot(it*_),Mt=ot(tt*vt),At=ot(yt*_);return Rt===Tt&&Mt===At}is0(){return this.equals(bt.ZERO)}negate(){return new bt(ot(-this.ex),this.ey,this.ez,ot(-this.et))}double(){const{a:at}=e,{ex:lt,ey:tt,ez:_}=this,it=ot(lt*lt),yt=ot(tt*tt),vt=ot(_2n$3*ot(_*_)),Rt=ot(at*it),Tt=lt+tt,Mt=ot(ot(Tt*Tt)-it-yt),At=Rt+yt,Ot=At-vt,Ct=Rt-yt,Ut=ot(Mt*Ot),Lt=ot(At*Ct),Nt=ot(Mt*Ct),Kt=ot(Ot*At);return new bt(Ut,Lt,Kt,Nt)}add(at){St(at);const{a:lt,d:tt}=e,{ex:_,ey:it,ez:yt,et:vt}=this,{ex:Rt,ey:Tt,ez:Mt,et:At}=at;if(lt===BigInt(-1)){const Ir=ot((it-_)*(Tt+Rt)),nr=ot((it+_)*(Tt-Rt)),or=ot(nr-Ir);if(or===_0n$2)return this.double();const xr=ot(yt*_2n$3*At),Ft=ot(vt*_2n$3*Mt),jt=Ft+xr,Rr=nr+Ir,Yt=Ft-xr,Zt=ot(jt*or),$r=ot(Rr*Yt),It=ot(jt*Yt),Et=ot(or*Rr);return new bt(Zt,$r,Et,It)}const Ot=ot(_*Rt),Ct=ot(it*Tt),Ut=ot(vt*tt*At),Lt=ot(yt*Mt),Nt=ot((_+it)*(Rt+Tt)-Ot-Ct),Kt=Lt-Ut,yr=Lt+Ut,Xt=ot(Ct-lt*Ot),Jt=ot(Nt*Kt),Ar=ot(yr*Xt),er=ot(Nt*Xt),Vt=ot(Kt*yr);return new bt(Jt,Ar,Vt,er)}subtract(at){return this.add(at.negate())}wNAF(at){return Dt.wNAFCached(this,at,bt.normalizeZ)}multiply(at){const lt=at;aInRange("scalar",lt,_1n$4,c);const{p:tt,f:_}=this.wNAF(lt);return bt.normalizeZ([tt,_])[0]}multiplyUnsafe(at,lt=bt.ZERO){const tt=at;return aInRange("scalar",tt,_0n$2,c),tt===_0n$2?Bt:this.is0()||tt===_1n$4?this:Dt.wNAFCachedUnsafe(this,tt,bt.normalizeZ,lt)}isSmallOrder(){return this.multiplyUnsafe(nt).is0()}isTorsionFree(){return Dt.unsafeLadder(this,c).is0()}toAffine(at){return _t(this,at)}clearCofactor(){const{h:at}=e;return at===_1n$4?this:this.multiplyUnsafe(at)}static fromHex(at,lt=!1){const{d:tt,a:_}=e,it=a.BYTES;at=ensureBytes("pointHex",at,it),abool("zip215",lt);const yt=at.slice(),vt=at[it-1];yt[it-1]=vt&-129;const Rt=bytesToNumberLE(yt),Tt=lt?st:a.ORDER;aInRange("pointHex.y",Rt,_0n$2,Tt);const Mt=ot(Rt*Rt),At=ot(Mt-_1n$4),Ot=ot(tt*Mt-_);let{isValid:Ct,value:Ut}=pt(At,Ot);if(!Ct)throw new Error("Point.fromHex: invalid y coordinate");const Lt=(Ut&_1n$4)===_1n$4,Nt=(vt&128)!==0;if(!lt&&Ut===_0n$2&&Nt)throw new Error("Point.fromHex: x=0 and x_0=1");return Nt!==Lt&&(Ut=ot(-Ut)),bt.fromAffine({x:Ut,y:Rt})}static fromPrivateKey(at){return Pt(at).point}toRawBytes(){const{x:at,y:lt}=this.toAffine(),tt=numberToBytesLE(lt,a.BYTES);return tt[tt.length-1]|=at&_1n$4?128:0,tt}toHex(){return bytesToHex(this.toRawBytes())}}bt.BASE=new bt(e.Gx,e.Gy,_1n$4,ot(e.Gx*e.Gy)),bt.ZERO=new bt(_0n$2,_1n$4,_1n$4,_0n$2);const{BASE:$t,ZERO:Bt}=bt,Dt=wNAF(bt,et*8);function Ht(rt){return mod(rt,c)}function qt(rt){return Ht(bytesToNumberLE(rt))}function Pt(rt){const at=a.BYTES;rt=ensureBytes("private key",rt,at);const lt=ensureBytes("hashed private key",h(rt),2*at),tt=dt(lt.slice(0,at)),_=lt.slice(at,2*at),it=qt(tt),yt=$t.multiply(it),vt=yt.toRawBytes();return{head:tt,prefix:_,scalar:it,point:yt,pointBytes:vt}}function Gt(rt){return Pt(rt).pointBytes}function ct(rt=new Uint8Array,...at){const lt=concatBytes(...at);return qt(h(gt(lt,ensureBytes("context",rt),!!d)))}function g(rt,at,lt={}){rt=ensureBytes("message",rt),d&&(rt=d(rt));const{prefix:tt,scalar:_,pointBytes:it}=Pt(at),yt=ct(lt.context,tt,rt),vt=$t.multiply(yt).toRawBytes(),Rt=ct(lt.context,vt,it,rt),Tt=Ht(yt+Rt*_);aInRange("signature.s",Tt,_0n$2,c);const Mt=concatBytes(vt,numberToBytesLE(Tt,a.BYTES));return ensureBytes("result",Mt,a.BYTES*2)}const b=VERIFY_DEFAULT;function $(rt,at,lt,tt=b){const{context:_,zip215:it}=tt,yt=a.BYTES;rt=ensureBytes("signature",rt,2*yt),at=ensureBytes("message",at),lt=ensureBytes("publicKey",lt,yt),it!==void 0&&abool("zip215",it),d&&(at=d(at));const vt=bytesToNumberLE(rt.slice(yt,2*yt));let Rt,Tt,Mt;try{Rt=bt.fromHex(lt,it),Tt=bt.fromHex(rt.slice(0,yt),it),Mt=$t.multiplyUnsafe(vt)}catch{return!1}if(!it&&Rt.isSmallOrder())return!1;const At=ct(_,Tt.toRawBytes(),Rt.toRawBytes(),at);return Tt.add(Rt.multiplyUnsafe(At)).subtract(Mt).clearCofactor().equals(bt.ZERO)}return $t._setWindowSize(8),{CURVE:e,getPublicKey:Gt,sign:g,verify:$,ExtendedPoint:bt,utils:{getExtendedPublicKey:Pt,randomPrivateKey:()=>j(a.BYTES),precompute(rt=8,at=bt.BASE){return at._setWindowSize(rt),at.multiply(BigInt(3)),at}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n$3=BigInt(1),_2n$2=BigInt(2);BigInt(3);const _5n=BigInt(5),_8n=BigInt(8);function ed25519_pow_2_252_3(o){const e=BigInt(10),a=BigInt(20),c=BigInt(40),d=BigInt(80),h=ED25519_P,et=o*o%h*o%h,nt=pow2(et,_2n$2,h)*et%h,st=pow2(nt,_1n$3,h)*o%h,ot=pow2(st,_5n,h)*st%h,ht=pow2(ot,e,h)*ot%h,pt=pow2(ht,a,h)*ht%h,dt=pow2(pt,c,h)*pt%h,gt=pow2(dt,d,h)*dt%h,wt=pow2(gt,d,h)*dt%h,St=pow2(wt,e,h)*ot%h;return{pow_p_5_8:pow2(St,_2n$2,h)*o%h,b2:et}}function adjustScalarBytes(o){return o[0]&=248,o[31]&=127,o[31]|=64,o}function uvRatio(o,e){const a=ED25519_P,c=mod(e*e*e,a),d=mod(c*c*e,a),h=ed25519_pow_2_252_3(o*d).pow_p_5_8;let j=mod(o*c*h,a);const et=mod(e*j*j,a),nt=j,st=mod(j*ED25519_SQRT_M1,a),ot=et===o,ht=et===mod(-o,a),pt=et===mod(-o*ED25519_SQRT_M1,a);return ot&&(j=nt),(ht||pt)&&(j=st),isNegativeLE(j,a)&&(j=mod(-j,a)),{isValid:ot||ht,value:j}}const Fp=Field(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512$2,randomBytes:randomBytes$3,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var bn$6={exports:{}};const require$$0$1=getAugmentedNamespace(dist$3);bn$6.exports;(function(o){(function(e,a){function c(b,$){if(!b)throw new Error($||"Assertion failed")}function d(b,$){b.super_=$;var _e=function(){};_e.prototype=$.prototype,b.prototype=new _e,b.prototype.constructor=b}function h(b,$,_e){if(h.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&(($==="le"||$==="be")&&(_e=$,$=10),this._init(b||0,$||10,_e||"be"))}typeof e=="object"?e.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var j;try{typeof window<"u"&&typeof window.Buffer<"u"?j=window.Buffer:j=require$$0$1.Buffer}catch{}h.isBN=function($){return $ instanceof h?!0:$!==null&&typeof $=="object"&&$.constructor.wordSize===h.wordSize&&Array.isArray($.words)},h.max=function($,_e){return $.cmp(_e)>0?$:_e},h.min=function($,_e){return $.cmp(_e)<0?$:_e},h.prototype._init=function($,_e,rt){if(typeof $=="number")return this._initNumber($,_e,rt);if(typeof $=="object")return this._initArray($,_e,rt);_e==="hex"&&(_e=16),c(_e===(_e|0)&&_e>=2&&_e<=36),$=$.toString().replace(/\s+/g,"");var at=0;$[0]==="-"&&(at++,this.negative=1),at<$.length&&(_e===16?this._parseHex($,at,rt):(this._parseBase($,_e,at),rt==="le"&&this._initArray(this.toArray(),_e,rt)))},h.prototype._initNumber=function($,_e,rt){$<0&&(this.negative=1,$=-$),$<67108864?(this.words=[$&67108863],this.length=1):$<4503599627370496?(this.words=[$&67108863,$/67108864&67108863],this.length=2):(c($<9007199254740992),this.words=[$&67108863,$/67108864&67108863,1],this.length=3),rt==="le"&&this._initArray(this.toArray(),_e,rt)},h.prototype._initArray=function($,_e,rt){if(c(typeof $.length=="number"),$.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil($.length/3),this.words=new Array(this.length);for(var at=0;at=0;at-=3)tt=$[at]|$[at-1]<<8|$[at-2]<<16,this.words[lt]|=tt<<_&67108863,this.words[lt+1]=tt>>>26-_&67108863,_+=24,_>=26&&(_-=26,lt++);else if(rt==="le")for(at=0,lt=0;at<$.length;at+=3)tt=$[at]|$[at+1]<<8|$[at+2]<<16,this.words[lt]|=tt<<_&67108863,this.words[lt+1]=tt>>>26-_&67108863,_+=24,_>=26&&(_-=26,lt++);return this._strip()};function et(b,$){var _e=b.charCodeAt($);if(_e>=48&&_e<=57)return _e-48;if(_e>=65&&_e<=70)return _e-55;if(_e>=97&&_e<=102)return _e-87;c(!1,"Invalid character in "+b)}function nt(b,$,_e){var rt=et(b,_e);return _e-1>=$&&(rt|=et(b,_e-1)<<4),rt}h.prototype._parseHex=function($,_e,rt){this.length=Math.ceil(($.length-_e)/6),this.words=new Array(this.length);for(var at=0;at=_e;at-=2)_=nt($,_e,at)<=18?(lt-=18,tt+=1,this.words[tt]|=_>>>26):lt+=8;else{var it=$.length-_e;for(at=it%2===0?_e+1:_e;at<$.length;at+=2)_=nt($,_e,at)<=18?(lt-=18,tt+=1,this.words[tt]|=_>>>26):lt+=8}this._strip()};function st(b,$,_e,rt){for(var at=0,lt=0,tt=Math.min(b.length,_e),_=$;_=49?lt=it-49+10:it>=17?lt=it-17+10:lt=it,c(it>=0&<1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{h.prototype[Symbol.for("nodejs.util.inspect.custom")]=ht}catch{h.prototype.inspect=ht}else h.prototype.inspect=ht;function ht(){return(this.red?""}var pt=["","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"],dt=[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],gt=[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];h.prototype.toString=function($,_e){$=$||10,_e=_e|0||1;var rt;if($===16||$==="hex"){rt="";for(var at=0,lt=0,tt=0;tt>>24-at&16777215,at+=2,at>=26&&(at-=26,tt--),lt!==0||tt!==this.length-1?rt=pt[6-it.length]+it+rt:rt=it+rt}for(lt!==0&&(rt=lt.toString(16)+rt);rt.length%_e!==0;)rt="0"+rt;return this.negative!==0&&(rt="-"+rt),rt}if($===($|0)&&$>=2&&$<=36){var yt=dt[$],vt=gt[$];rt="";var Rt=this.clone();for(Rt.negative=0;!Rt.isZero();){var Tt=Rt.modrn(vt).toString($);Rt=Rt.idivn(vt),Rt.isZero()?rt=Tt+rt:rt=pt[yt-Tt.length]+Tt+rt}for(this.isZero()&&(rt="0"+rt);rt.length%_e!==0;)rt="0"+rt;return this.negative!==0&&(rt="-"+rt),rt}c(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var $=this.words[0];return this.length===2?$+=this.words[1]*67108864:this.length===3&&this.words[2]===1?$+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-$:$},h.prototype.toJSON=function(){return this.toString(16,2)},j&&(h.prototype.toBuffer=function($,_e){return this.toArrayLike(j,$,_e)}),h.prototype.toArray=function($,_e){return this.toArrayLike(Array,$,_e)};var wt=function($,_e){return $.allocUnsafe?$.allocUnsafe(_e):new $(_e)};h.prototype.toArrayLike=function($,_e,rt){this._strip();var at=this.byteLength(),lt=rt||Math.max(1,at);c(at<=lt,"byte array longer than desired length"),c(lt>0,"Requested array length <= 0");var tt=wt($,lt),_=_e==="le"?"LE":"BE";return this["_toArrayLike"+_](tt,at),tt},h.prototype._toArrayLikeLE=function($,_e){for(var rt=0,at=0,lt=0,tt=0;lt>8&255),rt<$.length&&($[rt++]=_>>16&255),tt===6?(rt<$.length&&($[rt++]=_>>24&255),at=0,tt=0):(at=_>>>24,tt+=2)}if(rt<$.length)for($[rt++]=at;rt<$.length;)$[rt++]=0},h.prototype._toArrayLikeBE=function($,_e){for(var rt=$.length-1,at=0,lt=0,tt=0;lt=0&&($[rt--]=_>>8&255),rt>=0&&($[rt--]=_>>16&255),tt===6?(rt>=0&&($[rt--]=_>>24&255),at=0,tt=0):(at=_>>>24,tt+=2)}if(rt>=0)for($[rt--]=at;rt>=0;)$[rt--]=0},Math.clz32?h.prototype._countBits=function($){return 32-Math.clz32($)}:h.prototype._countBits=function($){var _e=$,rt=0;return _e>=4096&&(rt+=13,_e>>>=13),_e>=64&&(rt+=7,_e>>>=7),_e>=8&&(rt+=4,_e>>>=4),_e>=2&&(rt+=2,_e>>>=2),rt+_e},h.prototype._zeroBits=function($){if($===0)return 26;var _e=$,rt=0;return _e&8191||(rt+=13,_e>>>=13),_e&127||(rt+=7,_e>>>=7),_e&15||(rt+=4,_e>>>=4),_e&3||(rt+=2,_e>>>=2),_e&1||rt++,rt},h.prototype.bitLength=function(){var $=this.words[this.length-1],_e=this._countBits($);return(this.length-1)*26+_e};function St(b){for(var $=new Array(b.bitLength()),_e=0;_e<$.length;_e++){var rt=_e/26|0,at=_e%26;$[_e]=b.words[rt]>>>at&1}return $}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var $=0,_e=0;_e$.length?this.clone().ior($):$.clone().ior(this)},h.prototype.uor=function($){return this.length>$.length?this.clone().iuor($):$.clone().iuor(this)},h.prototype.iuand=function($){var _e;this.length>$.length?_e=$:_e=this;for(var rt=0;rt<_e.length;rt++)this.words[rt]=this.words[rt]&$.words[rt];return this.length=_e.length,this._strip()},h.prototype.iand=function($){return c((this.negative|$.negative)===0),this.iuand($)},h.prototype.and=function($){return this.length>$.length?this.clone().iand($):$.clone().iand(this)},h.prototype.uand=function($){return this.length>$.length?this.clone().iuand($):$.clone().iuand(this)},h.prototype.iuxor=function($){var _e,rt;this.length>$.length?(_e=this,rt=$):(_e=$,rt=this);for(var at=0;at$.length?this.clone().ixor($):$.clone().ixor(this)},h.prototype.uxor=function($){return this.length>$.length?this.clone().iuxor($):$.clone().iuxor(this)},h.prototype.inotn=function($){c(typeof $=="number"&&$>=0);var _e=Math.ceil($/26)|0,rt=$%26;this._expand(_e),rt>0&&_e--;for(var at=0;at<_e;at++)this.words[at]=~this.words[at]&67108863;return rt>0&&(this.words[at]=~this.words[at]&67108863>>26-rt),this._strip()},h.prototype.notn=function($){return this.clone().inotn($)},h.prototype.setn=function($,_e){c(typeof $=="number"&&$>=0);var rt=$/26|0,at=$%26;return this._expand(rt+1),_e?this.words[rt]=this.words[rt]|1<$.length?(rt=this,at=$):(rt=$,at=this);for(var lt=0,tt=0;tt>>26;for(;lt!==0&&tt>>26;if(this.length=rt.length,lt!==0)this.words[this.length]=lt,this.length++;else if(rt!==this)for(;tt$.length?this.clone().iadd($):$.clone().iadd(this)},h.prototype.isub=function($){if($.negative!==0){$.negative=0;var _e=this.iadd($);return $.negative=1,_e._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd($),this.negative=1,this._normSign();var rt=this.cmp($);if(rt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var at,lt;rt>0?(at=this,lt=$):(at=$,lt=this);for(var tt=0,_=0;_>26,this.words[_]=_e&67108863;for(;tt!==0&&_>26,this.words[_]=_e&67108863;if(tt===0&&_>>26,Rt=it&67108863,Tt=Math.min(yt,$.length-1),Mt=Math.max(0,yt-b.length+1);Mt<=Tt;Mt++){var At=yt-Mt|0;at=b.words[At]|0,lt=$.words[Mt]|0,tt=at*lt+Rt,vt+=tt/67108864|0,Rt=tt&67108863}_e.words[yt]=Rt|0,it=vt|0}return it!==0?_e.words[yt]=it|0:_e.length--,_e._strip()}var mt=function($,_e,rt){var at=$.words,lt=_e.words,tt=rt.words,_=0,it,yt,vt,Rt=at[0]|0,Tt=Rt&8191,Mt=Rt>>>13,At=at[1]|0,Ot=At&8191,Ct=At>>>13,Ut=at[2]|0,Lt=Ut&8191,Nt=Ut>>>13,Kt=at[3]|0,yr=Kt&8191,Xt=Kt>>>13,Jt=at[4]|0,Ar=Jt&8191,er=Jt>>>13,Vt=at[5]|0,Ir=Vt&8191,nr=Vt>>>13,or=at[6]|0,xr=or&8191,Ft=or>>>13,jt=at[7]|0,Rr=jt&8191,Yt=jt>>>13,Zt=at[8]|0,$r=Zt&8191,It=Zt>>>13,Et=at[9]|0,xt=Et&8191,kt=Et>>>13,zt=lt[0]|0,Qt=zt&8191,Wt=zt>>>13,rr=lt[1]|0,Mr=rr&8191,tr=rr>>>13,ir=lt[2]|0,Tr=ir&8191,ar=ir>>>13,gr=lt[3]|0,Cr=gr&8191,ur=gr>>>13,vr=lt[4]|0,Br=vr&8191,lr=vr>>>13,_r=lt[5]|0,kr=_r&8191,fr=_r>>>13,br=lt[6]|0,Lr=br&8191,cr=br>>>13,wr=lt[7]|0,Pr=wr&8191,dr=wr>>>13,Er=lt[8]|0,Dr=Er&8191,pr=Er>>>13,Sr=lt[9]|0,Or=Sr&8191,Nr=Sr>>>13;rt.negative=$.negative^_e.negative,rt.length=19,it=Math.imul(Tt,Qt),yt=Math.imul(Tt,Wt),yt=yt+Math.imul(Mt,Qt)|0,vt=Math.imul(Mt,Wt);var Ur=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,it=Math.imul(Ot,Qt),yt=Math.imul(Ot,Wt),yt=yt+Math.imul(Ct,Qt)|0,vt=Math.imul(Ct,Wt),it=it+Math.imul(Tt,Mr)|0,yt=yt+Math.imul(Tt,tr)|0,yt=yt+Math.imul(Mt,Mr)|0,vt=vt+Math.imul(Mt,tr)|0;var Hr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,it=Math.imul(Lt,Qt),yt=Math.imul(Lt,Wt),yt=yt+Math.imul(Nt,Qt)|0,vt=Math.imul(Nt,Wt),it=it+Math.imul(Ot,Mr)|0,yt=yt+Math.imul(Ot,tr)|0,yt=yt+Math.imul(Ct,Mr)|0,vt=vt+Math.imul(Ct,tr)|0,it=it+Math.imul(Tt,Tr)|0,yt=yt+Math.imul(Tt,ar)|0,yt=yt+Math.imul(Mt,Tr)|0,vt=vt+Math.imul(Mt,ar)|0;var Fr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,it=Math.imul(yr,Qt),yt=Math.imul(yr,Wt),yt=yt+Math.imul(Xt,Qt)|0,vt=Math.imul(Xt,Wt),it=it+Math.imul(Lt,Mr)|0,yt=yt+Math.imul(Lt,tr)|0,yt=yt+Math.imul(Nt,Mr)|0,vt=vt+Math.imul(Nt,tr)|0,it=it+Math.imul(Ot,Tr)|0,yt=yt+Math.imul(Ot,ar)|0,yt=yt+Math.imul(Ct,Tr)|0,vt=vt+Math.imul(Ct,ar)|0,it=it+Math.imul(Tt,Cr)|0,yt=yt+Math.imul(Tt,ur)|0,yt=yt+Math.imul(Mt,Cr)|0,vt=vt+Math.imul(Mt,ur)|0;var qr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(qr>>>26)|0,qr&=67108863,it=Math.imul(Ar,Qt),yt=Math.imul(Ar,Wt),yt=yt+Math.imul(er,Qt)|0,vt=Math.imul(er,Wt),it=it+Math.imul(yr,Mr)|0,yt=yt+Math.imul(yr,tr)|0,yt=yt+Math.imul(Xt,Mr)|0,vt=vt+Math.imul(Xt,tr)|0,it=it+Math.imul(Lt,Tr)|0,yt=yt+Math.imul(Lt,ar)|0,yt=yt+Math.imul(Nt,Tr)|0,vt=vt+Math.imul(Nt,ar)|0,it=it+Math.imul(Ot,Cr)|0,yt=yt+Math.imul(Ot,ur)|0,yt=yt+Math.imul(Ct,Cr)|0,vt=vt+Math.imul(Ct,ur)|0,it=it+Math.imul(Tt,Br)|0,yt=yt+Math.imul(Tt,lr)|0,yt=yt+Math.imul(Mt,Br)|0,vt=vt+Math.imul(Mt,lr)|0;var Kr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,it=Math.imul(Ir,Qt),yt=Math.imul(Ir,Wt),yt=yt+Math.imul(nr,Qt)|0,vt=Math.imul(nr,Wt),it=it+Math.imul(Ar,Mr)|0,yt=yt+Math.imul(Ar,tr)|0,yt=yt+Math.imul(er,Mr)|0,vt=vt+Math.imul(er,tr)|0,it=it+Math.imul(yr,Tr)|0,yt=yt+Math.imul(yr,ar)|0,yt=yt+Math.imul(Xt,Tr)|0,vt=vt+Math.imul(Xt,ar)|0,it=it+Math.imul(Lt,Cr)|0,yt=yt+Math.imul(Lt,ur)|0,yt=yt+Math.imul(Nt,Cr)|0,vt=vt+Math.imul(Nt,ur)|0,it=it+Math.imul(Ot,Br)|0,yt=yt+Math.imul(Ot,lr)|0,yt=yt+Math.imul(Ct,Br)|0,vt=vt+Math.imul(Ct,lr)|0,it=it+Math.imul(Tt,kr)|0,yt=yt+Math.imul(Tt,fr)|0,yt=yt+Math.imul(Mt,kr)|0,vt=vt+Math.imul(Mt,fr)|0;var jr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(jr>>>26)|0,jr&=67108863,it=Math.imul(xr,Qt),yt=Math.imul(xr,Wt),yt=yt+Math.imul(Ft,Qt)|0,vt=Math.imul(Ft,Wt),it=it+Math.imul(Ir,Mr)|0,yt=yt+Math.imul(Ir,tr)|0,yt=yt+Math.imul(nr,Mr)|0,vt=vt+Math.imul(nr,tr)|0,it=it+Math.imul(Ar,Tr)|0,yt=yt+Math.imul(Ar,ar)|0,yt=yt+Math.imul(er,Tr)|0,vt=vt+Math.imul(er,ar)|0,it=it+Math.imul(yr,Cr)|0,yt=yt+Math.imul(yr,ur)|0,yt=yt+Math.imul(Xt,Cr)|0,vt=vt+Math.imul(Xt,ur)|0,it=it+Math.imul(Lt,Br)|0,yt=yt+Math.imul(Lt,lr)|0,yt=yt+Math.imul(Nt,Br)|0,vt=vt+Math.imul(Nt,lr)|0,it=it+Math.imul(Ot,kr)|0,yt=yt+Math.imul(Ot,fr)|0,yt=yt+Math.imul(Ct,kr)|0,vt=vt+Math.imul(Ct,fr)|0,it=it+Math.imul(Tt,Lr)|0,yt=yt+Math.imul(Tt,cr)|0,yt=yt+Math.imul(Mt,Lr)|0,vt=vt+Math.imul(Mt,cr)|0;var Wr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,it=Math.imul(Rr,Qt),yt=Math.imul(Rr,Wt),yt=yt+Math.imul(Yt,Qt)|0,vt=Math.imul(Yt,Wt),it=it+Math.imul(xr,Mr)|0,yt=yt+Math.imul(xr,tr)|0,yt=yt+Math.imul(Ft,Mr)|0,vt=vt+Math.imul(Ft,tr)|0,it=it+Math.imul(Ir,Tr)|0,yt=yt+Math.imul(Ir,ar)|0,yt=yt+Math.imul(nr,Tr)|0,vt=vt+Math.imul(nr,ar)|0,it=it+Math.imul(Ar,Cr)|0,yt=yt+Math.imul(Ar,ur)|0,yt=yt+Math.imul(er,Cr)|0,vt=vt+Math.imul(er,ur)|0,it=it+Math.imul(yr,Br)|0,yt=yt+Math.imul(yr,lr)|0,yt=yt+Math.imul(Xt,Br)|0,vt=vt+Math.imul(Xt,lr)|0,it=it+Math.imul(Lt,kr)|0,yt=yt+Math.imul(Lt,fr)|0,yt=yt+Math.imul(Nt,kr)|0,vt=vt+Math.imul(Nt,fr)|0,it=it+Math.imul(Ot,Lr)|0,yt=yt+Math.imul(Ot,cr)|0,yt=yt+Math.imul(Ct,Lr)|0,vt=vt+Math.imul(Ct,cr)|0,it=it+Math.imul(Tt,Pr)|0,yt=yt+Math.imul(Tt,dr)|0,yt=yt+Math.imul(Mt,Pr)|0,vt=vt+Math.imul(Mt,dr)|0;var Vr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,it=Math.imul($r,Qt),yt=Math.imul($r,Wt),yt=yt+Math.imul(It,Qt)|0,vt=Math.imul(It,Wt),it=it+Math.imul(Rr,Mr)|0,yt=yt+Math.imul(Rr,tr)|0,yt=yt+Math.imul(Yt,Mr)|0,vt=vt+Math.imul(Yt,tr)|0,it=it+Math.imul(xr,Tr)|0,yt=yt+Math.imul(xr,ar)|0,yt=yt+Math.imul(Ft,Tr)|0,vt=vt+Math.imul(Ft,ar)|0,it=it+Math.imul(Ir,Cr)|0,yt=yt+Math.imul(Ir,ur)|0,yt=yt+Math.imul(nr,Cr)|0,vt=vt+Math.imul(nr,ur)|0,it=it+Math.imul(Ar,Br)|0,yt=yt+Math.imul(Ar,lr)|0,yt=yt+Math.imul(er,Br)|0,vt=vt+Math.imul(er,lr)|0,it=it+Math.imul(yr,kr)|0,yt=yt+Math.imul(yr,fr)|0,yt=yt+Math.imul(Xt,kr)|0,vt=vt+Math.imul(Xt,fr)|0,it=it+Math.imul(Lt,Lr)|0,yt=yt+Math.imul(Lt,cr)|0,yt=yt+Math.imul(Nt,Lr)|0,vt=vt+Math.imul(Nt,cr)|0,it=it+Math.imul(Ot,Pr)|0,yt=yt+Math.imul(Ot,dr)|0,yt=yt+Math.imul(Ct,Pr)|0,vt=vt+Math.imul(Ct,dr)|0,it=it+Math.imul(Tt,Dr)|0,yt=yt+Math.imul(Tt,pr)|0,yt=yt+Math.imul(Mt,Dr)|0,vt=vt+Math.imul(Mt,pr)|0;var Gr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,it=Math.imul(xt,Qt),yt=Math.imul(xt,Wt),yt=yt+Math.imul(kt,Qt)|0,vt=Math.imul(kt,Wt),it=it+Math.imul($r,Mr)|0,yt=yt+Math.imul($r,tr)|0,yt=yt+Math.imul(It,Mr)|0,vt=vt+Math.imul(It,tr)|0,it=it+Math.imul(Rr,Tr)|0,yt=yt+Math.imul(Rr,ar)|0,yt=yt+Math.imul(Yt,Tr)|0,vt=vt+Math.imul(Yt,ar)|0,it=it+Math.imul(xr,Cr)|0,yt=yt+Math.imul(xr,ur)|0,yt=yt+Math.imul(Ft,Cr)|0,vt=vt+Math.imul(Ft,ur)|0,it=it+Math.imul(Ir,Br)|0,yt=yt+Math.imul(Ir,lr)|0,yt=yt+Math.imul(nr,Br)|0,vt=vt+Math.imul(nr,lr)|0,it=it+Math.imul(Ar,kr)|0,yt=yt+Math.imul(Ar,fr)|0,yt=yt+Math.imul(er,kr)|0,vt=vt+Math.imul(er,fr)|0,it=it+Math.imul(yr,Lr)|0,yt=yt+Math.imul(yr,cr)|0,yt=yt+Math.imul(Xt,Lr)|0,vt=vt+Math.imul(Xt,cr)|0,it=it+Math.imul(Lt,Pr)|0,yt=yt+Math.imul(Lt,dr)|0,yt=yt+Math.imul(Nt,Pr)|0,vt=vt+Math.imul(Nt,dr)|0,it=it+Math.imul(Ot,Dr)|0,yt=yt+Math.imul(Ot,pr)|0,yt=yt+Math.imul(Ct,Dr)|0,vt=vt+Math.imul(Ct,pr)|0,it=it+Math.imul(Tt,Or)|0,yt=yt+Math.imul(Tt,Nr)|0,yt=yt+Math.imul(Mt,Or)|0,vt=vt+Math.imul(Mt,Nr)|0;var Yr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,it=Math.imul(xt,Mr),yt=Math.imul(xt,tr),yt=yt+Math.imul(kt,Mr)|0,vt=Math.imul(kt,tr),it=it+Math.imul($r,Tr)|0,yt=yt+Math.imul($r,ar)|0,yt=yt+Math.imul(It,Tr)|0,vt=vt+Math.imul(It,ar)|0,it=it+Math.imul(Rr,Cr)|0,yt=yt+Math.imul(Rr,ur)|0,yt=yt+Math.imul(Yt,Cr)|0,vt=vt+Math.imul(Yt,ur)|0,it=it+Math.imul(xr,Br)|0,yt=yt+Math.imul(xr,lr)|0,yt=yt+Math.imul(Ft,Br)|0,vt=vt+Math.imul(Ft,lr)|0,it=it+Math.imul(Ir,kr)|0,yt=yt+Math.imul(Ir,fr)|0,yt=yt+Math.imul(nr,kr)|0,vt=vt+Math.imul(nr,fr)|0,it=it+Math.imul(Ar,Lr)|0,yt=yt+Math.imul(Ar,cr)|0,yt=yt+Math.imul(er,Lr)|0,vt=vt+Math.imul(er,cr)|0,it=it+Math.imul(yr,Pr)|0,yt=yt+Math.imul(yr,dr)|0,yt=yt+Math.imul(Xt,Pr)|0,vt=vt+Math.imul(Xt,dr)|0,it=it+Math.imul(Lt,Dr)|0,yt=yt+Math.imul(Lt,pr)|0,yt=yt+Math.imul(Nt,Dr)|0,vt=vt+Math.imul(Nt,pr)|0,it=it+Math.imul(Ot,Or)|0,yt=yt+Math.imul(Ot,Nr)|0,yt=yt+Math.imul(Ct,Or)|0,vt=vt+Math.imul(Ct,Nr)|0;var Zr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,it=Math.imul(xt,Tr),yt=Math.imul(xt,ar),yt=yt+Math.imul(kt,Tr)|0,vt=Math.imul(kt,ar),it=it+Math.imul($r,Cr)|0,yt=yt+Math.imul($r,ur)|0,yt=yt+Math.imul(It,Cr)|0,vt=vt+Math.imul(It,ur)|0,it=it+Math.imul(Rr,Br)|0,yt=yt+Math.imul(Rr,lr)|0,yt=yt+Math.imul(Yt,Br)|0,vt=vt+Math.imul(Yt,lr)|0,it=it+Math.imul(xr,kr)|0,yt=yt+Math.imul(xr,fr)|0,yt=yt+Math.imul(Ft,kr)|0,vt=vt+Math.imul(Ft,fr)|0,it=it+Math.imul(Ir,Lr)|0,yt=yt+Math.imul(Ir,cr)|0,yt=yt+Math.imul(nr,Lr)|0,vt=vt+Math.imul(nr,cr)|0,it=it+Math.imul(Ar,Pr)|0,yt=yt+Math.imul(Ar,dr)|0,yt=yt+Math.imul(er,Pr)|0,vt=vt+Math.imul(er,dr)|0,it=it+Math.imul(yr,Dr)|0,yt=yt+Math.imul(yr,pr)|0,yt=yt+Math.imul(Xt,Dr)|0,vt=vt+Math.imul(Xt,pr)|0,it=it+Math.imul(Lt,Or)|0,yt=yt+Math.imul(Lt,Nr)|0,yt=yt+Math.imul(Nt,Or)|0,vt=vt+Math.imul(Nt,Nr)|0;var Xr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,it=Math.imul(xt,Cr),yt=Math.imul(xt,ur),yt=yt+Math.imul(kt,Cr)|0,vt=Math.imul(kt,ur),it=it+Math.imul($r,Br)|0,yt=yt+Math.imul($r,lr)|0,yt=yt+Math.imul(It,Br)|0,vt=vt+Math.imul(It,lr)|0,it=it+Math.imul(Rr,kr)|0,yt=yt+Math.imul(Rr,fr)|0,yt=yt+Math.imul(Yt,kr)|0,vt=vt+Math.imul(Yt,fr)|0,it=it+Math.imul(xr,Lr)|0,yt=yt+Math.imul(xr,cr)|0,yt=yt+Math.imul(Ft,Lr)|0,vt=vt+Math.imul(Ft,cr)|0,it=it+Math.imul(Ir,Pr)|0,yt=yt+Math.imul(Ir,dr)|0,yt=yt+Math.imul(nr,Pr)|0,vt=vt+Math.imul(nr,dr)|0,it=it+Math.imul(Ar,Dr)|0,yt=yt+Math.imul(Ar,pr)|0,yt=yt+Math.imul(er,Dr)|0,vt=vt+Math.imul(er,pr)|0,it=it+Math.imul(yr,Or)|0,yt=yt+Math.imul(yr,Nr)|0,yt=yt+Math.imul(Xt,Or)|0,vt=vt+Math.imul(Xt,Nr)|0;var Jr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,it=Math.imul(xt,Br),yt=Math.imul(xt,lr),yt=yt+Math.imul(kt,Br)|0,vt=Math.imul(kt,lr),it=it+Math.imul($r,kr)|0,yt=yt+Math.imul($r,fr)|0,yt=yt+Math.imul(It,kr)|0,vt=vt+Math.imul(It,fr)|0,it=it+Math.imul(Rr,Lr)|0,yt=yt+Math.imul(Rr,cr)|0,yt=yt+Math.imul(Yt,Lr)|0,vt=vt+Math.imul(Yt,cr)|0,it=it+Math.imul(xr,Pr)|0,yt=yt+Math.imul(xr,dr)|0,yt=yt+Math.imul(Ft,Pr)|0,vt=vt+Math.imul(Ft,dr)|0,it=it+Math.imul(Ir,Dr)|0,yt=yt+Math.imul(Ir,pr)|0,yt=yt+Math.imul(nr,Dr)|0,vt=vt+Math.imul(nr,pr)|0,it=it+Math.imul(Ar,Or)|0,yt=yt+Math.imul(Ar,Nr)|0,yt=yt+Math.imul(er,Or)|0,vt=vt+Math.imul(er,Nr)|0;var Qr=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,it=Math.imul(xt,kr),yt=Math.imul(xt,fr),yt=yt+Math.imul(kt,kr)|0,vt=Math.imul(kt,fr),it=it+Math.imul($r,Lr)|0,yt=yt+Math.imul($r,cr)|0,yt=yt+Math.imul(It,Lr)|0,vt=vt+Math.imul(It,cr)|0,it=it+Math.imul(Rr,Pr)|0,yt=yt+Math.imul(Rr,dr)|0,yt=yt+Math.imul(Yt,Pr)|0,vt=vt+Math.imul(Yt,dr)|0,it=it+Math.imul(xr,Dr)|0,yt=yt+Math.imul(xr,pr)|0,yt=yt+Math.imul(Ft,Dr)|0,vt=vt+Math.imul(Ft,pr)|0,it=it+Math.imul(Ir,Or)|0,yt=yt+Math.imul(Ir,Nr)|0,yt=yt+Math.imul(nr,Or)|0,vt=vt+Math.imul(nr,Nr)|0;var en=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(en>>>26)|0,en&=67108863,it=Math.imul(xt,Lr),yt=Math.imul(xt,cr),yt=yt+Math.imul(kt,Lr)|0,vt=Math.imul(kt,cr),it=it+Math.imul($r,Pr)|0,yt=yt+Math.imul($r,dr)|0,yt=yt+Math.imul(It,Pr)|0,vt=vt+Math.imul(It,dr)|0,it=it+Math.imul(Rr,Dr)|0,yt=yt+Math.imul(Rr,pr)|0,yt=yt+Math.imul(Yt,Dr)|0,vt=vt+Math.imul(Yt,pr)|0,it=it+Math.imul(xr,Or)|0,yt=yt+Math.imul(xr,Nr)|0,yt=yt+Math.imul(Ft,Or)|0,vt=vt+Math.imul(Ft,Nr)|0;var tn=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(tn>>>26)|0,tn&=67108863,it=Math.imul(xt,Pr),yt=Math.imul(xt,dr),yt=yt+Math.imul(kt,Pr)|0,vt=Math.imul(kt,dr),it=it+Math.imul($r,Dr)|0,yt=yt+Math.imul($r,pr)|0,yt=yt+Math.imul(It,Dr)|0,vt=vt+Math.imul(It,pr)|0,it=it+Math.imul(Rr,Or)|0,yt=yt+Math.imul(Rr,Nr)|0,yt=yt+Math.imul(Yt,Or)|0,vt=vt+Math.imul(Yt,Nr)|0;var rn=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(rn>>>26)|0,rn&=67108863,it=Math.imul(xt,Dr),yt=Math.imul(xt,pr),yt=yt+Math.imul(kt,Dr)|0,vt=Math.imul(kt,pr),it=it+Math.imul($r,Or)|0,yt=yt+Math.imul($r,Nr)|0,yt=yt+Math.imul(It,Or)|0,vt=vt+Math.imul(It,Nr)|0;var sn=(_+it|0)+((yt&8191)<<13)|0;_=(vt+(yt>>>13)|0)+(sn>>>26)|0,sn&=67108863,it=Math.imul(xt,Or),yt=Math.imul(xt,Nr),yt=yt+Math.imul(kt,Or)|0,vt=Math.imul(kt,Nr);var un=(_+it|0)+((yt&8191)<<13)|0;return _=(vt+(yt>>>13)|0)+(un>>>26)|0,un&=67108863,tt[0]=Ur,tt[1]=Hr,tt[2]=Fr,tt[3]=qr,tt[4]=Kr,tt[5]=jr,tt[6]=Wr,tt[7]=Vr,tt[8]=Gr,tt[9]=Yr,tt[10]=Zr,tt[11]=Xr,tt[12]=Jr,tt[13]=Qr,tt[14]=en,tt[15]=tn,tt[16]=rn,tt[17]=sn,tt[18]=un,_!==0&&(tt[19]=_,rt.length++),rt};Math.imul||(mt=_t);function bt(b,$,_e){_e.negative=$.negative^b.negative,_e.length=b.length+$.length;for(var rt=0,at=0,lt=0;lt<_e.length-1;lt++){var tt=at;at=0;for(var _=rt&67108863,it=Math.min(lt,$.length-1),yt=Math.max(0,lt-b.length+1);yt<=it;yt++){var vt=lt-yt,Rt=b.words[vt]|0,Tt=$.words[yt]|0,Mt=Rt*Tt,At=Mt&67108863;tt=tt+(Mt/67108864|0)|0,At=At+_|0,_=At&67108863,tt=tt+(At>>>26)|0,at+=tt>>>26,tt&=67108863}_e.words[lt]=_,rt=tt,tt=at}return rt!==0?_e.words[lt]=rt:_e.length--,_e._strip()}function $t(b,$,_e){return bt(b,$,_e)}h.prototype.mulTo=function($,_e){var rt,at=this.length+$.length;return this.length===10&&$.length===10?rt=mt(this,$,_e):at<63?rt=_t(this,$,_e):at<1024?rt=bt(this,$,_e):rt=$t(this,$,_e),rt},h.prototype.mul=function($){var _e=new h(null);return _e.words=new Array(this.length+$.length),this.mulTo($,_e)},h.prototype.mulf=function($){var _e=new h(null);return _e.words=new Array(this.length+$.length),$t(this,$,_e)},h.prototype.imul=function($){return this.clone().mulTo($,this)},h.prototype.imuln=function($){var _e=$<0;_e&&($=-$),c(typeof $=="number"),c($<67108864);for(var rt=0,at=0;at>=26,rt+=lt/67108864|0,rt+=tt>>>26,this.words[at]=tt&67108863}return rt!==0&&(this.words[at]=rt,this.length++),_e?this.ineg():this},h.prototype.muln=function($){return this.clone().imuln($)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function($){var _e=St($);if(_e.length===0)return new h(1);for(var rt=this,at=0;at<_e.length&&_e[at]===0;at++,rt=rt.sqr());if(++at<_e.length)for(var lt=rt.sqr();at<_e.length;at++,lt=lt.sqr())_e[at]!==0&&(rt=rt.mul(lt));return rt},h.prototype.iushln=function($){c(typeof $=="number"&&$>=0);var _e=$%26,rt=($-_e)/26,at=67108863>>>26-_e<<26-_e,lt;if(_e!==0){var tt=0;for(lt=0;lt>>26-_e}tt&&(this.words[lt]=tt,this.length++)}if(rt!==0){for(lt=this.length-1;lt>=0;lt--)this.words[lt+rt]=this.words[lt];for(lt=0;lt=0);var at;_e?at=(_e-_e%26)/26:at=0;var lt=$%26,tt=Math.min(($-lt)/26,this.length),_=67108863^67108863>>>lt<tt)for(this.length-=tt,yt=0;yt=0&&(vt!==0||yt>=at);yt--){var Rt=this.words[yt]|0;this.words[yt]=vt<<26-lt|Rt>>>lt,vt=Rt&_}return it&&vt!==0&&(it.words[it.length++]=vt),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function($,_e,rt){return c(this.negative===0),this.iushrn($,_e,rt)},h.prototype.shln=function($){return this.clone().ishln($)},h.prototype.ushln=function($){return this.clone().iushln($)},h.prototype.shrn=function($){return this.clone().ishrn($)},h.prototype.ushrn=function($){return this.clone().iushrn($)},h.prototype.testn=function($){c(typeof $=="number"&&$>=0);var _e=$%26,rt=($-_e)/26,at=1<<_e;if(this.length<=rt)return!1;var lt=this.words[rt];return!!(lt&at)},h.prototype.imaskn=function($){c(typeof $=="number"&&$>=0);var _e=$%26,rt=($-_e)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=rt)return this;if(_e!==0&&rt++,this.length=Math.min(rt,this.length),_e!==0){var at=67108863^67108863>>>_e<<_e;this.words[this.length-1]&=at}return this._strip()},h.prototype.maskn=function($){return this.clone().imaskn($)},h.prototype.iaddn=function($){return c(typeof $=="number"),c($<67108864),$<0?this.isubn(-$):this.negative!==0?this.length===1&&(this.words[0]|0)<=$?(this.words[0]=$-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn($),this.negative=1,this):this._iaddn($)},h.prototype._iaddn=function($){this.words[0]+=$;for(var _e=0;_e=67108864;_e++)this.words[_e]-=67108864,_e===this.length-1?this.words[_e+1]=1:this.words[_e+1]++;return this.length=Math.max(this.length,_e+1),this},h.prototype.isubn=function($){if(c(typeof $=="number"),c($<67108864),$<0)return this.iaddn(-$);if(this.negative!==0)return this.negative=0,this.iaddn($),this.negative=1,this;if(this.words[0]-=$,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var _e=0;_e>26)-(it/67108864|0),this.words[lt+rt]=tt&67108863}for(;lt>26,this.words[lt+rt]=tt&67108863;if(_===0)return this._strip();for(c(_===-1),_=0,lt=0;lt>26,this.words[lt]=tt&67108863;return this.negative=1,this._strip()},h.prototype._wordDiv=function($,_e){var rt=this.length-$.length,at=this.clone(),lt=$,tt=lt.words[lt.length-1]|0,_=this._countBits(tt);rt=26-_,rt!==0&&(lt=lt.ushln(rt),at.iushln(rt),tt=lt.words[lt.length-1]|0);var it=at.length-lt.length,yt;if(_e!=="mod"){yt=new h(null),yt.length=it+1,yt.words=new Array(yt.length);for(var vt=0;vt=0;Tt--){var Mt=(at.words[lt.length+Tt]|0)*67108864+(at.words[lt.length+Tt-1]|0);for(Mt=Math.min(Mt/tt|0,67108863),at._ishlnsubmul(lt,Mt,Tt);at.negative!==0;)Mt--,at.negative=0,at._ishlnsubmul(lt,1,Tt),at.isZero()||(at.negative^=1);yt&&(yt.words[Tt]=Mt)}return yt&&yt._strip(),at._strip(),_e!=="div"&&rt!==0&&at.iushrn(rt),{div:yt||null,mod:at}},h.prototype.divmod=function($,_e,rt){if(c(!$.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var at,lt,tt;return this.negative!==0&&$.negative===0?(tt=this.neg().divmod($,_e),_e!=="mod"&&(at=tt.div.neg()),_e!=="div"&&(lt=tt.mod.neg(),rt&<.negative!==0&<.iadd($)),{div:at,mod:lt}):this.negative===0&&$.negative!==0?(tt=this.divmod($.neg(),_e),_e!=="mod"&&(at=tt.div.neg()),{div:at,mod:tt.mod}):this.negative&$.negative?(tt=this.neg().divmod($.neg(),_e),_e!=="div"&&(lt=tt.mod.neg(),rt&<.negative!==0&<.isub($)),{div:tt.div,mod:lt}):$.length>this.length||this.cmp($)<0?{div:new h(0),mod:this}:$.length===1?_e==="div"?{div:this.divn($.words[0]),mod:null}:_e==="mod"?{div:null,mod:new h(this.modrn($.words[0]))}:{div:this.divn($.words[0]),mod:new h(this.modrn($.words[0]))}:this._wordDiv($,_e)},h.prototype.div=function($){return this.divmod($,"div",!1).div},h.prototype.mod=function($){return this.divmod($,"mod",!1).mod},h.prototype.umod=function($){return this.divmod($,"mod",!0).mod},h.prototype.divRound=function($){var _e=this.divmod($);if(_e.mod.isZero())return _e.div;var rt=_e.div.negative!==0?_e.mod.isub($):_e.mod,at=$.ushrn(1),lt=$.andln(1),tt=rt.cmp(at);return tt<0||lt===1&&tt===0?_e.div:_e.div.negative!==0?_e.div.isubn(1):_e.div.iaddn(1)},h.prototype.modrn=function($){var _e=$<0;_e&&($=-$),c($<=67108863);for(var rt=(1<<26)%$,at=0,lt=this.length-1;lt>=0;lt--)at=(rt*at+(this.words[lt]|0))%$;return _e?-at:at},h.prototype.modn=function($){return this.modrn($)},h.prototype.idivn=function($){var _e=$<0;_e&&($=-$),c($<=67108863);for(var rt=0,at=this.length-1;at>=0;at--){var lt=(this.words[at]|0)+rt*67108864;this.words[at]=lt/$|0,rt=lt%$}return this._strip(),_e?this.ineg():this},h.prototype.divn=function($){return this.clone().idivn($)},h.prototype.egcd=function($){c($.negative===0),c(!$.isZero());var _e=this,rt=$.clone();_e.negative!==0?_e=_e.umod($):_e=_e.clone();for(var at=new h(1),lt=new h(0),tt=new h(0),_=new h(1),it=0;_e.isEven()&&rt.isEven();)_e.iushrn(1),rt.iushrn(1),++it;for(var yt=rt.clone(),vt=_e.clone();!_e.isZero();){for(var Rt=0,Tt=1;!(_e.words[0]&Tt)&&Rt<26;++Rt,Tt<<=1);if(Rt>0)for(_e.iushrn(Rt);Rt-- >0;)(at.isOdd()||lt.isOdd())&&(at.iadd(yt),lt.isub(vt)),at.iushrn(1),lt.iushrn(1);for(var Mt=0,At=1;!(rt.words[0]&At)&&Mt<26;++Mt,At<<=1);if(Mt>0)for(rt.iushrn(Mt);Mt-- >0;)(tt.isOdd()||_.isOdd())&&(tt.iadd(yt),_.isub(vt)),tt.iushrn(1),_.iushrn(1);_e.cmp(rt)>=0?(_e.isub(rt),at.isub(tt),lt.isub(_)):(rt.isub(_e),tt.isub(at),_.isub(lt))}return{a:tt,b:_,gcd:rt.iushln(it)}},h.prototype._invmp=function($){c($.negative===0),c(!$.isZero());var _e=this,rt=$.clone();_e.negative!==0?_e=_e.umod($):_e=_e.clone();for(var at=new h(1),lt=new h(0),tt=rt.clone();_e.cmpn(1)>0&&rt.cmpn(1)>0;){for(var _=0,it=1;!(_e.words[0]&it)&&_<26;++_,it<<=1);if(_>0)for(_e.iushrn(_);_-- >0;)at.isOdd()&&at.iadd(tt),at.iushrn(1);for(var yt=0,vt=1;!(rt.words[0]&vt)&&yt<26;++yt,vt<<=1);if(yt>0)for(rt.iushrn(yt);yt-- >0;)lt.isOdd()&<.iadd(tt),lt.iushrn(1);_e.cmp(rt)>=0?(_e.isub(rt),at.isub(lt)):(rt.isub(_e),lt.isub(at))}var Rt;return _e.cmpn(1)===0?Rt=at:Rt=lt,Rt.cmpn(0)<0&&Rt.iadd($),Rt},h.prototype.gcd=function($){if(this.isZero())return $.abs();if($.isZero())return this.abs();var _e=this.clone(),rt=$.clone();_e.negative=0,rt.negative=0;for(var at=0;_e.isEven()&&rt.isEven();at++)_e.iushrn(1),rt.iushrn(1);do{for(;_e.isEven();)_e.iushrn(1);for(;rt.isEven();)rt.iushrn(1);var lt=_e.cmp(rt);if(lt<0){var tt=_e;_e=rt,rt=tt}else if(lt===0||rt.cmpn(1)===0)break;_e.isub(rt)}while(!0);return rt.iushln(at)},h.prototype.invm=function($){return this.egcd($).a.umod($)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function($){return this.words[0]&$},h.prototype.bincn=function($){c(typeof $=="number");var _e=$%26,rt=($-_e)/26,at=1<<_e;if(this.length<=rt)return this._expand(rt+1),this.words[rt]|=at,this;for(var lt=at,tt=rt;lt!==0&&tt>>26,_&=67108863,this.words[tt]=_}return lt!==0&&(this.words[tt]=lt,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function($){var _e=$<0;if(this.negative!==0&&!_e)return-1;if(this.negative===0&&_e)return 1;this._strip();var rt;if(this.length>1)rt=1;else{_e&&($=-$),c($<=67108863,"Number is too big");var at=this.words[0]|0;rt=at===$?0:at<$?-1:1}return this.negative!==0?-rt|0:rt},h.prototype.cmp=function($){if(this.negative!==0&&$.negative===0)return-1;if(this.negative===0&&$.negative!==0)return 1;var _e=this.ucmp($);return this.negative!==0?-_e|0:_e},h.prototype.ucmp=function($){if(this.length>$.length)return 1;if(this.length<$.length)return-1;for(var _e=0,rt=this.length-1;rt>=0;rt--){var at=this.words[rt]|0,lt=$.words[rt]|0;if(at!==lt){atlt&&(_e=1);break}}return _e},h.prototype.gtn=function($){return this.cmpn($)===1},h.prototype.gt=function($){return this.cmp($)===1},h.prototype.gten=function($){return this.cmpn($)>=0},h.prototype.gte=function($){return this.cmp($)>=0},h.prototype.ltn=function($){return this.cmpn($)===-1},h.prototype.lt=function($){return this.cmp($)===-1},h.prototype.lten=function($){return this.cmpn($)<=0},h.prototype.lte=function($){return this.cmp($)<=0},h.prototype.eqn=function($){return this.cmpn($)===0},h.prototype.eq=function($){return this.cmp($)===0},h.red=function($){return new ct($)},h.prototype.toRed=function($){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),$.convertTo(this)._forceRed($)},h.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function($){return this.red=$,this},h.prototype.forceRed=function($){return c(!this.red,"Already a number in reduction context"),this._forceRed($)},h.prototype.redAdd=function($){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,$)},h.prototype.redIAdd=function($){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,$)},h.prototype.redSub=function($){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,$)},h.prototype.redISub=function($){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,$)},h.prototype.redShl=function($){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,$)},h.prototype.redMul=function($){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,$),this.red.mul(this,$)},h.prototype.redIMul=function($){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,$),this.red.imul(this,$)},h.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function($){return c(this.red&&!$.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,$)};var Bt={k256:null,p224:null,p192:null,p25519:null};function Dt(b,$){this.name=b,this.p=new h($,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Dt.prototype._tmp=function(){var $=new h(null);return $.words=new Array(Math.ceil(this.n/13)),$},Dt.prototype.ireduce=function($){var _e=$,rt;do this.split(_e,this.tmp),_e=this.imulK(_e),_e=_e.iadd(this.tmp),rt=_e.bitLength();while(rt>this.n);var at=rt0?_e.isub(this.p):_e.strip!==void 0?_e.strip():_e._strip(),_e},Dt.prototype.split=function($,_e){$.iushrn(this.n,0,_e)},Dt.prototype.imulK=function($){return $.imul(this.k)};function Ht(){Dt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Ht,Dt),Ht.prototype.split=function($,_e){for(var rt=4194303,at=Math.min($.length,9),lt=0;lt>>22,tt=_}tt>>>=22,$.words[lt-10]=tt,tt===0&&$.length>10?$.length-=10:$.length-=9},Ht.prototype.imulK=function($){$.words[$.length]=0,$.words[$.length+1]=0,$.length+=2;for(var _e=0,rt=0;rt<$.length;rt++){var at=$.words[rt]|0;_e+=at*977,$.words[rt]=_e&67108863,_e=at*64+(_e/67108864|0)}return $.words[$.length-1]===0&&($.length--,$.words[$.length-1]===0&&$.length--),$};function qt(){Dt.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(qt,Dt);function Pt(){Dt.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(Pt,Dt);function Gt(){Dt.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(Gt,Dt),Gt.prototype.imulK=function($){for(var _e=0,rt=0;rt<$.length;rt++){var at=($.words[rt]|0)*19+_e,lt=at&67108863;at>>>=26,$.words[rt]=lt,_e=at}return _e!==0&&($.words[$.length++]=_e),$},h._prime=function($){if(Bt[$])return Bt[$];var _e;if($==="k256")_e=new Ht;else if($==="p224")_e=new qt;else if($==="p192")_e=new Pt;else if($==="p25519")_e=new Gt;else throw new Error("Unknown prime "+$);return Bt[$]=_e,_e};function ct(b){if(typeof b=="string"){var $=h._prime(b);this.m=$.p,this.prime=$}else c(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}ct.prototype._verify1=function($){c($.negative===0,"red works only with positives"),c($.red,"red works only with red numbers")},ct.prototype._verify2=function($,_e){c(($.negative|_e.negative)===0,"red works only with positives"),c($.red&&$.red===_e.red,"red works only with red numbers")},ct.prototype.imod=function($){return this.prime?this.prime.ireduce($)._forceRed(this):(ot($,$.umod(this.m)._forceRed(this)),$)},ct.prototype.neg=function($){return $.isZero()?$.clone():this.m.sub($)._forceRed(this)},ct.prototype.add=function($,_e){this._verify2($,_e);var rt=$.add(_e);return rt.cmp(this.m)>=0&&rt.isub(this.m),rt._forceRed(this)},ct.prototype.iadd=function($,_e){this._verify2($,_e);var rt=$.iadd(_e);return rt.cmp(this.m)>=0&&rt.isub(this.m),rt},ct.prototype.sub=function($,_e){this._verify2($,_e);var rt=$.sub(_e);return rt.cmpn(0)<0&&rt.iadd(this.m),rt._forceRed(this)},ct.prototype.isub=function($,_e){this._verify2($,_e);var rt=$.isub(_e);return rt.cmpn(0)<0&&rt.iadd(this.m),rt},ct.prototype.shl=function($,_e){return this._verify1($),this.imod($.ushln(_e))},ct.prototype.imul=function($,_e){return this._verify2($,_e),this.imod($.imul(_e))},ct.prototype.mul=function($,_e){return this._verify2($,_e),this.imod($.mul(_e))},ct.prototype.isqr=function($){return this.imul($,$.clone())},ct.prototype.sqr=function($){return this.mul($,$)},ct.prototype.sqrt=function($){if($.isZero())return $.clone();var _e=this.m.andln(3);if(c(_e%2===1),_e===3){var rt=this.m.add(new h(1)).iushrn(2);return this.pow($,rt)}for(var at=this.m.subn(1),lt=0;!at.isZero()&&at.andln(1)===0;)lt++,at.iushrn(1);c(!at.isZero());var tt=new h(1).toRed(this),_=tt.redNeg(),it=this.m.subn(1).iushrn(1),yt=this.m.bitLength();for(yt=new h(2*yt*yt).toRed(this);this.pow(yt,it).cmp(_)!==0;)yt.redIAdd(_);for(var vt=this.pow(yt,at),Rt=this.pow($,at.addn(1).iushrn(1)),Tt=this.pow($,at),Mt=lt;Tt.cmp(tt)!==0;){for(var At=Tt,Ot=0;At.cmp(tt)!==0;Ot++)At=At.redSqr();c(Ot=0;lt--){for(var vt=_e.words[lt],Rt=yt-1;Rt>=0;Rt--){var Tt=vt>>Rt&1;if(tt!==at[0]&&(tt=this.sqr(tt)),Tt===0&&_===0){it=0;continue}_<<=1,_|=Tt,it++,!(it!==rt&&(lt!==0||Rt!==0))&&(tt=this.mul(tt,at[_]),it=0,_=0)}yt=26}return tt},ct.prototype.convertTo=function($){var _e=$.umod(this.m);return _e===$?_e.clone():_e},ct.prototype.convertFrom=function($){var _e=$.clone();return _e.red=null,_e},h.mont=function($){return new g($)};function g(b){ct.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}d(g,ct),g.prototype.convertTo=function($){return this.imod($.ushln(this.shift))},g.prototype.convertFrom=function($){var _e=this.imod($.mul(this.rinv));return _e.red=null,_e},g.prototype.imul=function($,_e){if($.isZero()||_e.isZero())return $.words[0]=0,$.length=1,$;var rt=$.imul(_e),at=rt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),lt=rt.isub(at).iushrn(this.shift),tt=lt;return lt.cmp(this.m)>=0?tt=lt.isub(this.m):lt.cmpn(0)<0&&(tt=lt.iadd(this.m)),tt._forceRed(this)},g.prototype.mul=function($,_e){if($.isZero()||_e.isZero())return new h(0)._forceRed(this);var rt=$.mul(_e),at=rt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),lt=rt.isub(at).iushrn(this.shift),tt=lt;return lt.cmp(this.m)>=0?tt=lt.isub(this.m):lt.cmpn(0)<0&&(tt=lt.iadd(this.m)),tt._forceRed(this)},g.prototype.invm=function($){var _e=this.imod($._invmp(this.m).mul(this.r2));return _e._forceRed(this)}})(o,commonjsGlobal$2)})(bn$6);var bnExports$6=bn$6.exports;const BN$b=getDefaultExportFromCjs$3(bnExports$6);var safeBuffer$2={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(o,e){var a=require$$0$1,c=a.Buffer;function d(j,et){for(var nt in j)et[nt]=j[nt]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?o.exports=a:(d(a,e),e.Buffer=h);function h(j,et,nt){return c(j,et,nt)}h.prototype=Object.create(c.prototype),d(c,h),h.from=function(j,et,nt){if(typeof j=="number")throw new TypeError("Argument must not be a number");return c(j,et,nt)},h.alloc=function(j,et,nt){if(typeof j!="number")throw new TypeError("Argument must be a number");var st=c(j);return et!==void 0?typeof nt=="string"?st.fill(et,nt):st.fill(et):st.fill(0),st},h.allocUnsafe=function(j){if(typeof j!="number")throw new TypeError("Argument must be a number");return c(j)},h.allocUnsafeSlow=function(j){if(typeof j!="number")throw new TypeError("Argument must be a number");return a.SlowBuffer(j)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports$1=safeBuffer$2.exports,_Buffer=safeBufferExports$1.Buffer;function base$3(o){if(o.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),a=0;a>>0,bt=new Uint8Array(mt);St!==_t;){for(var $t=dt[St],Bt=0,Dt=mt-1;($t!==0||Bt>>0,bt[Dt]=$t%j>>>0,$t=$t/j>>>0;if($t!==0)throw new Error("Non-zero carry");wt=Bt,St++}for(var Ht=mt-wt;Ht!==mt&&bt[Ht]===0;)Ht++;for(var qt=et.repeat(gt);Ht>>0,mt=new Uint8Array(_t);gt>>0,mt[Bt]=bt%256>>>0,bt=bt/256>>>0;if(bt!==0)throw new Error("Non-zero carry");St=$t,gt++}for(var Dt=_t-St;Dt!==_t&&mt[Dt]===0;)Dt++;var Ht=_Buffer.allocUnsafe(wt+(_t-Dt));Ht.fill(0,0,wt);for(var qt=wt;Dt!==_t;)Ht[qt++]=mt[Dt++];return Ht}function pt(dt){var gt=ht(dt);if(gt)return gt;throw new Error("Non-base"+j+" character")}return{encode:ot,decodeUnsafe:ht,decode:pt}}var src$1=base$3,basex$1=src$1,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$3=basex$1(ALPHABET$1);const bs58$4=getDefaultExportFromCjs$3(bs58$3),SHA256_K=new Uint32Array([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]),SHA256_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);let SHA256$2=class extends HashMD{constructor(){super(64,32,8,!1),this.A=SHA256_IV[0]|0,this.B=SHA256_IV[1]|0,this.C=SHA256_IV[2]|0,this.D=SHA256_IV[3]|0,this.E=SHA256_IV[4]|0,this.F=SHA256_IV[5]|0,this.G=SHA256_IV[6]|0,this.H=SHA256_IV[7]|0}get(){const{A:e,B:a,C:c,D:d,E:h,F:j,G:et,H:nt}=this;return[e,a,c,d,h,j,et,nt]}set(e,a,c,d,h,j,et,nt){this.A=e|0,this.B=a|0,this.C=c|0,this.D=d|0,this.E=h|0,this.F=j|0,this.G=et|0,this.H=nt|0}process(e,a){for(let ht=0;ht<16;ht++,a+=4)SHA256_W[ht]=e.getUint32(a,!1);for(let ht=16;ht<64;ht++){const pt=SHA256_W[ht-15],dt=SHA256_W[ht-2],gt=rotr(pt,7)^rotr(pt,18)^pt>>>3,wt=rotr(dt,17)^rotr(dt,19)^dt>>>10;SHA256_W[ht]=wt+SHA256_W[ht-7]+gt+SHA256_W[ht-16]|0}let{A:c,B:d,C:h,D:j,E:et,F:nt,G:st,H:ot}=this;for(let ht=0;ht<64;ht++){const pt=rotr(et,6)^rotr(et,11)^rotr(et,25),dt=ot+pt+Chi(et,nt,st)+SHA256_K[ht]+SHA256_W[ht]|0,wt=(rotr(c,2)^rotr(c,13)^rotr(c,22))+Maj(c,d,h)|0;ot=st,st=nt,nt=et,et=j+dt|0,j=h,h=d,d=c,c=dt+wt|0}c=c+this.A|0,d=d+this.B|0,h=h+this.C|0,j=j+this.D|0,et=et+this.E|0,nt=nt+this.F|0,st=st+this.G|0,ot=ot+this.H|0,this.set(c,d,h,j,et,nt,st,ot)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const sha256$4=wrapConstructor(()=>new SHA256$2);var lib={};function inRange(o,e,a){return e<=o&&o<=a}function ToDictionary(o){if(o===void 0)return{};if(o===Object(o))return o;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(o){for(var e=String(o),a=e.length,c=0,d=[];c57343)d.push(h);else if(56320<=h&&h<=57343)d.push(65533);else if(55296<=h&&h<=56319)if(c===a-1)d.push(65533);else{var j=o.charCodeAt(c+1);if(56320<=j&&j<=57343){var et=h&1023,nt=j&1023;d.push(65536+(et<<10)+nt),c+=1}else d.push(65533)}c+=1}return d}function codePointsToString(o){for(var e="",a=0;a>10)+55296,(c&1023)+56320))}return e}var end_of_stream=-1;function Stream$1(o){this.tokens=[].slice.call(o)}Stream$1.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(o){if(Array.isArray(o))for(var e=o;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(o)},push:function(o){if(Array.isArray(o))for(var e=o;e.length;)this.tokens.push(e.shift());else this.tokens.push(o)}};var finished=-1;function decoderError(o,e){if(o)throw TypeError("Decoder error");return e||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(o,e){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(o,e);if(o=o!==void 0?String(o).toLowerCase():DEFAULT_ENCODING,o!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");e=ToDictionary(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function(e,a){var c;typeof e=="object"&&e instanceof ArrayBuffer?c=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?c=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):c=new Uint8Array(0),a=ToDictionary(a),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!a.stream;for(var d=new Stream$1(c),h=[],j;!d.endOfStream()&&(j=this._decoder.handler(d,d.read()),j!==finished);)j!==null&&(Array.isArray(j)?h.push.apply(h,j):h.push(j));if(!this._streaming){do{if(j=this._decoder.handler(d,d.read()),j===finished)break;j!==null&&(Array.isArray(j)?h.push.apply(h,j):h.push(j))}while(!d.endOfStream());this._decoder=null}return h.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(h[0]===65279?(this._BOMseen=!0,h.shift()):this._BOMseen=!0),codePointsToString(h)}};function TextEncoder$1(o,e){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(o,e);if(o=o!==void 0?String(o).toLowerCase():DEFAULT_ENCODING,o!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");e=ToDictionary(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function(e,a){e=e?String(e):"",a=ToDictionary(a),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!a.stream;for(var c=[],d=new Stream$1(stringToCodePoints(e)),h;!d.endOfStream()&&(h=this._encoder.handler(d,d.read()),h!==finished);)Array.isArray(h)?c.push.apply(c,h):c.push(h);if(!this._streaming){for(;h=this._encoder.handler(d,d.read()),h!==finished;)Array.isArray(h)?c.push.apply(c,h):c.push(h);this._encoder=null}return new Uint8Array(c)}};function UTF8Decoder(o){var e=o.fatal,a=0,c=0,d=0,h=128,j=191;this.handler=function(et,nt){if(nt===end_of_stream&&d!==0)return d=0,decoderError(e);if(nt===end_of_stream)return finished;if(d===0){if(inRange(nt,0,127))return nt;if(inRange(nt,194,223))d=1,a=nt-192;else if(inRange(nt,224,239))nt===224&&(h=160),nt===237&&(j=159),d=2,a=nt-224;else if(inRange(nt,240,244))nt===240&&(h=144),nt===244&&(j=143),d=3,a=nt-240;else return decoderError(e);return a=a<<6*d,null}if(!inRange(nt,h,j))return a=d=c=0,h=128,j=191,et.prepend(nt),decoderError(e);if(h=128,j=191,c+=1,a+=nt-128<<6*(d-c),c!==d)return null;var st=a;return a=d=c=0,st}}function UTF8Encoder(o){o.fatal,this.handler=function(e,a){if(a===end_of_stream)return finished;if(inRange(a,0,127))return a;var c,d;inRange(a,128,2047)?(c=1,d=192):inRange(a,2048,65535)?(c=2,d=224):inRange(a,65536,1114111)&&(c=3,d=240);for(var h=[(a>>6*c)+d];c>0;){var j=a>>6*(c-1);h.push(128|j&63),c-=1}return h}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2$1=getAugmentedNamespace(encoding$1);var __createBinding=commonjsGlobal$2&&commonjsGlobal$2.__createBinding||(Object.create?function(o,e,a,c){c===void 0&&(c=a),Object.defineProperty(o,c,{enumerable:!0,get:function(){return e[a]}})}:function(o,e,a,c){c===void 0&&(c=a),o[c]=e[a]}),__setModuleDefault=commonjsGlobal$2&&commonjsGlobal$2.__setModuleDefault||(Object.create?function(o,e){Object.defineProperty(o,"default",{enumerable:!0,value:e})}:function(o,e){o.default=e}),__decorate=commonjsGlobal$2&&commonjsGlobal$2.__decorate||function(o,e,a,c){var d=arguments.length,h=d<3?e:c===null?c=Object.getOwnPropertyDescriptor(e,a):c,j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(o,e,a,c);else for(var et=o.length-1;et>=0;et--)(j=o[et])&&(h=(d<3?j(h):d>3?j(e,a,h):j(e,a))||h);return d>3&&h&&Object.defineProperty(e,a,h),h},__importStar=commonjsGlobal$2&&commonjsGlobal$2.__importStar||function(o){if(o&&o.__esModule)return o;var e={};if(o!=null)for(var a in o)a!=="default"&&Object.hasOwnProperty.call(o,a)&&__createBinding(e,o,a);return __setModuleDefault(e,o),e},__importDefault=commonjsGlobal$2&&commonjsGlobal$2.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1=__importDefault(bnExports$6),bs58_1=__importDefault(bs58$3),encoding=__importStar(require$$2$1),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(o){return typeof o=="string"&&(o=Buffer$1$1.from(o,"utf8")),bs58_1.default.encode(Buffer$1$1.from(o))}lib.baseEncode=baseEncode;function baseDecode(o){return Buffer$1$1.from(bs58_1.default.decode(o))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$1$1.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$1$1.concat([this.buf,Buffer$1$1.alloc(INITIAL_LENGTH)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Buffer$1$1.from(new bn_js_1.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer$1$1.from(new bn_js_1.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer$1$1.from(new bn_js_1.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer$1$1.from(new bn_js_1.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer$1$1.concat([Buffer$1$1.from(this.buf.subarray(0,this.length)),e,Buffer$1$1.alloc(INITIAL_LENGTH)]),this.length+=e.length}writeString(e){this.maybeResize();const a=Buffer$1$1.from(e,"utf8");this.writeU32(a.length),this.writeBuffer(a)}writeFixedArray(e){this.writeBuffer(Buffer$1$1.from(e))}writeArray(e,a){this.maybeResize(),this.writeU32(e.length);for(const c of e)this.maybeResize(),a(c)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(o,e,a){const c=a.value;a.value=function(...d){try{return c.apply(this,d)}catch(h){if(h instanceof RangeError){const j=h.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(j)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw h}}}class BinaryReader{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new bn_js_1.default(e,"le")}readU128(){const e=this.readBuffer(16);return new bn_js_1.default(e,"le")}readU256(){const e=this.readBuffer(32);return new bn_js_1.default(e,"le")}readU512(){const e=this.readBuffer(64);return new bn_js_1.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new BorshError(`Expected buffer length ${e} isn't within bounds`);const a=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,a}readString(){const e=this.readU32(),a=this.readBuffer(e);try{return textDecoder.decode(a)}catch(c){throw new BorshError(`Error decoding UTF-8 string: ${c}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const a=this.readU32(),c=Array();for(let d=0;d{serializeField(o,e,h,c[0],d)});else if(c.kind!==void 0)switch(c.kind){case"option":{a==null?d.writeU8(0):(d.writeU8(1),serializeField(o,e,a,c.type,d));break}case"map":{d.writeU32(a.size),a.forEach((h,j)=>{serializeField(o,e,j,c.key,d),serializeField(o,e,h,c.value,d)});break}default:throw new BorshError(`FieldType ${c} unrecognized`)}else serializeStruct(o,a,d)}catch(h){throw h instanceof BorshError&&h.addToFieldPath(e),h}}function serializeStruct(o,e,a){if(typeof e.borshSerialize=="function"){e.borshSerialize(a);return}const c=o.get(e.constructor);if(!c)throw new BorshError(`Class ${e.constructor.name} is missing in schema`);if(c.kind==="struct")c.fields.map(([d,h])=>{serializeField(o,d,e[d],h,a)});else if(c.kind==="enum"){const d=e[c.field];for(let h=0;hdeserializeField(o,e,a[0],c))}if(a.kind==="option")return c.readU8()?deserializeField(o,e,a.type,c):void 0;if(a.kind==="map"){let d=new Map;const h=c.readU32();for(let j=0;j=c.values.length)throw new BorshError(`Enum index: ${d} is out of range`);const[h,j]=c.values[d],et=deserializeField(o,h,j,a);return new e({[h]:et})}throw new BorshError(`Unexpected schema kind: ${c.kind} for ${e.constructor.name}`)}function deserialize(o,e,a,c=BinaryReader){const d=new c(a),h=deserializeStruct(o,e,d);if(d.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const a=Object.create(this.constructor.prototype);return Object.assign(a,this),a.property=e,a}fromArray(e){}};Layout$5.Layout=Layout$4;function nameWithProperty$3(o,e){return e.property?o+"["+e.property+"]":o}Layout$5.nameWithProperty=nameWithProperty$3;function bindConstructorLayout$1(o,e){if(typeof o!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(o,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Layout$4))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");o.layout_=e,e.boundConstructor_=o,e.makeDestinationObject=()=>new o,Object.defineProperty(o.prototype,"encode",{value(a,c){return e.encode(this,a,c)},writable:!0}),Object.defineProperty(o,"decode",{value(a,c){return e.decode(a,c)},writable:!0})}Layout$5.bindConstructorLayout=bindConstructorLayout$1;let ExternalLayout$3=class extends Layout$4{isCount(){throw new Error("ExternalLayout is abstract")}};Layout$5.ExternalLayout=ExternalLayout$3;let GreedyCount$1=class extends ExternalLayout$3{constructor(e=1,a){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,a),this.elementSpan=e}isCount(){return!0}decode(e,a=0){checkUint8Array(e);const c=e.length-a;return Math.floor(c/this.elementSpan)}encode(e,a,c){return 0}};Layout$5.GreedyCount=GreedyCount$1;let OffsetLayout$3=class extends ExternalLayout$3{constructor(e,a=0,c){if(!(e instanceof Layout$4))throw new TypeError("layout must be a Layout");if(!Number.isInteger(a))throw new TypeError("offset must be integer or undefined");super(e.span,c||e.property),this.layout=e,this.offset=a}isCount(){return this.layout instanceof UInt$3||this.layout instanceof UIntBE$3}decode(e,a=0){return this.layout.decode(e,a+this.offset)}encode(e,a,c=0){return this.layout.encode(e,a,c+this.offset)}};Layout$5.OffsetLayout=OffsetLayout$3;let UInt$3=class extends Layout$4{constructor(e,a){if(super(e,a),6j+d.encode(et,a,c+j),0);return this.count instanceof ExternalLayout$3&&this.count.encode(e.length,a,c),h}};Layout$5.Sequence=Sequence$1;let Structure$3=class extends Layout$4{constructor(e,a,c){if(!(Array.isArray(e)&&e.reduce((h,j)=>h&&j instanceof Layout$4,!0)))throw new TypeError("fields must be array of Layout instances");typeof a=="boolean"&&c===void 0&&(c=a,a=void 0);for(const h of e)if(0>h.span&&h.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let d=-1;try{d=e.reduce((h,j)=>h+j.getSpan(),0)}catch{}super(d,a),this.fields=e,this.decodePrefixes=!!c}getSpan(e,a=0){if(0<=this.span)return this.span;let c=0;try{c=this.fields.reduce((d,h)=>{const j=h.getSpan(e,a);return a+=j,d+j},0)}catch{throw new RangeError("indeterminate span")}return c}decode(e,a=0){checkUint8Array(e);const c=this.makeDestinationObject();for(const d of this.fields)if(d.property!==void 0&&(c[d.property]=d.decode(e,a)),a+=d.getSpan(e,a),this.decodePrefixes&&e.length===a)break;return c}encode(e,a,c=0){const d=c;let h=0,j=0;for(const et of this.fields){let nt=et.span;if(j=0nt&&(nt=et.getSpan(a,c)))}h=c,c+=nt}return h+j-d}fromArray(e){const a=this.makeDestinationObject();for(const c of this.fields)c.property!==void 0&&0c.span?a=-1:0<=a&&(a+=c.span)}}};Layout$5.Structure=Structure$3;let UnionDiscriminator$3=class{constructor(e){this.property=e}decode(e,a){throw new Error("UnionDiscriminator is abstract")}encode(e,a,c){throw new Error("UnionDiscriminator is abstract")}};Layout$5.UnionDiscriminator=UnionDiscriminator$3;let UnionLayoutDiscriminator$3=class extends UnionDiscriminator$3{constructor(e,a){if(!(e instanceof ExternalLayout$3&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(a||e.property||"variant"),this.layout=e}decode(e,a){return this.layout.decode(e,a)}encode(e,a,c){return this.layout.encode(e,a,c)}};Layout$5.UnionLayoutDiscriminator=UnionLayoutDiscriminator$3;let Union$3=class extends Layout$4{constructor(e,a,c){let d;if(e instanceof UInt$3||e instanceof UIntBE$3)d=new UnionLayoutDiscriminator$3(new OffsetLayout$3(e));else if(e instanceof ExternalLayout$3&&e.isCount())d=new UnionLayoutDiscriminator$3(e);else if(e instanceof UnionDiscriminator$3)d=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(a===void 0&&(a=null),!(a===null||a instanceof Layout$4))throw new TypeError("defaultLayout must be null or a Layout");if(a!==null){if(0>a.span)throw new Error("defaultLayout must have constant span");a.property===void 0&&(a=a.replicate("content"))}let h=-1;a&&(h=a.span,0<=h&&(e instanceof UInt$3||e instanceof UIntBE$3)&&(h+=d.layout.span)),super(h,c),this.discriminator=d,this.usesPrefixDiscriminator=e instanceof UInt$3||e instanceof UIntBE$3,this.defaultLayout=a,this.registry={};let j=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(et){return j(et)},this.configGetSourceVariant=function(et){j=et.bind(this)}}getSpan(e,a=0){if(0<=this.span)return this.span;const c=this.getVariant(e,a);if(!c)throw new Error("unable to determine span for unrecognized variant");return c.getSpan(e,a)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const a=this.registry[e[this.discriminator.property]];if(a&&(!a.layout||a.property&&Object.prototype.hasOwnProperty.call(e,a.property)))return a}else for(const a in this.registry){const c=this.registry[a];if(c.property&&Object.prototype.hasOwnProperty.call(e,c.property))return c}throw new Error("unable to infer src variant")}decode(e,a=0){let c;const d=this.discriminator,h=d.decode(e,a),j=this.registry[h];if(j===void 0){const et=this.defaultLayout;let nt=0;this.usesPrefixDiscriminator&&(nt=d.layout.span),c=this.makeDestinationObject(),c[d.property]=h,c[et.property]=et.decode(e,a+nt)}else c=j.decode(e,a);return c}encode(e,a,c=0){const d=this.getSourceVariant(e);if(d===void 0){const h=this.discriminator,j=this.defaultLayout;let et=0;return this.usesPrefixDiscriminator&&(et=h.layout.span),h.encode(e[h.property],a,c),et+j.encode(e[j.property],a,c+et)}return d.encode(e,a,c)}addVariant(e,a,c){const d=new VariantLayout$3(this,e,a,c);return this.registry[e]=d,d}getVariant(e,a=0){let c;return e instanceof Uint8Array?c=this.discriminator.decode(e,a):c=e,this.registry[c]}};Layout$5.Union=Union$3;let VariantLayout$3=class extends Layout$4{constructor(e,a,c,d){if(!(e instanceof Union$3))throw new TypeError("union must be a Union");if(!Number.isInteger(a)||0>a)throw new TypeError("variant must be a (non-negative) integer");if(typeof c=="string"&&d===void 0&&(d=c,c=null),c){if(!(c instanceof Layout$4))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=c.span&&c.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof d!="string")throw new TypeError("variant must have a String property")}let h=e.span;0>e.span&&(h=c?c.span:0,0<=h&&e.usesPrefixDiscriminator&&(h+=e.discriminator.layout.span)),super(h,d),this.union=e,this.variant=a,this.layout=c||null}getSpan(e,a=0){if(0<=this.span)return this.span;let c=0;this.union.usesPrefixDiscriminator&&(c=this.union.discriminator.layout.span);let d=0;return this.layout&&(d=this.layout.getSpan(e,a+c)),c+d}decode(e,a=0){const c=this.makeDestinationObject();if(this!==this.union.getVariant(e,a))throw new Error("variant mismatch");let d=0;return this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout?c[this.property]=this.layout.decode(e,a+d):this.property?c[this.property]=!0:this.union.usesPrefixDiscriminator&&(c[this.union.discriminator.property]=this.variant),c}encode(e,a,c=0){let d=0;if(this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,a,c);let h=d;if(this.layout&&(this.layout.encode(e[this.property],a,c+d),h+=this.layout.getSpan(a,c+d),0<=this.union.span&&h>this.union.span))throw new Error("encoded variant overruns containing union");return h}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};Layout$5.VariantLayout=VariantLayout$3;function fixBitwiseResult$1(o){return 0>o&&(o+=4294967296),o}let BitStructure$1=class extends Layout$4{constructor(e,a,c){if(!(e instanceof UInt$3||e instanceof UIntBE$3))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof a=="string"&&c===void 0&&(c=a,a=!1),4=a)throw new TypeError("bits must be positive integer");const d=8*e.span,h=e.fields.reduce((j,et)=>j+et.bits,0);if(a+h>d)throw new Error("bits too long for span remainder ("+(d-h)+" of "+d+" remain)");this.container=e,this.bits=a,this.valueMask=(1<>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==fixBitwiseResult$1(e&this.valueMask))throw new TypeError(nameWithProperty$3("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const a=this.container._packedGetValue(),c=fixBitwiseResult$1(e<c&&(c=this.length.decode(e,a)),c}decode(e,a=0){let c=this.span;return 0>c&&(c=this.length.decode(e,a)),uint8ArrayToBuffer(e).slice(a,a+c)}encode(e,a,c){let d=this.length;if(this.length instanceof ExternalLayout$3&&(d=e.length),!(e instanceof Uint8Array&&d===e.length))throw new TypeError(nameWithProperty$3("Blob.encode",this)+" requires (length "+d+") Uint8Array as src");if(c+d>a.length)throw new RangeError("encoding overruns Uint8Array");const h=uint8ArrayToBuffer(e);return uint8ArrayToBuffer(a).write(h.toString("hex"),c,d,"hex"),this.length instanceof ExternalLayout$3&&this.length.encode(d,a,c),d}};Layout$5.Blob=Blob$3;let CString$1=class extends Layout$4{constructor(e){super(-1,e)}getSpan(e,a=0){checkUint8Array(e);let c=a;for(;ca.length)throw new RangeError("encoding overruns Buffer");const j=uint8ArrayToBuffer(a);return d.copy(j,c),j[c+h]=0,h+1}};Layout$5.CString=CString$1;let UTF8$1=class extends Layout$4{constructor(e,a){if(typeof e=="string"&&a===void 0&&(a=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,a),this.maxSpan=e}getSpan(e,a=0){return checkUint8Array(e),e.length-a}decode(e,a=0){const c=this.getSpan(e,a);if(0<=this.maxSpan&&this.maxSpana.length)throw new RangeError("encoding overruns Buffer");return d.copy(uint8ArrayToBuffer(a),c),h}};Layout$5.UTF8=UTF8$1;let Constant$1=class extends Layout$4{constructor(e,a){super(0,a),this.value=e}decode(e,a){return this.value}encode(e,a,c){return 0}};Layout$5.Constant=Constant$1;Layout$5.greedy=(o,e)=>new GreedyCount$1(o,e);var offset$2=Layout$5.offset=(o,e,a)=>new OffsetLayout$3(o,e,a),u8$2=Layout$5.u8=o=>new UInt$3(1,o),u16=Layout$5.u16=o=>new UInt$3(2,o);Layout$5.u24=o=>new UInt$3(3,o);var u32$2=Layout$5.u32=o=>new UInt$3(4,o);Layout$5.u40=o=>new UInt$3(5,o);Layout$5.u48=o=>new UInt$3(6,o);var nu64$2=Layout$5.nu64=o=>new NearUInt64$3(o);Layout$5.u16be=o=>new UIntBE$3(2,o);Layout$5.u24be=o=>new UIntBE$3(3,o);Layout$5.u32be=o=>new UIntBE$3(4,o);Layout$5.u40be=o=>new UIntBE$3(5,o);Layout$5.u48be=o=>new UIntBE$3(6,o);Layout$5.nu64be=o=>new NearUInt64BE$1(o);Layout$5.s8=o=>new Int$1(1,o);Layout$5.s16=o=>new Int$1(2,o);Layout$5.s24=o=>new Int$1(3,o);Layout$5.s32=o=>new Int$1(4,o);Layout$5.s40=o=>new Int$1(5,o);Layout$5.s48=o=>new Int$1(6,o);var ns64$2=Layout$5.ns64=o=>new NearInt64$3(o);Layout$5.s16be=o=>new IntBE$1(2,o);Layout$5.s24be=o=>new IntBE$1(3,o);Layout$5.s32be=o=>new IntBE$1(4,o);Layout$5.s40be=o=>new IntBE$1(5,o);Layout$5.s48be=o=>new IntBE$1(6,o);Layout$5.ns64be=o=>new NearInt64BE$1(o);Layout$5.f32=o=>new Float$1(o);Layout$5.f32be=o=>new FloatBE$1(o);Layout$5.f64=o=>new Double$1(o);Layout$5.f64be=o=>new DoubleBE$1(o);var struct$2=Layout$5.struct=(o,e,a)=>new Structure$3(o,e,a);Layout$5.bits=(o,e,a)=>new BitStructure$1(o,e,a);var seq=Layout$5.seq=(o,e,a)=>new Sequence$1(o,e,a);Layout$5.union=(o,e,a)=>new Union$3(o,e,a);Layout$5.unionLayoutDiscriminator=(o,e)=>new UnionLayoutDiscriminator$3(o,e);var blob$2=Layout$5.blob=(o,e)=>new Blob$3(o,e);Layout$5.cstr=o=>new CString$1(o);Layout$5.utf8=(o,e)=>new UTF8$1(o,e);Layout$5.constant=(o,e)=>new Constant$1(o,e);var browser$e={};Object.defineProperty(browser$e,"__esModule",{value:!0});function toBigIntLE(o){{const e=Buffer$1$1.from(o);e.reverse();const a=e.toString("hex");return a.length===0?BigInt(0):BigInt(`0x${a}`)}}var toBigIntLE_1=browser$e.toBigIntLE=toBigIntLE;function toBigIntBE(o){{const e=o.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}}browser$e.toBigIntBE=toBigIntBE;function toBufferLE(o,e){{const a=o.toString(16),c=Buffer$1$1.from(a.padStart(e*2,"0").slice(0,e*2),"hex");return c.reverse(),c}}var toBufferLE_1=browser$e.toBufferLE=toBufferLE;function toBufferBE(o,e){{const a=o.toString(16);return Buffer$1$1.from(a.padStart(e*2,"0").slice(0,e*2),"hex")}}browser$e.toBufferBE=toBufferBE;let StructError$2=class extends TypeError{constructor(e,a){let c;const{message:d,explanation:h,...j}=e,{path:et}=e,nt=et.length===0?d:`At path: ${et.join(".")} -- ${d}`;super(h??nt),h!=null&&(this.cause=nt),Object.assign(this,j),this.name=this.constructor.name,this.failures=()=>c??(c=[e,...a()])}};function isIterable$2(o){return isObject$3(o)&&typeof o[Symbol.iterator]=="function"}function isObject$3(o){return typeof o=="object"&&o!=null}function isNonArrayObject(o){return isObject$3(o)&&!Array.isArray(o)}function print$2(o){return typeof o=="symbol"?o.toString():typeof o=="string"?JSON.stringify(o):`${o}`}function shiftIterator$2(o){const{done:e,value:a}=o.next();return e?void 0:a}function toFailure$2(o,e,a,c){if(o===!0)return;o===!1?o={}:typeof o=="string"&&(o={message:o});const{path:d,branch:h}=e,{type:j}=a,{refinement:et,message:nt=`Expected a value of type \`${j}\`${et?` with refinement \`${et}\``:""}, but received: \`${print$2(c)}\``}=o;return{value:c,type:j,refinement:et,key:d[d.length-1],path:d,branch:h,...o,message:nt}}function*toFailures$2(o,e,a,c){isIterable$2(o)||(o=[o]);for(const d of o){const h=toFailure$2(d,e,a,c);h&&(yield h)}}function*run$2(o,e,a={}){const{path:c=[],branch:d=[o],coerce:h=!1,mask:j=!1}=a,et={path:c,branch:d,mask:j};h&&(o=e.coercer(o,et));let nt="valid";for(const st of e.validator(o,et))st.explanation=a.message,nt="not_valid",yield[st,void 0];for(let[st,ot,ht]of e.entries(o,et)){const pt=run$2(ot,ht,{path:st===void 0?c:[...c,st],branch:st===void 0?d:[...d,ot],coerce:h,mask:j,message:a.message});for(const dt of pt)dt[0]?(nt=dt[0].refinement!=null?"not_refined":"not_valid",yield[dt[0],void 0]):h&&(ot=dt[1],st===void 0?o=ot:o instanceof Map?o.set(st,ot):o instanceof Set?o.add(ot):isObject$3(o)&&(ot!==void 0||st in o)&&(o[st]=ot))}if(nt!=="not_valid")for(const st of e.refiner(o,et))st.explanation=a.message,nt="not_refined",yield[st,void 0];nt==="valid"&&(yield[void 0,o])}let Struct$3=class{constructor(e){const{type:a,schema:c,validator:d,refiner:h,coercer:j=nt=>nt,entries:et=function*(){}}=e;this.type=a,this.schema=c,this.entries=et,this.coercer=j,d?this.validator=(nt,st)=>{const ot=d(nt,st);return toFailures$2(ot,st,this,nt)}:this.validator=()=>[],h?this.refiner=(nt,st)=>{const ot=h(nt,st);return toFailures$2(ot,st,this,nt)}:this.refiner=()=>[]}assert(e,a){return assert$n(e,this,a)}create(e,a){return create$2(e,this,a)}is(e){return is$2(e,this)}mask(e,a){return mask$2(e,this,a)}validate(e,a={}){return validate$3(e,this,a)}};function assert$n(o,e,a){const c=validate$3(o,e,{message:a});if(c[0])throw c[0]}function create$2(o,e,a){const c=validate$3(o,e,{coerce:!0,message:a});if(c[0])throw c[0];return c[1]}function mask$2(o,e,a){const c=validate$3(o,e,{coerce:!0,mask:!0,message:a});if(c[0])throw c[0];return c[1]}function is$2(o,e){return!validate$3(o,e)[0]}function validate$3(o,e,a={}){const c=run$2(o,e,a),d=shiftIterator$2(c);return d[0]?[new StructError$2(d[0],function*(){for(const j of c)j[0]&&(yield j[0])}),void 0]:[void 0,d[1]]}function define$2(o,e){return new Struct$3({type:o,schema:null,validator:e})}function any$2(){return define$2("any",()=>!0)}function array$2(o){return new Struct$3({type:"array",schema:o,*entries(e){if(o&&Array.isArray(e))for(const[a,c]of e.entries())yield[a,c,o]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${print$2(e)}`}})}function boolean$2(){return define$2("boolean",o=>typeof o=="boolean")}function instance(o){return define$2("instance",e=>e instanceof o||`Expected a \`${o.name}\` instance, but received: ${print$2(e)}`)}function literal$2(o){const e=print$2(o),a=typeof o;return new Struct$3({type:"literal",schema:a==="string"||a==="number"||a==="boolean"?o:null,validator(c){return c===o||`Expected the literal \`${e}\`, but received: ${print$2(c)}`}})}function never(){return define$2("never",()=>!1)}function nullable$2(o){return new Struct$3({...o,validator:(e,a)=>e===null||o.validator(e,a),refiner:(e,a)=>e===null||o.refiner(e,a)})}function number$2(){return define$2("number",o=>typeof o=="number"&&!isNaN(o)||`Expected a number, but received: ${print$2(o)}`)}function optional$2(o){return new Struct$3({...o,validator:(e,a)=>e===void 0||o.validator(e,a),refiner:(e,a)=>e===void 0||o.refiner(e,a)})}function record(o,e){return new Struct$3({type:"record",schema:null,*entries(a){if(isObject$3(a))for(const c in a){const d=a[c];yield[c,c,o],yield[c,d,e]}},validator(a){return isNonArrayObject(a)||`Expected an object, but received: ${print$2(a)}`},coercer(a){return isNonArrayObject(a)?{...a}:a}})}function string$2(){return define$2("string",o=>typeof o=="string"||`Expected a string, but received: ${print$2(o)}`)}function tuple(o){const e=never();return new Struct$3({type:"tuple",schema:null,*entries(a){if(Array.isArray(a)){const c=Math.max(o.length,a.length);for(let d=0;da.type).join(" | ");return new Struct$3({type:"union",schema:null,coercer(a,c){for(const d of o){const[h,j]=d.validate(a,{coerce:!0,mask:c.mask});if(!h)return j}return a},validator(a,c){const d=[];for(const h of o){const[...j]=run$2(a,h,c),[et]=j;if(et[0])for(const[nt]of j)nt&&d.push(nt);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${print$2(a)}`,...d]}})}function unknown$2(){return define$2("unknown",()=>!0)}function coerce$2(o,e,a){return new Struct$3({...o,coercer:(c,d)=>is$2(c,e)?o.coercer(a(c,d),d):o.coercer(c,d)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate$2(o){return typeof o=="string"&®EX.test(o)}var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).substr(1));function stringify(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=(byteToHex[o[e+0]]+byteToHex[o[e+1]]+byteToHex[o[e+2]]+byteToHex[o[e+3]]+"-"+byteToHex[o[e+4]]+byteToHex[o[e+5]]+"-"+byteToHex[o[e+6]]+byteToHex[o[e+7]]+"-"+byteToHex[o[e+8]]+byteToHex[o[e+9]]+"-"+byteToHex[o[e+10]]+byteToHex[o[e+11]]+byteToHex[o[e+12]]+byteToHex[o[e+13]]+byteToHex[o[e+14]]+byteToHex[o[e+15]]).toLowerCase();if(!validate$2(a))throw TypeError("Stringified UUID is invalid");return a}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(o,e,a){var c=e&&a||0,d=e||new Array(16);o=o||{};var h=o.node||_nodeId,j=o.clockseq!==void 0?o.clockseq:_clockseq;if(h==null||j==null){var et=o.random||(o.rng||rng)();h==null&&(h=_nodeId=[et[0]|1,et[1],et[2],et[3],et[4],et[5]]),j==null&&(j=_clockseq=(et[6]<<8|et[7])&16383)}var nt=o.msecs!==void 0?o.msecs:Date.now(),st=o.nsecs!==void 0?o.nsecs:_lastNSecs+1,ot=nt-_lastMSecs+(st-_lastNSecs)/1e4;if(ot<0&&o.clockseq===void 0&&(j=j+1&16383),(ot<0||nt>_lastMSecs)&&o.nsecs===void 0&&(st=0),st>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=nt,_lastNSecs=st,_clockseq=j,nt+=122192928e5;var ht=((nt&268435455)*1e4+st)%4294967296;d[c++]=ht>>>24&255,d[c++]=ht>>>16&255,d[c++]=ht>>>8&255,d[c++]=ht&255;var pt=nt/4294967296*1e4&268435455;d[c++]=pt>>>8&255,d[c++]=pt&255,d[c++]=pt>>>24&15|16,d[c++]=pt>>>16&255,d[c++]=j>>>8|128,d[c++]=j&255;for(var dt=0;dt<6;++dt)d[c+dt]=h[dt];return e||stringify(d)}function parse(o){if(!validate$2(o))throw TypeError("Invalid UUID");var e,a=new Uint8Array(16);return a[0]=(e=parseInt(o.slice(0,8),16))>>>24,a[1]=e>>>16&255,a[2]=e>>>8&255,a[3]=e&255,a[4]=(e=parseInt(o.slice(9,13),16))>>>8,a[5]=e&255,a[6]=(e=parseInt(o.slice(14,18),16))>>>8,a[7]=e&255,a[8]=(e=parseInt(o.slice(19,23),16))>>>8,a[9]=e&255,a[10]=(e=parseInt(o.slice(24,36),16))/1099511627776&255,a[11]=e/4294967296&255,a[12]=e>>>24&255,a[13]=e>>>16&255,a[14]=e>>>8&255,a[15]=e&255,a}function stringToBytes(o){o=unescape(encodeURIComponent(o));for(var e=[],a=0;a>5]>>>d%32&255,j=parseInt(c.charAt(h>>>4&15)+c.charAt(h&15),16);e.push(j)}return e}function getOutputLength(o){return(o+64>>>9<<4)+14+1}function wordsToMd5(o,e){o[e>>5]|=128<>5]|=(o[c/8]&255)<>16)+(e>>16)+(a>>16);return c<<16|a&65535}function bitRotateLeft(o,e){return o<>>32-e}function md5cmn(o,e,a,c,d,h){return safeAdd(bitRotateLeft(safeAdd(safeAdd(e,o),safeAdd(c,h)),d),a)}function md5ff(o,e,a,c,d,h,j){return md5cmn(e&a|~e&c,o,e,d,h,j)}function md5gg(o,e,a,c,d,h,j){return md5cmn(e&c|a&~c,o,e,d,h,j)}function md5hh(o,e,a,c,d,h,j){return md5cmn(e^a^c,o,e,d,h,j)}function md5ii(o,e,a,c,d,h,j){return md5cmn(a^(e|~c),o,e,d,h,j)}var v3=v35("v3",48,md5$3);function v4(o,e,a){o=o||{};var c=o.random||(o.rng||rng)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,e){a=a||0;for(var d=0;d<16;++d)e[a+d]=c[d];return e}return stringify(c)}function f$1(o,e,a,c){switch(o){case 0:return e&a^~e&c;case 1:return e^a^c;case 2:return e&a^e&c^a&c;case 3:return e^a^c}}function ROTL(o,e){return o<>>32-e}function sha1$1(o){var e=[1518500249,1859775393,2400959708,3395469782],a=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof o=="string"){var c=unescape(encodeURIComponent(o));o=[];for(var d=0;d>>0;bt=mt,mt=_t,_t=ROTL(St,30)>>>0,St=wt,wt=Dt}a[0]=a[0]+wt>>>0,a[1]=a[1]+St>>>0,a[2]=a[2]+_t>>>0,a[3]=a[3]+mt>>>0,a[4]=a[4]+bt>>>0}return[a[0]>>24&255,a[0]>>16&255,a[0]>>8&255,a[0]&255,a[1]>>24&255,a[1]>>16&255,a[1]>>8&255,a[1]&255,a[2]>>24&255,a[2]>>16&255,a[2]>>8&255,a[2]&255,a[3]>>24&255,a[3]>>16&255,a[3]>>8&255,a[3]&255,a[4]>>24&255,a[4]>>16&255,a[4]>>8&255,a[4]&255]}var v5=v35("v5",80,sha1$1);const nil="00000000-0000-0000-0000-000000000000";function version$2(o){if(!validate$2(o))throw TypeError("Invalid UUID");return parseInt(o.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse,stringify,v1,v3,v4,v5,validate:validate$2,version:version$2},Symbol.toStringTag,{value:"Module"})),require$$4$1=getAugmentedNamespace(esmBrowser),uuid$1=require$$4$1.v4,generateRequest$1=function(o,e,a,c){if(typeof o!="string")throw new TypeError(o+" must be a string");c=c||{};const d=typeof c.version=="number"?c.version:2;if(d!==1&&d!==2)throw new TypeError(d+" must be 1 or 2");const h={method:o};if(d===2&&(h.jsonrpc="2.0"),e){if(typeof e!="object"&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");h.params=e}if(typeof a>"u"){const j=typeof c.generator=="function"?c.generator:function(){return uuid$1()};h.id=j(h,c)}else d===2&&a===null?c.notificationIdNull&&(h.id=null):h.id=a;return h};var generateRequest_1=generateRequest$1;const uuid=require$$4$1.v4,generateRequest=generateRequest_1,ClientBrowser=function(o,e){if(!(this instanceof ClientBrowser))return new ClientBrowser(o,e);e||(e={}),this.options={reviver:typeof e.reviver<"u"?e.reviver:null,replacer:typeof e.replacer<"u"?e.replacer:null,generator:typeof e.generator<"u"?e.generator:function(){return uuid()},version:typeof e.version<"u"?e.version:2,notificationIdNull:typeof e.notificationIdNull=="boolean"?e.notificationIdNull:!1},this.callServer=o};var browser$d=ClientBrowser;ClientBrowser.prototype.request=function(o,e,a,c){const d=this;let h=null;const j=Array.isArray(o)&&typeof e=="function";if(this.options.version===1&&j)throw new TypeError("JSON-RPC 1.0 does not support batching");if(j||!j&&o&&typeof o=="object"&&typeof e=="function")c=e,h=o;else{typeof a=="function"&&(c=a,a=void 0);const st=typeof c=="function";try{h=generateRequest(o,e,a,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(ot){if(st)return c(ot);throw ot}if(!st)return h}let nt;try{nt=JSON.stringify(h,this.options.replacer)}catch(st){return c(st)}return this.callServer(nt,function(st,ot){d._parseResponse(st,ot,c)}),h};ClientBrowser.prototype._parseResponse=function(o,e,a){if(o){a(o);return}if(!e)return a();let c;try{c=JSON.parse(e,this.options.reviver)}catch(d){return a(d)}if(a.length===3)if(Array.isArray(c)){const d=function(j){return typeof j.error<"u"},h=function(j){return!d(j)};return a(null,c.filter(d),c.filter(h))}else return a(null,c.error,c.result);a(null,c)};const RpcClient=getDefaultExportFromCjs$3(browser$d);var eventemitter3$1={exports:{}};(function(o){var e=Object.prototype.hasOwnProperty,a="~";function c(){}Object.create&&(c.prototype=Object.create(null),new c().__proto__||(a=!1));function d(nt,st,ot){this.fn=nt,this.context=st,this.once=ot||!1}function h(nt,st,ot,ht,pt){if(typeof ot!="function")throw new TypeError("The listener must be a function");var dt=new d(ot,ht||nt,pt),gt=a?a+st:st;return nt._events[gt]?nt._events[gt].fn?nt._events[gt]=[nt._events[gt],dt]:nt._events[gt].push(dt):(nt._events[gt]=dt,nt._eventsCount++),nt}function j(nt,st){--nt._eventsCount===0?nt._events=new c:delete nt._events[st]}function et(){this._events=new c,this._eventsCount=0}et.prototype.eventNames=function(){var st=[],ot,ht;if(this._eventsCount===0)return st;for(ht in ot=this._events)e.call(ot,ht)&&st.push(a?ht.slice(1):ht);return Object.getOwnPropertySymbols?st.concat(Object.getOwnPropertySymbols(ot)):st},et.prototype.listeners=function(st){var ot=a?a+st:st,ht=this._events[ot];if(!ht)return[];if(ht.fn)return[ht.fn];for(var pt=0,dt=ht.length,gt=new Array(dt);ptthis.emit("open"),this.socket.onmessage=d=>this.emit("message",d.data),this.socket.onerror=d=>this.emit("error",d),this.socket.onclose=d=>{this.emit("close",d.code,d.reason)}}send(e,a,c){const d=c||a;try{this.socket.send(e),d()}catch(h){d(h)}}close(e,a){this.socket.close(e,a)}addEventListener(e,a,c){this.socket.addEventListener(e,a,c)}};function WebSocket$1(o,e){return new WebSocketBrowserImpl(o,e)}var DefaultDataPack=class{encode(o){return JSON.stringify(o)}decode(o){return JSON.parse(o)}},CommonClient=class extends EventEmitter$2{constructor(e,a="ws://localhost:8080",{autoconnect:c=!0,reconnect:d=!0,reconnect_interval:h=1e3,max_reconnects:j=5,...et}={},nt,st){super();nn(this,"address");nn(this,"rpc_id");nn(this,"queue");nn(this,"options");nn(this,"autoconnect");nn(this,"ready");nn(this,"reconnect");nn(this,"reconnect_timer_id");nn(this,"reconnect_interval");nn(this,"max_reconnects");nn(this,"rest_options");nn(this,"current_reconnects");nn(this,"generate_request_id");nn(this,"socket");nn(this,"webSocketFactory");nn(this,"dataPack");this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=a,this.autoconnect=c,this.ready=!1,this.reconnect=d,this.reconnect_timer_id=void 0,this.reconnect_interval=h,this.max_reconnects=j,this.rest_options=et,this.current_reconnects=0,this.generate_request_id=nt||(()=>++this.rpc_id),st?this.dataPack=st:this.dataPack=new DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,a,c,d){return!d&&typeof c=="object"&&(d=c,c=null),new Promise((h,j)=>{if(!this.ready)return j(new Error("socket not ready"));const et=this.generate_request_id(e,a),nt={jsonrpc:"2.0",method:e,params:a||void 0,id:et};this.socket.send(this.dataPack.encode(nt),d,st=>{if(st)return j(st);this.queue[et]={promise:[h,j]},c&&(this.queue[et].timeout=setTimeout(()=>{delete this.queue[et],j(new Error("reply timeout"))},c))})})}async login(e){const a=await this.call("rpc.login",e);if(!a)throw new Error("authentication failed");return a}async listMethods(){return await this.call("__listMethods")}notify(e,a){return new Promise((c,d)=>{if(!this.ready)return d(new Error("socket not ready"));const h={jsonrpc:"2.0",method:e,params:a};this.socket.send(this.dataPack.encode(h),j=>{if(j)return d(j);c()})})}async subscribe(e){typeof e=="string"&&(e=[e]);const a=await this.call("rpc.on",e);if(typeof e=="string"&&a[e]!=="ok")throw new Error("Failed subscribing to an event '"+e+"' with: "+a[e]);return a}async unsubscribe(e){typeof e=="string"&&(e=[e]);const a=await this.call("rpc.off",e);if(typeof e=="string"&&a[e]!=="ok")throw new Error("Failed unsubscribing from an event with: "+a);return a}close(e,a){this.socket.close(e||1e3,a)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_connect(e,a){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,a),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:c})=>{c instanceof ArrayBuffer&&(c=Buffer$1$1.from(c).toString());try{c=this.dataPack.decode(c)}catch{return}if(c.notification&&this.listeners(c.notification).length){if(!Object.keys(c.params).length)return this.emit(c.notification);const d=[c.notification];if(c.params.constructor===Object)d.push(c.params);else for(let h=0;h{this.emit.apply(this,d)})}if(!this.queue[c.id])return c.method?Promise.resolve().then(()=>{this.emit(c.method,c==null?void 0:c.params)}):void 0;"error"in c=="result"in c&&this.queue[c.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[c.id].timeout&&clearTimeout(this.queue[c.id].timeout),c.error?this.queue[c.id].promise[1](c.error):this.queue[c.id].promise[0](c.result),delete this.queue[c.id]}),this.socket.addEventListener("error",c=>this.emit("error",c)),this.socket.addEventListener("close",({code:c,reason:d})=>{this.ready&&setTimeout(()=>this.emit("close",c,d),0),this.ready=!1,this.socket=void 0,c!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(e,a),this.reconnect_interval)))})}};const SHA3_PI=[],SHA3_ROTL=[],_SHA3_IOTA=[],_0n$1=BigInt(0),_1n$2=BigInt(1),_2n$1=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let o=0,e=_1n$2,a=1,c=0;o<24;o++){[a,c]=[c,(2*a+3*c)%5],SHA3_PI.push(2*(5*c+a)),SHA3_ROTL.push((o+1)*(o+2)/2%64);let d=_0n$1;for(let h=0;h<7;h++)e=(e<<_1n$2^(e>>_7n)*_0x71n)%_256n,e&_2n$1&&(d^=_1n$2<<(_1n$2<a>32?rotlBH(o,e,a):rotlSH(o,e,a),rotlL=(o,e,a)=>a>32?rotlBL(o,e,a):rotlSL(o,e,a);function keccakP(o,e=24){const a=new Uint32Array(10);for(let c=24-e;c<24;c++){for(let j=0;j<10;j++)a[j]=o[j]^o[j+10]^o[j+20]^o[j+30]^o[j+40];for(let j=0;j<10;j+=2){const et=(j+8)%10,nt=(j+2)%10,st=a[nt],ot=a[nt+1],ht=rotlH(st,ot,1)^a[et],pt=rotlL(st,ot,1)^a[et+1];for(let dt=0;dt<50;dt+=10)o[j+dt]^=ht,o[j+dt+1]^=pt}let d=o[2],h=o[3];for(let j=0;j<24;j++){const et=SHA3_ROTL[j],nt=rotlH(d,h,et),st=rotlL(d,h,et),ot=SHA3_PI[j];d=o[ot],h=o[ot+1],o[ot]=nt,o[ot+1]=st}for(let j=0;j<50;j+=10){for(let et=0;et<10;et++)a[et]=o[j+et];for(let et=0;et<10;et++)o[j+et]^=~a[(et+2)%10]&a[(et+4)%10]}o[0]^=SHA3_IOTA_H[c],o[1]^=SHA3_IOTA_L[c]}a.fill(0)}class Keccak extends Hash$8{constructor(e,a,c,d=!1,h=24){if(super(),this.blockLen=e,this.suffix=a,this.outputLen=c,this.enableXOF=d,this.rounds=h,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,anumber(c),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32$3(this.state)}keccak(){isLE||byteSwap32(this.state32),keccakP(this.state32,this.rounds),isLE||byteSwap32(this.state32),this.posOut=0,this.pos=0}update(e){aexists(this);const{blockLen:a,state:c}=this;e=toBytes(e);const d=e.length;for(let h=0;h=c&&this.keccak();const j=Math.min(c-this.posOut,h-d);e.set(a.subarray(this.posOut,this.posOut+j),d),this.posOut+=j,d+=j}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return anumber(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(aoutput(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:a,suffix:c,outputLen:d,rounds:h,enableXOF:j}=this;return e||(e=new Keccak(a,c,d,j,h)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=h,e.suffix=c,e.outputLen=d,e.enableXOF=j,e.destroyed=this.destroyed,e}}const gen=(o,e,a)=>wrapConstructor(()=>new Keccak(e,o,a)),keccak_256=gen(1,136,256/8);class HMAC extends Hash$8{constructor(e,a){super(),this.finished=!1,this.destroyed=!1,ahash(e);const c=toBytes(a);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const d=this.blockLen,h=new Uint8Array(d);h.set(c.length>d?e.create().update(c).digest():c);for(let j=0;jnew HMAC(o,e).update(a).digest();hmac$1.create=(o,e)=>new HMAC(o,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function validateSigVerOpts(o){o.lowS!==void 0&&abool("lowS",o.lowS),o.prehash!==void 0&&abool("prehash",o.prehash)}function validatePointOpts(o){const e=validateBasic(o);validateObject(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:a,Fp:c,a:d}=e;if(a){if(!c.eql(d,c.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof a!="object"||typeof a.beta!="bigint"||typeof a.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:b2n,hexToBytes:h2b}=ut,DER={Err:class extends Error{constructor(e=""){super(e)}},_tlv:{encode:(o,e)=>{const{Err:a}=DER;if(o<0||o>256)throw new a("tlv.encode: wrong tag");if(e.length&1)throw new a("tlv.encode: unpadded data");const c=e.length/2,d=numberToHexUnpadded(c);if(d.length/2&128)throw new a("tlv.encode: long form length too big");const h=c>127?numberToHexUnpadded(d.length/2|128):"";return numberToHexUnpadded(o)+h+d+e},decode(o,e){const{Err:a}=DER;let c=0;if(o<0||o>256)throw new a("tlv.encode: wrong tag");if(e.length<2||e[c++]!==o)throw new a("tlv.decode: wrong tlv");const d=e[c++],h=!!(d&128);let j=0;if(!h)j=d;else{const nt=d&127;if(!nt)throw new a("tlv.decode(long): indefinite length not supported");if(nt>4)throw new a("tlv.decode(long): byte length is too big");const st=e.subarray(c,c+nt);if(st.length!==nt)throw new a("tlv.decode: length bytes not complete");if(st[0]===0)throw new a("tlv.decode(long): zero leftmost byte");for(const ot of st)j=j<<8|ot;if(c+=nt,j<128)throw new a("tlv.decode(long): not minimal encoding")}const et=e.subarray(c,c+j);if(et.length!==j)throw new a("tlv.decode: wrong value length");return{v:et,l:e.subarray(c+j)}}},_int:{encode(o){const{Err:e}=DER;if(o<_0n)throw new e("integer: negative integers are not allowed");let a=numberToHexUnpadded(o);if(Number.parseInt(a[0],16)&8&&(a="00"+a),a.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return a},decode(o){const{Err:e}=DER;if(o[0]&128)throw new e("invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return b2n(o)}},toSig(o){const{Err:e,_int:a,_tlv:c}=DER,d=typeof o=="string"?h2b(o):o;abytes(d);const{v:h,l:j}=c.decode(48,d);if(j.length)throw new e("invalid signature: left bytes after parsing");const{v:et,l:nt}=c.decode(2,h),{v:st,l:ot}=c.decode(2,nt);if(ot.length)throw new e("invalid signature: left bytes after parsing");return{r:a.decode(et),s:a.decode(st)}},hexFromSig(o){const{_tlv:e,_int:a}=DER,c=e.encode(2,a.encode(o.r)),d=e.encode(2,a.encode(o.s)),h=c+d;return e.encode(48,h)}},_0n=BigInt(0),_1n$1=BigInt(1);BigInt(2);const _3n=BigInt(3);BigInt(4);function weierstrassPoints(o){const e=validatePointOpts(o),{Fp:a}=e,c=Field(e.n,e.nBitLength),d=e.toBytes||((wt,St,_t)=>{const mt=St.toAffine();return concatBytes(Uint8Array.from([4]),a.toBytes(mt.x),a.toBytes(mt.y))}),h=e.fromBytes||(wt=>{const St=wt.subarray(1),_t=a.fromBytes(St.subarray(0,a.BYTES)),mt=a.fromBytes(St.subarray(a.BYTES,2*a.BYTES));return{x:_t,y:mt}});function j(wt){const{a:St,b:_t}=e,mt=a.sqr(wt),bt=a.mul(mt,wt);return a.add(a.add(bt,a.mul(wt,St)),_t)}if(!a.eql(a.sqr(e.Gy),j(e.Gx)))throw new Error("bad generator point: equation left != right");function et(wt){return inRange$1(wt,_1n$1,e.n)}function nt(wt){const{allowedPrivateKeyLengths:St,nByteLength:_t,wrapPrivateKey:mt,n:bt}=e;if(St&&typeof wt!="bigint"){if(isBytes(wt)&&(wt=bytesToHex(wt)),typeof wt!="string"||!St.includes(wt.length))throw new Error("invalid private key");wt=wt.padStart(_t*2,"0")}let $t;try{$t=typeof wt=="bigint"?wt:bytesToNumberBE(ensureBytes("private key",wt,_t))}catch{throw new Error("invalid private key, expected hex or "+_t+" bytes, got "+typeof wt)}return mt&&($t=mod($t,bt)),aInRange("private key",$t,_1n$1,bt),$t}function st(wt){if(!(wt instanceof pt))throw new Error("ProjectivePoint expected")}const ot=memoized((wt,St)=>{const{px:_t,py:mt,pz:bt}=wt;if(a.eql(bt,a.ONE))return{x:_t,y:mt};const $t=wt.is0();St==null&&(St=$t?a.ONE:a.inv(bt));const Bt=a.mul(_t,St),Dt=a.mul(mt,St),Ht=a.mul(bt,St);if($t)return{x:a.ZERO,y:a.ZERO};if(!a.eql(Ht,a.ONE))throw new Error("invZ was invalid");return{x:Bt,y:Dt}}),ht=memoized(wt=>{if(wt.is0()){if(e.allowInfinityPoint&&!a.is0(wt.py))return;throw new Error("bad point: ZERO")}const{x:St,y:_t}=wt.toAffine();if(!a.isValid(St)||!a.isValid(_t))throw new Error("bad point: x or y not FE");const mt=a.sqr(_t),bt=j(St);if(!a.eql(mt,bt))throw new Error("bad point: equation left != right");if(!wt.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class pt{constructor(St,_t,mt){if(this.px=St,this.py=_t,this.pz=mt,St==null||!a.isValid(St))throw new Error("x required");if(_t==null||!a.isValid(_t))throw new Error("y required");if(mt==null||!a.isValid(mt))throw new Error("z required");Object.freeze(this)}static fromAffine(St){const{x:_t,y:mt}=St||{};if(!St||!a.isValid(_t)||!a.isValid(mt))throw new Error("invalid affine point");if(St instanceof pt)throw new Error("projective point not allowed");const bt=$t=>a.eql($t,a.ZERO);return bt(_t)&&bt(mt)?pt.ZERO:new pt(_t,mt,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(St){const _t=a.invertBatch(St.map(mt=>mt.pz));return St.map((mt,bt)=>mt.toAffine(_t[bt])).map(pt.fromAffine)}static fromHex(St){const _t=pt.fromAffine(h(ensureBytes("pointHex",St)));return _t.assertValidity(),_t}static fromPrivateKey(St){return pt.BASE.multiply(nt(St))}static msm(St,_t){return pippenger(pt,c,St,_t)}_setWindowSize(St){gt.setWindowSize(this,St)}assertValidity(){ht(this)}hasEvenY(){const{y:St}=this.toAffine();if(a.isOdd)return!a.isOdd(St);throw new Error("Field doesn't support isOdd")}equals(St){st(St);const{px:_t,py:mt,pz:bt}=this,{px:$t,py:Bt,pz:Dt}=St,Ht=a.eql(a.mul(_t,Dt),a.mul($t,bt)),qt=a.eql(a.mul(mt,Dt),a.mul(Bt,bt));return Ht&&qt}negate(){return new pt(this.px,a.neg(this.py),this.pz)}double(){const{a:St,b:_t}=e,mt=a.mul(_t,_3n),{px:bt,py:$t,pz:Bt}=this;let Dt=a.ZERO,Ht=a.ZERO,qt=a.ZERO,Pt=a.mul(bt,bt),Gt=a.mul($t,$t),ct=a.mul(Bt,Bt),g=a.mul(bt,$t);return g=a.add(g,g),qt=a.mul(bt,Bt),qt=a.add(qt,qt),Dt=a.mul(St,qt),Ht=a.mul(mt,ct),Ht=a.add(Dt,Ht),Dt=a.sub(Gt,Ht),Ht=a.add(Gt,Ht),Ht=a.mul(Dt,Ht),Dt=a.mul(g,Dt),qt=a.mul(mt,qt),ct=a.mul(St,ct),g=a.sub(Pt,ct),g=a.mul(St,g),g=a.add(g,qt),qt=a.add(Pt,Pt),Pt=a.add(qt,Pt),Pt=a.add(Pt,ct),Pt=a.mul(Pt,g),Ht=a.add(Ht,Pt),ct=a.mul($t,Bt),ct=a.add(ct,ct),Pt=a.mul(ct,g),Dt=a.sub(Dt,Pt),qt=a.mul(ct,Gt),qt=a.add(qt,qt),qt=a.add(qt,qt),new pt(Dt,Ht,qt)}add(St){st(St);const{px:_t,py:mt,pz:bt}=this,{px:$t,py:Bt,pz:Dt}=St;let Ht=a.ZERO,qt=a.ZERO,Pt=a.ZERO;const Gt=e.a,ct=a.mul(e.b,_3n);let g=a.mul(_t,$t),b=a.mul(mt,Bt),$=a.mul(bt,Dt),_e=a.add(_t,mt),rt=a.add($t,Bt);_e=a.mul(_e,rt),rt=a.add(g,b),_e=a.sub(_e,rt),rt=a.add(_t,bt);let at=a.add($t,Dt);return rt=a.mul(rt,at),at=a.add(g,$),rt=a.sub(rt,at),at=a.add(mt,bt),Ht=a.add(Bt,Dt),at=a.mul(at,Ht),Ht=a.add(b,$),at=a.sub(at,Ht),Pt=a.mul(Gt,rt),Ht=a.mul(ct,$),Pt=a.add(Ht,Pt),Ht=a.sub(b,Pt),Pt=a.add(b,Pt),qt=a.mul(Ht,Pt),b=a.add(g,g),b=a.add(b,g),$=a.mul(Gt,$),rt=a.mul(ct,rt),b=a.add(b,$),$=a.sub(g,$),$=a.mul(Gt,$),rt=a.add(rt,$),g=a.mul(b,rt),qt=a.add(qt,g),g=a.mul(at,rt),Ht=a.mul(_e,Ht),Ht=a.sub(Ht,g),g=a.mul(_e,b),Pt=a.mul(at,Pt),Pt=a.add(Pt,g),new pt(Ht,qt,Pt)}subtract(St){return this.add(St.negate())}is0(){return this.equals(pt.ZERO)}wNAF(St){return gt.wNAFCached(this,St,pt.normalizeZ)}multiplyUnsafe(St){const{endo:_t,n:mt}=e;aInRange("scalar",St,_0n,mt);const bt=pt.ZERO;if(St===_0n)return bt;if(this.is0()||St===_1n$1)return this;if(!_t||gt.hasPrecomputes(this))return gt.wNAFCachedUnsafe(this,St,pt.normalizeZ);let{k1neg:$t,k1:Bt,k2neg:Dt,k2:Ht}=_t.splitScalar(St),qt=bt,Pt=bt,Gt=this;for(;Bt>_0n||Ht>_0n;)Bt&_1n$1&&(qt=qt.add(Gt)),Ht&_1n$1&&(Pt=Pt.add(Gt)),Gt=Gt.double(),Bt>>=_1n$1,Ht>>=_1n$1;return $t&&(qt=qt.negate()),Dt&&(Pt=Pt.negate()),Pt=new pt(a.mul(Pt.px,_t.beta),Pt.py,Pt.pz),qt.add(Pt)}multiply(St){const{endo:_t,n:mt}=e;aInRange("scalar",St,_1n$1,mt);let bt,$t;if(_t){const{k1neg:Bt,k1:Dt,k2neg:Ht,k2:qt}=_t.splitScalar(St);let{p:Pt,f:Gt}=this.wNAF(Dt),{p:ct,f:g}=this.wNAF(qt);Pt=gt.constTimeNegate(Bt,Pt),ct=gt.constTimeNegate(Ht,ct),ct=new pt(a.mul(ct.px,_t.beta),ct.py,ct.pz),bt=Pt.add(ct),$t=Gt.add(g)}else{const{p:Bt,f:Dt}=this.wNAF(St);bt=Bt,$t=Dt}return pt.normalizeZ([bt,$t])[0]}multiplyAndAddUnsafe(St,_t,mt){const bt=pt.BASE,$t=(Dt,Ht)=>Ht===_0n||Ht===_1n$1||!Dt.equals(bt)?Dt.multiplyUnsafe(Ht):Dt.multiply(Ht),Bt=$t(this,_t).add($t(St,mt));return Bt.is0()?void 0:Bt}toAffine(St){return ot(this,St)}isTorsionFree(){const{h:St,isTorsionFree:_t}=e;if(St===_1n$1)return!0;if(_t)return _t(pt,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:St,clearCofactor:_t}=e;return St===_1n$1?this:_t?_t(pt,this):this.multiplyUnsafe(e.h)}toRawBytes(St=!0){return abool("isCompressed",St),this.assertValidity(),d(pt,this,St)}toHex(St=!0){return abool("isCompressed",St),bytesToHex(this.toRawBytes(St))}}pt.BASE=new pt(e.Gx,e.Gy,a.ONE),pt.ZERO=new pt(a.ZERO,a.ONE,a.ZERO);const dt=e.nBitLength,gt=wNAF(pt,e.endo?Math.ceil(dt/2):dt);return{CURVE:e,ProjectivePoint:pt,normPrivateKeyToScalar:nt,weierstrassEquation:j,isWithinCurveOrder:et}}function validateOpts(o){const e=validateBasic(o);return validateObject(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function weierstrass(o){const e=validateOpts(o),{Fp:a,n:c}=e,d=a.BYTES+1,h=2*a.BYTES+1;function j($){return mod($,c)}function et($){return invert($,c)}const{ProjectivePoint:nt,normPrivateKeyToScalar:st,weierstrassEquation:ot,isWithinCurveOrder:ht}=weierstrassPoints({...e,toBytes($,_e,rt){const at=_e.toAffine(),lt=a.toBytes(at.x),tt=concatBytes;return abool("isCompressed",rt),rt?tt(Uint8Array.from([_e.hasEvenY()?2:3]),lt):tt(Uint8Array.from([4]),lt,a.toBytes(at.y))},fromBytes($){const _e=$.length,rt=$[0],at=$.subarray(1);if(_e===d&&(rt===2||rt===3)){const lt=bytesToNumberBE(at);if(!inRange$1(lt,_1n$1,a.ORDER))throw new Error("Point is not on curve");const tt=ot(lt);let _;try{_=a.sqrt(tt)}catch(vt){const Rt=vt instanceof Error?": "+vt.message:"";throw new Error("Point is not on curve"+Rt)}const it=(_&_1n$1)===_1n$1;return(rt&1)===1!==it&&(_=a.neg(_)),{x:lt,y:_}}else if(_e===h&&rt===4){const lt=a.fromBytes(at.subarray(0,a.BYTES)),tt=a.fromBytes(at.subarray(a.BYTES,2*a.BYTES));return{x:lt,y:tt}}else{const lt=d,tt=h;throw new Error("invalid Point, expected length of "+lt+", or uncompressed "+tt+", got "+_e)}}}),pt=$=>bytesToHex(numberToBytesBE($,e.nByteLength));function dt($){const _e=c>>_1n$1;return $>_e}function gt($){return dt($)?j(-$):$}const wt=($,_e,rt)=>bytesToNumberBE($.slice(_e,rt));class St{constructor(_e,rt,at){this.r=_e,this.s=rt,this.recovery=at,this.assertValidity()}static fromCompact(_e){const rt=e.nByteLength;return _e=ensureBytes("compactSignature",_e,rt*2),new St(wt(_e,0,rt),wt(_e,rt,2*rt))}static fromDER(_e){const{r:rt,s:at}=DER.toSig(ensureBytes("DER",_e));return new St(rt,at)}assertValidity(){aInRange("r",this.r,_1n$1,c),aInRange("s",this.s,_1n$1,c)}addRecoveryBit(_e){return new St(this.r,this.s,_e)}recoverPublicKey(_e){const{r:rt,s:at,recovery:lt}=this,tt=Dt(ensureBytes("msgHash",_e));if(lt==null||![0,1,2,3].includes(lt))throw new Error("recovery id invalid");const _=lt===2||lt===3?rt+e.n:rt;if(_>=a.ORDER)throw new Error("recovery id 2 or 3 invalid");const it=lt&1?"03":"02",yt=nt.fromHex(it+pt(_)),vt=et(_),Rt=j(-tt*vt),Tt=j(at*vt),Mt=nt.BASE.multiplyAndAddUnsafe(yt,Rt,Tt);if(!Mt)throw new Error("point at infinify");return Mt.assertValidity(),Mt}hasHighS(){return dt(this.s)}normalizeS(){return this.hasHighS()?new St(this.r,j(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return pt(this.r)+pt(this.s)}}const _t={isValidPrivateKey($){try{return st($),!0}catch{return!1}},normPrivateKeyToScalar:st,randomPrivateKey:()=>{const $=getMinHashLength(e.n);return mapHashToField(e.randomBytes($),e.n)},precompute($=8,_e=nt.BASE){return _e._setWindowSize($),_e.multiply(BigInt(3)),_e}};function mt($,_e=!0){return nt.fromPrivateKey($).toRawBytes(_e)}function bt($){const _e=isBytes($),rt=typeof $=="string",at=(_e||rt)&&$.length;return _e?at===d||at===h:rt?at===2*d||at===2*h:$ instanceof nt}function $t($,_e,rt=!0){if(bt($))throw new Error("first arg must be private key");if(!bt(_e))throw new Error("second arg must be public key");return nt.fromHex(_e).multiply(st($)).toRawBytes(rt)}const Bt=e.bits2int||function($){if($.length>8192)throw new Error("input is too large");const _e=bytesToNumberBE($),rt=$.length*8-e.nBitLength;return rt>0?_e>>BigInt(rt):_e},Dt=e.bits2int_modN||function($){return j(Bt($))},Ht=bitMask(e.nBitLength);function qt($){return aInRange("num < 2^"+e.nBitLength,$,_0n,Ht),numberToBytesBE($,e.nByteLength)}function Pt($,_e,rt=Gt){if(["recovered","canonical"].some(Ot=>Ot in rt))throw new Error("sign() legacy options not supported");const{hash:at,randomBytes:lt}=e;let{lowS:tt,prehash:_,extraEntropy:it}=rt;tt==null&&(tt=!0),$=ensureBytes("msgHash",$),validateSigVerOpts(rt),_&&($=ensureBytes("prehashed msgHash",at($)));const yt=Dt($),vt=st(_e),Rt=[qt(vt),qt(yt)];if(it!=null&&it!==!1){const Ot=it===!0?lt(a.BYTES):it;Rt.push(ensureBytes("extraEntropy",Ot))}const Tt=concatBytes(...Rt),Mt=yt;function At(Ot){const Ct=Bt(Ot);if(!ht(Ct))return;const Ut=et(Ct),Lt=nt.BASE.multiply(Ct).toAffine(),Nt=j(Lt.x);if(Nt===_0n)return;const Kt=j(Ut*j(Mt+Nt*vt));if(Kt===_0n)return;let yr=(Lt.x===Nt?0:2)|Number(Lt.y&_1n$1),Xt=Kt;return tt&&dt(Kt)&&(Xt=gt(Kt),yr^=1),new St(Nt,Xt,yr)}return{seed:Tt,k2sig:At}}const Gt={lowS:e.lowS,prehash:!1},ct={lowS:e.lowS,prehash:!1};function g($,_e,rt=Gt){const{seed:at,k2sig:lt}=Pt($,_e,rt),tt=e;return createHmacDrbg(tt.hash.outputLen,tt.nByteLength,tt.hmac)(at,lt)}nt.BASE._setWindowSize(8);function b($,_e,rt,at=ct){var yr;const lt=$;_e=ensureBytes("msgHash",_e),rt=ensureBytes("publicKey",rt);const{lowS:tt,prehash:_,format:it}=at;if(validateSigVerOpts(at),"strict"in at)throw new Error("options.strict was renamed to lowS");if(it!==void 0&&it!=="compact"&&it!=="der")throw new Error("format must be compact or der");const yt=typeof lt=="string"||isBytes(lt),vt=!yt&&!it&&typeof lt=="object"&<!==null&&typeof lt.r=="bigint"&&typeof lt.s=="bigint";if(!yt&&!vt)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let Rt,Tt;try{if(vt&&(Rt=new St(lt.r,lt.s)),yt){try{it!=="compact"&&(Rt=St.fromDER(lt))}catch(Xt){if(!(Xt instanceof DER.Err))throw Xt}!Rt&&it!=="der"&&(Rt=St.fromCompact(lt))}Tt=nt.fromHex(rt)}catch{return!1}if(!Rt||tt&&Rt.hasHighS())return!1;_&&(_e=e.hash(_e));const{r:Mt,s:At}=Rt,Ot=Dt(_e),Ct=et(At),Ut=j(Ot*Ct),Lt=j(Mt*Ct),Nt=(yr=nt.BASE.multiplyAndAddUnsafe(Tt,Ut,Lt))==null?void 0:yr.toAffine();return Nt?j(Nt.x)===Mt:!1}return{CURVE:e,getPublicKey:mt,getSharedSecret:$t,sign:g,verify:b,ProjectivePoint:nt,Signature:St,utils:_t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(o){return{hash:o,hmac:(e,...a)=>hmac$1(o,e,concatBytes$1(...a)),randomBytes:randomBytes$3}}function createCurve(o,e){const a=c=>weierstrass({...o,...getHash(c)});return Object.freeze({...a(e),create:a})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n=BigInt(1),_2n=BigInt(2),divNearest=(o,e)=>(o+e/_2n)/e;function sqrtMod(o){const e=secp256k1P,a=BigInt(3),c=BigInt(6),d=BigInt(11),h=BigInt(22),j=BigInt(23),et=BigInt(44),nt=BigInt(88),st=o*o*o%e,ot=st*st*o%e,ht=pow2(ot,a,e)*ot%e,pt=pow2(ht,a,e)*ot%e,dt=pow2(pt,_2n,e)*st%e,gt=pow2(dt,d,e)*dt%e,wt=pow2(gt,h,e)*gt%e,St=pow2(wt,et,e)*wt%e,_t=pow2(St,nt,e)*St%e,mt=pow2(_t,et,e)*wt%e,bt=pow2(mt,a,e)*ot%e,$t=pow2(bt,j,e)*gt%e,Bt=pow2($t,c,e)*st%e,Dt=pow2(Bt,_2n,e);if(!Fpk1.eql(Fpk1.sqr(Dt),o))throw new Error("Cannot find square root");return Dt}const Fpk1=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1$1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fpk1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:o=>{const e=secp256k1N,a=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),c=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),d=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),h=a,j=BigInt("0x100000000000000000000000000000000"),et=divNearest(h*o,e),nt=divNearest(-c*o,e);let st=mod(o-et*a-nt*d,e),ot=mod(-et*c-nt*h,e);const ht=st>j,pt=ot>j;if(ht&&(st=e-st),pt&&(ot=e-ot),st>j||ot>j)throw new Error("splitScalar: Endomorphism failed, k="+o);return{k1neg:ht,k1:st,k2neg:pt,k2:ot}}}},sha256$4);BigInt(0);secp256k1$1.ProjectivePoint;const generatePrivateKey=ed25519.utils.randomPrivateKey,generateKeypair=()=>{const o=ed25519.utils.randomPrivateKey(),e=getPublicKey(o),a=new Uint8Array(64);return a.set(o),a.set(e,32),{publicKey:e,secretKey:a}},getPublicKey=ed25519.getPublicKey;function isOnCurve(o){try{return ed25519.ExtendedPoint.fromHex(o),!0}catch{return!1}}const sign$1=(o,e)=>ed25519.sign(o,e.slice(0,32)),verify=ed25519.verify,toBuffer$3=o=>Buffer$1$1.isBuffer(o)?o:o instanceof Uint8Array?Buffer$1$1.from(o.buffer,o.byteOffset,o.byteLength):Buffer$1$1.from(o);let Struct$2=class{constructor(e){Object.assign(this,e)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA,this))}static decode(e){return deserialize_1(SOLANA_SCHEMA,this,e)}static decodeUnchecked(e){return deserializeUnchecked_1(SOLANA_SCHEMA,this,e)}};class Enum extends Struct$2{constructor(e){if(super(e),this.enum="",Object.keys(e).length!==1)throw new Error("Enum can only take single value");Object.keys(e).map(a=>{this.enum=a})}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(o){return o._bn!==void 0}let uniquePublicKeyCounter=1,PublicKey$1=class an extends Struct$2{constructor(e){if(super({}),this._bn=void 0,isPublicKeyData(e))this._bn=e._bn;else{if(typeof e=="string"){const a=bs58$4.decode(e);if(a.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN$b(a)}else this._bn=new BN$b(e);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const e=new an(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new an(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return bs58$4.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(Buffer$1$1);if(e.length===PUBLIC_KEY_LENGTH)return e;const a=Buffer$1$1.alloc(32);return e.copy(a,32-e.length),a}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,a,c){const d=Buffer$1$1.concat([e.toBuffer(),Buffer$1$1.from(a),c.toBuffer()]),h=sha256$4(d);return new an(h)}static createProgramAddressSync(e,a){let c=Buffer$1$1.alloc(0);e.forEach(function(h){if(h.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");c=Buffer$1$1.concat([c,toBuffer$3(h)])}),c=Buffer$1$1.concat([c,a.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const d=sha256$4(c);if(isOnCurve(d))throw new Error("Invalid seeds, address must fall off the curve");return new an(d)}static async createProgramAddress(e,a){return this.createProgramAddressSync(e,a)}static findProgramAddressSync(e,a){let c=255,d;for(;c!=0;){try{const h=e.concat(Buffer$1$1.from([c]));d=this.createProgramAddressSync(h,a)}catch(h){if(h instanceof TypeError)throw h;c--;continue}return[d,c]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,a){return this.findProgramAddressSync(e,a)}static isOnCurve(e){const a=new an(e);return isOnCurve(a.toBytes())}};_PublicKey=PublicKey$1;PublicKey$1.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey$1,{kind:"struct",fields:[["_bn","u256"]]});class Account{constructor(e){if(this._publicKey=void 0,this._secretKey=void 0,e){const a=toBuffer$3(e);if(e.length!==64)throw new Error("bad secret key size");this._publicKey=a.slice(32,64),this._secretKey=a.slice(0,32)}else this._secretKey=toBuffer$3(generatePrivateKey()),this._publicKey=toBuffer$3(getPublicKey(this._secretKey))}get publicKey(){return new PublicKey$1(this._publicKey)}get secretKey(){return Buffer$1$1.concat([this._secretKey,this._publicKey],64)}}const BPF_LOADER_DEPRECATED_PROGRAM_ID=new PublicKey$1("BPFLoader1111111111111111111111111111111111"),PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(e,a){super(`Transaction was not confirmed in ${a.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(e,a){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=a}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const a of this.keySegments()){if(e256)throw new Error("Account index overflow encountered during compilation");const c=new Map;this.keySegments().flat().forEach((h,j)=>{c.set(h.toBase58(),j)});const d=h=>{const j=c.get(h.toBase58());if(j===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return j};return e.map(h=>({programIdIndex:d(h.programId),accountKeyIndexes:h.keys.map(j=>d(j.pubkey)),data:h.data}))}}const publicKey$5=(o="publicKey")=>blob$2(32,o),signature$2=(o="signature")=>blob$2(64,o),rustString=(o="string")=>{const e=struct$2([u32$2("length"),u32$2("lengthPadding"),blob$2(offset$2(u32$2(),-8),"chars")],o),a=e.decode.bind(e),c=e.encode.bind(e),d=e;return d.decode=(h,j)=>a(h,j).chars.toString(),d.encode=(h,j,et)=>{const nt={chars:Buffer$1$1.from(h,"utf8")};return c(nt,j,et)},d.alloc=h=>u32$2().span+u32$2().span+Buffer$1$1.from(h,"utf8").length,d},authorized=(o="authorized")=>struct$2([publicKey$5("staker"),publicKey$5("withdrawer")],o),lockup=(o="lockup")=>struct$2([ns64$2("unixTimestamp"),ns64$2("epoch"),publicKey$5("custodian")],o),voteInit=(o="voteInit")=>struct$2([publicKey$5("nodePubkey"),publicKey$5("authorizedVoter"),publicKey$5("authorizedWithdrawer"),u8$2("commission")],o),voteAuthorizeWithSeedArgs=(o="voteAuthorizeWithSeedArgs")=>struct$2([u32$2("voteAuthorizationType"),publicKey$5("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey$5("newAuthorized")],o);function getAlloc(o,e){const a=d=>{if(d.span>=0)return d.span;if(typeof d.alloc=="function")return d.alloc(e[d.property]);if("count"in d&&"elementLayout"in d){const h=e[d.property];if(Array.isArray(h))return h.length*a(d.elementLayout)}else if("fields"in d)return getAlloc({layout:d},e[d.property]);return 0};let c=0;return o.layout.fields.forEach(d=>{c+=a(d)}),c}function decodeLength(o){let e=0,a=0;for(;;){let c=o.shift();if(e|=(c&127)<>=7,a==0){o.push(c);break}else c|=128,o.push(c)}}function assert$m(o,e){if(!o)throw new Error(e||"Assertion failed")}class CompiledKeys{constructor(e,a){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=a}static compile(e,a){const c=new Map,d=j=>{const et=j.toBase58();let nt=c.get(et);return nt===void 0&&(nt={isSigner:!1,isWritable:!1,isInvoked:!1},c.set(et,nt)),nt},h=d(a);h.isSigner=!0,h.isWritable=!0;for(const j of e){d(j.programId).isInvoked=!0;for(const et of j.keys){const nt=d(et.pubkey);nt.isSigner||(nt.isSigner=et.isSigner),nt.isWritable||(nt.isWritable=et.isWritable)}}return new CompiledKeys(a,c)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];assert$m(e.length<=256,"Max static account keys length exceeded");const a=e.filter(([,nt])=>nt.isSigner&&nt.isWritable),c=e.filter(([,nt])=>nt.isSigner&&!nt.isWritable),d=e.filter(([,nt])=>!nt.isSigner&&nt.isWritable),h=e.filter(([,nt])=>!nt.isSigner&&!nt.isWritable),j={numRequiredSignatures:a.length+c.length,numReadonlySignedAccounts:c.length,numReadonlyUnsignedAccounts:h.length};{assert$m(a.length>0,"Expected at least one writable signer key");const[nt]=a[0];assert$m(nt===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const et=[...a.map(([nt])=>new PublicKey$1(nt)),...c.map(([nt])=>new PublicKey$1(nt)),...d.map(([nt])=>new PublicKey$1(nt)),...h.map(([nt])=>new PublicKey$1(nt))];return[j,et]}extractTableLookup(e){const[a,c]=this.drainKeysFoundInLookupTable(e.state.addresses,j=>!j.isSigner&&!j.isInvoked&&j.isWritable),[d,h]=this.drainKeysFoundInLookupTable(e.state.addresses,j=>!j.isSigner&&!j.isInvoked&&!j.isWritable);if(!(a.length===0&&d.length===0))return[{accountKey:e.key,writableIndexes:a,readonlyIndexes:d},{writable:c,readonly:h}]}drainKeysFoundInLookupTable(e,a){const c=new Array,d=new Array;for(const[h,j]of this.keyMetaMap.entries())if(a(j)){const et=new PublicKey$1(h),nt=e.findIndex(st=>st.equals(et));nt>=0&&(assert$m(nt<256,"Max lookup table index exceeded"),c.push(nt),d.push(et),this.keyMetaMap.delete(h))}return[c,d]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(o){if(o.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return o.shift()}function guardedSplice(o,...e){const[a]=e;if(e.length===2?a+(e[1]??0)>o.length:a>=o.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return o.splice(...e)}class Message{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(a=>new PublicKey$1(a)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(a=>this.indexToProgramIds.set(a.programIdIndex,this.accountKeys[a.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:bs58$4.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(e){const a=CompiledKeys.compile(e.instructions,e.payerKey),[c,d]=a.getMessageComponents(),j=new MessageAccountKeys(d).compileInstructions(e.instructions).map(et=>({programIdIndex:et.programIdIndex,accounts:et.accountKeyIndexes,data:bs58$4.encode(et.data)}));return new Message({header:c,accountKeys:d,recentBlockhash:e.recentBlockhash,instructions:j})}isAccountSigner(e){return e=this.header.numRequiredSignatures){const c=e-a,h=this.accountKeys.length-a-this.header.numReadonlyUnsignedAccounts;return c!this.isProgramId(a))}serialize(){const e=this.accountKeys.length;let a=[];encodeLength(a,e);const c=this.instructions.map(ht=>{const{accounts:pt,programIdIndex:dt}=ht,gt=Array.from(bs58$4.decode(ht.data));let wt=[];encodeLength(wt,pt.length);let St=[];return encodeLength(St,gt.length),{programIdIndex:dt,keyIndicesCount:Buffer$1$1.from(wt),keyIndices:pt,dataLength:Buffer$1$1.from(St),data:gt}});let d=[];encodeLength(d,c.length);let h=Buffer$1$1.alloc(PACKET_DATA_SIZE);Buffer$1$1.from(d).copy(h);let j=d.length;c.forEach(ht=>{const dt=struct$2([u8$2("programIdIndex"),blob$2(ht.keyIndicesCount.length,"keyIndicesCount"),seq(u8$2("keyIndex"),ht.keyIndices.length,"keyIndices"),blob$2(ht.dataLength.length,"dataLength"),seq(u8$2("userdatum"),ht.data.length,"data")]).encode(ht,h,j);j+=dt}),h=h.slice(0,j);const et=struct$2([blob$2(1,"numRequiredSignatures"),blob$2(1,"numReadonlySignedAccounts"),blob$2(1,"numReadonlyUnsignedAccounts"),blob$2(a.length,"keyCount"),seq(publicKey$5("key"),e,"keys"),publicKey$5("recentBlockhash")]),nt={numRequiredSignatures:Buffer$1$1.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Buffer$1$1.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Buffer$1$1.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Buffer$1$1.from(a),keys:this.accountKeys.map(ht=>toBuffer$3(ht.toBytes())),recentBlockhash:bs58$4.decode(this.recentBlockhash)};let st=Buffer$1$1.alloc(2048);const ot=et.encode(nt,st);return h.copy(st,ot),st.slice(0,ot+h.length)}static from(e){let a=[...e];const c=guardedShift(a);if(c!==(c&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const d=guardedShift(a),h=guardedShift(a),j=decodeLength(a);let et=[];for(let pt=0;pt0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,a)}isAccountSigner(e){return e=c){const d=e-c,h=this.addressTableLookups.reduce((j,et)=>j+et.writableIndexes.length,0);return d=this.header.numRequiredSignatures){const d=e-a,j=c-a-this.header.numReadonlyUnsignedAccounts;return dh.key.equals(c.accountKey));if(!d)throw new Error(`Failed to find address lookup table account for table key ${c.accountKey.toBase58()}`);for(const h of c.writableIndexes)if(hot.toBytes()),recentBlockhash:bs58$4.decode(this.recentBlockhash),instructionsLength:new Uint8Array(c),serializedInstructions:a,addressTableLookupsLength:new Uint8Array(h),serializedAddressTableLookups:d},et);return et.slice(0,st)}serializeInstructions(){let e=0;const a=new Uint8Array(PACKET_DATA_SIZE);for(const c of this.compiledInstructions){const d=Array();encodeLength(d,c.accountKeyIndexes.length);const h=Array();encodeLength(h,c.data.length);const j=struct$2([u8$2("programIdIndex"),blob$2(d.length,"encodedAccountKeyIndexesLength"),seq(u8$2(),c.accountKeyIndexes.length,"accountKeyIndexes"),blob$2(h.length,"encodedDataLength"),blob$2(c.data.length,"data")]);e+=j.encode({programIdIndex:c.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(d),accountKeyIndexes:c.accountKeyIndexes,encodedDataLength:new Uint8Array(h),data:c.data},a,e)}return a.slice(0,e)}serializeAddressTableLookups(){let e=0;const a=new Uint8Array(PACKET_DATA_SIZE);for(const c of this.addressTableLookups){const d=Array();encodeLength(d,c.writableIndexes.length);const h=Array();encodeLength(h,c.readonlyIndexes.length);const j=struct$2([publicKey$5("accountKey"),blob$2(d.length,"encodedWritableIndexesLength"),seq(u8$2(),c.writableIndexes.length,"writableIndexes"),blob$2(h.length,"encodedReadonlyIndexesLength"),seq(u8$2(),c.readonlyIndexes.length,"readonlyIndexes")]);e+=j.encode({accountKey:c.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(d),writableIndexes:c.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(h),readonlyIndexes:c.readonlyIndexes},a,e)}return a.slice(0,e)}static deserialize(e){let a=[...e];const c=guardedShift(a),d=c&VERSION_PREFIX_MASK;assert$m(c!==d,"Expected versioned message but received legacy message");const h=d;assert$m(h===0,`Expected versioned message with version 0 but found version ${h}`);const j={numRequiredSignatures:guardedShift(a),numReadonlySignedAccounts:guardedShift(a),numReadonlyUnsignedAccounts:guardedShift(a)},et=[],nt=decodeLength(a);for(let gt=0;gt{const e=VersionedMessage.deserializeMessageVersion(o);if(e==="legacy")return Message.from(o);if(e===0)return MessageV0.deserialize(o);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let TransactionStatus=function(o){return o[o.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",o[o.PROCESSED=1]="PROCESSED",o[o.TIMED_OUT=2]="TIMED_OUT",o[o.NONCE_INVALID=3]="NONCE_INVALID",o}({});const DEFAULT_SIGNATURE=Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);class TransactionInstruction{constructor(e){this.keys=void 0,this.programId=void 0,this.data=Buffer$1$1.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:a,isWritable:c})=>({pubkey:e.toJSON(),isSigner:a,isWritable:c})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:a,nonceInfo:c}=e;this.minNonceContextSlot=a,this.nonceInfo=c}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:a,lastValidBlockHeight:c}=e;this.recentBlockhash=a,this.lastValidBlockHeight=c}else{const{recentBlockhash:a,nonceInfo:c}=e;c&&(this.nonceInfo=c),this.recentBlockhash=a}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(a=>{"instructions"in a?this.instructions=this.instructions.concat(a.instructions):"data"in a&&"programId"in a&&"keys"in a?this.instructions.push(a):this.instructions.push(new TransactionInstruction(a))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,a;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?a=[this.nonceInfo.nonceInstruction,...this.instructions]:a=this.instructions):(e=this.recentBlockhash,a=this.instructions),!e)throw new Error("Transaction recentBlockhash required");a.length<1&&console.warn("No instructions provided");let c;if(this.feePayer)c=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)c=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let wt=0;wt{wt.keys.forEach(_t=>{h.push({..._t})});const St=wt.programId.toString();d.includes(St)||d.push(St)}),d.forEach(wt=>{h.push({pubkey:new PublicKey$1(wt),isSigner:!1,isWritable:!1})});const j=[];h.forEach(wt=>{const St=wt.pubkey.toString(),_t=j.findIndex(mt=>mt.pubkey.toString()===St);_t>-1?(j[_t].isWritable=j[_t].isWritable||wt.isWritable,j[_t].isSigner=j[_t].isSigner||wt.isSigner):j.push(wt)}),j.sort(function(wt,St){if(wt.isSigner!==St.isSigner)return wt.isSigner?-1:1;if(wt.isWritable!==St.isWritable)return wt.isWritable?-1:1;const _t={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return wt.pubkey.toBase58().localeCompare(St.pubkey.toBase58(),"en",_t)});const et=j.findIndex(wt=>wt.pubkey.equals(c));if(et>-1){const[wt]=j.splice(et,1);wt.isSigner=!0,wt.isWritable=!0,j.unshift(wt)}else j.unshift({pubkey:c,isSigner:!0,isWritable:!0});for(const wt of this.signatures){const St=j.findIndex(_t=>_t.pubkey.equals(wt.publicKey));if(St>-1)j[St].isSigner||(j[St].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${wt.publicKey.toString()}`)}let nt=0,st=0,ot=0;const ht=[],pt=[];j.forEach(({pubkey:wt,isSigner:St,isWritable:_t})=>{St?(ht.push(wt.toString()),nt+=1,_t||(st+=1)):(pt.push(wt.toString()),_t||(ot+=1))});const dt=ht.concat(pt),gt=a.map(wt=>{const{data:St,programId:_t}=wt;return{programIdIndex:dt.indexOf(_t.toString()),accounts:wt.keys.map(mt=>dt.indexOf(mt.pubkey.toString())),data:bs58$4.encode(St)}});return gt.forEach(wt=>{assert$m(wt.programIdIndex>=0),wt.accounts.forEach(St=>assert$m(St>=0))}),new Message({header:{numRequiredSignatures:nt,numReadonlySignedAccounts:st,numReadonlyUnsignedAccounts:ot},accountKeys:dt,recentBlockhash:e,instructions:gt})}_compile(){const e=this.compileMessage(),a=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===a.length&&this.signatures.every((d,h)=>a[h].equals(d.publicKey))||(this.signatures=a.map(c=>({signature:null,publicKey:c}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");const a=new Set;this.signatures=e.filter(c=>{const d=c.toString();return a.has(d)?!1:(a.add(d),!0)}).map(c=>({signature:null,publicKey:c}))}sign(...e){if(e.length===0)throw new Error("No signers");const a=new Set,c=[];for(const h of e){const j=h.publicKey.toString();a.has(j)||(a.add(j),c.push(h))}this.signatures=c.map(h=>({signature:null,publicKey:h.publicKey}));const d=this._compile();this._partialSign(d,...c)}partialSign(...e){if(e.length===0)throw new Error("No signers");const a=new Set,c=[];for(const h of e){const j=h.publicKey.toString();a.has(j)||(a.add(j),c.push(h))}const d=this._compile();this._partialSign(d,...c)}_partialSign(e,...a){const c=e.serialize();a.forEach(d=>{const h=sign$1(c,d.secretKey);this._addSignature(d.publicKey,toBuffer$3(h))})}addSignature(e,a){this._compile(),this._addSignature(e,a)}_addSignature(e,a){assert$m(a.length===64);const c=this.signatures.findIndex(d=>e.equals(d.publicKey));if(c<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[c].signature=Buffer$1$1.from(a)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,a){const c={};for(const{signature:d,publicKey:h}of this.signatures)d===null?a&&(c.missing||(c.missing=[])).push(h):verify(d,e,h.toBytes())||(c.invalid||(c.invalid=[])).push(h);return c.invalid||c.missing?c:void 0}serialize(e){const{requireAllSignatures:a,verifySignatures:c}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),d=this.serializeMessage();if(c){const h=this._getMessageSignednessErrors(d,a);if(h){let j="Signature verification failed.";throw h.invalid&&(j+=` +Invalid signature for public key${h.invalid.length===1?"":"(s)"} [\`${h.invalid.map(et=>et.toBase58()).join("`, `")}\`].`),h.missing&&(j+=` +Missing signature for public key${h.missing.length===1?"":"(s)"} [\`${h.missing.map(et=>et.toBase58()).join("`, `")}\`].`),new Error(j)}}return this._serialize(d)}_serialize(e){const{signatures:a}=this,c=[];encodeLength(c,a.length);const d=c.length+a.length*64+e.length,h=Buffer$1$1.alloc(d);return assert$m(a.length<256),Buffer$1$1.from(c).copy(h,0),a.forEach(({signature:j},et)=>{j!==null&&(assert$m(j.length===64,"signature has invalid length"),Buffer$1$1.from(j).copy(h,c.length+et*64))}),e.copy(h,c.length+a.length*64),assert$m(h.length<=PACKET_DATA_SIZE,`Transaction too large: ${h.length} > ${PACKET_DATA_SIZE}`),h}get keys(){return assert$m(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return assert$m(this.instructions.length===1),this.instructions[0].programId}get data(){return assert$m(this.instructions.length===1),this.instructions[0].data}static from(e){let a=[...e];const c=decodeLength(a);let d=[];for(let h=0;h0&&(c.feePayer=e.accountKeys[0]),a.forEach((d,h)=>{const j={signature:d==bs58$4.encode(DEFAULT_SIGNATURE)?null:bs58$4.decode(d),publicKey:e.accountKeys[h]};c.signatures.push(j)}),e.instructions.forEach(d=>{const h=d.accounts.map(j=>{const et=e.accountKeys[j];return{pubkey:et,isSigner:c.signatures.some(nt=>nt.publicKey.toString()===et.toString())||e.isAccountSigner(j),isWritable:e.isAccountWritable(j)}});c.instructions.push(new TransactionInstruction({keys:h,programId:e.accountKeys[d.programIdIndex],data:bs58$4.decode(d.data)}))}),c._message=e,c._json=c.toJSON(),c}}class TransactionMessage{constructor(e){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}static decompile(e,a){const{header:c,compiledInstructions:d,recentBlockhash:h}=e,{numRequiredSignatures:j,numReadonlySignedAccounts:et,numReadonlyUnsignedAccounts:nt}=c,st=j-et;assert$m(st>0,"Message header is invalid");const ot=e.staticAccountKeys.length-j-nt;assert$m(ot>=0,"Message header is invalid");const ht=e.getAccountKeys(a),pt=ht.get(0);if(pt===void 0)throw new Error("Failed to decompile message because no account keys were found");const dt=[];for(const gt of d){const wt=[];for(const _t of gt.accountKeyIndexes){const mt=ht.get(_t);if(mt===void 0)throw new Error(`Failed to find key for account key index ${_t}`);const bt=_tj.equals(d.publicKey));assert$m(h>=0,`Cannot sign with non signer key ${d.publicKey.toBase58()}`),this.signatures[h]=sign$1(a,d.secretKey)}}addSignature(e,a){assert$m(a.byteLength===64,"Signature must be 64 bytes long");const d=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(h=>h.equals(e));assert$m(d>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[d]=a}}const NUM_TICKS_PER_SECOND=160,DEFAULT_TICKS_PER_SLOT=64,NUM_SLOTS_PER_SECOND=NUM_TICKS_PER_SECOND/DEFAULT_TICKS_PER_SLOT,MS_PER_SLOT=1e3/NUM_SLOTS_PER_SECOND,SYSVAR_CLOCK_PUBKEY=new PublicKey$1("SysvarC1ock11111111111111111111111111111111"),SYSVAR_EPOCH_SCHEDULE_PUBKEY=new PublicKey$1("SysvarEpochSchedu1e111111111111111111111111"),SYSVAR_INSTRUCTIONS_PUBKEY=new PublicKey$1("Sysvar1nstructions1111111111111111111111111"),SYSVAR_RECENT_BLOCKHASHES_PUBKEY=new PublicKey$1("SysvarRecentB1ockHashes11111111111111111111"),SYSVAR_RENT_PUBKEY=new PublicKey$1("SysvarRent111111111111111111111111111111111"),SYSVAR_REWARDS_PUBKEY=new PublicKey$1("SysvarRewards111111111111111111111111111111"),SYSVAR_SLOT_HASHES_PUBKEY=new PublicKey$1("SysvarS1otHashes111111111111111111111111111"),SYSVAR_SLOT_HISTORY_PUBKEY=new PublicKey$1("SysvarS1otHistory11111111111111111111111111"),SYSVAR_STAKE_HISTORY_PUBKEY=new PublicKey$1("SysvarStakeHistory1111111111111111111111111");class SendTransactionError extends Error{constructor({action:e,signature:a,transactionMessage:c,logs:d}){const h=d?`Logs: +${JSON.stringify(d.slice(-10),null,2)}. `:"",j="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let et;switch(e){case"send":et=`Transaction ${a} resulted in an error. +${c}. `+h+j;break;case"simulate":et=`Simulation failed. +Message: ${c}. +`+h+j;break;default:et=`Unknown action '${(nt=>nt)(e)}'`}super(et),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=a,this.transactionMessage=c,this.transactionLogs=d||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){const e=this.transactionLogs;if(!(e!=null&&typeof e=="object"&&"then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((a,c)=>{e.getTransaction(this.signature).then(d=>{if(d&&d.meta&&d.meta.logMessages){const h=d.meta.logMessages;this.transactionLogs=h,a(h)}else c(new Error("Log messages not found"))}).catch(c)})),await this.transactionLogs}}const SolanaJSONRPCErrorCode={JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016};class SolanaJSONRPCError extends Error{constructor({code:e,message:a,data:c},d){super(d!=null?`${d}: ${a}`:a),this.code=void 0,this.data=void 0,this.code=e,this.data=c,this.name="SolanaJSONRPCError"}}async function sendAndConfirmTransaction(o,e,a,c){const d=c&&{skipPreflight:c.skipPreflight,preflightCommitment:c.preflightCommitment||c.commitment,maxRetries:c.maxRetries,minContextSlot:c.minContextSlot},h=await o.sendTransaction(e,a,d);let j;if(e.recentBlockhash!=null&&e.lastValidBlockHeight!=null)j=(await o.confirmTransaction({abortSignal:c==null?void 0:c.abortSignal,signature:h,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},c&&c.commitment)).value;else if(e.minNonceContextSlot!=null&&e.nonceInfo!=null){const{nonceInstruction:et}=e.nonceInfo,nt=et.keys[0].pubkey;j=(await o.confirmTransaction({abortSignal:c==null?void 0:c.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:nt,nonceValue:e.nonceInfo.nonce,signature:h},c&&c.commitment)).value}else(c==null?void 0:c.abortSignal)!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),j=(await o.confirmTransaction(h,c&&c.commitment)).value;if(j.err)throw h!=null?new SendTransactionError({action:"send",signature:h,transactionMessage:`Status: (${JSON.stringify(j)})`}):new Error(`Transaction ${h} failed (${JSON.stringify(j)})`);return h}function sleep(o){return new Promise(e=>setTimeout(e,o))}function encodeData(o,e){const a=o.layout.span>=0?o.layout.span:getAlloc(o,e),c=Buffer$1$1.alloc(a),d=Object.assign({instruction:o.index},e);return o.layout.encode(d,c),c}function decodeData$1(o,e){let a;try{a=o.layout.decode(e)}catch(c){throw new Error("invalid instruction; "+c)}if(a.instruction!==o.index)throw new Error(`invalid instruction; instruction index mismatch ${a.instruction} != ${o.index}`);return a}const FeeCalculatorLayout=nu64$2("lamportsPerSignature"),NonceAccountLayout=struct$2([u32$2("version"),u32$2("state"),publicKey$5("authorizedPubkey"),publicKey$5("nonce"),struct$2([FeeCalculatorLayout],"feeCalculator")]),NONCE_ACCOUNT_LENGTH=NonceAccountLayout.span;class NonceAccount{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const a=NonceAccountLayout.decode(toBuffer$3(e),0);return new NonceAccount({authorizedPubkey:new PublicKey$1(a.authorizedPubkey),nonce:new PublicKey$1(a.nonce).toString(),feeCalculator:a.feeCalculator})}}const encodeDecode$1=o=>{const e=o.decode.bind(o),a=o.encode.bind(o);return{decode:e,encode:a}},bigInt$1=o=>e=>{const a=blob$2(o,e),{encode:c,decode:d}=encodeDecode$1(a),h=a;return h.decode=(j,et)=>{const nt=d(j,et);return toBigIntLE_1(Buffer$1$1.from(nt))},h.encode=(j,et,nt)=>{const st=toBufferLE_1(j,o);return c(st,et,nt)},h},u64$3=bigInt$1(8);class SystemInstruction{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const c=u32$2("instruction").decode(e.data);let d;for(const[h,j]of Object.entries(SYSTEM_INSTRUCTION_LAYOUTS))if(j.index==c){d=h;break}if(!d)throw new Error("Instruction type incorrect; not a SystemInstruction");return d}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:a,space:c,programId:d}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:a,space:c,programId:new PublicKey$1(d)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:a}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:a}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:a,seed:c,programId:d}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:a,seed:c,programId:new PublicKey$1(d)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:a}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:a}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:a,seed:c,space:d,programId:h}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new PublicKey$1(a),seed:c,space:d,programId:new PublicKey$1(h)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:a}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new PublicKey$1(a)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:a,seed:c,programId:d}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new PublicKey$1(a),seed:c,programId:new PublicKey$1(d)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:a,seed:c,lamports:d,space:h,programId:j}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new PublicKey$1(a),seed:c,lamports:d,space:h,programId:new PublicKey$1(j)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:a}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new PublicKey$1(a)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:a}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:a}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:a}=decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new PublicKey$1(a)}}static checkProgramId(e){if(!e.equals(SystemProgram.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,a){if(e.length0?ht:1,space:h.length,programId:d}));dt!==null&&await sendAndConfirmTransaction(e,dt,[a,c],{commitment:"confirmed"})}const j=struct$2([u32$2("instruction"),u32$2("offset"),u32$2("bytesLength"),u32$2("bytesLengthPadding"),seq(u8$2("byte"),offset$2(u32$2(),-8),"bytes")]),et=Loader.chunkSize;let nt=0,st=h,ot=[];for(;st.length>0;){const ht=st.slice(0,et),pt=Buffer$1$1.alloc(et+16);j.encode({instruction:0,offset:nt,bytes:ht,bytesLength:0,bytesLengthPadding:0},pt);const dt=new Transaction().add({keys:[{pubkey:c.publicKey,isSigner:!0,isWritable:!0}],programId:d,data:pt});ot.push(sendAndConfirmTransaction(e,dt,[a,c],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await sleep(1e3/4),nt+=et,st=st.slice(et)}await Promise.all(ot);{const ht=struct$2([u32$2("instruction")]),pt=Buffer$1$1.alloc(ht.span);ht.encode({instruction:1},pt);const dt=new Transaction().add({keys:[{pubkey:c.publicKey,isSigner:!0,isWritable:!0},{pubkey:SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],programId:d,data:pt}),gt="processed",wt=await e.sendTransaction(dt,[a,c],{preflightCommitment:gt}),{context:St,value:_t}=await e.confirmTransaction({signature:wt,lastValidBlockHeight:dt.lastValidBlockHeight,blockhash:dt.recentBlockhash},gt);if(_t.err)throw new Error(`Transaction ${wt} failed (${JSON.stringify(_t)})`);for(;;){try{if(await e.getSlot({commitment:gt})>St.slot)break}catch{}await new Promise(mt=>setTimeout(mt,Math.round(MS_PER_SLOT/2)))}}return!0}}Loader.chunkSize=CHUNK_SIZE;const BPF_LOADER_PROGRAM_ID=new PublicKey$1("BPFLoader2111111111111111111111111111111111");class BpfLoader{static getMinNumSignatures(e){return Loader.getMinNumSignatures(e)}static load(e,a,c,d,h){return Loader.load(e,a,c,h,d)}}function getDefaultExportFromCjs$2(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var fastStableStringify$1,hasRequiredFastStableStringify;function requireFastStableStringify(){if(hasRequiredFastStableStringify)return fastStableStringify$1;hasRequiredFastStableStringify=1;var o=Object.prototype.toString,e=Object.keys||function(c){var d=[];for(var h in c)d.push(h);return d};function a(c,d){var h,j,et,nt,st,ot,ht;if(c===!0)return"true";if(c===!1)return"false";switch(typeof c){case"object":if(c===null)return null;if(c.toJSON&&typeof c.toJSON=="function")return a(c.toJSON(),d);if(ht=o.call(c),ht==="[object Array]"){for(et="[",j=c.length-1,h=0;h-1&&(et+=a(c[h],!0)),et+"]"}else if(ht==="[object Object]"){for(nt=e(c).sort(),j=nt.length,et="",h=0;h1;)o/=2,e++;return e}function nextPowerOfTwo(o){return o===0?1:(o--,o|=o>>1,o|=o>>2,o|=o>>4,o|=o>>8,o|=o>>16,o|=o>>32,o+1)}class EpochSchedule{constructor(e,a,c,d,h){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=a,this.warmup=c,this.firstNormalEpoch=d,this.firstNormalSlot=h}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e{const j=WebSocket$1(h,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...a});return"socket"in j?this.underlyingSocket=j.socket:this.underlyingSocket=j,j};super(d,e,a,c),this.underlyingSocket=void 0}call(...e){var c;const a=(c=this.underlyingSocket)==null?void 0:c.readyState;return a===1?super.call(...e):Promise.reject(new Error("Tried to call a JSON-RPC method `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+a+")"))}notify(...e){var c;const a=(c=this.underlyingSocket)==null?void 0:c.readyState;return a===1?super.notify(...e):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+a+")"))}}function decodeData(o,e){let a;try{a=o.layout.decode(e)}catch(c){throw new Error("invalid instruction; "+c)}if(a.typeIndex!==o.index)throw new Error(`invalid account data; account type mismatch ${a.typeIndex} != ${o.index}`);return a}const LOOKUP_TABLE_META_SIZE=56;class AddressLookupTableAccount{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){const e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){const a=decodeData(LookupTableMetaLayout,e),c=e.length-LOOKUP_TABLE_META_SIZE;assert$m(c>=0,"lookup table is invalid"),assert$m(c%32===0,"lookup table is invalid");const d=c/32,{addresses:h}=struct$2([seq(publicKey$5(),d,"addresses")]).decode(e.slice(LOOKUP_TABLE_META_SIZE));return{deactivationSlot:a.deactivationSlot,lastExtendedSlot:a.lastExtendedSlot,lastExtendedSlotStartIndex:a.lastExtendedStartIndex,authority:a.authority.length!==0?new PublicKey$1(a.authority[0]):void 0,addresses:h.map(j=>new PublicKey$1(j))}}}const LookupTableMetaLayout={index:1,layout:struct$2([u32$2("typeIndex"),u64$3("deactivationSlot"),nu64$2("lastExtendedSlot"),u8$2("lastExtendedStartIndex"),u8$2(),seq(publicKey$5(),offset$2(u8$2(),-1),"authority")])},URL_RE=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function makeWebsocketUrl(o){const e=o.match(URL_RE);if(e==null)throw TypeError(`Failed to validate endpoint URL \`${o}\``);const[a,c,d,h]=e,j=o.startsWith("https:")?"wss:":"ws:",et=d==null?null:parseInt(d.slice(1),10),nt=et==null?"":`:${et+1}`;return`${j}//${c}${nt}${h}`}const PublicKeyFromString=coerce$2(instance(PublicKey$1),string$2(),o=>new PublicKey$1(o)),RawAccountDataResult=tuple([string$2(),literal$2("base64")]),BufferFromRawAccountData=coerce$2(instance(Buffer$1$1),RawAccountDataResult,o=>Buffer$1$1.from(o[0],"base64")),BLOCKHASH_CACHE_TIMEOUT_MS=30*1e3;function assertEndpointUrl(o){if(/^https?:/.test(o)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return o}function extractCommitmentFromConfig(o){let e,a;if(typeof o=="string")e=o;else if(o){const{commitment:c,...d}=o;e=c,a=d}return{commitment:e,config:a}}function applyDefaultMemcmpEncodingToFilters(o){return o.map(e=>"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:e.memcmp.encoding??"base58"}}:e)}function createRpcResult$2(o){return union$3([type$3({jsonrpc:literal$2("2.0"),id:string$2(),result:o}),type$3({jsonrpc:literal$2("2.0"),id:string$2(),error:type$3({code:unknown$2(),message:string$2(),data:optional$2(any$2())})})])}const UnknownRpcResult$2=createRpcResult$2(unknown$2());function jsonRpcResult$2(o){return coerce$2(createRpcResult$2(o),UnknownRpcResult$2,e=>"error"in e?e:{...e,result:create$2(e.result,o)})}function jsonRpcResultAndContext$2(o){return jsonRpcResult$2(type$3({context:type$3({slot:number$2()}),value:o}))}function notificationResultAndContext(o){return type$3({context:type$3({slot:number$2()}),value:o})}function versionedMessageFromResponse(o,e){return o===0?new MessageV0({header:e.header,staticAccountKeys:e.accountKeys.map(a=>new PublicKey$1(a)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(a=>({programIdIndex:a.programIdIndex,accountKeyIndexes:a.accounts,data:bs58$4.decode(a.data)})),addressTableLookups:e.addressTableLookups}):new Message(e)}const GetInflationGovernorResult=type$3({foundation:number$2(),foundationTerm:number$2(),initial:number$2(),taper:number$2(),terminal:number$2()}),GetInflationRewardResult=jsonRpcResult$2(array$2(nullable$2(type$3({epoch:number$2(),effectiveSlot:number$2(),amount:number$2(),postBalance:number$2(),commission:optional$2(nullable$2(number$2()))})))),GetRecentPrioritizationFeesResult=array$2(type$3({slot:number$2(),prioritizationFee:number$2()})),GetInflationRateResult=type$3({total:number$2(),validator:number$2(),foundation:number$2(),epoch:number$2()}),GetEpochInfoResult=type$3({epoch:number$2(),slotIndex:number$2(),slotsInEpoch:number$2(),absoluteSlot:number$2(),blockHeight:optional$2(number$2()),transactionCount:optional$2(number$2())}),GetEpochScheduleResult=type$3({slotsPerEpoch:number$2(),leaderScheduleSlotOffset:number$2(),warmup:boolean$2(),firstNormalEpoch:number$2(),firstNormalSlot:number$2()}),GetLeaderScheduleResult=record(string$2(),array$2(number$2())),TransactionErrorResult=nullable$2(union$3([type$3({}),string$2()])),SignatureStatusResult=type$3({err:TransactionErrorResult}),SignatureReceivedResult=literal$2("receivedSignature"),VersionResult=type$3({"solana-core":string$2(),"feature-set":optional$2(number$2())}),ParsedInstructionStruct=type$3({program:string$2(),programId:PublicKeyFromString,parsed:unknown$2()}),PartiallyDecodedInstructionStruct=type$3({programId:PublicKeyFromString,accounts:array$2(PublicKeyFromString),data:string$2()}),SimulatedTransactionResponseStruct$1=jsonRpcResultAndContext$2(type$3({err:nullable$2(union$3([type$3({}),string$2()])),logs:nullable$2(array$2(string$2())),accounts:optional$2(nullable$2(array$2(nullable$2(type$3({executable:boolean$2(),owner:string$2(),lamports:number$2(),data:array$2(string$2()),rentEpoch:optional$2(number$2())}))))),unitsConsumed:optional$2(number$2()),returnData:optional$2(nullable$2(type$3({programId:string$2(),data:tuple([string$2(),literal$2("base64")])}))),innerInstructions:optional$2(nullable$2(array$2(type$3({index:number$2(),instructions:array$2(union$3([ParsedInstructionStruct,PartiallyDecodedInstructionStruct]))}))))})),BlockProductionResponseStruct=jsonRpcResultAndContext$2(type$3({byIdentity:record(string$2(),array$2(number$2())),range:type$3({firstSlot:number$2(),lastSlot:number$2()})}));function createRpcClient(o,e,a,c,d,h){const j=a||fetchImpl;let et;h!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments.");let nt;return c&&(nt=async(ot,ht)=>{const pt=await new Promise((dt,gt)=>{try{c(ot,ht,(wt,St)=>dt([wt,St]))}catch(wt){gt(wt)}});return await j(...pt)}),new RpcClient(async(ot,ht)=>{const pt={method:"POST",body:ot,agent:et,headers:Object.assign({"Content-Type":"application/json"},e||{},COMMON_HTTP_HEADERS)};try{let dt=5,gt,wt=500;for(;nt?gt=await nt(o,pt):gt=await j(o,pt),!(gt.status!==429||d===!0||(dt-=1,dt===0));)console.error(`Server responded with ${gt.status} ${gt.statusText}. Retrying after ${wt}ms delay...`),await sleep(wt),wt*=2;const St=await gt.text();gt.ok?ht(null,St):ht(new Error(`${gt.status} ${gt.statusText}: ${St}`))}catch(dt){dt instanceof Error&&ht(dt)}},{})}function createRpcRequest(o){return(e,a)=>new Promise((c,d)=>{o.request(e,a,(h,j)=>{if(h){d(h);return}c(j)})})}function createRpcBatchRequest(o){return e=>new Promise((a,c)=>{e.length===0&&a([]);const d=e.map(h=>o.request(h.methodName,h.args));o.request(d,(h,j)=>{if(h){c(h);return}a(j)})})}const GetInflationGovernorRpcResult=jsonRpcResult$2(GetInflationGovernorResult),GetInflationRateRpcResult=jsonRpcResult$2(GetInflationRateResult),GetRecentPrioritizationFeesRpcResult=jsonRpcResult$2(GetRecentPrioritizationFeesResult),GetEpochInfoRpcResult=jsonRpcResult$2(GetEpochInfoResult),GetEpochScheduleRpcResult=jsonRpcResult$2(GetEpochScheduleResult),GetLeaderScheduleRpcResult=jsonRpcResult$2(GetLeaderScheduleResult),SlotRpcResult=jsonRpcResult$2(number$2()),GetSupplyRpcResult=jsonRpcResultAndContext$2(type$3({total:number$2(),circulating:number$2(),nonCirculating:number$2(),nonCirculatingAccounts:array$2(PublicKeyFromString)})),TokenAmountResult=type$3({amount:string$2(),uiAmount:nullable$2(number$2()),decimals:number$2(),uiAmountString:optional$2(string$2())}),GetTokenLargestAccountsResult=jsonRpcResultAndContext$2(array$2(type$3({address:PublicKeyFromString,amount:string$2(),uiAmount:nullable$2(number$2()),decimals:number$2(),uiAmountString:optional$2(string$2())}))),GetTokenAccountsByOwner=jsonRpcResultAndContext$2(array$2(type$3({pubkey:PublicKeyFromString,account:type$3({executable:boolean$2(),owner:PublicKeyFromString,lamports:number$2(),data:BufferFromRawAccountData,rentEpoch:number$2()})}))),ParsedAccountDataResult=type$3({program:string$2(),parsed:unknown$2(),space:number$2()}),GetParsedTokenAccountsByOwner=jsonRpcResultAndContext$2(array$2(type$3({pubkey:PublicKeyFromString,account:type$3({executable:boolean$2(),owner:PublicKeyFromString,lamports:number$2(),data:ParsedAccountDataResult,rentEpoch:number$2()})}))),GetLargestAccountsRpcResult=jsonRpcResultAndContext$2(array$2(type$3({lamports:number$2(),address:PublicKeyFromString}))),AccountInfoResult=type$3({executable:boolean$2(),owner:PublicKeyFromString,lamports:number$2(),data:BufferFromRawAccountData,rentEpoch:number$2()}),KeyedAccountInfoResult=type$3({pubkey:PublicKeyFromString,account:AccountInfoResult}),ParsedOrRawAccountData=coerce$2(union$3([instance(Buffer$1$1),ParsedAccountDataResult]),union$3([RawAccountDataResult,ParsedAccountDataResult]),o=>Array.isArray(o)?create$2(o,BufferFromRawAccountData):o),ParsedAccountInfoResult=type$3({executable:boolean$2(),owner:PublicKeyFromString,lamports:number$2(),data:ParsedOrRawAccountData,rentEpoch:number$2()}),KeyedParsedAccountInfoResult=type$3({pubkey:PublicKeyFromString,account:ParsedAccountInfoResult}),StakeActivationResult=type$3({state:union$3([literal$2("active"),literal$2("inactive"),literal$2("activating"),literal$2("deactivating")]),active:number$2(),inactive:number$2()}),GetConfirmedSignaturesForAddress2RpcResult=jsonRpcResult$2(array$2(type$3({signature:string$2(),slot:number$2(),err:TransactionErrorResult,memo:nullable$2(string$2()),blockTime:optional$2(nullable$2(number$2()))}))),GetSignaturesForAddressRpcResult=jsonRpcResult$2(array$2(type$3({signature:string$2(),slot:number$2(),err:TransactionErrorResult,memo:nullable$2(string$2()),blockTime:optional$2(nullable$2(number$2()))}))),AccountNotificationResult=type$3({subscription:number$2(),result:notificationResultAndContext(AccountInfoResult)}),ProgramAccountInfoResult=type$3({pubkey:PublicKeyFromString,account:AccountInfoResult}),ProgramAccountNotificationResult=type$3({subscription:number$2(),result:notificationResultAndContext(ProgramAccountInfoResult)}),SlotInfoResult=type$3({parent:number$2(),slot:number$2(),root:number$2()}),SlotNotificationResult=type$3({subscription:number$2(),result:SlotInfoResult}),SlotUpdateResult=union$3([type$3({type:union$3([literal$2("firstShredReceived"),literal$2("completed"),literal$2("optimisticConfirmation"),literal$2("root")]),slot:number$2(),timestamp:number$2()}),type$3({type:literal$2("createdBank"),parent:number$2(),slot:number$2(),timestamp:number$2()}),type$3({type:literal$2("frozen"),slot:number$2(),timestamp:number$2(),stats:type$3({numTransactionEntries:number$2(),numSuccessfulTransactions:number$2(),numFailedTransactions:number$2(),maxTransactionsPerEntry:number$2()})}),type$3({type:literal$2("dead"),slot:number$2(),timestamp:number$2(),err:string$2()})]),SlotUpdateNotificationResult=type$3({subscription:number$2(),result:SlotUpdateResult}),SignatureNotificationResult=type$3({subscription:number$2(),result:notificationResultAndContext(union$3([SignatureStatusResult,SignatureReceivedResult]))}),RootNotificationResult=type$3({subscription:number$2(),result:number$2()}),ContactInfoResult=type$3({pubkey:string$2(),gossip:nullable$2(string$2()),tpu:nullable$2(string$2()),rpc:nullable$2(string$2()),version:nullable$2(string$2())}),VoteAccountInfoResult=type$3({votePubkey:string$2(),nodePubkey:string$2(),activatedStake:number$2(),epochVoteAccount:boolean$2(),epochCredits:array$2(tuple([number$2(),number$2(),number$2()])),commission:number$2(),lastVote:number$2(),rootSlot:nullable$2(number$2())}),GetVoteAccounts=jsonRpcResult$2(type$3({current:array$2(VoteAccountInfoResult),delinquent:array$2(VoteAccountInfoResult)})),ConfirmationStatus=union$3([literal$2("processed"),literal$2("confirmed"),literal$2("finalized")]),SignatureStatusResponse=type$3({slot:number$2(),confirmations:nullable$2(number$2()),err:TransactionErrorResult,confirmationStatus:optional$2(ConfirmationStatus)}),GetSignatureStatusesRpcResult=jsonRpcResultAndContext$2(array$2(nullable$2(SignatureStatusResponse))),GetMinimumBalanceForRentExemptionRpcResult=jsonRpcResult$2(number$2()),AddressTableLookupStruct=type$3({accountKey:PublicKeyFromString,writableIndexes:array$2(number$2()),readonlyIndexes:array$2(number$2())}),ConfirmedTransactionResult=type$3({signatures:array$2(string$2()),message:type$3({accountKeys:array$2(string$2()),header:type$3({numRequiredSignatures:number$2(),numReadonlySignedAccounts:number$2(),numReadonlyUnsignedAccounts:number$2()}),instructions:array$2(type$3({accounts:array$2(number$2()),data:string$2(),programIdIndex:number$2()})),recentBlockhash:string$2(),addressTableLookups:optional$2(array$2(AddressTableLookupStruct))})}),AnnotatedAccountKey=type$3({pubkey:PublicKeyFromString,signer:boolean$2(),writable:boolean$2(),source:optional$2(union$3([literal$2("transaction"),literal$2("lookupTable")]))}),ConfirmedTransactionAccountsModeResult=type$3({accountKeys:array$2(AnnotatedAccountKey),signatures:array$2(string$2())}),ParsedInstructionResult=type$3({parsed:unknown$2(),program:string$2(),programId:PublicKeyFromString}),RawInstructionResult=type$3({accounts:array$2(PublicKeyFromString),data:string$2(),programId:PublicKeyFromString}),InstructionResult=union$3([RawInstructionResult,ParsedInstructionResult]),UnknownInstructionResult=union$3([type$3({parsed:unknown$2(),program:string$2(),programId:string$2()}),type$3({accounts:array$2(string$2()),data:string$2(),programId:string$2()})]),ParsedOrRawInstruction=coerce$2(InstructionResult,UnknownInstructionResult,o=>"accounts"in o?create$2(o,RawInstructionResult):create$2(o,ParsedInstructionResult)),ParsedConfirmedTransactionResult=type$3({signatures:array$2(string$2()),message:type$3({accountKeys:array$2(AnnotatedAccountKey),instructions:array$2(ParsedOrRawInstruction),recentBlockhash:string$2(),addressTableLookups:optional$2(nullable$2(array$2(AddressTableLookupStruct)))})}),TokenBalanceResult=type$3({accountIndex:number$2(),mint:string$2(),owner:optional$2(string$2()),programId:optional$2(string$2()),uiTokenAmount:TokenAmountResult}),LoadedAddressesResult=type$3({writable:array$2(PublicKeyFromString),readonly:array$2(PublicKeyFromString)}),ConfirmedTransactionMetaResult=type$3({err:TransactionErrorResult,fee:number$2(),innerInstructions:optional$2(nullable$2(array$2(type$3({index:number$2(),instructions:array$2(type$3({accounts:array$2(number$2()),data:string$2(),programIdIndex:number$2()}))})))),preBalances:array$2(number$2()),postBalances:array$2(number$2()),logMessages:optional$2(nullable$2(array$2(string$2()))),preTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult))),postTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult))),loadedAddresses:optional$2(LoadedAddressesResult),computeUnitsConsumed:optional$2(number$2())}),ParsedConfirmedTransactionMetaResult=type$3({err:TransactionErrorResult,fee:number$2(),innerInstructions:optional$2(nullable$2(array$2(type$3({index:number$2(),instructions:array$2(ParsedOrRawInstruction)})))),preBalances:array$2(number$2()),postBalances:array$2(number$2()),logMessages:optional$2(nullable$2(array$2(string$2()))),preTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult))),postTokenBalances:optional$2(nullable$2(array$2(TokenBalanceResult))),loadedAddresses:optional$2(LoadedAddressesResult),computeUnitsConsumed:optional$2(number$2())}),TransactionVersionStruct=union$3([literal$2(0),literal$2("legacy")]),RewardsResult=type$3({pubkey:string$2(),lamports:number$2(),postBalance:nullable$2(number$2()),rewardType:nullable$2(string$2()),commission:optional$2(nullable$2(number$2()))}),GetBlockRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),transactions:array$2(type$3({transaction:ConfirmedTransactionResult,meta:nullable$2(ConfirmedTransactionMetaResult),version:optional$2(TransactionVersionStruct)})),rewards:optional$2(array$2(RewardsResult)),blockTime:nullable$2(number$2()),blockHeight:nullable$2(number$2())}))),GetNoneModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),rewards:optional$2(array$2(RewardsResult)),blockTime:nullable$2(number$2()),blockHeight:nullable$2(number$2())}))),GetAccountsModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),transactions:array$2(type$3({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable$2(ConfirmedTransactionMetaResult),version:optional$2(TransactionVersionStruct)})),rewards:optional$2(array$2(RewardsResult)),blockTime:nullable$2(number$2()),blockHeight:nullable$2(number$2())}))),GetParsedBlockRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),transactions:array$2(type$3({transaction:ParsedConfirmedTransactionResult,meta:nullable$2(ParsedConfirmedTransactionMetaResult),version:optional$2(TransactionVersionStruct)})),rewards:optional$2(array$2(RewardsResult)),blockTime:nullable$2(number$2()),blockHeight:nullable$2(number$2())}))),GetParsedAccountsModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),transactions:array$2(type$3({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable$2(ParsedConfirmedTransactionMetaResult),version:optional$2(TransactionVersionStruct)})),rewards:optional$2(array$2(RewardsResult)),blockTime:nullable$2(number$2()),blockHeight:nullable$2(number$2())}))),GetParsedNoneModeBlockRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),rewards:optional$2(array$2(RewardsResult)),blockTime:nullable$2(number$2()),blockHeight:nullable$2(number$2())}))),GetConfirmedBlockRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),transactions:array$2(type$3({transaction:ConfirmedTransactionResult,meta:nullable$2(ConfirmedTransactionMetaResult)})),rewards:optional$2(array$2(RewardsResult)),blockTime:nullable$2(number$2())}))),GetBlockSignaturesRpcResult=jsonRpcResult$2(nullable$2(type$3({blockhash:string$2(),previousBlockhash:string$2(),parentSlot:number$2(),signatures:array$2(string$2()),blockTime:nullable$2(number$2())}))),GetTransactionRpcResult=jsonRpcResult$2(nullable$2(type$3({slot:number$2(),meta:nullable$2(ConfirmedTransactionMetaResult),blockTime:optional$2(nullable$2(number$2())),transaction:ConfirmedTransactionResult,version:optional$2(TransactionVersionStruct)}))),GetParsedTransactionRpcResult=jsonRpcResult$2(nullable$2(type$3({slot:number$2(),transaction:ParsedConfirmedTransactionResult,meta:nullable$2(ParsedConfirmedTransactionMetaResult),blockTime:optional$2(nullable$2(number$2())),version:optional$2(TransactionVersionStruct)}))),GetRecentBlockhashAndContextRpcResult=jsonRpcResultAndContext$2(type$3({blockhash:string$2(),feeCalculator:type$3({lamportsPerSignature:number$2()})})),GetLatestBlockhashRpcResult=jsonRpcResultAndContext$2(type$3({blockhash:string$2(),lastValidBlockHeight:number$2()})),IsBlockhashValidRpcResult=jsonRpcResultAndContext$2(boolean$2()),PerfSampleResult=type$3({slot:number$2(),numTransactions:number$2(),numSlots:number$2(),samplePeriodSecs:number$2()}),GetRecentPerformanceSamplesRpcResult=jsonRpcResult$2(array$2(PerfSampleResult)),GetFeeCalculatorRpcResult=jsonRpcResultAndContext$2(nullable$2(type$3({feeCalculator:type$3({lamportsPerSignature:number$2()})}))),RequestAirdropRpcResult=jsonRpcResult$2(string$2()),SendTransactionRpcResult=jsonRpcResult$2(string$2()),LogsResult=type$3({err:TransactionErrorResult,logs:array$2(string$2()),signature:string$2()}),LogsNotificationResult=type$3({result:notificationResultAndContext(LogsResult),subscription:number$2()}),COMMON_HTTP_HEADERS={"solana-client":"js/1.0.0-maintenance"};class Connection{constructor(e,a){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const st={};return async ot=>{const{commitment:ht,config:pt}=extractCommitmentFromConfig(ot),dt=this._buildArgs([],ht,void 0,pt),gt=fastStableStringify(dt);return st[gt]=st[gt]??(async()=>{try{const wt=await this._rpcRequest("getBlockHeight",dt),St=create$2(wt,jsonRpcResult$2(number$2()));if("error"in St)throw new SolanaJSONRPCError(St.error,"failed to get block height information");return St.result}finally{delete st[gt]}})(),await st[gt]}})();let c,d,h,j,et,nt;a&&typeof a=="string"?this._commitment=a:a&&(this._commitment=a.commitment,this._confirmTransactionInitialTimeout=a.confirmTransactionInitialTimeout,c=a.wsEndpoint,d=a.httpHeaders,h=a.fetch,j=a.fetchMiddleware,et=a.disableRetryOnRateLimit,nt=a.httpAgent),this._rpcEndpoint=assertEndpointUrl(e),this._rpcWsEndpoint=c||makeWebsocketUrl(e),this._rpcClient=createRpcClient(e,d,h,j,et,nt),this._rpcRequest=createRpcRequest(this._rpcClient),this._rpcBatchRequest=createRpcBatchRequest(this._rpcClient),this._rpcWebSocket=new RpcWebSocketClient(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgs([e.toBase58()],c,void 0,d),j=await this._rpcRequest("getBalance",h),et=create$2(j,jsonRpcResultAndContext$2(number$2()));if("error"in et)throw new SolanaJSONRPCError(et.error,`failed to get balance for ${e.toBase58()}`);return et.result}async getBalance(e,a){return await this.getBalanceAndContext(e,a).then(c=>c.value).catch(c=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+c)})}async getBlockTime(e){const a=await this._rpcRequest("getBlockTime",[e]),c=create$2(a,jsonRpcResult$2(nullable$2(number$2())));if("error"in c)throw new SolanaJSONRPCError(c.error,`failed to get block time for slot ${e}`);return c.result}async getMinimumLedgerSlot(){const e=await this._rpcRequest("minimumLedgerSlot",[]),a=create$2(e,jsonRpcResult$2(number$2()));if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get minimum ledger slot");return a.result}async getFirstAvailableBlock(){const e=await this._rpcRequest("getFirstAvailableBlock",[]),a=create$2(e,SlotRpcResult);if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get first available block");return a.result}async getSupply(e){let a={};typeof e=="string"?a={commitment:e}:e?a={...e,commitment:e&&e.commitment||this.commitment}:a={commitment:this.commitment};const c=await this._rpcRequest("getSupply",[a]),d=create$2(c,GetSupplyRpcResult);if("error"in d)throw new SolanaJSONRPCError(d.error,"failed to get supply");return d.result}async getTokenSupply(e,a){const c=this._buildArgs([e.toBase58()],a),d=await this._rpcRequest("getTokenSupply",c),h=create$2(d,jsonRpcResultAndContext$2(TokenAmountResult));if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get token supply");return h.result}async getTokenAccountBalance(e,a){const c=this._buildArgs([e.toBase58()],a),d=await this._rpcRequest("getTokenAccountBalance",c),h=create$2(d,jsonRpcResultAndContext$2(TokenAmountResult));if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get token account balance");return h.result}async getTokenAccountsByOwner(e,a,c){const{commitment:d,config:h}=extractCommitmentFromConfig(c);let j=[e.toBase58()];"mint"in a?j.push({mint:a.mint.toBase58()}):j.push({programId:a.programId.toBase58()});const et=this._buildArgs(j,d,"base64",h),nt=await this._rpcRequest("getTokenAccountsByOwner",et),st=create$2(nt,GetTokenAccountsByOwner);if("error"in st)throw new SolanaJSONRPCError(st.error,`failed to get token accounts owned by account ${e.toBase58()}`);return st.result}async getParsedTokenAccountsByOwner(e,a,c){let d=[e.toBase58()];"mint"in a?d.push({mint:a.mint.toBase58()}):d.push({programId:a.programId.toBase58()});const h=this._buildArgs(d,c,"jsonParsed"),j=await this._rpcRequest("getTokenAccountsByOwner",h),et=create$2(j,GetParsedTokenAccountsByOwner);if("error"in et)throw new SolanaJSONRPCError(et.error,`failed to get token accounts owned by account ${e.toBase58()}`);return et.result}async getLargestAccounts(e){const a={...e,commitment:e&&e.commitment||this.commitment},c=a.filter||a.commitment?[a]:[],d=await this._rpcRequest("getLargestAccounts",c),h=create$2(d,GetLargestAccountsRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get largest accounts");return h.result}async getTokenLargestAccounts(e,a){const c=this._buildArgs([e.toBase58()],a),d=await this._rpcRequest("getTokenLargestAccounts",c),h=create$2(d,GetTokenLargestAccountsResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get token largest accounts");return h.result}async getAccountInfoAndContext(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgs([e.toBase58()],c,"base64",d),j=await this._rpcRequest("getAccountInfo",h),et=create$2(j,jsonRpcResultAndContext$2(nullable$2(AccountInfoResult)));if("error"in et)throw new SolanaJSONRPCError(et.error,`failed to get info about account ${e.toBase58()}`);return et.result}async getParsedAccountInfo(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgs([e.toBase58()],c,"jsonParsed",d),j=await this._rpcRequest("getAccountInfo",h),et=create$2(j,jsonRpcResultAndContext$2(nullable$2(ParsedAccountInfoResult)));if("error"in et)throw new SolanaJSONRPCError(et.error,`failed to get info about account ${e.toBase58()}`);return et.result}async getAccountInfo(e,a){try{return(await this.getAccountInfoAndContext(e,a)).value}catch(c){throw new Error("failed to get info about account "+e.toBase58()+": "+c)}}async getMultipleParsedAccounts(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=e.map(st=>st.toBase58()),j=this._buildArgs([h],c,"jsonParsed",d),et=await this._rpcRequest("getMultipleAccounts",j),nt=create$2(et,jsonRpcResultAndContext$2(array$2(nullable$2(ParsedAccountInfoResult))));if("error"in nt)throw new SolanaJSONRPCError(nt.error,`failed to get info for accounts ${h}`);return nt.result}async getMultipleAccountsInfoAndContext(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=e.map(st=>st.toBase58()),j=this._buildArgs([h],c,"base64",d),et=await this._rpcRequest("getMultipleAccounts",j),nt=create$2(et,jsonRpcResultAndContext$2(array$2(nullable$2(AccountInfoResult))));if("error"in nt)throw new SolanaJSONRPCError(nt.error,`failed to get info for accounts ${h}`);return nt.result}async getMultipleAccountsInfo(e,a){return(await this.getMultipleAccountsInfoAndContext(e,a)).value}async getStakeActivation(e,a,c){const{commitment:d,config:h}=extractCommitmentFromConfig(a),j=this._buildArgs([e.toBase58()],d,void 0,{...h,epoch:c??(h==null?void 0:h.epoch)}),et=await this._rpcRequest("getStakeActivation",j),nt=create$2(et,jsonRpcResult$2(StakeActivationResult));if("error"in nt)throw new SolanaJSONRPCError(nt.error,`failed to get Stake Activation ${e.toBase58()}`);return nt.result}async getProgramAccounts(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),{encoding:h,...j}=d||{},et=this._buildArgs([e.toBase58()],c,h||"base64",{...j,...j.filters?{filters:applyDefaultMemcmpEncodingToFilters(j.filters)}:null}),nt=await this._rpcRequest("getProgramAccounts",et),st=array$2(KeyedAccountInfoResult),ot=j.withContext===!0?create$2(nt,jsonRpcResultAndContext$2(st)):create$2(nt,jsonRpcResult$2(st));if("error"in ot)throw new SolanaJSONRPCError(ot.error,`failed to get accounts owned by program ${e.toBase58()}`);return ot.result}async getParsedProgramAccounts(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgs([e.toBase58()],c,"jsonParsed",d),j=await this._rpcRequest("getProgramAccounts",h),et=create$2(j,jsonRpcResult$2(array$2(KeyedParsedAccountInfoResult)));if("error"in et)throw new SolanaJSONRPCError(et.error,`failed to get accounts owned by program ${e.toBase58()}`);return et.result}async confirmTransaction(e,a){var h;let c;if(typeof e=="string")c=e;else{const j=e;if((h=j.abortSignal)!=null&&h.aborted)return Promise.reject(j.abortSignal.reason);c=j.signature}let d;try{d=bs58$4.decode(c)}catch{throw new Error("signature must be base58 encoded: "+c)}return assert$m(d.length===64,"signature has invalid length"),typeof e=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:a||this.commitment,signature:c}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:a||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:a||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise((a,c)=>{e!=null&&(e.aborted?c(e.reason):e.addEventListener("abort",()=>{c(e.reason)}))})}getTransactionConfirmationPromise({commitment:e,signature:a}){let c,d,h=!1;const j=new Promise((nt,st)=>{try{c=this.onSignature(a,(ht,pt)=>{c=void 0;const dt={context:pt,value:ht};nt({__type:TransactionStatus.PROCESSED,response:dt})},e);const ot=new Promise(ht=>{c==null?ht():d=this._onSubscriptionStateChange(c,pt=>{pt==="subscribed"&&ht()})});(async()=>{if(await ot,h)return;const ht=await this.getSignatureStatus(a);if(h||ht==null)return;const{context:pt,value:dt}=ht;if(dt!=null)if(dt!=null&&dt.err)st(dt.err);else{switch(e){case"confirmed":case"single":case"singleGossip":{if(dt.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(dt.confirmationStatus==="processed"||dt.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}h=!0,nt({__type:TransactionStatus.PROCESSED,response:{context:pt,value:dt}})}})()}catch(ot){st(ot)}});return{abortConfirmation:()=>{d&&(d(),d=void 0),c!=null&&(this.removeSignatureListener(c),c=void 0)},confirmationPromise:j}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:a,lastValidBlockHeight:c,signature:d}}){let h=!1;const j=new Promise(ht=>{const pt=async()=>{try{return await this.getBlockHeight(e)}catch{return-1}};(async()=>{let dt=await pt();if(!h){for(;dt<=c;)if(await sleep(1e3),h||(dt=await pt(),h))return;ht({__type:TransactionStatus.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:et,confirmationPromise:nt}=this.getTransactionConfirmationPromise({commitment:e,signature:d}),st=this.getCancellationPromise(a);let ot;try{const ht=await Promise.race([st,nt,j]);if(ht.__type===TransactionStatus.PROCESSED)ot=ht.response;else throw new TransactionExpiredBlockheightExceededError(d)}finally{h=!0,et()}return ot}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:a,minContextSlot:c,nonceAccountPubkey:d,nonceValue:h,signature:j}}){let et=!1;const nt=new Promise(dt=>{let gt=h,wt=null;const St=async()=>{try{const{context:_t,value:mt}=await this.getNonceAndContext(d,{commitment:e,minContextSlot:c});return wt=_t.slot,mt==null?void 0:mt.nonce}catch{return gt}};(async()=>{if(gt=await St(),!et)for(;;){if(h!==gt){dt({__type:TransactionStatus.NONCE_INVALID,slotInWhichNonceDidAdvance:wt});return}if(await sleep(2e3),et||(gt=await St(),et))return}})()}),{abortConfirmation:st,confirmationPromise:ot}=this.getTransactionConfirmationPromise({commitment:e,signature:j}),ht=this.getCancellationPromise(a);let pt;try{const dt=await Promise.race([ht,ot,nt]);if(dt.__type===TransactionStatus.PROCESSED)pt=dt.response;else{let gt;for(;;){const wt=await this.getSignatureStatus(j);if(wt==null)break;if(wt.context.slot<(dt.slotInWhichNonceDidAdvance??c)){await sleep(400);continue}gt=wt;break}if(gt!=null&>.value){const wt=e||"finalized",{confirmationStatus:St}=gt.value;switch(wt){case"processed":case"recent":if(St!=="processed"&&St!=="confirmed"&&St!=="finalized")throw new TransactionExpiredNonceInvalidError(j);break;case"confirmed":case"single":case"singleGossip":if(St!=="confirmed"&&St!=="finalized")throw new TransactionExpiredNonceInvalidError(j);break;case"finalized":case"max":case"root":if(St!=="finalized")throw new TransactionExpiredNonceInvalidError(j);break;default:}pt={context:gt.context,value:{err:gt.value.err}}}else throw new TransactionExpiredNonceInvalidError(j)}}finally{et=!0,st()}return pt}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:a}){let c;const d=new Promise(nt=>{let st=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{st=this._confirmTransactionInitialTimeout||3e4;break}}c=setTimeout(()=>nt({__type:TransactionStatus.TIMED_OUT,timeoutMs:st}),st)}),{abortConfirmation:h,confirmationPromise:j}=this.getTransactionConfirmationPromise({commitment:e,signature:a});let et;try{const nt=await Promise.race([j,d]);if(nt.__type===TransactionStatus.PROCESSED)et=nt.response;else throw new TransactionExpiredTimeoutError(a,nt.timeoutMs/1e3)}finally{clearTimeout(c),h()}return et}async getClusterNodes(){const e=await this._rpcRequest("getClusterNodes",[]),a=create$2(e,jsonRpcResult$2(array$2(ContactInfoResult)));if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get cluster nodes");return a.result}async getVoteAccounts(e){const a=this._buildArgs([],e),c=await this._rpcRequest("getVoteAccounts",a),d=create$2(c,GetVoteAccounts);if("error"in d)throw new SolanaJSONRPCError(d.error,"failed to get vote accounts");return d.result}async getSlot(e){const{commitment:a,config:c}=extractCommitmentFromConfig(e),d=this._buildArgs([],a,void 0,c),h=await this._rpcRequest("getSlot",d),j=create$2(h,jsonRpcResult$2(number$2()));if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get slot");return j.result}async getSlotLeader(e){const{commitment:a,config:c}=extractCommitmentFromConfig(e),d=this._buildArgs([],a,void 0,c),h=await this._rpcRequest("getSlotLeader",d),j=create$2(h,jsonRpcResult$2(string$2()));if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get slot leader");return j.result}async getSlotLeaders(e,a){const c=[e,a],d=await this._rpcRequest("getSlotLeaders",c),h=create$2(d,jsonRpcResult$2(array$2(PublicKeyFromString)));if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get slot leaders");return h.result}async getSignatureStatus(e,a){const{context:c,value:d}=await this.getSignatureStatuses([e],a);assert$m(d.length===1);const h=d[0];return{context:c,value:h}}async getSignatureStatuses(e,a){const c=[e];a&&c.push(a);const d=await this._rpcRequest("getSignatureStatuses",c),h=create$2(d,GetSignatureStatusesRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get signature status");return h.result}async getTransactionCount(e){const{commitment:a,config:c}=extractCommitmentFromConfig(e),d=this._buildArgs([],a,void 0,c),h=await this._rpcRequest("getTransactionCount",d),j=create$2(h,jsonRpcResult$2(number$2()));if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get transaction count");return j.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const a=this._buildArgs([],e),c=await this._rpcRequest("getInflationGovernor",a),d=create$2(c,GetInflationGovernorRpcResult);if("error"in d)throw new SolanaJSONRPCError(d.error,"failed to get inflation");return d.result}async getInflationReward(e,a,c){const{commitment:d,config:h}=extractCommitmentFromConfig(c),j=this._buildArgs([e.map(st=>st.toBase58())],d,void 0,{...h,epoch:a??(h==null?void 0:h.epoch)}),et=await this._rpcRequest("getInflationReward",j),nt=create$2(et,GetInflationRewardResult);if("error"in nt)throw new SolanaJSONRPCError(nt.error,"failed to get inflation reward");return nt.result}async getInflationRate(){const e=await this._rpcRequest("getInflationRate",[]),a=create$2(e,GetInflationRateRpcResult);if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get inflation rate");return a.result}async getEpochInfo(e){const{commitment:a,config:c}=extractCommitmentFromConfig(e),d=this._buildArgs([],a,void 0,c),h=await this._rpcRequest("getEpochInfo",d),j=create$2(h,GetEpochInfoRpcResult);if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get epoch info");return j.result}async getEpochSchedule(){const e=await this._rpcRequest("getEpochSchedule",[]),a=create$2(e,GetEpochScheduleRpcResult);if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get epoch schedule");const c=a.result;return new EpochSchedule(c.slotsPerEpoch,c.leaderScheduleSlotOffset,c.warmup,c.firstNormalEpoch,c.firstNormalSlot)}async getLeaderSchedule(){const e=await this._rpcRequest("getLeaderSchedule",[]),a=create$2(e,GetLeaderScheduleRpcResult);if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get leader schedule");return a.result}async getMinimumBalanceForRentExemption(e,a){const c=this._buildArgs([e],a),d=await this._rpcRequest("getMinimumBalanceForRentExemption",c),h=create$2(d,GetMinimumBalanceForRentExemptionRpcResult);return"error"in h?(console.warn("Unable to fetch minimum balance for rent exemption"),0):h.result}async getRecentBlockhashAndContext(e){const a=this._buildArgs([],e),c=await this._rpcRequest("getRecentBlockhash",a),d=create$2(c,GetRecentBlockhashAndContextRpcResult);if("error"in d)throw new SolanaJSONRPCError(d.error,"failed to get recent blockhash");return d.result}async getRecentPerformanceSamples(e){const a=await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),c=create$2(a,GetRecentPerformanceSamplesRpcResult);if("error"in c)throw new SolanaJSONRPCError(c.error,"failed to get recent performance samples");return c.result}async getFeeCalculatorForBlockhash(e,a){const c=this._buildArgs([e],a),d=await this._rpcRequest("getFeeCalculatorForBlockhash",c),h=create$2(d,GetFeeCalculatorRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get fee calculator");const{context:j,value:et}=h.result;return{context:j,value:et!==null?et.feeCalculator:null}}async getFeeForMessage(e,a){const c=toBuffer$3(e.serialize()).toString("base64"),d=this._buildArgs([c],a),h=await this._rpcRequest("getFeeForMessage",d),j=create$2(h,jsonRpcResultAndContext$2(nullable$2(number$2())));if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get fee for message");if(j.result===null)throw new Error("invalid blockhash");return j.result}async getRecentPrioritizationFees(e){var j;const a=(j=e==null?void 0:e.lockedWritableAccounts)==null?void 0:j.map(et=>et.toBase58()),c=a!=null&&a.length?[a]:[],d=await this._rpcRequest("getRecentPrioritizationFees",c),h=create$2(d,GetRecentPrioritizationFeesRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get recent prioritization fees");return h.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(a){throw new Error("failed to get recent blockhash: "+a)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(a){throw new Error("failed to get recent blockhash: "+a)}}async getLatestBlockhashAndContext(e){const{commitment:a,config:c}=extractCommitmentFromConfig(e),d=this._buildArgs([],a,void 0,c),h=await this._rpcRequest("getLatestBlockhash",d),j=create$2(h,GetLatestBlockhashRpcResult);if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get latest blockhash");return j.result}async isBlockhashValid(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgs([e],c,void 0,d),j=await this._rpcRequest("isBlockhashValid",h),et=create$2(j,IsBlockhashValidRpcResult);if("error"in et)throw new SolanaJSONRPCError(et.error,"failed to determine if the blockhash `"+e+"`is valid");return et.result}async getVersion(){const e=await this._rpcRequest("getVersion",[]),a=create$2(e,jsonRpcResult$2(VersionResult));if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get version");return a.result}async getGenesisHash(){const e=await this._rpcRequest("getGenesisHash",[]),a=create$2(e,jsonRpcResult$2(string$2()));if("error"in a)throw new SolanaJSONRPCError(a.error,"failed to get genesis hash");return a.result}async getBlock(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgsAtLeastConfirmed([e],c,void 0,d),j=await this._rpcRequest("getBlock",h);try{switch(d==null?void 0:d.transactionDetails){case"accounts":{const et=create$2(j,GetAccountsModeBlockRpcResult);if("error"in et)throw et.error;return et.result}case"none":{const et=create$2(j,GetNoneModeBlockRpcResult);if("error"in et)throw et.error;return et.result}default:{const et=create$2(j,GetBlockRpcResult);if("error"in et)throw et.error;const{result:nt}=et;return nt?{...nt,transactions:nt.transactions.map(({transaction:st,meta:ot,version:ht})=>({meta:ot,transaction:{...st,message:versionedMessageFromResponse(ht,st.message)},version:ht}))}:null}}}catch(et){throw new SolanaJSONRPCError(et,"failed to get confirmed block")}}async getParsedBlock(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgsAtLeastConfirmed([e],c,"jsonParsed",d),j=await this._rpcRequest("getBlock",h);try{switch(d==null?void 0:d.transactionDetails){case"accounts":{const et=create$2(j,GetParsedAccountsModeBlockRpcResult);if("error"in et)throw et.error;return et.result}case"none":{const et=create$2(j,GetParsedNoneModeBlockRpcResult);if("error"in et)throw et.error;return et.result}default:{const et=create$2(j,GetParsedBlockRpcResult);if("error"in et)throw et.error;return et.result}}}catch(et){throw new SolanaJSONRPCError(et,"failed to get block")}}async getBlockProduction(e){let a,c;if(typeof e=="string")c=e;else if(e){const{commitment:et,...nt}=e;c=et,a=nt}const d=this._buildArgs([],c,"base64",a),h=await this._rpcRequest("getBlockProduction",d),j=create$2(h,BlockProductionResponseStruct);if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get block production information");return j.result}async getTransaction(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgsAtLeastConfirmed([e],c,void 0,d),j=await this._rpcRequest("getTransaction",h),et=create$2(j,GetTransactionRpcResult);if("error"in et)throw new SolanaJSONRPCError(et.error,"failed to get transaction");const nt=et.result;return nt&&{...nt,transaction:{...nt.transaction,message:versionedMessageFromResponse(nt.version,nt.transaction.message)}}}async getParsedTransaction(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=this._buildArgsAtLeastConfirmed([e],c,"jsonParsed",d),j=await this._rpcRequest("getTransaction",h),et=create$2(j,GetParsedTransactionRpcResult);if("error"in et)throw new SolanaJSONRPCError(et.error,"failed to get transaction");return et.result}async getParsedTransactions(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=e.map(nt=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([nt],c,"jsonParsed",d)}));return(await this._rpcBatchRequest(h)).map(nt=>{const st=create$2(nt,GetParsedTransactionRpcResult);if("error"in st)throw new SolanaJSONRPCError(st.error,"failed to get transactions");return st.result})}async getTransactions(e,a){const{commitment:c,config:d}=extractCommitmentFromConfig(a),h=e.map(nt=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([nt],c,void 0,d)}));return(await this._rpcBatchRequest(h)).map(nt=>{const st=create$2(nt,GetTransactionRpcResult);if("error"in st)throw new SolanaJSONRPCError(st.error,"failed to get transactions");const ot=st.result;return ot&&{...ot,transaction:{...ot.transaction,message:versionedMessageFromResponse(ot.version,ot.transaction.message)}}})}async getConfirmedBlock(e,a){const c=this._buildArgsAtLeastConfirmed([e],a),d=await this._rpcRequest("getConfirmedBlock",c),h=create$2(d,GetConfirmedBlockRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get confirmed block");const j=h.result;if(!j)throw new Error("Confirmed block "+e+" not found");const et={...j,transactions:j.transactions.map(({transaction:nt,meta:st})=>{const ot=new Message(nt.message);return{meta:st,transaction:{...nt,message:ot}}})};return{...et,transactions:et.transactions.map(({transaction:nt,meta:st})=>({meta:st,transaction:Transaction.populate(nt.message,nt.signatures)}))}}async getBlocks(e,a,c){const d=this._buildArgsAtLeastConfirmed(a!==void 0?[e,a]:[e],c),h=await this._rpcRequest("getBlocks",d),j=create$2(h,jsonRpcResult$2(array$2(number$2())));if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get blocks");return j.result}async getBlockSignatures(e,a){const c=this._buildArgsAtLeastConfirmed([e],a,void 0,{transactionDetails:"signatures",rewards:!1}),d=await this._rpcRequest("getBlock",c),h=create$2(d,GetBlockSignaturesRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get block");const j=h.result;if(!j)throw new Error("Block "+e+" not found");return j}async getConfirmedBlockSignatures(e,a){const c=this._buildArgsAtLeastConfirmed([e],a,void 0,{transactionDetails:"signatures",rewards:!1}),d=await this._rpcRequest("getConfirmedBlock",c),h=create$2(d,GetBlockSignaturesRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get confirmed block");const j=h.result;if(!j)throw new Error("Confirmed block "+e+" not found");return j}async getConfirmedTransaction(e,a){const c=this._buildArgsAtLeastConfirmed([e],a),d=await this._rpcRequest("getConfirmedTransaction",c),h=create$2(d,GetTransactionRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get transaction");const j=h.result;if(!j)return j;const et=new Message(j.transaction.message),nt=j.transaction.signatures;return{...j,transaction:Transaction.populate(et,nt)}}async getParsedConfirmedTransaction(e,a){const c=this._buildArgsAtLeastConfirmed([e],a,"jsonParsed"),d=await this._rpcRequest("getConfirmedTransaction",c),h=create$2(d,GetParsedTransactionRpcResult);if("error"in h)throw new SolanaJSONRPCError(h.error,"failed to get confirmed transaction");return h.result}async getParsedConfirmedTransactions(e,a){const c=e.map(j=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([j],a,"jsonParsed")}));return(await this._rpcBatchRequest(c)).map(j=>{const et=create$2(j,GetParsedTransactionRpcResult);if("error"in et)throw new SolanaJSONRPCError(et.error,"failed to get confirmed transactions");return et.result})}async getConfirmedSignaturesForAddress(e,a,c){let d={},h=await this.getFirstAvailableBlock();for(;!("until"in d)&&(a--,!(a<=0||a0&&(d.until=nt.signatures[nt.signatures.length-1].toString())}catch(nt){if(nt instanceof Error&&nt.message.includes("skipped"))continue;throw nt}let j=await this.getSlot("finalized");for(;!("before"in d)&&(c++,!(c>j));)try{const nt=await this.getConfirmedBlockSignatures(c);nt.signatures.length>0&&(d.before=nt.signatures[nt.signatures.length-1].toString())}catch(nt){if(nt instanceof Error&&nt.message.includes("skipped"))continue;throw nt}return(await this.getConfirmedSignaturesForAddress2(e,d)).map(nt=>nt.signature)}async getConfirmedSignaturesForAddress2(e,a,c){const d=this._buildArgsAtLeastConfirmed([e.toBase58()],c,void 0,a),h=await this._rpcRequest("getConfirmedSignaturesForAddress2",d),j=create$2(h,GetConfirmedSignaturesForAddress2RpcResult);if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get confirmed signatures for address");return j.result}async getSignaturesForAddress(e,a,c){const d=this._buildArgsAtLeastConfirmed([e.toBase58()],c,void 0,a),h=await this._rpcRequest("getSignaturesForAddress",d),j=create$2(h,GetSignaturesForAddressRpcResult);if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get signatures for address");return j.result}async getAddressLookupTable(e,a){const{context:c,value:d}=await this.getAccountInfoAndContext(e,a);let h=null;return d!==null&&(h=new AddressLookupTableAccount({key:e,state:AddressLookupTableAccount.deserialize(d.data)})),{context:c,value:h}}async getNonceAndContext(e,a){const{context:c,value:d}=await this.getAccountInfoAndContext(e,a);let h=null;return d!==null&&(h=NonceAccount.fromAccountData(d.data)),{context:c,value:h}}async getNonce(e,a){return await this.getNonceAndContext(e,a).then(c=>c.value).catch(c=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+c)})}async requestAirdrop(e,a){const c=await this._rpcRequest("requestAirdrop",[e.toBase58(),a]),d=create$2(c,RequestAirdropRpcResult);if("error"in d)throw new SolanaJSONRPCError(d.error,`airdrop to ${e.toBase58()} failed`);return d.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await sleep(100);const c=Date.now()-this._blockhashInfo.lastFetch>=BLOCKHASH_CACHE_TIMEOUT_MS;if(this._blockhashInfo.latestBlockhash!==null&&!c)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now(),a=this._blockhashInfo.latestBlockhash,c=a?a.blockhash:null;for(let d=0;d<50;d++){const h=await this.getLatestBlockhash("finalized");if(c!==h.blockhash)return this._blockhashInfo={latestBlockhash:h,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},h;await sleep(MS_PER_SLOT/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){const{commitment:a,config:c}=extractCommitmentFromConfig(e),d=this._buildArgs([],a,"base64",c),h=await this._rpcRequest("getStakeMinimumDelegation",d),j=create$2(h,jsonRpcResultAndContext$2(number$2()));if("error"in j)throw new SolanaJSONRPCError(j.error,"failed to get stake minimum delegation");return j.result}async simulateTransaction(e,a,c){if("message"in e){const wt=e.serialize(),St=Buffer$1$1.from(wt).toString("base64");if(Array.isArray(a)||c!==void 0)throw new Error("Invalid arguments");const _t=a||{};_t.encoding="base64","commitment"in _t||(_t.commitment=this.commitment),a&&typeof a=="object"&&"innerInstructions"in a&&(_t.innerInstructions=a.innerInstructions);const mt=[St,_t],bt=await this._rpcRequest("simulateTransaction",mt),$t=create$2(bt,SimulatedTransactionResponseStruct$1);if("error"in $t)throw new Error("failed to simulate transaction: "+$t.error.message);return $t.result}let d;if(e instanceof Transaction){let gt=e;d=new Transaction,d.feePayer=gt.feePayer,d.instructions=e.instructions,d.nonceInfo=gt.nonceInfo,d.signatures=gt.signatures}else d=Transaction.populate(e),d._message=d._json=void 0;if(a!==void 0&&!Array.isArray(a))throw new Error("Invalid arguments");const h=a;if(d.nonceInfo&&h)d.sign(...h);else{let gt=this._disableBlockhashCaching;for(;;){const wt=await this._blockhashWithExpiryBlockHeight(gt);if(d.lastValidBlockHeight=wt.lastValidBlockHeight,d.recentBlockhash=wt.blockhash,!h)break;if(d.sign(...h),!d.signature)throw new Error("!signature");const St=d.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(St)&&!this._blockhashInfo.transactionSignatures.includes(St)){this._blockhashInfo.simulatedSignatures.push(St);break}else gt=!0}}const j=d._compile(),et=j.serialize(),st=d._serialize(et).toString("base64"),ot={encoding:"base64",commitment:this.commitment};if(c){const gt=(Array.isArray(c)?c:j.nonProgramIds()).map(wt=>wt.toBase58());ot.accounts={encoding:"base64",addresses:gt}}h&&(ot.sigVerify=!0),a&&typeof a=="object"&&"innerInstructions"in a&&(ot.innerInstructions=a.innerInstructions);const ht=[st,ot],pt=await this._rpcRequest("simulateTransaction",ht),dt=create$2(pt,SimulatedTransactionResponseStruct$1);if("error"in dt){let gt;if("data"in dt.error&&(gt=dt.error.data.logs,gt&&Array.isArray(gt))){const wt=` + `,St=wt+gt.join(wt);console.error(dt.error.message,St)}throw new SendTransactionError({action:"simulate",signature:"",transactionMessage:dt.error.message,logs:gt})}return dt.result}async sendTransaction(e,a,c){if("version"in e){if(a&&Array.isArray(a))throw new Error("Invalid arguments");const j=e.serialize();return await this.sendRawTransaction(j,a)}if(a===void 0||!Array.isArray(a))throw new Error("Invalid arguments");const d=a;if(e.nonceInfo)e.sign(...d);else{let j=this._disableBlockhashCaching;for(;;){const et=await this._blockhashWithExpiryBlockHeight(j);if(e.lastValidBlockHeight=et.lastValidBlockHeight,e.recentBlockhash=et.blockhash,e.sign(...d),!e.signature)throw new Error("!signature");const nt=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(nt))j=!0;else{this._blockhashInfo.transactionSignatures.push(nt);break}}}const h=e.serialize();return await this.sendRawTransaction(h,c)}async sendRawTransaction(e,a){const c=toBuffer$3(e).toString("base64");return await this.sendEncodedTransaction(c,a)}async sendEncodedTransaction(e,a){const c={encoding:"base64"},d=a&&a.skipPreflight,h=d===!0?"processed":a&&a.preflightCommitment||this.commitment;a&&a.maxRetries!=null&&(c.maxRetries=a.maxRetries),a&&a.minContextSlot!=null&&(c.minContextSlot=a.minContextSlot),d&&(c.skipPreflight=d),h&&(c.preflightCommitment=h);const j=[e,c],et=await this._rpcRequest("sendTransaction",j),nt=create$2(et,SendTransactionRpcResult);if("error"in nt){let st;throw"data"in nt.error&&(st=nt.error.data.logs),new SendTransactionError({action:d?"send":"simulate",signature:"",transactionMessage:nt.error.message,logs:st})}return nt.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){if(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),e===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([a,c])=>{this._setSubscription(a,{...c,state:"pending"})})}_setSubscription(e,a){var d;const c=(d=this._subscriptionsByHash[e])==null?void 0:d.state;if(this._subscriptionsByHash[e]=a,c!==a.state){const h=this._subscriptionStateChangeCallbacksByHash[e];h&&h.forEach(j=>{try{j(a.state)}catch{}})}}_onSubscriptionStateChange(e,a){var h;const c=this._subscriptionHashByClientSubscriptionId[e];if(c==null)return()=>{};const d=(h=this._subscriptionStateChangeCallbacksByHash)[c]||(h[c]=new Set);return d.add(a),()=>{d.delete(a),d.size===0&&delete this._subscriptionStateChangeCallbacksByHash[c]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(c){c instanceof Error&&console.log(`Error when closing socket connection: ${c.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}const e=this._rpcWebSocketGeneration,a=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async c=>{const d=this._subscriptionsByHash[c];if(d!==void 0)switch(d.state){case"pending":case"unsubscribed":if(d.callbacks.size===0){delete this._subscriptionsByHash[c],d.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[d.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{const{args:h,method:j}=d;try{this._setSubscription(c,{...d,state:"subscribing"});const et=await this._rpcWebSocket.call(j,h);this._setSubscription(c,{...d,serverSubscriptionId:et,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[et]=d.callbacks,await this._updateSubscriptions()}catch(et){if(console.error(`Received ${et instanceof Error?"":"JSON-RPC "}error calling \`${j}\``,{args:h,error:et}),!a())return;this._setSubscription(c,{...d,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":d.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:h,unsubscribeMethod:j}=d;if(this._subscriptionsAutoDisposedByRpc.has(h))this._subscriptionsAutoDisposedByRpc.delete(h);else{this._setSubscription(c,{...d,state:"unsubscribing"}),this._setSubscription(c,{...d,state:"unsubscribing"});try{await this._rpcWebSocket.call(j,[h])}catch(et){if(et instanceof Error&&console.error(`${j} error:`,et.message),!a())return;this._setSubscription(c,{...d,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(c,{...d,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(e,a){const c=this._subscriptionCallbacksByServerSubscriptionId[e];c!==void 0&&c.forEach(d=>{try{d(...a)}catch(h){console.error(h)}})}_wsOnAccountNotification(e){const{result:a,subscription:c}=create$2(e,AccountNotificationResult);this._handleServerNotification(c,[a.value,a.context])}_makeSubscription(e,a){const c=this._nextClientSubscriptionId++,d=fastStableStringify([e.method,a]),h=this._subscriptionsByHash[d];return h===void 0?this._subscriptionsByHash[d]={...e,args:a,callbacks:new Set([e.callback]),state:"pending"}:h.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[c]=d,this._subscriptionDisposeFunctionsByClientSubscriptionId[c]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[c],delete this._subscriptionHashByClientSubscriptionId[c];const j=this._subscriptionsByHash[d];assert$m(j!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${c}`),j.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),c}onAccountChange(e,a,c){const{commitment:d,config:h}=extractCommitmentFromConfig(c),j=this._buildArgs([e.toBase58()],d||this._commitment||"finalized","base64",h);return this._makeSubscription({callback:a,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},j)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){const{result:a,subscription:c}=create$2(e,ProgramAccountNotificationResult);this._handleServerNotification(c,[{accountId:a.value.pubkey,accountInfo:a.value.account},a.context])}onProgramAccountChange(e,a,c,d){const{commitment:h,config:j}=extractCommitmentFromConfig(c),et=this._buildArgs([e.toBase58()],h||this._commitment||"finalized","base64",j||(d?{filters:applyDefaultMemcmpEncodingToFilters(d)}:void 0));return this._makeSubscription({callback:a,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},et)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,a,c){const d=this._buildArgs([typeof e=="object"?{mentions:[e.toString()]}:e],c||this._commitment||"finalized");return this._makeSubscription({callback:a,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},d)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){const{result:a,subscription:c}=create$2(e,LogsNotificationResult);this._handleServerNotification(c,[a.value,a.context])}_wsOnSlotNotification(e){const{result:a,subscription:c}=create$2(e,SlotNotificationResult);this._handleServerNotification(c,[a])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){const{result:a,subscription:c}=create$2(e,SlotUpdateNotificationResult);this._handleServerNotification(c,[a])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,a){const c=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];c?await c():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${a}' events could not be found.`)}_buildArgs(e,a,c,d){const h=a||this._commitment;if(h||c||d){let j={};c&&(j.encoding=c),h&&(j.commitment=h),d&&(j=Object.assign(j,d)),e.push(j)}return e}_buildArgsAtLeastConfirmed(e,a,c,d){const h=a||this._commitment;if(h&&!["confirmed","finalized"].includes(h))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,a,c,d)}_wsOnSignatureNotification(e){const{result:a,subscription:c}=create$2(e,SignatureNotificationResult);a.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(c),this._handleServerNotification(c,a.value==="receivedSignature"?[{type:"received"},a.context]:[{type:"status",result:a.value},a.context])}onSignature(e,a,c){const d=this._buildArgs([e],c||this._commitment||"finalized"),h=this._makeSubscription({callback:(j,et)=>{if(j.type==="status"){a(j.result,et);try{this.removeSignatureListener(h)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},d);return h}onSignatureWithOptions(e,a,c){const{commitment:d,...h}={...c,commitment:c&&c.commitment||this._commitment||"finalized"},j=this._buildArgs([e],d,void 0,h),et=this._makeSubscription({callback:(nt,st)=>{a(nt,st);try{this.removeSignatureListener(et)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},j);return et}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){const{result:a,subscription:c}=create$2(e,RootNotificationResult);this._handleServerNotification(c,[a])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}}class Keypair{constructor(e){this._keypair=void 0,this._keypair=e??generateKeypair()}static generate(){return new Keypair(generateKeypair())}static fromSecretKey(e,a){if(e.byteLength!==64)throw new Error("bad secret key size");const c=e.slice(32,64);if(!a||!a.skipValidation){const d=e.slice(0,32),h=getPublicKey(d);for(let j=0;j<32;j++)if(c[j]!==h[j])throw new Error("provided secretKey is invalid")}return new Keypair({publicKey:c,secretKey:e})}static fromSeed(e){const a=getPublicKey(e),c=new Uint8Array(64);return c.set(e),c.set(a,32),new Keypair({publicKey:a,secretKey:c})}get publicKey(){return new PublicKey$1(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const LOOKUP_TABLE_INSTRUCTION_LAYOUTS=Object.freeze({CreateLookupTable:{index:0,layout:struct$2([u32$2("instruction"),u64$3("recentSlot"),u8$2("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct$2([u32$2("instruction")])},ExtendLookupTable:{index:2,layout:struct$2([u32$2("instruction"),u64$3(),seq(publicKey$5(),offset$2(u32$2(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct$2([u32$2("instruction")])},CloseLookupTable:{index:4,layout:struct$2([u32$2("instruction")])}});class AddressLookupTableInstruction{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const c=u32$2("instruction").decode(e.data);let d;for(const[h,j]of Object.entries(LOOKUP_TABLE_INSTRUCTION_LAYOUTS))if(j.index==c){d=h;break}if(!d)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return d}static decodeCreateLookupTable(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);const{recentSlot:a}=decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable,e.data);return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(a)}}static decodeExtendLookupTable(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error(`invalid instruction; found ${e.keys.length} keys, expected at least 2`);const{addresses:a}=decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable,e.data);return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:a.map(c=>new PublicKey$1(c))}}static decodeCloseLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}static decodeFreezeLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static decodeDeactivateLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(AddressLookupTableProgram.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(e,a){if(e.lengthh.toBytes())}),d=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&d.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:SystemProgram.programId,isSigner:!1,isWritable:!1}),new TransactionInstruction({programId:this.programId,keys:d,data:c})}static deactivateLookupTable(e){const a=LOOKUP_TABLE_INSTRUCTION_LAYOUTS.DeactivateLookupTable,c=encodeData(a),d=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new TransactionInstruction({programId:this.programId,keys:d,data:c})}static closeLookupTable(e){const a=LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CloseLookupTable,c=encodeData(a),d=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new TransactionInstruction({programId:this.programId,keys:d,data:c})}}AddressLookupTableProgram.programId=new PublicKey$1("AddressLookupTab1e1111111111111111111111111");class ComputeBudgetInstruction{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const c=u8$2("instruction").decode(e.data);let d;for(const[h,j]of Object.entries(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS))if(j.index==c){d=h;break}if(!d)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return d}static decodeRequestUnits(e){this.checkProgramId(e.programId);const{units:a,additionalFee:c}=decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits,e.data);return{units:a,additionalFee:c}}static decodeRequestHeapFrame(e){this.checkProgramId(e.programId);const{bytes:a}=decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame,e.data);return{bytes:a}}static decodeSetComputeUnitLimit(e){this.checkProgramId(e.programId);const{units:a}=decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit,e.data);return{units:a}}static decodeSetComputeUnitPrice(e){this.checkProgramId(e.programId);const{microLamports:a}=decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice,e.data);return{microLamports:a}}static checkProgramId(e){if(!e.equals(ComputeBudgetProgram.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const COMPUTE_BUDGET_INSTRUCTION_LAYOUTS=Object.freeze({RequestUnits:{index:0,layout:struct$2([u8$2("instruction"),u32$2("units"),u32$2("additionalFee")])},RequestHeapFrame:{index:1,layout:struct$2([u8$2("instruction"),u32$2("bytes")])},SetComputeUnitLimit:{index:2,layout:struct$2([u8$2("instruction"),u32$2("units")])},SetComputeUnitPrice:{index:3,layout:struct$2([u8$2("instruction"),u64$3("microLamports")])}});class ComputeBudgetProgram{constructor(){}static requestUnits(e){const a=COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits,c=encodeData(a,e);return new TransactionInstruction({keys:[],programId:this.programId,data:c})}static requestHeapFrame(e){const a=COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame,c=encodeData(a,e);return new TransactionInstruction({keys:[],programId:this.programId,data:c})}static setComputeUnitLimit(e){const a=COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit,c=encodeData(a,e);return new TransactionInstruction({keys:[],programId:this.programId,data:c})}static setComputeUnitPrice(e){const a=COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice,c=encodeData(a,{microLamports:BigInt(e.microLamports)});return new TransactionInstruction({keys:[],programId:this.programId,data:c})}}ComputeBudgetProgram.programId=new PublicKey$1("ComputeBudget111111111111111111111111111111");const PRIVATE_KEY_BYTES$1=64,PUBLIC_KEY_BYTES$1=32,SIGNATURE_BYTES=64,ED25519_INSTRUCTION_LAYOUT=struct$2([u8$2("numSignatures"),u8$2("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);class Ed25519Program{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:a,message:c,signature:d,instructionIndex:h}=e;assert$m(a.length===PUBLIC_KEY_BYTES$1,`Public Key must be ${PUBLIC_KEY_BYTES$1} bytes but received ${a.length} bytes`),assert$m(d.length===SIGNATURE_BYTES,`Signature must be ${SIGNATURE_BYTES} bytes but received ${d.length} bytes`);const j=ED25519_INSTRUCTION_LAYOUT.span,et=j+a.length,nt=et+d.length,st=1,ot=Buffer$1$1.alloc(nt+c.length),ht=h??65535;return ED25519_INSTRUCTION_LAYOUT.encode({numSignatures:st,padding:0,signatureOffset:et,signatureInstructionIndex:ht,publicKeyOffset:j,publicKeyInstructionIndex:ht,messageDataOffset:nt,messageDataSize:c.length,messageInstructionIndex:ht},ot),ot.fill(a,j),ot.fill(d,et),ot.fill(c,nt),new TransactionInstruction({keys:[],programId:Ed25519Program.programId,data:ot})}static createInstructionWithPrivateKey(e){const{privateKey:a,message:c,instructionIndex:d}=e;assert$m(a.length===PRIVATE_KEY_BYTES$1,`Private key must be ${PRIVATE_KEY_BYTES$1} bytes but received ${a.length} bytes`);try{const h=Keypair.fromSecretKey(a),j=h.publicKey.toBytes(),et=sign$1(c,h.secretKey);return this.createInstructionWithPublicKey({publicKey:j,message:c,signature:et,instructionIndex:d})}catch(h){throw new Error(`Error creating instruction; ${h}`)}}}Ed25519Program.programId=new PublicKey$1("Ed25519SigVerify111111111111111111111111111");const ecdsaSign=(o,e)=>{const a=secp256k1$1.sign(o,e);return[a.toCompactRawBytes(),a.recovery]};secp256k1$1.utils.isValidPrivateKey;const publicKeyCreate=secp256k1$1.getPublicKey,PRIVATE_KEY_BYTES=32,ETHEREUM_ADDRESS_BYTES=20,PUBLIC_KEY_BYTES=64,SIGNATURE_OFFSETS_SERIALIZED_SIZE=11,SECP256K1_INSTRUCTION_LAYOUT=struct$2([u8$2("numSignatures"),u16("signatureOffset"),u8$2("signatureInstructionIndex"),u16("ethAddressOffset"),u8$2("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8$2("messageInstructionIndex"),blob$2(20,"ethAddress"),blob$2(64,"signature"),u8$2("recoveryId")]);class Secp256k1Program{constructor(){}static publicKeyToEthAddress(e){assert$m(e.length===PUBLIC_KEY_BYTES,`Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${e.length} bytes`);try{return Buffer$1$1.from(keccak_256(toBuffer$3(e))).slice(-ETHEREUM_ADDRESS_BYTES)}catch(a){throw new Error(`Error constructing Ethereum address: ${a}`)}}static createInstructionWithPublicKey(e){const{publicKey:a,message:c,signature:d,recoveryId:h,instructionIndex:j}=e;return Secp256k1Program.createInstructionWithEthAddress({ethAddress:Secp256k1Program.publicKeyToEthAddress(a),message:c,signature:d,recoveryId:h,instructionIndex:j})}static createInstructionWithEthAddress(e){const{ethAddress:a,message:c,signature:d,recoveryId:h,instructionIndex:j=0}=e;let et;typeof a=="string"?a.startsWith("0x")?et=Buffer$1$1.from(a.substr(2),"hex"):et=Buffer$1$1.from(a,"hex"):et=a,assert$m(et.length===ETHEREUM_ADDRESS_BYTES,`Address must be ${ETHEREUM_ADDRESS_BYTES} bytes but received ${et.length} bytes`);const nt=1+SIGNATURE_OFFSETS_SERIALIZED_SIZE,st=nt,ot=nt+et.length,ht=ot+d.length+1,pt=1,dt=Buffer$1$1.alloc(SECP256K1_INSTRUCTION_LAYOUT.span+c.length);return SECP256K1_INSTRUCTION_LAYOUT.encode({numSignatures:pt,signatureOffset:ot,signatureInstructionIndex:j,ethAddressOffset:st,ethAddressInstructionIndex:j,messageDataOffset:ht,messageDataSize:c.length,messageInstructionIndex:j,signature:toBuffer$3(d),ethAddress:toBuffer$3(et),recoveryId:h},dt),dt.fill(toBuffer$3(c),SECP256K1_INSTRUCTION_LAYOUT.span),new TransactionInstruction({keys:[],programId:Secp256k1Program.programId,data:dt})}static createInstructionWithPrivateKey(e){const{privateKey:a,message:c,instructionIndex:d}=e;assert$m(a.length===PRIVATE_KEY_BYTES,`Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${a.length} bytes`);try{const h=toBuffer$3(a),j=publicKeyCreate(h,!1).slice(1),et=Buffer$1$1.from(keccak_256(toBuffer$3(c))),[nt,st]=ecdsaSign(et,h);return this.createInstructionWithPublicKey({publicKey:j,message:c,signature:nt,recoveryId:st,instructionIndex:d})}catch(h){throw new Error(`Error creating instruction; ${h}`)}}}Secp256k1Program.programId=new PublicKey$1("KeccakSecp256k11111111111111111111111111111");var _Lockup;const STAKE_CONFIG_ID=new PublicKey$1("StakeConfig11111111111111111111111111111111");class Authorized{constructor(e,a){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=a}}class Lockup{constructor(e,a,c){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=a,this.custodian=c}}_Lockup=Lockup;Lockup.default=new _Lockup(0,0,PublicKey$1.default);class StakeInstruction{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const c=u32$2("instruction").decode(e.data);let d;for(const[h,j]of Object.entries(STAKE_INSTRUCTION_LAYOUTS))if(j.index==c){d=h;break}if(!d)throw new Error("Instruction type incorrect; not a StakeInstruction");return d}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:a,lockup:c}=decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new Authorized(new PublicKey$1(a.staker),new PublicKey$1(a.withdrawer)),lockup:new Lockup(c.unixTimestamp,c.epoch,new PublicKey$1(c.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:a,stakeAuthorizationType:c}=decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Authorize,e.data),d={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new PublicKey$1(a),stakeAuthorizationType:{index:c}};return e.keys.length>3&&(d.custodianPubkey=e.keys[3].pubkey),d}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:a,stakeAuthorizationType:c,authoritySeed:d,authorityOwner:h}=decodeData$1(STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed,e.data),j={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:d,authorityOwner:new PublicKey$1(h),newAuthorizedPubkey:new PublicKey$1(a),stakeAuthorizationType:{index:c}};return e.keys.length>3&&(j.custodianPubkey=e.keys[3].pubkey),j}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:a}=decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Split,e.data);return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:a}}static decodeMerge(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:a}=decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Withdraw,e.data),c={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:a};return e.keys.length>5&&(c.custodianPubkey=e.keys[5].pubkey),c}static decodeDeactivate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(StakeProgram.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,a){if(e.length0&&st.add(SystemProgram.transfer({fromPubkey:e.authorizedPubkey,toPubkey:h,lamports:a})),st.add(this.splitInstruction({stakePubkey:c,authorizedPubkey:d,splitStakePubkey:h,lamports:nt}))}static merge(e){const{stakePubkey:a,sourceStakePubKey:c,authorizedPubkey:d}=e,h=STAKE_INSTRUCTION_LAYOUTS.Merge,j=encodeData(h);return new Transaction().add({keys:[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:SYSVAR_STAKE_HISTORY_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:d,isSigner:!0,isWritable:!1}],programId:this.programId,data:j})}static withdraw(e){const{stakePubkey:a,authorizedPubkey:c,toPubkey:d,lamports:h,custodianPubkey:j}=e,et=STAKE_INSTRUCTION_LAYOUTS.Withdraw,nt=encodeData(et,{lamports:h}),st=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!0},{pubkey:SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:SYSVAR_STAKE_HISTORY_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!0,isWritable:!1}];return j&&st.push({pubkey:j,isSigner:!0,isWritable:!1}),new Transaction().add({keys:st,programId:this.programId,data:nt})}static deactivate(e){const{stakePubkey:a,authorizedPubkey:c}=e,d=STAKE_INSTRUCTION_LAYOUTS.Deactivate,h=encodeData(d);return new Transaction().add({keys:[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1},{pubkey:c,isSigner:!0,isWritable:!1}],programId:this.programId,data:h})}}StakeProgram.programId=new PublicKey$1("Stake11111111111111111111111111111111111111");StakeProgram.space=200;class VoteInit{constructor(e,a,c,d){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=a,this.authorizedWithdrawer=c,this.commission=d}}class VoteInstruction{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const c=u32$2("instruction").decode(e.data);let d;for(const[h,j]of Object.entries(VOTE_INSTRUCTION_LAYOUTS))if(j.index==c){d=h;break}if(!d)throw new Error("Instruction type incorrect; not a VoteInstruction");return d}static decodeInitializeAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);const{voteInit:a}=decodeData$1(VOTE_INSTRUCTION_LAYOUTS.InitializeAccount,e.data);return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new VoteInit(new PublicKey$1(a.nodePubkey),new PublicKey$1(a.authorizedVoter),new PublicKey$1(a.authorizedWithdrawer),a.commission)}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:a,voteAuthorizationType:c}=decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Authorize,e.data);return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new PublicKey$1(a),voteAuthorizationType:{index:c}}}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:a,currentAuthorityDerivedKeySeed:c,newAuthorized:d,voteAuthorizationType:h}}=decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed,e.data);return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new PublicKey$1(a),currentAuthorityDerivedKeySeed:c,newAuthorizedPubkey:new PublicKey$1(d),voteAuthorizationType:{index:h},votePubkey:e.keys[0].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:a}=decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Withdraw,e.data);return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:a,toPubkey:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(VoteProgram.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(e,a){if(e.lengtha-c)throw new Error("Withdraw will leave vote account with insufficient funds.");return VoteProgram.withdraw(e)}static updateValidatorIdentity(e){const{votePubkey:a,authorizedWithdrawerPubkey:c,nodePubkey:d}=e,h=VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity,j=encodeData(h),et=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!0,isWritable:!1},{pubkey:c,isSigner:!0,isWritable:!1}];return new Transaction().add({keys:et,programId:this.programId,data:j})}}VoteProgram.programId=new PublicKey$1("Vote111111111111111111111111111111111111111");VoteProgram.space=3762;const VALIDATOR_INFO_KEY=new PublicKey$1("Va1idator1nfo111111111111111111111111111111"),InfoString=type$3({name:string$2(),website:optional$2(string$2()),details:optional$2(string$2()),iconUrl:optional$2(string$2()),keybaseUsername:optional$2(string$2())});class ValidatorInfo{constructor(e,a){this.key=void 0,this.info=void 0,this.key=e,this.info=a}static fromConfigData(e){let a=[...e];if(decodeLength(a)!==2)return null;const d=[];for(let h=0;h<2;h++){const j=new PublicKey$1(guardedSplice(a,0,PUBLIC_KEY_LENGTH)),et=guardedShift(a)===1;d.push({publicKey:j,isSigner:et})}if(d[0].publicKey.equals(VALIDATOR_INFO_KEY)&&d[1].isSigner){const h=rustString().decode(Buffer$1$1.from(a)),j=JSON.parse(h);return assert$n(j,InfoString),new ValidatorInfo(d[1].publicKey,j)}return null}}const VOTE_PROGRAM_ID=new PublicKey$1("Vote111111111111111111111111111111111111111"),VoteAccountLayout=struct$2([publicKey$5("nodePubkey"),publicKey$5("authorizedWithdrawer"),u8$2("commission"),nu64$2(),seq(struct$2([nu64$2("slot"),u32$2("confirmationCount")]),offset$2(u32$2(),-8),"votes"),u8$2("rootSlotValid"),nu64$2("rootSlot"),nu64$2(),seq(struct$2([nu64$2("epoch"),publicKey$5("authorizedVoter")]),offset$2(u32$2(),-8),"authorizedVoters"),struct$2([seq(struct$2([publicKey$5("authorizedPubkey"),nu64$2("epochOfLastAuthorizedSwitch"),nu64$2("targetEpoch")]),32,"buf"),nu64$2("idx"),u8$2("isEmpty")],"priorVoters"),nu64$2(),seq(struct$2([nu64$2("epoch"),nu64$2("credits"),nu64$2("prevCredits")]),offset$2(u32$2(),-8),"epochCredits"),struct$2([nu64$2("slot"),nu64$2("timestamp")],"lastTimestamp")]);class VoteAccount{constructor(e){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){const c=VoteAccountLayout.decode(toBuffer$3(e),4);let d=c.rootSlot;return c.rootSlotValid||(d=null),new VoteAccount({nodePubkey:new PublicKey$1(c.nodePubkey),authorizedWithdrawer:new PublicKey$1(c.authorizedWithdrawer),commission:c.commission,votes:c.votes,rootSlot:d,authorizedVoters:c.authorizedVoters.map(parseAuthorizedVoter),priorVoters:getPriorVoters(c.priorVoters),epochCredits:c.epochCredits,lastTimestamp:c.lastTimestamp})}}function parseAuthorizedVoter({authorizedVoter:o,epoch:e}){return{epoch:e,authorizedVoter:new PublicKey$1(o)}}function parsePriorVoters({authorizedPubkey:o,epochOfLastAuthorizedSwitch:e,targetEpoch:a}){return{authorizedPubkey:new PublicKey$1(o),epochOfLastAuthorizedSwitch:e,targetEpoch:a}}function getPriorVoters({buf:o,idx:e,isEmpty:a}){return a?[]:[...o.slice(e+1).map(parsePriorVoters),...o.slice(0,e).map(parsePriorVoters)]}const endpoint={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function clusterApiUrl(o,e){const a=e===!1?"http":"https";if(!o)return endpoint[a].devnet;const c=endpoint[a][o];if(!c)throw new Error(`Unknown ${a} cluster: ${o}`);return c}async function sendAndConfirmRawTransaction$1(o,e,a,c){let d,h;a&&Object.prototype.hasOwnProperty.call(a,"lastValidBlockHeight")||a&&Object.prototype.hasOwnProperty.call(a,"nonceValue")?(d=a,h=c):h=a;const j=h&&{skipPreflight:h.skipPreflight,preflightCommitment:h.preflightCommitment||h.commitment,minContextSlot:h.minContextSlot},et=await o.sendRawTransaction(e,j),nt=h&&h.commitment,ot=(await(d?o.confirmTransaction(d,nt):o.confirmTransaction(et,nt))).value;if(ot.err)throw et!=null?new SendTransactionError({action:j!=null&&j.skipPreflight?"send":"simulate",signature:et,transactionMessage:`Status: (${JSON.stringify(ot)})`}):new Error(`Raw transaction ${et} failed (${JSON.stringify(ot)})`);return et}const LAMPORTS_PER_SOL=1e9,index_browser_esm=Object.freeze(Object.defineProperty({__proto__:null,Account,AddressLookupTableAccount,AddressLookupTableInstruction,AddressLookupTableProgram,Authorized,BLOCKHASH_CACHE_TIMEOUT_MS,BPF_LOADER_DEPRECATED_PROGRAM_ID,BPF_LOADER_PROGRAM_ID,BpfLoader,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS,ComputeBudgetInstruction,ComputeBudgetProgram,Connection,Ed25519Program,Enum,EpochSchedule,FeeCalculatorLayout,Keypair,LAMPORTS_PER_SOL,LOOKUP_TABLE_INSTRUCTION_LAYOUTS,Loader,Lockup,MAX_SEED_LENGTH,Message,MessageAccountKeys,MessageV0,NONCE_ACCOUNT_LENGTH,NonceAccount,PACKET_DATA_SIZE,PUBLIC_KEY_LENGTH,PublicKey:PublicKey$1,SIGNATURE_LENGTH_IN_BYTES,SOLANA_SCHEMA,STAKE_CONFIG_ID,STAKE_INSTRUCTION_LAYOUTS,SYSTEM_INSTRUCTION_LAYOUTS,SYSVAR_CLOCK_PUBKEY,SYSVAR_EPOCH_SCHEDULE_PUBKEY,SYSVAR_INSTRUCTIONS_PUBKEY,SYSVAR_RECENT_BLOCKHASHES_PUBKEY,SYSVAR_RENT_PUBKEY,SYSVAR_REWARDS_PUBKEY,SYSVAR_SLOT_HASHES_PUBKEY,SYSVAR_SLOT_HISTORY_PUBKEY,SYSVAR_STAKE_HISTORY_PUBKEY,Secp256k1Program,SendTransactionError,SolanaJSONRPCError,SolanaJSONRPCErrorCode,StakeAuthorizationLayout,StakeInstruction,StakeProgram,Struct:Struct$2,SystemInstruction,SystemProgram,Transaction,TransactionExpiredBlockheightExceededError,TransactionExpiredNonceInvalidError,TransactionExpiredTimeoutError,TransactionInstruction,TransactionMessage,TransactionStatus,VALIDATOR_INFO_KEY,VERSION_PREFIX_MASK,VOTE_PROGRAM_ID,ValidatorInfo,VersionedMessage,VersionedTransaction,VoteAccount,VoteAuthorizationLayout,VoteInit,VoteInstruction,VoteProgram,clusterApiUrl,sendAndConfirmRawTransaction:sendAndConfirmRawTransaction$1,sendAndConfirmTransaction},Symbol.toStringTag,{value:"Module"})),ConnectionContext=reactExports.createContext({});function useConnection(){return reactExports.useContext(ConnectionContext)}const ConnectionProvider=({children:o,endpoint:e,config:a={commitment:"confirmed"}})=>{const c=reactExports.useMemo(()=>new Connection(e,a),[e,a]);return React.createElement(ConnectionContext.Provider,{value:{connection:c}},o)};var eventemitter3={exports:{}};(function(o){var e=Object.prototype.hasOwnProperty,a="~";function c(){}Object.create&&(c.prototype=Object.create(null),new c().__proto__||(a=!1));function d(nt,st,ot){this.fn=nt,this.context=st,this.once=ot||!1}function h(nt,st,ot,ht,pt){if(typeof ot!="function")throw new TypeError("The listener must be a function");var dt=new d(ot,ht||nt,pt),gt=a?a+st:st;return nt._events[gt]?nt._events[gt].fn?nt._events[gt]=[nt._events[gt],dt]:nt._events[gt].push(dt):(nt._events[gt]=dt,nt._eventsCount++),nt}function j(nt,st){--nt._eventsCount===0?nt._events=new c:delete nt._events[st]}function et(){this._events=new c,this._eventsCount=0}et.prototype.eventNames=function(){var st=[],ot,ht;if(this._eventsCount===0)return st;for(ht in ot=this._events)e.call(ot,ht)&&st.push(a?ht.slice(1):ht);return Object.getOwnPropertySymbols?st.concat(Object.getOwnPropertySymbols(ot)):st},et.prototype.listeners=function(st){var ot=a?a+st:st,ht=this._events[ot];if(!ht)return[];if(ht.fn)return[ht.fn];for(var pt=0,dt=ht.length,gt=new Array(dt);pt"u"||typeof document>"u")return;const e=[];function a(){if(o())for(const h of e)h()}const c=setInterval(a,1e3);e.push(()=>clearInterval(c)),document.readyState==="loading"&&(document.addEventListener("DOMContentLoaded",a,{once:!0}),e.push(()=>document.removeEventListener("DOMContentLoaded",a))),document.readyState!=="complete"&&(window.addEventListener("load",a,{once:!0}),e.push(()=>window.removeEventListener("load",a))),a()}function isIosAndRedirectable(){if(!navigator)return!1;const o=navigator.userAgent.toLowerCase(),e=o.includes("iphone")||o.includes("ipad"),a=o.includes("safari");return e&&a}function isVersionedTransaction$2(o){return"version"in o}class BaseSignerWalletAdapter extends BaseWalletAdapter{async sendTransaction(e,a,c={}){let d=!0;try{if(isVersionedTransaction$2(e)){if(!this.supportedTransactionVersions)throw new WalletSendTransactionError("Sending versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(e.version))throw new WalletSendTransactionError(`Sending transaction version ${e.version} isn't supported by this wallet`);try{e=await this.signTransaction(e);const h=e.serialize();return await a.sendRawTransaction(h,c)}catch(h){throw h instanceof WalletSignTransactionError?(d=!1,h):new WalletSendTransactionError(h==null?void 0:h.message,h)}}else try{const{signers:h,...j}=c;e=await this.prepareTransaction(e,a,j),h!=null&&h.length&&e.partialSign(...h),e=await this.signTransaction(e);const et=e.serialize();return await a.sendRawTransaction(et,j)}catch(h){throw h instanceof WalletSignTransactionError?(d=!1,h):new WalletSendTransactionError(h==null?void 0:h.message,h)}}catch(h){throw d&&this.emit("error",h),h}}async signAllTransactions(e){for(const c of e)if(isVersionedTransaction$2(c)){if(!this.supportedTransactionVersions)throw new WalletSignTransactionError("Signing versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(c.version))throw new WalletSignTransactionError(`Signing transaction version ${c.version} isn't supported by this wallet`)}const a=[];for(const c of e)a.push(await this.signTransaction(c));return a}}class BaseMessageSignerWalletAdapter extends BaseSignerWalletAdapter{}class BaseSignInMessageSignerWalletAdapter extends BaseMessageSignerWalletAdapter{}const SolanaSignAndSendTransaction="solana:signAndSendTransaction",SolanaSignIn="solana:signIn",SolanaSignMessage="solana:signMessage",SolanaSignTransaction="solana:signTransaction",StandardConnect="standard:connect",StandardDisconnect="standard:disconnect",StandardEvents="standard:events";function isWalletAdapterCompatibleStandardWallet(o){return StandardConnect in o.features&&StandardEvents in o.features&&(SolanaSignAndSendTransaction in o.features||SolanaSignTransaction in o.features)}class WalletNotSelectedError extends WalletError{constructor(){super(...arguments),this.name="WalletNotSelectedError"}}const EMPTY_ARRAY=[],DEFAULT_CONTEXT={autoConnect:!1,connecting:!1,connected:!1,disconnecting:!1,select(){logMissingProviderError("call","select")},connect(){return Promise.reject(logMissingProviderError("call","connect"))},disconnect(){return Promise.reject(logMissingProviderError("call","disconnect"))},sendTransaction(){return Promise.reject(logMissingProviderError("call","sendTransaction"))},signTransaction(){return Promise.reject(logMissingProviderError("call","signTransaction"))},signAllTransactions(){return Promise.reject(logMissingProviderError("call","signAllTransactions"))},signMessage(){return Promise.reject(logMissingProviderError("call","signMessage"))},signIn(){return Promise.reject(logMissingProviderError("call","signIn"))}};Object.defineProperty(DEFAULT_CONTEXT,"wallets",{get(){return logMissingProviderError("read","wallets"),EMPTY_ARRAY}});Object.defineProperty(DEFAULT_CONTEXT,"wallet",{get(){return logMissingProviderError("read","wallet"),null}});Object.defineProperty(DEFAULT_CONTEXT,"publicKey",{get(){return logMissingProviderError("read","publicKey"),null}});function logMissingProviderError(o,e){const a=new Error(`You have tried to ${o} "${e}" on a WalletContext without providing one. Make sure to render a WalletProvider as an ancestor of the component that uses WalletContext.`);return console.error(a),a}const WalletContext=reactExports.createContext(DEFAULT_CONTEXT);function useWallet(){return reactExports.useContext(WalletContext)}function useAnchorWallet(){const{publicKey:o,signTransaction:e,signAllTransactions:a}=useWallet();return reactExports.useMemo(()=>o&&e&&a?{publicKey:o,signTransaction:e,signAllTransactions:a}:void 0,[o,e,a])}function useLocalStorage(o,e){const a=reactExports.useState(()=>{try{const h=localStorage.getItem(o);if(h)return JSON.parse(h)}catch(h){typeof window<"u"&&console.error(h)}return e}),c=a[0],d=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(d.current){d.current=!1;return}try{c===null?localStorage.removeItem(o):localStorage.setItem(o,JSON.stringify(c))}catch(h){typeof window<"u"&&console.error(h)}},[c,o]),a}function getCommitment(o){switch(o){case"processed":case"confirmed":case"finalized":case void 0:return o;case"recent":return"processed";case"single":case"singleGossip":return"confirmed";case"max":case"root":return"finalized";default:return}}const SOLANA_MAINNET_CHAIN="solana:mainnet",SOLANA_DEVNET_CHAIN="solana:devnet",SOLANA_TESTNET_CHAIN="solana:testnet",SOLANA_LOCALNET_CHAIN="solana:localnet",MAINNET_ENDPOINT="https://api.mainnet-beta.solana.com";function getChainForEndpoint(o){return o.includes(MAINNET_ENDPOINT)?SOLANA_MAINNET_CHAIN:/\bdevnet\b/i.test(o)?SOLANA_DEVNET_CHAIN:/\btestnet\b/i.test(o)?SOLANA_TESTNET_CHAIN:/\blocalhost\b/i.test(o)||/\b127\.0\.0\.1\b/.test(o)?SOLANA_LOCALNET_CHAIN:SOLANA_MAINNET_CHAIN}function createSignInMessageText(o){let e=`${o.domain} wants you to sign in with your Solana account: +`;e+=`${o.address}`,o.statement&&(e+=` + +${o.statement}`);const a=[];if(o.uri&&a.push(`URI: ${o.uri}`),o.version&&a.push(`Version: ${o.version}`),o.chainId&&a.push(`Chain ID: ${o.chainId}`),o.nonce&&a.push(`Nonce: ${o.nonce}`),o.issuedAt&&a.push(`Issued At: ${o.issuedAt}`),o.expirationTime&&a.push(`Expiration Time: ${o.expirationTime}`),o.notBefore&&a.push(`Not Before: ${o.notBefore}`),o.requestId&&a.push(`Request ID: ${o.requestId}`),o.resources){a.push("Resources:");for(const c of o.resources)a.push(`- ${c}`)}return a.length&&(e+=` + +${a.join(` +`)}`),e}const SolanaMobileWalletAdapterErrorCode={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_REFLECTOR_ID_OUT_OF_RANGE:"ERROR_REFLECTOR_ID_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND",ERROR_INVALID_PROTOCOL_VERSION:"ERROR_INVALID_PROTOCOL_VERSION"};class SolanaMobileWalletAdapterError extends Error{constructor(...e){const[a,c,d]=e;super(c),this.code=a,this.data=d,this.name="SolanaMobileWalletAdapterError"}}class SolanaMobileWalletAdapterProtocolError extends Error{constructor(...e){const[a,c,d,h]=e;super(d),this.code=c,this.data=h,this.jsonRpcMessageId=a,this.name="SolanaMobileWalletAdapterProtocolError"}}function __awaiter$2(o,e,a,c){function d(h){return h instanceof a?h:new a(function(j){j(h)})}return new(a||(a=Promise))(function(h,j){function et(ot){try{st(c.next(ot))}catch(ht){j(ht)}}function nt(ot){try{st(c.throw(ot))}catch(ht){j(ht)}}function st(ot){ot.done?h(ot.value):d(ot.value).then(et,nt)}st((c=c.apply(o,[])).next())})}function createHelloReq(o,e){return __awaiter$2(this,void 0,void 0,function*(){const a=yield crypto.subtle.exportKey("raw",o),c=yield crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},e,a),d=new Uint8Array(a.byteLength+c.byteLength);return d.set(new Uint8Array(a),0),d.set(new Uint8Array(c),a.byteLength),d})}function encode$4(o){return window.btoa(o)}function createSIWSMessage(o){return createSignInMessageText(o)}function createSIWSMessageBase64(o){return encode$4(createSIWSMessage(o))}const SolanaSignTransactions="solana:signTransactions",SolanaCloneAuthorization="solana:cloneAuthorization";function createMobileWalletProxy(o,e){return new Proxy({},{get(a,c){return a[c]==null&&(a[c]=function(d){return __awaiter$2(this,void 0,void 0,function*(){const{method:h,params:j}=handleMobileWalletRequest(c,d,o),et=yield e(h,j);return h==="authorize"&&j.sign_in_payload&&!et.sign_in_result&&(et.sign_in_result=yield signInFallback(j.sign_in_payload,et,e)),handleMobileWalletResponse(c,et,o)})}),a[c]},defineProperty(){return!1},deleteProperty(){return!1}})}function handleMobileWalletRequest(o,e,a){let c=e,d=o.toString().replace(/[A-Z]/g,h=>`_${h.toLowerCase()}`).toLowerCase();switch(o){case"authorize":{let{chain:h}=c;if(a==="legacy"){switch(h){case"solana:testnet":{h="testnet";break}case"solana:devnet":{h="devnet";break}case"solana:mainnet":{h="mainnet-beta";break}default:h=c.cluster}c.cluster=h}else{switch(h){case"testnet":case"devnet":{h=`solana:${h}`;break}case"mainnet-beta":{h="solana:mainnet";break}}c.chain=h}}case"reauthorize":{const{auth_token:h,identity:j}=c;if(h)switch(a){case"legacy":{d="reauthorize",c={auth_token:h,identity:j};break}default:{d="authorize";break}}break}}return{method:d,params:c}}function handleMobileWalletResponse(o,e,a){switch(o){case"getCapabilities":{const c=e;switch(a){case"legacy":{const d=[SolanaSignTransactions];return c.supports_clone_authorization===!0&&d.push(SolanaCloneAuthorization),Object.assign(Object.assign({},c),{features:d})}case"v1":return Object.assign(Object.assign({},c),{supports_sign_and_send_transactions:!0,supports_clone_authorization:c.features.includes(SolanaCloneAuthorization)})}}}return e}function signInFallback(o,e,a){var c;return __awaiter$2(this,void 0,void 0,function*(){const d=(c=o.domain)!==null&&c!==void 0?c:window.location.host,h=e.accounts[0].address,j=createSIWSMessageBase64(Object.assign(Object.assign({},o),{domain:d,address:h})),et=yield a("sign_messages",{addresses:[h],payloads:[j]});return{address:h,signed_message:j,signature:et.signed_payloads[0].slice(j.length)}})}const SEQUENCE_NUMBER_BYTES=4;function createSequenceNumberVector(o){if(o>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");const e=new ArrayBuffer(SEQUENCE_NUMBER_BYTES);return new DataView(e).setUint32(0,o,!1),new Uint8Array(e)}const INITIALIZATION_VECTOR_BYTES=12,ENCODED_PUBLIC_KEY_LENGTH_BYTES=65;function encryptMessage(o,e,a){return __awaiter$2(this,void 0,void 0,function*(){const c=createSequenceNumberVector(e),d=new Uint8Array(INITIALIZATION_VECTOR_BYTES);crypto.getRandomValues(d);const h=yield crypto.subtle.encrypt(getAlgorithmParams(c,d),a,new TextEncoder().encode(o)),j=new Uint8Array(c.byteLength+d.byteLength+h.byteLength);return j.set(new Uint8Array(c),0),j.set(new Uint8Array(d),c.byteLength),j.set(new Uint8Array(h),c.byteLength+d.byteLength),j})}function decryptMessage(o,e){return __awaiter$2(this,void 0,void 0,function*(){const a=o.slice(0,SEQUENCE_NUMBER_BYTES),c=o.slice(SEQUENCE_NUMBER_BYTES,SEQUENCE_NUMBER_BYTES+INITIALIZATION_VECTOR_BYTES),d=o.slice(SEQUENCE_NUMBER_BYTES+INITIALIZATION_VECTOR_BYTES),h=yield crypto.subtle.decrypt(getAlgorithmParams(a,c),e,d);return getUtf8Decoder().decode(h)})}function getAlgorithmParams(o,e){return{additionalData:o,iv:e,name:"AES-GCM",tagLength:128}}let _utf8Decoder;function getUtf8Decoder(){return _utf8Decoder===void 0&&(_utf8Decoder=new TextDecoder("utf-8")),_utf8Decoder}function generateAssociationKeypair(){return __awaiter$2(this,void 0,void 0,function*(){return yield crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"])})}function generateECDHKeypair(){return __awaiter$2(this,void 0,void 0,function*(){return yield crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"])})}function encryptJsonRpcMessage(o,e){return __awaiter$2(this,void 0,void 0,function*(){const a=JSON.stringify(o),c=o.id;return encryptMessage(a,c,e)})}function decryptJsonRpcMessage(o,e){return __awaiter$2(this,void 0,void 0,function*(){const a=yield decryptMessage(o,e),c=JSON.parse(a);if(Object.hasOwnProperty.call(c,"error"))throw new SolanaMobileWalletAdapterProtocolError(c.id,c.error.code,c.error.message);return c})}function parseHelloRsp(o,e,a){return __awaiter$2(this,void 0,void 0,function*(){const[c,d]=yield Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",o.slice(0,ENCODED_PUBLIC_KEY_LENGTH_BYTES),{name:"ECDH",namedCurve:"P-256"},!1,[])]),h=yield crypto.subtle.deriveBits({name:"ECDH",public:d},a,256),j=yield crypto.subtle.importKey("raw",h,"HKDF",!1,["deriveKey"]);return yield crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(c),info:new Uint8Array},j,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"])})}function parseSessionProps(o,e){return __awaiter$2(this,void 0,void 0,function*(){const a=yield decryptMessage(o,e),c=JSON.parse(a);let d="legacy";if(Object.hasOwnProperty.call(c,"v"))switch(c.v){case 1:case"1":case"v1":d="v1";break;case"legacy":d="legacy";break;default:throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_INVALID_PROTOCOL_VERSION,`Unknown/unsupported protocol version: ${c.v}`)}return{protocol_version:d}})}function getRandomAssociationPort(){return assertAssociationPort(49152+Math.floor(Math.random()*16384))}function assertAssociationPort(o){if(o<49152||o>65535)throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,`Association port number must be between 49152 and 65535. ${o} given.`,{port:o});return o}function arrayBufferToBase64String(o){let e="";const a=new Uint8Array(o),c=a.byteLength;for(let d=0;d({"/":"_","+":"-","=":"."})[e])}const INTENT_NAME="solana-wallet";function getPathParts(o){return o.replace(/(^\/+|\/+$)/g,"").split("/")}function getIntentURL(o,e){let a=null;if(e){try{a=new URL(e)}catch{}if((a==null?void 0:a.protocol)!=="https:")throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}a||(a=new URL(`${INTENT_NAME}:/`));const c=o.startsWith("/")?o:[...getPathParts(a.pathname),...getPathParts(o)].join("/");return new URL(c,a)}function getAssociateAndroidIntentURL(o,e,a,c=["v1"]){return __awaiter$2(this,void 0,void 0,function*(){const d=assertAssociationPort(e),h=yield crypto.subtle.exportKey("raw",o),j=arrayBufferToBase64String(h),et=getIntentURL("v1/associate/local",a);return et.searchParams.set("association",getStringWithURLUnsafeCharactersReplaced(j)),et.searchParams.set("port",`${d}`),c.forEach(nt=>{et.searchParams.set("v",nt)}),et})}const Browser={Firefox:0,Other:1};function assertUnreachable(o){return o}function getBrowser(){return navigator.userAgent.indexOf("Firefox/")!==-1?Browser.Firefox:Browser.Other}function getDetectionPromise(){return new Promise((o,e)=>{function a(){clearTimeout(d),window.removeEventListener("blur",c)}function c(){a(),o()}window.addEventListener("blur",c);const d=setTimeout(()=>{a(),e()},2e3)})}let _frame=null;function launchUrlThroughHiddenFrame(o){_frame==null&&(_frame=document.createElement("iframe"),_frame.style.display="none",document.body.appendChild(_frame)),_frame.contentWindow.location.href=o.toString()}function launchAssociation(o){return __awaiter$2(this,void 0,void 0,function*(){if(o.protocol==="https:")window.location.assign(o);else try{const e=getBrowser();switch(e){case Browser.Firefox:launchUrlThroughHiddenFrame(o);break;case Browser.Other:{const a=getDetectionPromise();window.location.assign(o),yield a;break}default:}}catch{throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND,"Found no installed wallet that supports the mobile wallet protocol.")}})}function startSession(o,e){return __awaiter$2(this,void 0,void 0,function*(){const a=getRandomAssociationPort(),c=yield getAssociateAndroidIntentURL(o,a,e);return yield launchAssociation(c),a})}const WEBSOCKET_CONNECTION_CONFIG={retryDelayScheduleMs:[150,150,200,500,500,750,750,1e3],timeoutMs:3e4},WEBSOCKET_PROTOCOL="com.solana.mobilewalletadapter.v1";function assertSecureContext(){if(typeof window>"u"||window.isSecureContext!==!0)throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).")}function assertSecureEndpointSpecificURI(o){let e;try{e=new URL(o)}catch{throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if(e.protocol!=="https:")throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}function getSequenceNumberFromByteArray(o){return new DataView(o).getUint32(0,!1)}function transact$1(o,e){return __awaiter$2(this,void 0,void 0,function*(){assertSecureContext();const a=yield generateAssociationKeypair(),d=`ws://localhost:${yield startSession(a.publicKey,e==null?void 0:e.baseUri)}/solana-wallet`;let h;const j=(()=>{const ot=[...WEBSOCKET_CONNECTION_CONFIG.retryDelayScheduleMs];return()=>ot.length>1?ot.shift():ot[0]})();let et=1,nt=0,st={__type:"disconnected"};return new Promise((ot,ht)=>{let pt;const dt={},gt=()=>__awaiter$2(this,void 0,void 0,function*(){if(st.__type!=="connecting"){console.warn(`Expected adapter state to be \`connecting\` at the moment the websocket opens. Got \`${st.__type}\`.`);return}pt.removeEventListener("open",gt);const{associationKeypair:Bt}=st,Dt=yield generateECDHKeypair();pt.send(yield createHelloReq(Dt.publicKey,Bt.privateKey)),st={__type:"hello_req_sent",associationPublicKey:Bt.publicKey,ecdhPrivateKey:Dt.privateKey}}),wt=Bt=>{Bt.wasClean?st={__type:"disconnected"}:ht(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED,`The wallet session dropped unexpectedly (${Bt.code}: ${Bt.reason}).`,{closeEvent:Bt})),mt()},St=Bt=>__awaiter$2(this,void 0,void 0,function*(){mt(),Date.now()-h>=WEBSOCKET_CONNECTION_CONFIG.timeoutMs?ht(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT,`Failed to connect to the wallet websocket at ${d}.`)):(yield new Promise(Dt=>{const Ht=j();bt=window.setTimeout(Dt,Ht)}),$t())}),_t=Bt=>__awaiter$2(this,void 0,void 0,function*(){const Dt=yield Bt.data.arrayBuffer();switch(st.__type){case"connecting":if(Dt.byteLength!==0)throw new Error("Encountered unexpected message while connecting");const Ht=yield generateECDHKeypair();pt.send(yield createHelloReq(Ht.publicKey,a.privateKey)),st={__type:"hello_req_sent",associationPublicKey:a.publicKey,ecdhPrivateKey:Ht.privateKey};break;case"connected":try{const qt=Dt.slice(0,SEQUENCE_NUMBER_BYTES),Pt=getSequenceNumberFromByteArray(qt);if(Pt!==nt+1)throw new Error("Encrypted message has invalid sequence number");nt=Pt;const Gt=yield decryptJsonRpcMessage(Dt,st.sharedSecret),ct=dt[Gt.id];delete dt[Gt.id],ct.resolve(Gt.result)}catch(qt){if(qt instanceof SolanaMobileWalletAdapterProtocolError){const Pt=dt[qt.jsonRpcMessageId];delete dt[qt.jsonRpcMessageId],Pt.reject(qt)}else throw qt}break;case"hello_req_sent":{if(Dt.byteLength===0){const g=yield generateECDHKeypair();pt.send(yield createHelloReq(g.publicKey,a.privateKey)),st={__type:"hello_req_sent",associationPublicKey:a.publicKey,ecdhPrivateKey:g.privateKey};break}const qt=yield parseHelloRsp(Dt,st.associationPublicKey,st.ecdhPrivateKey),Pt=Dt.slice(ENCODED_PUBLIC_KEY_LENGTH_BYTES),Gt=Pt.byteLength!==0?yield __awaiter$2(this,void 0,void 0,function*(){const g=Pt.slice(0,SEQUENCE_NUMBER_BYTES),b=getSequenceNumberFromByteArray(g);if(b!==nt+1)throw new Error("Encrypted message has invalid sequence number");return nt=b,parseSessionProps(Pt,qt)}):{protocol_version:"legacy"};st={__type:"connected",sharedSecret:qt,sessionProperties:Gt};const ct=createMobileWalletProxy(Gt.protocol_version,(g,b)=>__awaiter$2(this,void 0,void 0,function*(){const $=et++;return pt.send(yield encryptJsonRpcMessage({id:$,jsonrpc:"2.0",method:g,params:b??{}},qt)),new Promise((_e,rt)=>{dt[$]={resolve(at){switch(g){case"authorize":case"reauthorize":{const{wallet_uri_base:lt}=at;if(lt!=null)try{assertSecureEndpointSpecificURI(lt)}catch(tt){rt(tt);return}break}}_e(at)},reject:rt}})}));try{ot(yield o(ct))}catch(g){ht(g)}finally{mt(),pt.close()}break}}});let mt,bt;const $t=()=>{mt&&mt(),st={__type:"connecting",associationKeypair:a},h===void 0&&(h=Date.now()),pt=new WebSocket(d,[WEBSOCKET_PROTOCOL]),pt.addEventListener("open",gt),pt.addEventListener("close",wt),pt.addEventListener("error",St),pt.addEventListener("message",_t),mt=()=>{window.clearTimeout(bt),pt.removeEventListener("open",gt),pt.removeEventListener("close",wt),pt.removeEventListener("error",St),pt.removeEventListener("message",_t)}};$t()})})}function base$2(o){if(o.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),a=0;a>>0,bt=new Uint8Array(mt);St!==_t;){for(var $t=dt[St],Bt=0,Dt=mt-1;($t!==0||Bt>>0,bt[Dt]=$t%j>>>0,$t=$t/j>>>0;if($t!==0)throw new Error("Non-zero carry");wt=Bt,St++}for(var Ht=mt-wt;Ht!==mt&&bt[Ht]===0;)Ht++;for(var qt=et.repeat(gt);Ht>>0,mt=new Uint8Array(_t);dt[gt];){var bt=e[dt.charCodeAt(gt)];if(bt===255)return;for(var $t=0,Bt=_t-1;(bt!==0||$t>>0,mt[Bt]=bt%256>>>0,bt=bt/256>>>0;if(bt!==0)throw new Error("Non-zero carry");St=$t,gt++}for(var Dt=_t-St;Dt!==_t&&mt[Dt]===0;)Dt++;for(var Ht=new Uint8Array(wt+(_t-Dt)),qt=wt;Dt!==_t;)Ht[qt++]=mt[Dt++];return Ht}function pt(dt){var gt=ht(dt);if(gt)return gt;throw new Error("Non-base"+j+" character")}return{encode:ot,decodeUnsafe:ht,decode:pt}}var src=base$2;const basex=src,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58$1=basex(ALPHABET);const bs58$2=getDefaultExportFromCjs$3(bs58$1);function __rest(o,e){var a={};for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&e.indexOf(c)<0&&(a[c]=o[c]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,c=Object.getOwnPropertySymbols(o);de.charCodeAt(0)))}function getPayloadFromTransaction(o){const e="version"in o?o.serialize():o.serialize({requireAllSignatures:!1,verifySignatures:!1});return fromUint8Array(e)}function getTransactionFromWireMessage(o){const a=o[0]*SIGNATURE_LENGTH_IN_BYTES+1;return VersionedMessage.deserializeMessageVersion(o.slice(a,o.length))==="legacy"?Transaction.from(o):VersionedTransaction.deserialize(o)}function transact(o,e){return __awaiter$1(this,void 0,void 0,function*(){return yield transact$1(c=>{const d=new Proxy({},{get(h,j){if(h[j]==null)switch(j){case"signAndSendTransactions":h[j]=function(et){var{minContextSlot:nt,commitment:st,skipPreflight:ot,maxRetries:ht,waitForCommitmentToSendNextTransaction:pt,transactions:dt}=et,gt=__rest(et,["minContextSlot","commitment","skipPreflight","maxRetries","waitForCommitmentToSendNextTransaction","transactions"]);return __awaiter$1(this,void 0,void 0,function*(){const wt=dt.map(getPayloadFromTransaction),St={min_context_slot:nt,commitment:st,skip_preflight:ot,max_retries:ht,wait_for_commitment_to_send_next_transaction:pt},{signatures:_t}=yield c.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},gt),Object.values(St).some(bt=>bt!=null)?{options:St}:null),{payloads:wt}));return _t.map(toUint8Array$1).map(bs58$2.encode)})};break;case"signMessages":h[j]=function(et){var{payloads:nt}=et,st=__rest(et,["payloads"]);return __awaiter$1(this,void 0,void 0,function*(){const ot=nt.map(fromUint8Array),{signed_payloads:ht}=yield c.signMessages(Object.assign(Object.assign({},st),{payloads:ot}));return ht.map(toUint8Array$1)})};break;case"signTransactions":h[j]=function(et){var{transactions:nt}=et,st=__rest(et,["transactions"]);return __awaiter$1(this,void 0,void 0,function*(){const ot=nt.map(getPayloadFromTransaction),{signed_payloads:ht}=yield c.signTransactions(Object.assign(Object.assign({},st),{payloads:ot}));return ht.map(toUint8Array$1).map(getTransactionFromWireMessage)})};break;default:{h[j]=c[j];break}}return h[j]},defineProperty(){return!1},deleteProperty(){return!1}});return o(d)},e)})}var canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$p={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$p.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};utils$p.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT[e]};utils$p.getBCHDigit=function(o){let e=0;for(;o!==0;)e++,o>>>=1;return e};utils$p.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=e};utils$p.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$p.toSJIS=function(e){return toSJISFunction(e)};var errorCorrectionLevel={};(function(o){o.L={bit:1},o.M={bit:0},o.Q={bit:3},o.H={bit:2};function e(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return o.L;case"m":case"medium":return o.M;case"q":case"quartile":return o.Q;case"h":case"high":return o.H;default:throw new Error("Unknown EC Level: "+a)}}o.isValid=function(c){return c&&typeof c.bit<"u"&&c.bit>=0&&c.bit<4},o.from=function(c,d){if(o.isValid(c))return c;try{return e(c)}catch{return d}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(o){const e=Math.floor(o/8);return(this.buffer[e]>>>7-o%8&1)===1},put:function(o,e){for(let a=0;a>>e-a-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),o&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}BitMatrix$1.prototype.set=function(o,e,a,c){const d=o*this.size+e;this.data[d]=a,c&&(this.reservedBit[d]=!0)};BitMatrix$1.prototype.get=function(o,e){return this.data[o*this.size+e]};BitMatrix$1.prototype.xor=function(o,e,a){this.data[o*this.size+e]^=a};BitMatrix$1.prototype.isReserved=function(o,e){return this.reservedBit[o*this.size+e]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(o){const e=utils$p.getSymbolSize;o.getRowColCoords=function(c){if(c===1)return[];const d=Math.floor(c/7)+2,h=e(c),j=h===145?26:Math.ceil((h-13)/(2*d-2))*2,et=[h-7];for(let nt=1;nt=0&&d<=7},o.from=function(d){return o.isValid(d)?parseInt(d,10):void 0},o.getPenaltyN1=function(d){const h=d.size;let j=0,et=0,nt=0,st=null,ot=null;for(let ht=0;ht=5&&(j+=e.N1+(et-5)),st=dt,et=1),dt=d.get(pt,ht),dt===ot?nt++:(nt>=5&&(j+=e.N1+(nt-5)),ot=dt,nt=1)}et>=5&&(j+=e.N1+(et-5)),nt>=5&&(j+=e.N1+(nt-5))}return j},o.getPenaltyN2=function(d){const h=d.size;let j=0;for(let et=0;et=10&&(et===1488||et===93)&&j++,nt=nt<<1&2047|d.get(ot,st),ot>=10&&(nt===1488||nt===93)&&j++}return j*e.N3},o.getPenaltyN4=function(d){let h=0;const j=d.data.length;for(let nt=0;nt=0;){const j=h[0];for(let nt=0;nt0){const h=new Uint8Array(this.degree);return h.set(c,d),h}return c};var reedSolomonEncoder=ReedSolomonEncoder$1,version$1={},mode={},versionCheck={};versionCheck.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r +]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(e){return TEST_KANJI.test(e)};regex.testNumeric=function(e){return TEST_NUMERIC.test(e)};regex.testAlphanumeric=function(e){return TEST_ALPHANUMERIC.test(e)};(function(o){const e=versionCheck,a=regex;o.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},o.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},o.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},o.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},o.MIXED={bit:-1},o.getCharCountIndicator=function(h,j){if(!h.ccBits)throw new Error("Invalid mode: "+h);if(!e.isValid(j))throw new Error("Invalid version: "+j);return j>=1&&j<10?h.ccBits[0]:j<27?h.ccBits[1]:h.ccBits[2]},o.getBestModeForData=function(h){return a.testNumeric(h)?o.NUMERIC:a.testAlphanumeric(h)?o.ALPHANUMERIC:a.testKanji(h)?o.KANJI:o.BYTE},o.toString=function(h){if(h&&h.id)return h.id;throw new Error("Invalid mode")},o.isValid=function(h){return h&&h.bit&&h.ccBits};function c(d){if(typeof d!="string")throw new Error("Param is not a string");switch(d.toLowerCase()){case"numeric":return o.NUMERIC;case"alphanumeric":return o.ALPHANUMERIC;case"kanji":return o.KANJI;case"byte":return o.BYTE;default:throw new Error("Unknown mode: "+d)}}o.from=function(h,j){if(o.isValid(h))return h;try{return c(h)}catch{return j}}})(mode);(function(o){const e=utils$p,a=errorCorrectionCode,c=errorCorrectionLevel,d=mode,h=versionCheck,j=7973,et=e.getBCHDigit(j);function nt(pt,dt,gt){for(let wt=1;wt<=40;wt++)if(dt<=o.getCapacity(wt,gt,pt))return wt}function st(pt,dt){return d.getCharCountIndicator(pt,dt)+4}function ot(pt,dt){let gt=0;return pt.forEach(function(wt){const St=st(wt.mode,dt);gt+=St+wt.getBitsLength()}),gt}function ht(pt,dt){for(let gt=1;gt<=40;gt++)if(ot(pt,gt)<=o.getCapacity(gt,dt,d.MIXED))return gt}o.from=function(dt,gt){return h.isValid(dt)?parseInt(dt,10):gt},o.getCapacity=function(dt,gt,wt){if(!h.isValid(dt))throw new Error("Invalid QR Code version");typeof wt>"u"&&(wt=d.BYTE);const St=e.getSymbolTotalCodewords(dt),_t=a.getTotalCodewordsCount(dt,gt),mt=(St-_t)*8;if(wt===d.MIXED)return mt;const bt=mt-st(wt,dt);switch(wt){case d.NUMERIC:return Math.floor(bt/10*3);case d.ALPHANUMERIC:return Math.floor(bt/11*2);case d.KANJI:return Math.floor(bt/13);case d.BYTE:default:return Math.floor(bt/8)}},o.getBestVersionForData=function(dt,gt){let wt;const St=c.from(gt,c.M);if(Array.isArray(dt)){if(dt.length>1)return ht(dt,St);if(dt.length===0)return 1;wt=dt[0]}else wt=dt;return nt(wt.mode,wt.getLength(),St)},o.getEncodedBits=function(dt){if(!h.isValid(dt)||dt<7)throw new Error("Invalid QR Code version");let gt=dt<<12;for(;e.getBCHDigit(gt)-et>=0;)gt^=j<=0;)d^=G15<0&&(c=this.data.substr(a),d=parseInt(c,10),e.put(d,h*3+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(o){this.mode=Mode$3.ALPHANUMERIC,this.data=o}AlphanumericData.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(e){let a;for(a=0;a+2<=this.data.length;a+=2){let c=ALPHA_NUM_CHARS.indexOf(this.data[a])*45;c+=ALPHA_NUM_CHARS.indexOf(this.data[a+1]),e.put(c,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS.indexOf(this.data[a]),6)};var alphanumericData=AlphanumericData;const Mode$2=mode;function ByteData(o){this.mode=Mode$2.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}ByteData.getBitsLength=function(e){return e*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(o){for(let e=0,a=this.data.length;e=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),o.put(a,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(o){var e={single_source_shortest_paths:function(a,c,d){var h={},j={};j[c]=0;var et=e.PriorityQueue.make();et.push(c,0);for(var nt,st,ot,ht,pt,dt,gt,wt,St;!et.empty();){nt=et.pop(),st=nt.value,ht=nt.cost,pt=a[st]||{};for(ot in pt)pt.hasOwnProperty(ot)&&(dt=pt[ot],gt=ht+dt,wt=j[ot],St=typeof j[ot]>"u",(St||wt>gt)&&(j[ot]=gt,et.push(ot,gt),h[ot]=st))}if(typeof d<"u"&&typeof j[d]>"u"){var _t=["Could not find a path from ",c," to ",d,"."].join("");throw new Error(_t)}return h},extract_shortest_path_from_predecessor_list:function(a,c){for(var d=[],h=c;h;)d.push(h),a[h],h=a[h];return d.reverse(),d},find_path:function(a,c,d){var h=e.single_source_shortest_paths(a,c,d);return e.extract_shortest_path_from_predecessor_list(h,d)},PriorityQueue:{make:function(a){var c=e.PriorityQueue,d={},h;a=a||{};for(h in c)c.hasOwnProperty(h)&&(d[h]=c[h]);return d.queue=[],d.sorter=a.sorter||c.default_sorter,d},default_sorter:function(a,c){return a.cost-c.cost},push:function(a,c){var d={value:a,cost:c};this.queue.push(d),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};o.exports=e})(dijkstra);var dijkstraExports=dijkstra.exports;(function(o){const e=mode,a=numericData,c=alphanumericData,d=byteData,h=kanjiData,j=regex,et=utils$p,nt=dijkstraExports;function st(_t){return unescape(encodeURIComponent(_t)).length}function ot(_t,mt,bt){const $t=[];let Bt;for(;(Bt=_t.exec(bt))!==null;)$t.push({data:Bt[0],index:Bt.index,mode:mt,length:Bt[0].length});return $t}function ht(_t){const mt=ot(j.NUMERIC,e.NUMERIC,_t),bt=ot(j.ALPHANUMERIC,e.ALPHANUMERIC,_t);let $t,Bt;return et.isKanjiModeEnabled()?($t=ot(j.BYTE,e.BYTE,_t),Bt=ot(j.KANJI,e.KANJI,_t)):($t=ot(j.BYTE_KANJI,e.BYTE,_t),Bt=[]),mt.concat(bt,$t,Bt).sort(function(Ht,qt){return Ht.index-qt.index}).map(function(Ht){return{data:Ht.data,mode:Ht.mode,length:Ht.length}})}function pt(_t,mt){switch(mt){case e.NUMERIC:return a.getBitsLength(_t);case e.ALPHANUMERIC:return c.getBitsLength(_t);case e.KANJI:return h.getBitsLength(_t);case e.BYTE:return d.getBitsLength(_t)}}function dt(_t){return _t.reduce(function(mt,bt){const $t=mt.length-1>=0?mt[mt.length-1]:null;return $t&&$t.mode===bt.mode?(mt[mt.length-1].data+=bt.data,mt):(mt.push(bt),mt)},[])}function gt(_t){const mt=[];for(let bt=0;bt<_t.length;bt++){const $t=_t[bt];switch($t.mode){case e.NUMERIC:mt.push([$t,{data:$t.data,mode:e.ALPHANUMERIC,length:$t.length},{data:$t.data,mode:e.BYTE,length:$t.length}]);break;case e.ALPHANUMERIC:mt.push([$t,{data:$t.data,mode:e.BYTE,length:$t.length}]);break;case e.KANJI:mt.push([$t,{data:$t.data,mode:e.BYTE,length:st($t.data)}]);break;case e.BYTE:mt.push([{data:$t.data,mode:e.BYTE,length:st($t.data)}])}}return mt}function wt(_t,mt){const bt={},$t={start:{}};let Bt=["start"];for(let Dt=0;Dt<_t.length;Dt++){const Ht=_t[Dt],qt=[];for(let Pt=0;Pt=0&&et<=6&&(nt===0||nt===6)||nt>=0&&nt<=6&&(et===0||et===6)||et>=2&&et<=4&&nt>=2&&nt<=4?o.set(h+et,j+nt,!0,!0):o.set(h+et,j+nt,!1,!0))}}function setupTimingPattern(o){const e=o.size;for(let a=8;a>et&1)===1,o.set(d,h,j,!0),o.set(h,d,j,!0)}function setupFormatInfo(o,e,a){const c=o.size,d=FormatInfo.getEncodedBits(e,a);let h,j;for(h=0;h<15;h++)j=(d>>h&1)===1,h<6?o.set(h,8,j,!0):h<8?o.set(h+1,8,j,!0):o.set(c-15+h,8,j,!0),h<8?o.set(8,c-h-1,j,!0):h<9?o.set(8,15-h-1+1,j,!0):o.set(8,15-h-1,j,!0);o.set(c-8,8,1,!0)}function setupData(o,e){const a=o.size;let c=-1,d=a-1,h=7,j=0;for(let et=a-1;et>0;et-=2)for(et===6&&et--;;){for(let nt=0;nt<2;nt++)if(!o.isReserved(d,et-nt)){let st=!1;j>>h&1)===1),o.set(d,et-nt,st),h--,h===-1&&(j++,h=7)}if(d+=c,d<0||a<=d){d-=c,c=-c;break}}}function createData(o,e,a){const c=new BitBuffer;a.forEach(function(nt){c.put(nt.mode.bit,4),c.put(nt.getLength(),Mode.getCharCountIndicator(nt.mode,o)),nt.write(c)});const d=Utils$1.getSymbolTotalCodewords(o),h=ECCode.getTotalCodewordsCount(o,e),j=(d-h)*8;for(c.getLengthInBits()+4<=j&&c.put(0,4);c.getLengthInBits()%8!==0;)c.putBit(0);const et=(j-c.getLengthInBits())/8;for(let nt=0;nt=7&&setupVersionInfo(nt,e),setupData(nt,j),isNaN(c)&&(c=MaskPattern.getBestMask(nt,setupFormatInfo.bind(null,nt,a))),MaskPattern.applyMask(c,nt),setupFormatInfo(nt,a,c),{modules:nt,version:e,errorCorrectionLevel:a,maskPattern:c,segments:d}}qrcode.create=function(e,a){if(typeof e>"u"||e==="")throw new Error("No input text");let c=ECLevel.M,d,h;return typeof a<"u"&&(c=ECLevel.from(a.errorCorrectionLevel,ECLevel.M),d=Version.from(a.version),h=MaskPattern.from(a.maskPattern),a.toSJISFunc&&Utils$1.setToSJISFunction(a.toSJISFunc)),createSymbol(e,d,c,h)};var canvas={},utils$o={};(function(o){function e(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let c=a.slice().replace("#","").split("");if(c.length<3||c.length===5||c.length>8)throw new Error("Invalid hex color: "+a);(c.length===3||c.length===4)&&(c=Array.prototype.concat.apply([],c.map(function(h){return[h,h]}))),c.length===6&&c.push("F","F");const d=parseInt(c.join(""),16);return{r:d>>24&255,g:d>>16&255,b:d>>8&255,a:d&255,hex:"#"+c.slice(0,6).join("")}}o.getOptions=function(c){c||(c={}),c.color||(c.color={});const d=typeof c.margin>"u"||c.margin===null||c.margin<0?4:c.margin,h=c.width&&c.width>=21?c.width:void 0,j=c.scale||4;return{width:h,scale:h?4:j,margin:d,color:{dark:e(c.color.dark||"#000000ff"),light:e(c.color.light||"#ffffffff")},type:c.type,rendererOpts:c.rendererOpts||{}}},o.getScale=function(c,d){return d.width&&d.width>=c+d.margin*2?d.width/(c+d.margin*2):d.scale},o.getImageWidth=function(c,d){const h=o.getScale(c,d);return Math.floor((c+d.margin*2)*h)},o.qrToImageData=function(c,d,h){const j=d.modules.size,et=d.modules.data,nt=o.getScale(j,h),st=Math.floor((j+h.margin*2)*nt),ot=h.margin*nt,ht=[h.color.light,h.color.dark];for(let pt=0;pt=ot&&dt>=ot&&pt"u"&&(!j||!j.getContext)&&(nt=j,j=void 0),j||(st=c()),nt=e.getOptions(nt);const ot=e.getImageWidth(h.modules.size,nt),ht=st.getContext("2d"),pt=ht.createImageData(ot,ot);return e.qrToImageData(pt.data,h,nt),a(ht,st,ot),ht.putImageData(pt,0,0),st},o.renderToDataURL=function(h,j,et){let nt=et;typeof nt>"u"&&(!j||!j.getContext)&&(nt=j,j=void 0),nt||(nt={});const st=o.render(h,j,nt),ot=nt.type||"image/png",ht=nt.rendererOpts||{};return st.toDataURL(ot,ht.quality)}})(canvas);var svgTag={};const Utils=utils$o;function getColorAttrib(o,e){const a=o.a/255,c=e+'="'+o.hex+'"';return a<1?c+" "+e+'-opacity="'+a.toFixed(2).slice(1)+'"':c}function svgCmd(o,e,a){let c=o+e;return typeof a<"u"&&(c+=" "+a),c}function qrToPath(o,e,a){let c="",d=0,h=!1,j=0;for(let et=0;et0&&nt>0&&o[et-1]||(c+=h?svgCmd("M",nt+a,.5+st+a):svgCmd("m",d,0),d=0,h=!1),nt+1':"",st="',ot='viewBox="0 0 '+et+" "+et+'"',pt=''+nt+st+` +`;return typeof c=="function"&&c(null,pt),pt};const canPromise=canPromise$1,QRCode=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(o,e,a,c,d){const h=[].slice.call(arguments,1),j=h.length,et=typeof h[j-1]=="function";if(!et&&!canPromise())throw new Error("Callback required as last argument");if(et){if(j<2)throw new Error("Too few arguments provided");j===2?(d=a,a=e,e=c=void 0):j===3&&(e.getContext&&typeof d>"u"?(d=c,c=void 0):(d=c,c=a,a=e,e=void 0))}else{if(j<1)throw new Error("Too few arguments provided");return j===1?(a=e,e=c=void 0):j===2&&!e.getContext&&(c=a,a=e,e=void 0),new Promise(function(nt,st){try{const ot=QRCode.create(a,c);nt(o(ot,e,c))}catch(ot){st(ot)}})}try{const nt=QRCode.create(a,c);d(null,o(nt,e,c))}catch(nt){d(nt)}}QRCode.create;renderCanvas.bind(null,CanvasRenderer.render);renderCanvas.bind(null,CanvasRenderer.renderToDataURL);renderCanvas.bind(null,function(o,e,a){return SvgRenderer.render(o,a)});function __awaiter(o,e,a,c){function d(h){return h instanceof a?h:new a(function(j){j(h)})}return new(a||(a=Promise))(function(h,j){function et(ot){try{st(c.next(ot))}catch(ht){j(ht)}}function nt(ot){try{st(c.throw(ot))}catch(ht){j(ht)}}function st(ot){ot.done?h(ot.value):d(ot.value).then(et,nt)}st((c=c.apply(o,[])).next())})}function toUint8Array(o){return new Uint8Array(window.atob(o).split("").map(e=>e.charCodeAt(0)))}function getIsSupported$1(){return typeof window<"u"&&window.isSecureContext&&typeof document<"u"&&/android/i.test(navigator.userAgent)}const SolanaMobileWalletAdapterWalletName="Mobile Wallet Adapter",SIGNATURE_LENGTH_IN_BYTES$1=64;function getPublicKeyFromAddress$1(o){const e=toUint8Array(o);return new PublicKey$1(e)}function isVersionedTransaction$1(o){return"version"in o}function clusterToChainId(o){switch(o){case"mainnet-beta":return"solana:mainnet";case"testnet":return"solana:testnet";case"devnet":return"solana:devnet"}}class SolanaMobileWalletAdapter extends BaseSignInMessageSignerWalletAdapter{constructor(e){var a;super(),this.supportedTransactionVersions=new Set(["legacy",0]),this.name=SolanaMobileWalletAdapterWalletName,this.url="https://solanamobile.com/wallets",this.icon="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI4IiB3aWR0aD0iMjgiIHZpZXdCb3g9Ii0zIDAgMjggMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0RDQjhGRiI+PHBhdGggZD0iTTE3LjQgMTcuNEgxNXYyLjRoMi40di0yLjRabTEuMi05LjZoLTIuNHYyLjRoMi40VjcuOFoiLz48cGF0aCBkPSJNMjEuNiAzVjBoLTIuNHYzaC0zLjZWMGgtMi40djNoLTIuNHY2LjZINC41YTIuMSAyLjEgMCAxIDEgMC00LjJoMi43VjNINC41QTQuNSA0LjUgMCAwIDAgMCA3LjVWMjRoMjEuNnYtNi42aC0yLjR2NC4ySDIuNFYxMS41Yy41LjMgMS4yLjQgMS44LjVoNy41QTYuNiA2LjYgMCAwIDAgMjQgOVYzaC0yLjRabTAgNS43YTQuMiA0LjIgMCAxIDEtOC40IDBWNS40aDguNHYzLjNaIi8+PC9nPjwvc3ZnPg==",this._connecting=!1,this._connectionGeneration=0,this._readyState=getIsSupported$1()?WalletReadyState.Loadable:WalletReadyState.Unsupported,this._authorizationResultCache=e.authorizationResultCache,this._addressSelector=e.addressSelector,this._appIdentity=e.appIdentity,this._chain=(a=e.chain)!==null&&a!==void 0?a:clusterToChainId(e.cluster),this._hostAuthority=e.remoteHostAuthority,this._onWalletNotFound=e.onWalletNotFound,this._readyState!==WalletReadyState.Unsupported&&this._authorizationResultCache.get().then(c=>{c&&this.declareWalletAsInstalled()})}get publicKey(){if(this._publicKey==null&&this._selectedAddress!=null)try{this._publicKey=getPublicKeyFromAddress$1(this._selectedAddress)}catch(e){throw new WalletPublicKeyError(e instanceof Error&&(e==null?void 0:e.message)||"Unknown error",e)}return this._publicKey?this._publicKey:null}get connected(){return!!this._authorizationResult}get connecting(){return this._connecting}get readyState(){return this._readyState}declareWalletAsInstalled(){this._readyState!==WalletReadyState.Installed&&this.emit("readyStateChange",this._readyState=WalletReadyState.Installed)}runWithGuard(e){return __awaiter(this,void 0,void 0,function*(){try{return yield e()}catch(a){throw this.emit("error",a),a}})}autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(){return __awaiter(this,void 0,void 0,function*(){return yield this.autoConnect()})}autoConnect(){return __awaiter(this,void 0,void 0,function*(){if(!(this.connecting||this.connected))return yield this.runWithGuard(()=>__awaiter(this,void 0,void 0,function*(){if(this._readyState!==WalletReadyState.Installed&&this._readyState!==WalletReadyState.Loadable)throw new WalletNotReadyError;this._connecting=!0;try{const e=yield this._authorizationResultCache.get();e&&this.handleAuthorizationResult(e)}catch(e){throw new WalletConnectionError(e instanceof Error&&e.message||"Unknown error",e)}finally{this._connecting=!1}}))})}connect(){return __awaiter(this,void 0,void 0,function*(){if(!(this.connecting||this.connected))return yield this.runWithGuard(()=>__awaiter(this,void 0,void 0,function*(){if(this._readyState!==WalletReadyState.Installed&&this._readyState!==WalletReadyState.Loadable)throw new WalletNotReadyError;this._connecting=!0;try{yield this.performAuthorization()}catch(e){throw new WalletConnectionError(e instanceof Error&&e.message||"Unknown error",e)}finally{this._connecting=!1}}))})}performAuthorization(e){return __awaiter(this,void 0,void 0,function*(){try{const a=yield this._authorizationResultCache.get();return a?(this.handleAuthorizationResult(a),a):yield this.transact(c=>__awaiter(this,void 0,void 0,function*(){const d=yield c.authorize({chain:this._chain,identity:this._appIdentity,sign_in_payload:e});return Promise.all([this._authorizationResultCache.set(d),this.handleAuthorizationResult(d)]),d}))}catch(a){throw new WalletConnectionError(a instanceof Error&&a.message||"Unknown error",a)}})}handleAuthorizationResult(e){var a;return __awaiter(this,void 0,void 0,function*(){const c=this._authorizationResult==null||((a=this._authorizationResult)===null||a===void 0?void 0:a.accounts.length)!==e.accounts.length||this._authorizationResult.accounts.some((d,h)=>d.address!==e.accounts[h].address);if(this._authorizationResult=e,this.declareWalletAsInstalled(),c){const d=yield this._addressSelector.select(e.accounts.map(({address:h})=>h));d!==this._selectedAddress&&(this._selectedAddress=d,delete this._publicKey,this.emit("connect",this.publicKey))}})}performReauthorization(e,a){return __awaiter(this,void 0,void 0,function*(){try{const c=yield e.authorize({auth_token:a,identity:this._appIdentity});Promise.all([this._authorizationResultCache.set(c),this.handleAuthorizationResult(c)])}catch(c){throw this.disconnect(),new WalletDisconnectedError(c instanceof Error&&(c==null?void 0:c.message)||"Unknown error",c)}})}disconnect(){return __awaiter(this,void 0,void 0,function*(){this._authorizationResultCache.clear(),this._connecting=!1,this._connectionGeneration++,delete this._authorizationResult,delete this._publicKey,delete this._selectedAddress,this.emit("disconnect")})}transact(e){var a;return __awaiter(this,void 0,void 0,function*(){const c=(a=this._authorizationResult)===null||a===void 0?void 0:a.wallet_uri_base,d=c?{baseUri:c}:void 0,h=this._hostAuthority?{remoteHostAuthority:this._hostAuthority}:void 0,j=this._connectionGeneration;try{return yield transact(e,Object.assign(Object.assign({},d),h))}catch(et){throw this._connectionGeneration!==j&&(yield new Promise(()=>{})),et instanceof Error&&et.name==="SolanaMobileWalletAdapterError"&&et.code==="ERROR_WALLET_NOT_FOUND"&&(yield this._onWalletNotFound(this)),et}})}assertIsAuthorized(){if(!this._authorizationResult||!this._selectedAddress)throw new WalletNotConnectedError;return{authToken:this._authorizationResult.auth_token,selectedAddress:this._selectedAddress}}performSignTransactions(e){return __awaiter(this,void 0,void 0,function*(){const{authToken:a}=this.assertIsAuthorized();try{return yield this.transact(c=>__awaiter(this,void 0,void 0,function*(){return yield this.performReauthorization(c,a),yield c.signTransactions({transactions:e})}))}catch(c){throw new WalletSignTransactionError(c==null?void 0:c.message,c)}})}sendTransaction(e,a,c){return __awaiter(this,void 0,void 0,function*(){return yield this.runWithGuard(()=>__awaiter(this,void 0,void 0,function*(){const{authToken:d}=this.assertIsAuthorized(),h=c==null?void 0:c.minContextSlot;try{return yield this.transact(j=>__awaiter(this,void 0,void 0,function*(){function et(){let ht;switch(a.commitment){case"confirmed":case"finalized":case"processed":ht=a.commitment;break;default:ht="finalized"}let pt;switch(c==null?void 0:c.preflightCommitment){case"confirmed":case"finalized":case"processed":pt=c.preflightCommitment;break;case void 0:pt=ht;break;default:pt="finalized"}return(pt==="finalized"?2:pt==="confirmed"?1:0)<(ht==="finalized"?2:ht==="confirmed"?1:0)?pt:ht}const[nt,st,ot]=yield Promise.all([j.getCapabilities(),this.performReauthorization(j,d),isVersionedTransaction$1(e)?null:__awaiter(this,void 0,void 0,function*(){var ht;if(e.feePayer||(e.feePayer=(ht=this.publicKey)!==null&&ht!==void 0?ht:void 0),e.recentBlockhash==null){const{blockhash:pt}=yield a.getLatestBlockhash({commitment:et()});e.recentBlockhash=pt}})]);if(nt.supports_sign_and_send_transactions)return(yield j.signAndSendTransactions({minContextSlot:h,transactions:[e]}))[0];{const[ht]=yield j.signTransactions({transactions:[e]});if(isVersionedTransaction$1(ht))return yield a.sendTransaction(ht);{const pt=ht.serialize();return yield a.sendRawTransaction(pt,Object.assign(Object.assign({},c),{preflightCommitment:et()}))}}}))}catch(j){throw new WalletSendTransactionError(j==null?void 0:j.message,j)}}))})}signTransaction(e){return __awaiter(this,void 0,void 0,function*(){return yield this.runWithGuard(()=>__awaiter(this,void 0,void 0,function*(){const[a]=yield this.performSignTransactions([e]);return a}))})}signAllTransactions(e){return __awaiter(this,void 0,void 0,function*(){return yield this.runWithGuard(()=>__awaiter(this,void 0,void 0,function*(){return yield this.performSignTransactions(e)}))})}signMessage(e){return __awaiter(this,void 0,void 0,function*(){return yield this.runWithGuard(()=>__awaiter(this,void 0,void 0,function*(){const{authToken:a,selectedAddress:c}=this.assertIsAuthorized();try{return yield this.transact(d=>__awaiter(this,void 0,void 0,function*(){yield this.performReauthorization(d,a);const[h]=yield d.signMessages({addresses:[c],payloads:[e]});return h.slice(-SIGNATURE_LENGTH_IN_BYTES$1)}))}catch(d){throw new WalletSignMessageError(d==null?void 0:d.message,d)}}))})}signIn(e){return __awaiter(this,void 0,void 0,function*(){return yield this.runWithGuard(()=>__awaiter(this,void 0,void 0,function*(){var a,c;if(this._readyState!==WalletReadyState.Installed&&this._readyState!==WalletReadyState.Loadable)throw new WalletNotReadyError;this._connecting=!0;try{const d=yield this.performAuthorization(Object.assign(Object.assign({},e),{domain:(a=e==null?void 0:e.domain)!==null&&a!==void 0?a:window.location.host}));if(!d.sign_in_result)throw new Error("Sign in failed, no sign in result returned by wallet");const h=d.sign_in_result.address;return{account:Object.assign(Object.assign({},(c=d.accounts.find(et=>et.address==h))!==null&&c!==void 0?c:{address:h}),{publicKey:toUint8Array(h)}),signedMessage:toUint8Array(d.sign_in_result.signed_message),signature:toUint8Array(d.sign_in_result.signature)}}catch(d){throw new WalletConnectionError(d instanceof Error&&d.message||"Unknown error",d)}finally{this._connecting=!1}}))})}}function createDefaultAddressSelector(){return{select(o){return __awaiter(this,void 0,void 0,function*(){return o[0]})}}}const CACHE_KEY="SolanaMobileWalletAdapterDefaultAuthorizationCache";function createDefaultAuthorizationResultCache(){let o;try{o=window.localStorage}catch{}return{clear(){return __awaiter(this,void 0,void 0,function*(){if(o)try{o.removeItem(CACHE_KEY)}catch{}})},get(){return __awaiter(this,void 0,void 0,function*(){if(o)try{return JSON.parse(o.getItem(CACHE_KEY))||void 0}catch{}})},set(e){return __awaiter(this,void 0,void 0,function*(){if(o)try{o.setItem(CACHE_KEY,JSON.stringify(e))}catch{}})}}}function defaultWalletNotFoundHandler(o){return __awaiter(this,void 0,void 0,function*(){typeof window<"u"&&window.location.assign(o.url)})}function createDefaultWalletNotFoundHandler(){return defaultWalletNotFoundHandler}function arraysEqual(o,e){if(o===e)return!0;const a=o.length;if(a!==e.length)return!1;for(let c=0;c"u"||typeof document>"u"?WalletReadyState.Unsupported:WalletReadyState.Installed),_StandardWalletAdapter_changed.set(this,a=>{if("accounts"in a){const c=__classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").accounts[0];__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f")&&!__classPrivateFieldGet$1(this,_StandardWalletAdapter_disconnecting,"f")&&c!==__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f")&&(c?__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_connected).call(this,c):(this.emit("error",new WalletDisconnectedError),__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_disconnected).call(this)))}"features"in a&&__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_reset).call(this)}),__classPrivateFieldSet$1(this,_StandardWalletAdapter_wallet,e,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_account,null,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_publicKey,null,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_connecting,!1,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_disconnecting,!1,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_off,__classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[StandardEvents].on("change",__classPrivateFieldGet$1(this,_StandardWalletAdapter_changed,"f")),"f"),__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_reset).call(this)}get name(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").icon}get readyState(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_readyState,"f")}get publicKey(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_publicKey,"f")}get connecting(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_connecting,"f")}get supportedTransactionVersions(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_supportedTransactionVersions,"f")}get wallet(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f")}get standard(){return!0}destroy(){__classPrivateFieldSet$1(this,_StandardWalletAdapter_account,null,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_publicKey,null,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_connecting,!1,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_disconnecting,!1,"f");const e=__classPrivateFieldGet$1(this,_StandardWalletAdapter_off,"f");e&&(__classPrivateFieldSet$1(this,_StandardWalletAdapter_off,null,"f"),e())}async autoConnect(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_connect).call(this,{silent:!0})}async connect(){return __classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_connect).call(this)}async disconnect(){if(StandardDisconnect in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features)try{__classPrivateFieldSet$1(this,_StandardWalletAdapter_disconnecting,!0,"f"),await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[StandardDisconnect].disconnect()}catch(e){this.emit("error",new WalletDisconnectionError(e==null?void 0:e.message,e))}finally{__classPrivateFieldSet$1(this,_StandardWalletAdapter_disconnecting,!1,"f")}__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_disconnected).call(this)}async sendTransaction(e,a,c={}){try{const d=__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f");if(!d)throw new WalletNotConnectedError;let h;if(SolanaSignAndSendTransaction in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features)if(d.features.includes(SolanaSignAndSendTransaction))h=SolanaSignAndSendTransaction;else if(SolanaSignTransaction in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features&&d.features.includes(SolanaSignTransaction))h=SolanaSignTransaction;else throw new WalletAccountError;else if(SolanaSignTransaction in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features){if(!d.features.includes(SolanaSignTransaction))throw new WalletAccountError;h=SolanaSignTransaction}else throw new WalletConfigError;const j=getChainForEndpoint(a.rpcEndpoint);if(!d.chains.includes(j))throw new WalletSendTransactionError;try{const{signers:et,...nt}=c;let st;if(isVersionedTransaction$2(e)?(et!=null&&et.length&&e.sign(et),st=e.serialize()):(e=await this.prepareTransaction(e,a,nt),et!=null&&et.length&&e.partialSign(...et),st=new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))),h===SolanaSignAndSendTransaction){const[ot]=await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignAndSendTransaction].signAndSendTransaction({account:d,chain:j,transaction:st,options:{preflightCommitment:getCommitment(nt.preflightCommitment||a.commitment),skipPreflight:nt.skipPreflight,maxRetries:nt.maxRetries,minContextSlot:nt.minContextSlot}});return bs58$4.encode(ot.signature)}else{const[ot]=await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignTransaction].signTransaction({account:d,chain:j,transaction:st,options:{preflightCommitment:getCommitment(nt.preflightCommitment||a.commitment),minContextSlot:nt.minContextSlot}});return await a.sendRawTransaction(ot.signedTransaction,{...nt,preflightCommitment:getCommitment(nt.preflightCommitment||a.commitment)})}}catch(et){throw et instanceof WalletError?et:new WalletSendTransactionError(et==null?void 0:et.message,et)}}catch(d){throw this.emit("error",d),d}}}_StandardWalletAdapter_account=new WeakMap,_StandardWalletAdapter_publicKey=new WeakMap,_StandardWalletAdapter_connecting=new WeakMap,_StandardWalletAdapter_disconnecting=new WeakMap,_StandardWalletAdapter_off=new WeakMap,_StandardWalletAdapter_supportedTransactionVersions=new WeakMap,_StandardWalletAdapter_wallet=new WeakMap,_StandardWalletAdapter_readyState=new WeakMap,_StandardWalletAdapter_changed=new WeakMap,_StandardWalletAdapter_instances=new WeakSet,_StandardWalletAdapter_connect=async function(e){try{if(this.connected||this.connecting)return;if(__classPrivateFieldGet$1(this,_StandardWalletAdapter_readyState,"f")!==WalletReadyState.Installed)throw new WalletNotReadyError;if(__classPrivateFieldSet$1(this,_StandardWalletAdapter_connecting,!0,"f"),!__classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").accounts.length)try{await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[StandardConnect].connect(e)}catch(c){throw new WalletConnectionError(c==null?void 0:c.message,c)}const a=__classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").accounts[0];if(!a)throw new WalletAccountError;__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_connected).call(this,a)}catch(a){throw this.emit("error",a),a}finally{__classPrivateFieldSet$1(this,_StandardWalletAdapter_connecting,!1,"f")}},_StandardWalletAdapter_connected=function(e){let a;try{a=new PublicKey$1(e.address)}catch(c){throw new WalletPublicKeyError(c==null?void 0:c.message,c)}__classPrivateFieldSet$1(this,_StandardWalletAdapter_account,e,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_publicKey,a,"f"),__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_reset).call(this),this.emit("connect",a)},_StandardWalletAdapter_disconnected=function(){__classPrivateFieldSet$1(this,_StandardWalletAdapter_account,null,"f"),__classPrivateFieldSet$1(this,_StandardWalletAdapter_publicKey,null,"f"),__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_reset).call(this),this.emit("disconnect")},_StandardWalletAdapter_reset=function(){var a,c;const e=SolanaSignAndSendTransaction in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features?__classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignAndSendTransaction].supportedTransactionVersions:__classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignTransaction].supportedTransactionVersions;__classPrivateFieldSet$1(this,_StandardWalletAdapter_supportedTransactionVersions,arraysEqual(e,["legacy"])?null:new Set(e),"f"),SolanaSignTransaction in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features&&((a=__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f"))!=null&&a.features.includes(SolanaSignTransaction))?(this.signTransaction=__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_signTransaction),this.signAllTransactions=__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_signAllTransactions)):(delete this.signTransaction,delete this.signAllTransactions),SolanaSignMessage in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features&&((c=__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f"))!=null&&c.features.includes(SolanaSignMessage))?this.signMessage=__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_signMessage):delete this.signMessage,SolanaSignIn in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features?this.signIn=__classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_signIn):delete this.signIn},_StandardWalletAdapter_signTransaction=async function(e){try{const a=__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f");if(!a)throw new WalletNotConnectedError;if(!(SolanaSignTransaction in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features))throw new WalletConfigError;if(!a.features.includes(SolanaSignTransaction))throw new WalletAccountError;try{const d=(await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignTransaction].signTransaction({account:a,transaction:isVersionedTransaction$2(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}))[0].signedTransaction;return isVersionedTransaction$2(e)?VersionedTransaction.deserialize(d):Transaction.from(d)}catch(c){throw c instanceof WalletError?c:new WalletSignTransactionError(c==null?void 0:c.message,c)}}catch(a){throw this.emit("error",a),a}},_StandardWalletAdapter_signAllTransactions=async function(e){try{const a=__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f");if(!a)throw new WalletNotConnectedError;if(!(SolanaSignTransaction in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features))throw new WalletConfigError;if(!a.features.includes(SolanaSignTransaction))throw new WalletAccountError;try{const c=await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignTransaction].signTransaction(...e.map(d=>({account:a,transaction:isVersionedTransaction$2(d)?d.serialize():new Uint8Array(d.serialize({requireAllSignatures:!1,verifySignatures:!1}))})));return e.map((d,h)=>{const j=c[h].signedTransaction;return isVersionedTransaction$2(d)?VersionedTransaction.deserialize(j):Transaction.from(j)})}catch(c){throw new WalletSignTransactionError(c==null?void 0:c.message,c)}}catch(a){throw this.emit("error",a),a}},_StandardWalletAdapter_signMessage=async function(e){try{const a=__classPrivateFieldGet$1(this,_StandardWalletAdapter_account,"f");if(!a)throw new WalletNotConnectedError;if(!(SolanaSignMessage in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features))throw new WalletConfigError;if(!a.features.includes(SolanaSignMessage))throw new WalletAccountError;try{return(await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignMessage].signMessage({account:a,message:e}))[0].signature}catch(c){throw new WalletSignMessageError(c==null?void 0:c.message,c)}}catch(a){throw this.emit("error",a),a}},_StandardWalletAdapter_signIn=async function(e={}){try{if(!(SolanaSignIn in __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features))throw new WalletConfigError;let a;try{[a]=await __classPrivateFieldGet$1(this,_StandardWalletAdapter_wallet,"f").features[SolanaSignIn].signIn(e)}catch(c){throw new WalletSignInError(c==null?void 0:c.message,c)}if(!a)throw new WalletSignInError;return __classPrivateFieldGet$1(this,_StandardWalletAdapter_instances,"m",_StandardWalletAdapter_connected).call(this,a.account),a}catch(a){throw this.emit("error",a),a}};const isWalletAdapterCompatibleWallet=isWalletAdapterCompatibleStandardWallet;var __classPrivateFieldGet=function(o,e,a,c){if(a==="a"&&!c)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?o!==e||!c:!e.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?c:a==="a"?c.call(o):c?c.value:e.get(o)},__classPrivateFieldSet=function(o,e,a,c,d){if(c==="m")throw new TypeError("Private method is not writable");if(c==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?o!==e||!d:!e.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return c==="a"?d.call(o,a):d?d.value=a:e.set(o,a),a},_AppReadyEvent_detail;let wallets;const registeredWalletsSet=new Set;function addRegisteredWallet(o){cachedWalletsArray=void 0,registeredWalletsSet.add(o)}function removeRegisteredWallet(o){cachedWalletsArray=void 0,registeredWalletsSet.delete(o)}const listeners={};function getWallets(){if(wallets||(wallets=Object.freeze({register,get,on}),typeof window>"u"))return wallets;const o=Object.freeze({register});try{window.addEventListener("wallet-standard:register-wallet",({detail:e})=>e(o))}catch(e){console.error(`wallet-standard:register-wallet event listener could not be added +`,e)}try{window.dispatchEvent(new AppReadyEvent(o))}catch(e){console.error(`wallet-standard:app-ready event could not be dispatched +`,e)}return wallets}function register(...o){var e;return o=o.filter(a=>!registeredWalletsSet.has(a)),o.length?(o.forEach(a=>addRegisteredWallet(a)),(e=listeners.register)==null||e.forEach(a=>guard(()=>a(...o))),function(){var c;o.forEach(d=>removeRegisteredWallet(d)),(c=listeners.unregister)==null||c.forEach(d=>guard(()=>d(...o)))}):()=>{}}let cachedWalletsArray;function get(){return cachedWalletsArray||(cachedWalletsArray=[...registeredWalletsSet]),cachedWalletsArray}function on(o,e){var a;return(a=listeners[o])!=null&&a.push(e)||(listeners[o]=[e]),function(){var d;listeners[o]=(d=listeners[o])==null?void 0:d.filter(h=>e!==h)}}function guard(o){try{o()}catch(e){console.error(e)}}class AppReadyEvent extends Event{get detail(){return __classPrivateFieldGet(this,_AppReadyEvent_detail,"f")}get type(){return"wallet-standard:app-ready"}constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),_AppReadyEvent_detail.set(this,void 0),__classPrivateFieldSet(this,_AppReadyEvent_detail,e,"f")}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}_AppReadyEvent_detail=new WeakMap;function DEPRECATED_getWallets(){if(wallets||(wallets=getWallets(),typeof window>"u"))return wallets;const o=window.navigator.wallets||[];if(!Array.isArray(o))return console.error("window.navigator.wallets is not an array"),wallets;const{register:e}=wallets,a=(...c)=>c.forEach(d=>guard(()=>d({register:e})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:a})})}catch{return console.error("window.navigator.wallets could not be set"),wallets}return a(...o),wallets}function useStandardWalletAdapters(o){const e=useConstant(()=>new Set),{get:a,on:c}=useConstant(()=>DEPRECATED_getWallets()),[d,h]=reactExports.useState(()=>wrapWalletsWithAdapters(a()));reactExports.useEffect(()=>{const et=[c("register",(...nt)=>h(st=>[...st,...wrapWalletsWithAdapters(nt)])),c("unregister",(...nt)=>h(st=>st.filter(ot=>nt.some(ht=>ht===ot.wallet))))];return()=>et.forEach(nt=>nt())},[c]);const j=usePrevious(d);return reactExports.useEffect(()=>{if(!j)return;const et=new Set(d);new Set(j.filter(st=>!et.has(st))).forEach(st=>st.destroy())},[j,d]),reactExports.useEffect(()=>()=>d.forEach(et=>et.destroy()),[]),reactExports.useMemo(()=>[...d,...o.filter(({name:et})=>d.some(nt=>nt.name===et)?(e.has(et)||(e.add(et),console.warn(`${et} was registered as a Standard Wallet. The Wallet Adapter for ${et} can be removed from your app.`)),!1):!0)],[d,o,e])}function useConstant(o){const e=reactExports.useRef();return e.current||(e.current={value:o()}),e.current.value}function usePrevious(o){const e=reactExports.useRef();return reactExports.useEffect(()=>{e.current=o}),e.current}function wrapWalletsWithAdapters(o){return o.filter(isWalletAdapterCompatibleWallet).map(e=>new StandardWalletAdapter({wallet:e}))}var Environment;(function(o){o[o.DESKTOP_WEB=0]="DESKTOP_WEB",o[o.MOBILE_WEB=1]="MOBILE_WEB"})(Environment||(Environment={}));function isWebView(o){return/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(o)}function getEnvironment({adapters:o,userAgentString:e}){return o.some(a=>a.name!==SolanaMobileWalletAdapterWalletName&&a.readyState===WalletReadyState.Installed)?Environment.DESKTOP_WEB:e&&/android/i.test(e)&&!isWebView(e)?Environment.MOBILE_WEB:Environment.DESKTOP_WEB}function getInferredClusterFromEndpoint(o){return o?/devnet/i.test(o)?"devnet":/testnet/i.test(o)?"testnet":"mainnet-beta":"mainnet-beta"}function WalletProviderBase({children:o,wallets:e,adapter:a,isUnloadingRef:c,onAutoConnectRequest:d,onConnectError:h,onError:j,onSelectWallet:et}){const nt=reactExports.useRef(!1),[st,ot]=reactExports.useState(!1),ht=reactExports.useRef(!1),[pt,dt]=reactExports.useState(!1),[gt,wt]=reactExports.useState(()=>(a==null?void 0:a.publicKey)??null),[St,_t]=reactExports.useState(()=>(a==null?void 0:a.connected)??!1),mt=reactExports.useRef(j);reactExports.useEffect(()=>(mt.current=j,()=>{mt.current=void 0}),[j]);const bt=reactExports.useRef((_e,rt)=>(c.current||(mt.current?mt.current(_e,rt):(console.error(_e,rt),_e instanceof WalletNotReadyError&&typeof window<"u"&&rt&&window.open(rt.url,"_blank"))),_e)),[$t,Bt]=reactExports.useState(()=>e.map(_e=>({adapter:_e,readyState:_e.readyState})).filter(({readyState:_e})=>_e!==WalletReadyState.Unsupported));reactExports.useEffect(()=>{Bt(rt=>e.map((at,lt)=>{const tt=rt[lt];return tt&&tt.adapter===at&&tt.readyState===at.readyState?tt:{adapter:at,readyState:at.readyState}}).filter(({readyState:at})=>at!==WalletReadyState.Unsupported));function _e(rt){Bt(at=>{const lt=at.findIndex(({adapter:_})=>_===this);if(lt===-1)return at;const{adapter:tt}=at[lt];return[...at.slice(0,lt),{adapter:tt,readyState:rt},...at.slice(lt+1)].filter(({readyState:_})=>_!==WalletReadyState.Unsupported)})}return e.forEach(rt=>rt.on("readyStateChange",_e,rt)),()=>{e.forEach(rt=>rt.off("readyStateChange",_e,rt))}},[a,e]);const Dt=reactExports.useMemo(()=>$t.find(_e=>_e.adapter===a)??null,[a,$t]);reactExports.useEffect(()=>{if(!a)return;const _e=lt=>{wt(lt),nt.current=!1,ot(!1),_t(!0),ht.current=!1,dt(!1)},rt=()=>{c.current||(wt(null),nt.current=!1,ot(!1),_t(!1),ht.current=!1,dt(!1))},at=lt=>{bt.current(lt,a)};return a.on("connect",_e),a.on("disconnect",rt),a.on("error",at),()=>{a.off("connect",_e),a.off("disconnect",rt),a.off("error",at),rt()}},[a,c]);const Ht=reactExports.useRef(!1);reactExports.useEffect(()=>()=>{Ht.current=!1},[a]),reactExports.useEffect(()=>{Ht.current||nt.current||St||!d||!((Dt==null?void 0:Dt.readyState)===WalletReadyState.Installed||(Dt==null?void 0:Dt.readyState)===WalletReadyState.Loadable)||(nt.current=!0,ot(!0),Ht.current=!0,async function(){try{await d()}catch{h()}finally{ot(!1),nt.current=!1}}())},[St,d,h,Dt]);const qt=reactExports.useCallback(async(_e,rt,at)=>{if(!a)throw bt.current(new WalletNotSelectedError);if(!St)throw bt.current(new WalletNotConnectedError,a);return await a.sendTransaction(_e,rt,at)},[a,St]),Pt=reactExports.useMemo(()=>a&&"signTransaction"in a?async _e=>{if(!St)throw bt.current(new WalletNotConnectedError,a);return await a.signTransaction(_e)}:void 0,[a,St]),Gt=reactExports.useMemo(()=>a&&"signAllTransactions"in a?async _e=>{if(!St)throw bt.current(new WalletNotConnectedError,a);return await a.signAllTransactions(_e)}:void 0,[a,St]),ct=reactExports.useMemo(()=>a&&"signMessage"in a?async _e=>{if(!St)throw bt.current(new WalletNotConnectedError,a);return await a.signMessage(_e)}:void 0,[a,St]),g=reactExports.useMemo(()=>a&&"signIn"in a?async _e=>await a.signIn(_e):void 0,[a]),b=reactExports.useCallback(async()=>{if(nt.current||ht.current||Dt!=null&&Dt.adapter.connected)return;if(!Dt)throw bt.current(new WalletNotSelectedError);const{adapter:_e,readyState:rt}=Dt;if(!(rt===WalletReadyState.Installed||rt===WalletReadyState.Loadable))throw bt.current(new WalletNotReadyError,_e);nt.current=!0,ot(!0);try{await _e.connect()}catch(at){throw h(),at}finally{ot(!1),nt.current=!1}},[h,Dt]),$=reactExports.useCallback(async()=>{if(!ht.current&&a){ht.current=!0,dt(!0);try{await a.disconnect()}finally{dt(!1),ht.current=!1}}},[a]);return React.createElement(WalletContext.Provider,{value:{autoConnect:!!d,wallets:$t,wallet:Dt,publicKey:gt,connected:St,connecting:st,disconnecting:pt,select:et,connect:b,disconnect:$,sendTransaction:qt,signTransaction:Pt,signAllTransactions:Gt,signMessage:ct,signIn:g}},o)}let _userAgent;function getUserAgent(){var o;return _userAgent===void 0&&(_userAgent=((o=globalThis.navigator)==null?void 0:o.userAgent)??null),_userAgent}function getIsMobile(o){const e=getUserAgent();return getEnvironment({adapters:o,userAgentString:e})===Environment.MOBILE_WEB}function getUriForAppIdentity(){const o=globalThis.location;if(o)return`${o.protocol}//${o.host}`}function WalletProvider({children:o,wallets:e,autoConnect:a,localStorageKey:c="walletName",onError:d}){const{connection:h}=useConnection(),j=useStandardWalletAdapters(e),et=reactExports.useMemo(()=>{if(!getIsMobile(j))return null;const mt=j.find(bt=>bt.name===SolanaMobileWalletAdapterWalletName);return mt||new SolanaMobileWalletAdapter({addressSelector:createDefaultAddressSelector(),appIdentity:{uri:getUriForAppIdentity()},authorizationResultCache:createDefaultAuthorizationResultCache(),cluster:getInferredClusterFromEndpoint(h==null?void 0:h.rpcEndpoint),onWalletNotFound:createDefaultWalletNotFoundHandler()})},[j,h==null?void 0:h.rpcEndpoint]),nt=reactExports.useMemo(()=>et==null||j.indexOf(et)!==-1?j:[et,...j],[j,et]),[st,ot]=useLocalStorage(c,getIsMobile(j)?SolanaMobileWalletAdapterWalletName:null),ht=reactExports.useMemo(()=>nt.find(mt=>mt.name===st)??null,[nt,st]),pt=reactExports.useCallback(mt=>{st!==mt&&(ht&&ht.name!==SolanaMobileWalletAdapterWalletName&&ht.disconnect(),ot(mt))},[ht,ot,st]);reactExports.useEffect(()=>{if(!ht)return;function mt(){wt.current||st===SolanaMobileWalletAdapterWalletName&&getIsMobile(j)||ot(null)}return ht.on("disconnect",mt),()=>{ht.off("disconnect",mt)}},[ht,j,ot,st]);const dt=reactExports.useRef(!1),gt=reactExports.useMemo(()=>{if(!(!a||!ht))return async()=>{(a===!0||await a(ht))&&(dt.current?await ht.connect():await ht.autoConnect())}},[a,ht]),wt=reactExports.useRef(!1);reactExports.useEffect(()=>{if(st===SolanaMobileWalletAdapterWalletName&&getIsMobile(j)){wt.current=!1;return}function mt(){wt.current=!0}return window.addEventListener("beforeunload",mt),()=>{window.removeEventListener("beforeunload",mt)}},[j,st]);const St=reactExports.useCallback(()=>{ht&&ht.name!==SolanaMobileWalletAdapterWalletName&&pt(null)},[ht,pt]),_t=reactExports.useCallback(mt=>{dt.current=!0,pt(mt)},[pt]);return React.createElement(WalletProviderBase,{wallets:nt,adapter:ht,isUnloadingRef:wt,onAutoConnectRequest:gt,onConnectError:St,onError:d,onSelectWallet:_t},o)}function useWalletMultiButton({onSelectWallet:o}){const{connect:e,connected:a,connecting:c,disconnect:d,disconnecting:h,publicKey:j,select:et,wallet:nt,wallets:st}=useWallet();let ot;c?ot="connecting":a?ot="connected":h?ot="disconnecting":nt?ot="has-wallet":ot="no-wallet";const ht=reactExports.useCallback(()=>{e().catch(()=>{})},[e]),pt=reactExports.useCallback(()=>{d().catch(()=>{})},[d]),dt=reactExports.useCallback(()=>{o({onSelectWallet:et,wallets:st})},[o,et,st]);return{buttonState:ot,onConnect:ot==="has-wallet"?ht:void 0,onDisconnect:ot!=="disconnecting"&&ot!=="no-wallet"?pt:void 0,onSelectWallet:dt,publicKey:j??void 0,walletIcon:nt==null?void 0:nt.adapter.icon,walletName:nt==null?void 0:nt.adapter.name}}const Button=o=>React.createElement("button",{className:`wallet-adapter-button ${o.className||""}`,disabled:o.disabled,style:o.style,onClick:o.onClick,tabIndex:o.tabIndex||0,type:"button"},o.startIcon&&React.createElement("i",{className:"wallet-adapter-button-start-icon"},o.startIcon),o.children,o.endIcon&&React.createElement("i",{className:"wallet-adapter-button-end-icon"},o.endIcon)),WalletIcon=({wallet:o,...e})=>o&&React.createElement("img",{src:o.adapter.icon,alt:`${o.adapter.name} icon`,...e});function BaseWalletConnectionButton({walletIcon:o,walletName:e,...a}){return React.createElement(Button,{...a,className:"wallet-adapter-button-trigger",startIcon:o&&e?React.createElement(WalletIcon,{wallet:{adapter:{icon:o,name:e}}}):void 0})}function BaseWalletMultiButton({children:o,labels:e,...a}){const{setVisible:c}=useWalletModal(),{buttonState:d,onConnect:h,onDisconnect:j,publicKey:et,walletIcon:nt,walletName:st}=useWalletMultiButton({onSelectWallet(){c(!0)}}),[ot,ht]=reactExports.useState(!1),[pt,dt]=reactExports.useState(!1),gt=reactExports.useRef(null);reactExports.useEffect(()=>{const St=_t=>{const mt=gt.current;!mt||mt.contains(_t.target)||dt(!1)};return document.addEventListener("mousedown",St),document.addEventListener("touchstart",St),()=>{document.removeEventListener("mousedown",St),document.removeEventListener("touchstart",St)}},[]);const wt=reactExports.useMemo(()=>{if(o)return o;if(et){const St=et.toBase58();return St.slice(0,4)+".."+St.slice(-4)}else return d==="connecting"||d==="has-wallet"?e[d]:e["no-wallet"]},[d,o,e,et]);return React.createElement("div",{className:"wallet-adapter-dropdown"},React.createElement(BaseWalletConnectionButton,{...a,"aria-expanded":pt,style:{pointerEvents:pt?"none":"auto",...a.style},onClick:()=>{switch(d){case"no-wallet":c(!0);break;case"has-wallet":h&&h();break;case"connected":dt(!0);break}},walletIcon:nt,walletName:st},wt),React.createElement("ul",{"aria-label":"dropdown-list",className:`wallet-adapter-dropdown-list ${pt&&"wallet-adapter-dropdown-list-active"}`,ref:gt,role:"menu"},et?React.createElement("li",{className:"wallet-adapter-dropdown-list-item",onClick:async()=>{await navigator.clipboard.writeText(et.toBase58()),ht(!0),setTimeout(()=>ht(!1),400)},role:"menuitem"},ot?e.copied:e["copy-address"]):null,React.createElement("li",{className:"wallet-adapter-dropdown-list-item",onClick:()=>{c(!0),dt(!1)},role:"menuitem"},e["change-wallet"]),j?React.createElement("li",{className:"wallet-adapter-dropdown-list-item",onClick:()=>{j(),dt(!1)},role:"menuitem"},e.disconnect):null))}const Collapse=({id:o,children:e,expanded:a=!1})=>{const c=reactExports.useRef(null),d=reactExports.useRef(!0),h="height 250ms ease-out",j=()=>{const nt=c.current;nt&&requestAnimationFrame(()=>{nt.style.height=nt.scrollHeight+"px"})},et=()=>{const nt=c.current;nt&&requestAnimationFrame(()=>{nt.style.height=nt.offsetHeight+"px",nt.style.overflow="hidden",requestAnimationFrame(()=>{nt.style.height="0"})})};return reactExports.useLayoutEffect(()=>{a?j():et()},[a]),reactExports.useLayoutEffect(()=>{const nt=c.current;if(!nt)return;function st(){nt&&(nt.style.overflow=a?"initial":"hidden",a&&(nt.style.height="auto"))}function ot(ht){nt&&ht.target===nt&&ht.propertyName==="height"&&st()}return d.current&&(st(),d.current=!1),nt.addEventListener("transitionend",ot),()=>nt.removeEventListener("transitionend",ot)},[a]),React.createElement("div",{className:"wallet-adapter-collapse",id:o,ref:c,role:"region",style:{height:0,transition:d.current?void 0:h}},e)},WalletListItem=({handleClick:o,tabIndex:e,wallet:a})=>React.createElement("li",null,React.createElement(Button,{onClick:o,startIcon:React.createElement(WalletIcon,{wallet:a}),tabIndex:e},a.adapter.name,a.readyState===WalletReadyState.Installed&&React.createElement("span",null,"Detected"))),WalletSVG=()=>React.createElement("svg",{width:"97",height:"96",viewBox:"0 0 97 96",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("circle",{cx:"48.5",cy:"48",r:"48",fill:"url(#paint0_linear_880_5115)",fillOpacity:"0.1"}),React.createElement("circle",{cx:"48.5",cy:"48",r:"47",stroke:"url(#paint1_linear_880_5115)",strokeOpacity:"0.4",strokeWidth:"2"}),React.createElement("g",{clipPath:"url(#clip0_880_5115)"},React.createElement("path",{d:"M65.5769 28.1523H31.4231C27.6057 28.1523 24.5 31.258 24.5 35.0754V60.9215C24.5 64.7389 27.6057 67.8446 31.4231 67.8446H65.5769C69.3943 67.8446 72.5 64.7389 72.5 60.9215V35.0754C72.5 31.258 69.3943 28.1523 65.5769 28.1523ZM69.7308 52.1523H59.5769C57.2865 52.1523 55.4231 50.289 55.4231 47.9985C55.4231 45.708 57.2864 43.8446 59.5769 43.8446H69.7308V52.1523ZM69.7308 41.0754H59.5769C55.7595 41.0754 52.6539 44.1811 52.6539 47.9985C52.6539 51.8159 55.7595 54.9215 59.5769 54.9215H69.7308V60.9215C69.7308 63.2119 67.8674 65.0754 65.5769 65.0754H31.4231C29.1327 65.0754 27.2692 63.212 27.2692 60.9215V35.0754C27.2692 32.785 29.1326 30.9215 31.4231 30.9215H65.5769C67.8673 30.9215 69.7308 32.7849 69.7308 35.0754V41.0754Z",fill:"url(#paint2_linear_880_5115)"}),React.createElement("path",{d:"M61.4231 46.6172H59.577C58.8123 46.6172 58.1924 47.2371 58.1924 48.0018C58.1924 48.7665 58.8123 49.3863 59.577 49.3863H61.4231C62.1878 49.3863 62.8077 48.7664 62.8077 48.0018C62.8077 47.2371 62.1878 46.6172 61.4231 46.6172Z",fill:"url(#paint3_linear_880_5115)"})),React.createElement("defs",null,React.createElement("linearGradient",{id:"paint0_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{stopColor:"#9945FF"}),React.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),React.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),React.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),React.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),React.createElement("stop",{offset:"1",stopColor:"#00D18C"})),React.createElement("linearGradient",{id:"paint1_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{stopColor:"#9945FF"}),React.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),React.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),React.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),React.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),React.createElement("stop",{offset:"1",stopColor:"#00D18C"})),React.createElement("linearGradient",{id:"paint2_linear_880_5115",x1:"25.9583",y1:"68.7101",x2:"67.2337",y2:"23.7879",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{stopColor:"#9945FF"}),React.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),React.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),React.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),React.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),React.createElement("stop",{offset:"1",stopColor:"#00D18C"})),React.createElement("linearGradient",{id:"paint3_linear_880_5115",x1:"58.3326",y1:"49.4467",x2:"61.0002",y2:"45.4453",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{stopColor:"#9945FF"}),React.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),React.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),React.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),React.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),React.createElement("stop",{offset:"1",stopColor:"#00D18C"})),React.createElement("clipPath",{id:"clip0_880_5115"},React.createElement("rect",{width:"48",height:"48",fill:"white",transform:"translate(24.5 24)"})))),WalletModal=({className:o="",container:e="body"})=>{const a=reactExports.useRef(null),{wallets:c,select:d}=useWallet(),{setVisible:h}=useWalletModal(),[j,et]=reactExports.useState(!1),[nt,st]=reactExports.useState(!1),[ot,ht]=reactExports.useState(null),[pt,dt]=reactExports.useMemo(()=>{const bt=[],$t=[];for(const Bt of c)Bt.readyState===WalletReadyState.Installed?bt.push(Bt):$t.push(Bt);return bt.length?[bt,$t]:[$t,[]]},[c]),gt=reactExports.useCallback(()=>{st(!1),setTimeout(()=>h(!1),150)},[h]),wt=reactExports.useCallback(bt=>{bt.preventDefault(),gt()},[gt]),St=reactExports.useCallback((bt,$t)=>{d($t),wt(bt)},[d,wt]),_t=reactExports.useCallback(()=>et(!j),[j]),mt=reactExports.useCallback(bt=>{const $t=a.current;if(!$t)return;const Bt=$t.querySelectorAll("button"),Dt=Bt[0],Ht=Bt[Bt.length-1];bt.shiftKey?document.activeElement===Dt&&(Ht.focus(),bt.preventDefault()):document.activeElement===Ht&&(Dt.focus(),bt.preventDefault())},[a]);return reactExports.useLayoutEffect(()=>{const bt=Bt=>{Bt.key==="Escape"?gt():Bt.key==="Tab"&&mt(Bt)},{overflow:$t}=window.getComputedStyle(document.body);return setTimeout(()=>st(!0),0),document.body.style.overflow="hidden",window.addEventListener("keydown",bt,!1),()=>{document.body.style.overflow=$t,window.removeEventListener("keydown",bt,!1)}},[gt,mt]),reactExports.useLayoutEffect(()=>ht(document.querySelector(e)),[e]),ot&&reactDomExports.createPortal(React.createElement("div",{"aria-labelledby":"wallet-adapter-modal-title","aria-modal":"true",className:`wallet-adapter-modal ${nt&&"wallet-adapter-modal-fade-in"} ${o}`,ref:a,role:"dialog"},React.createElement("div",{className:"wallet-adapter-modal-container"},React.createElement("div",{className:"wallet-adapter-modal-wrapper"},React.createElement("button",{onClick:wt,className:"wallet-adapter-modal-button-close"},React.createElement("svg",{width:"14",height:"14"},React.createElement("path",{d:"M14 12.461 8.3 6.772l5.234-5.233L12.006 0 6.772 5.234 1.54 0 0 1.539l5.234 5.233L0 12.006l1.539 1.528L6.772 8.3l5.69 5.7L14 12.461z"}))),pt.length?React.createElement(React.Fragment,null,React.createElement("h1",{className:"wallet-adapter-modal-title"},"Connect a wallet on Solana to continue"),React.createElement("ul",{className:"wallet-adapter-modal-list"},pt.map(bt=>React.createElement(WalletListItem,{key:bt.adapter.name,handleClick:$t=>St($t,bt.adapter.name),wallet:bt})),dt.length?React.createElement(Collapse,{expanded:j,id:"wallet-adapter-modal-collapse"},dt.map(bt=>React.createElement(WalletListItem,{key:bt.adapter.name,handleClick:$t=>St($t,bt.adapter.name),tabIndex:j?0:-1,wallet:bt}))):null),dt.length?React.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:_t,tabIndex:0},React.createElement("span",null,j?"Less ":"More ","options"),React.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${j?"wallet-adapter-modal-list-more-icon-rotate":""}`},React.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))):null):React.createElement(React.Fragment,null,React.createElement("h1",{className:"wallet-adapter-modal-title"},"You'll need a wallet on Solana to continue"),React.createElement("div",{className:"wallet-adapter-modal-middle"},React.createElement(WalletSVG,null)),dt.length?React.createElement(React.Fragment,null,React.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:_t,tabIndex:0},React.createElement("span",null,j?"Hide ":"Already have a wallet? View ","options"),React.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${j?"wallet-adapter-modal-list-more-icon-rotate":""}`},React.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))),React.createElement(Collapse,{expanded:j,id:"wallet-adapter-modal-collapse"},React.createElement("ul",{className:"wallet-adapter-modal-list"},dt.map(bt=>React.createElement(WalletListItem,{key:bt.adapter.name,handleClick:$t=>St($t,bt.adapter.name),tabIndex:j?0:-1,wallet:bt}))))):null))),React.createElement("div",{className:"wallet-adapter-modal-overlay",onMouseDown:wt})),ot)},WalletModalProvider=({children:o,...e})=>{const[a,c]=reactExports.useState(!1);return React.createElement(WalletModalContext.Provider,{value:{visible:a,setVisible:c}},o,a&&React.createElement(WalletModal,{...e}))},LABELS={"change-wallet":"Change wallet",connecting:"Connecting ...","copy-address":"Copy address",copied:"Copied",disconnect:"Disconnect","has-wallet":"Connect","no-wallet":"Select Wallet"};function WalletMultiButton(o){return React.createElement(BaseWalletMultiButton,{...o,labels:LABELS})}var camelcase={exports:{}};const UPPERCASE=/[\p{Lu}]/u,LOWERCASE=/[\p{Ll}]/u,LEADING_CAPITAL=/^[\p{Lu}](?![\p{Lu}])/gu,IDENTIFIER=/([\p{Alpha}\p{N}_]|$)/u,SEPARATORS=/[_.\- ]+/,LEADING_SEPARATORS=new RegExp("^"+SEPARATORS.source),SEPARATORS_AND_IDENTIFIER=new RegExp(SEPARATORS.source+IDENTIFIER.source,"gu"),NUMBERS_AND_IDENTIFIER=new RegExp("\\d+"+IDENTIFIER.source,"gu"),preserveCamelCase=(o,e,a)=>{let c=!1,d=!1,h=!1;for(let j=0;j(LEADING_CAPITAL.lastIndex=0,o.replace(LEADING_CAPITAL,a=>e(a))),postProcess=(o,e)=>(SEPARATORS_AND_IDENTIFIER.lastIndex=0,NUMBERS_AND_IDENTIFIER.lastIndex=0,o.replace(SEPARATORS_AND_IDENTIFIER,(a,c)=>e(c)).replace(NUMBERS_AND_IDENTIFIER,a=>e(a))),camelCase=(o,e)=>{if(!(typeof o=="string"||Array.isArray(o)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(o)?o=o.map(h=>h.trim()).filter(h=>h.length).join("-"):o=o.trim(),o.length===0)return"";const a=e.locale===!1?h=>h.toLowerCase():h=>h.toLocaleLowerCase(e.locale),c=e.locale===!1?h=>h.toUpperCase():h=>h.toLocaleUpperCase(e.locale);return o.length===1?e.pascalCase?c(o):a(o):(o!==a(o)&&(o=preserveCamelCase(o,a,c)),o=o.replace(LEADING_SEPARATORS,""),e.preserveConsecutiveUppercase?o=preserveConsecutiveUppercase(o,a):o=a(o),e.pascalCase&&(o=c(o.charAt(0))+o.slice(1)),postProcess(o,c))};camelcase.exports=camelCase;camelcase.exports.default=camelCase;var camelcaseExports=camelcase.exports;const camelCase$1=getDefaultExportFromCjs$3(camelcaseExports);var dist$2={},Layout$3={};let Layout$2=class{constructor(e,a){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=a}makeDestinationObject(){return{}}decode(e,a){throw new Error("Layout is abstract")}encode(e,a,c){throw new Error("Layout is abstract")}getSpan(e,a){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const a=Object.create(this.constructor.prototype);return Object.assign(a,this),a.property=e,a}fromArray(e){}};Layout$3.Layout=Layout$2;function nameWithProperty$2(o,e){return e.property?o+"["+e.property+"]":o}Layout$3.nameWithProperty=nameWithProperty$2;function bindConstructorLayout(o,e){if(typeof o!="function")throw new TypeError("Class must be constructor");if(o.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Layout$2))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");o.layout_=e,e.boundConstructor_=o,e.makeDestinationObject=()=>new o,Object.defineProperty(o.prototype,"encode",{value:function(a,c){return e.encode(this,a,c)},writable:!0}),Object.defineProperty(o,"decode",{value:function(a,c){return e.decode(a,c)},writable:!0})}Layout$3.bindConstructorLayout=bindConstructorLayout;let ExternalLayout$2=class extends Layout$2{isCount(){throw new Error("ExternalLayout is abstract")}};class GreedyCount extends ExternalLayout$2{constructor(e,a){if(e===void 0&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,a),this.elementSpan=e}isCount(){return!0}decode(e,a){a===void 0&&(a=0);const c=e.length-a;return Math.floor(c/this.elementSpan)}encode(e,a,c){return 0}}let OffsetLayout$2=class extends ExternalLayout$2{constructor(e,a,c){if(!(e instanceof Layout$2))throw new TypeError("layout must be a Layout");if(a===void 0)a=0;else if(!Number.isInteger(a))throw new TypeError("offset must be integer or undefined");super(e.span,c||e.property),this.layout=e,this.offset=a}isCount(){return this.layout instanceof UInt$2||this.layout instanceof UIntBE$2}decode(e,a){return a===void 0&&(a=0),this.layout.decode(e,a+this.offset)}encode(e,a,c){return c===void 0&&(c=0),this.layout.encode(e,a,c+this.offset)}},UInt$2=class extends Layout$2{constructor(e,a){if(super(e,a),6j+d.encode(et,a,c+j),0);return this.count instanceof ExternalLayout$2&&this.count.encode(e.length,a,c),h}}let Structure$2=class extends Layout$2{constructor(e,a,c){if(!(Array.isArray(e)&&e.reduce((h,j)=>h&&j instanceof Layout$2,!0)))throw new TypeError("fields must be array of Layout instances");typeof a=="boolean"&&c===void 0&&(c=a,a=void 0);for(const h of e)if(0>h.span&&h.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let d=-1;try{d=e.reduce((h,j)=>h+j.getSpan(),0)}catch{}super(d,a),this.fields=e,this.decodePrefixes=!!c}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let c=0;try{c=this.fields.reduce((d,h)=>{const j=h.getSpan(e,a);return a+=j,d+j},0)}catch{throw new RangeError("indeterminate span")}return c}decode(e,a){a===void 0&&(a=0);const c=this.makeDestinationObject();for(const d of this.fields)if(d.property!==void 0&&(c[d.property]=d.decode(e,a)),a+=d.getSpan(e,a),this.decodePrefixes&&e.length===a)break;return c}encode(e,a,c){c===void 0&&(c=0);const d=c;let h=0,j=0;for(const et of this.fields){let nt=et.span;if(j=0nt&&(nt=et.getSpan(a,c)))}h=c,c+=nt}return h+j-d}fromArray(e){const a=this.makeDestinationObject();for(const c of this.fields)c.property!==void 0&&0c.span?a=-1:0<=a&&(a+=c.span)}}},UnionDiscriminator$2=class{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}},UnionLayoutDiscriminator$2=class extends UnionDiscriminator$2{constructor(e,a){if(!(e instanceof ExternalLayout$2&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(a||e.property||"variant"),this.layout=e}decode(e,a){return this.layout.decode(e,a)}encode(e,a,c){return this.layout.encode(e,a,c)}},Union$2=class extends Layout$2{constructor(e,a,c){const d=e instanceof UInt$2||e instanceof UIntBE$2;if(d)e=new UnionLayoutDiscriminator$2(new OffsetLayout$2(e));else if(e instanceof ExternalLayout$2&&e.isCount())e=new UnionLayoutDiscriminator$2(e);else if(!(e instanceof UnionDiscriminator$2))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(a===void 0&&(a=null),!(a===null||a instanceof Layout$2))throw new TypeError("defaultLayout must be null or a Layout");if(a!==null){if(0>a.span)throw new Error("defaultLayout must have constant span");a.property===void 0&&(a=a.replicate("content"))}let h=-1;a&&(h=a.span,0<=h&&d&&(h+=e.layout.span)),super(h,c),this.discriminator=e,this.usesPrefixDiscriminator=d,this.defaultLayout=a,this.registry={};let j=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(et){return j(et)},this.configGetSourceVariant=function(et){j=et.bind(this)}}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);const c=this.getVariant(e,a);if(!c)throw new Error("unable to determine span for unrecognized variant");return c.getSpan(e,a)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const a=this.registry[e[this.discriminator.property]];if(a&&(!a.layout||e.hasOwnProperty(a.property)))return a}else for(const a in this.registry){const c=this.registry[a];if(e.hasOwnProperty(c.property))return c}throw new Error("unable to infer src variant")}decode(e,a){a===void 0&&(a=0);let c;const d=this.discriminator,h=d.decode(e,a);let j=this.registry[h];if(j===void 0){let et=0;j=this.defaultLayout,this.usesPrefixDiscriminator&&(et=d.layout.span),c=this.makeDestinationObject(),c[d.property]=h,c[j.property]=this.defaultLayout.decode(e,a+et)}else c=j.decode(e,a);return c}encode(e,a,c){c===void 0&&(c=0);const d=this.getSourceVariant(e);if(d===void 0){const h=this.discriminator,j=this.defaultLayout;let et=0;return this.usesPrefixDiscriminator&&(et=h.layout.span),h.encode(e[h.property],a,c),et+j.encode(e[j.property],a,c+et)}return d.encode(e,a,c)}addVariant(e,a,c){const d=new VariantLayout$2(this,e,a,c);return this.registry[e]=d,d}getVariant(e,a){let c=e;return Buffer$1$1.isBuffer(e)&&(a===void 0&&(a=0),c=this.discriminator.decode(e,a)),this.registry[c]}},VariantLayout$2=class extends Layout$2{constructor(e,a,c,d){if(!(e instanceof Union$2))throw new TypeError("union must be a Union");if(!Number.isInteger(a)||0>a)throw new TypeError("variant must be a (non-negative) integer");if(typeof c=="string"&&d===void 0&&(d=c,c=null),c){if(!(c instanceof Layout$2))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=c.span&&c.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof d!="string")throw new TypeError("variant must have a String property")}let h=e.span;0>e.span&&(h=c?c.span:0,0<=h&&e.usesPrefixDiscriminator&&(h+=e.discriminator.layout.span)),super(h,d),this.union=e,this.variant=a,this.layout=c||null}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let c=0;return this.union.usesPrefixDiscriminator&&(c=this.union.discriminator.layout.span),c+this.layout.getSpan(e,a+c)}decode(e,a){const c=this.makeDestinationObject();if(a===void 0&&(a=0),this!==this.union.getVariant(e,a))throw new Error("variant mismatch");let d=0;return this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout?c[this.property]=this.layout.decode(e,a+d):this.property?c[this.property]=!0:this.union.usesPrefixDiscriminator&&(c[this.union.discriminator.property]=this.variant),c}encode(e,a,c){c===void 0&&(c=0);let d=0;if(this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,a,c);let h=d;if(this.layout&&(this.layout.encode(e[this.property],a,c+d),h+=this.layout.getSpan(a,c+d),0<=this.union.span&&h>this.union.span))throw new Error("encoded variant overruns containing union");return h}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};function fixBitwiseResult(o){return 0>o&&(o+=4294967296),o}class BitStructure extends Layout$2{constructor(e,a,c){if(!(e instanceof UInt$2||e instanceof UIntBE$2))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof a=="string"&&c===void 0&&(c=a,a=void 0),4=a)throw new TypeError("bits must be positive integer");const d=8*e.span,h=e.fields.reduce((j,et)=>j+et.bits,0);if(a+h>d)throw new Error("bits too long for span remainder ("+(d-h)+" of "+d+" remain)");this.container=e,this.bits=a,this.valueMask=(1<>>this.start}encode(e){if(!Number.isInteger(e)||e!==fixBitwiseResult(e&this.valueMask))throw new TypeError(nameWithProperty$2("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const a=this.container._packedGetValue(),c=fixBitwiseResult(e<c&&(c=this.length.decode(e,a)),c}decode(e,a){a===void 0&&(a=0);let c=this.span;return 0>c&&(c=this.length.decode(e,a)),e.slice(a,a+c)}encode(e,a,c){let d=this.length;if(this.length instanceof ExternalLayout$2&&(d=e.length),!(Buffer$1$1.isBuffer(e)&&d===e.length))throw new TypeError(nameWithProperty$2("Blob.encode",this)+" requires (length "+d+") Buffer as src");if(c+d>a.length)throw new RangeError("encoding overruns Buffer");return a.write(e.toString("hex"),c,d,"hex"),this.length instanceof ExternalLayout$2&&this.length.encode(d,a,c),d}};class CString extends Layout$2{constructor(e){super(-1,e)}getSpan(e,a){if(!Buffer$1$1.isBuffer(e))throw new TypeError("b must be a Buffer");a===void 0&&(a=0);let c=a;for(;ca.length)throw new RangeError("encoding overruns Buffer");return d.copy(a,c),a[c+h]=0,h+1}}class UTF8 extends Layout$2{constructor(e,a){if(typeof e=="string"&&a===void 0&&(a=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,a),this.maxSpan=e}getSpan(e,a){if(!Buffer$1$1.isBuffer(e))throw new TypeError("b must be a Buffer");return a===void 0&&(a=0),e.length-a}decode(e,a,c){a===void 0&&(a=0);let d=this.getSpan(e,a);if(0<=this.maxSpan&&this.maxSpana.length)throw new RangeError("encoding overruns Buffer");return d.copy(a,c),h}}class Constant extends Layout$2{constructor(e,a){super(0,a),this.value=e}decode(e,a,c){return this.value}encode(e,a,c){return 0}}Layout$3.ExternalLayout=ExternalLayout$2;Layout$3.GreedyCount=GreedyCount;Layout$3.OffsetLayout=OffsetLayout$2;Layout$3.UInt=UInt$2;Layout$3.UIntBE=UIntBE$2;Layout$3.Int=Int;Layout$3.IntBE=IntBE;Layout$3.Float=Float;Layout$3.FloatBE=FloatBE;Layout$3.Double=Double;Layout$3.DoubleBE=DoubleBE;Layout$3.Sequence=Sequence;Layout$3.Structure=Structure$2;Layout$3.UnionDiscriminator=UnionDiscriminator$2;Layout$3.UnionLayoutDiscriminator=UnionLayoutDiscriminator$2;Layout$3.Union=Union$2;Layout$3.VariantLayout=VariantLayout$2;Layout$3.BitStructure=BitStructure;Layout$3.BitField=BitField;Layout$3.Boolean=Boolean$1;Layout$3.Blob=Blob$2;Layout$3.CString=CString;Layout$3.UTF8=UTF8;Layout$3.Constant=Constant;Layout$3.greedy=(o,e)=>new GreedyCount(o,e);Layout$3.offset=(o,e,a)=>new OffsetLayout$2(o,e,a);Layout$3.u8=o=>new UInt$2(1,o);Layout$3.u16=o=>new UInt$2(2,o);Layout$3.u24=o=>new UInt$2(3,o);Layout$3.u32=o=>new UInt$2(4,o);Layout$3.u40=o=>new UInt$2(5,o);Layout$3.u48=o=>new UInt$2(6,o);Layout$3.nu64=o=>new NearUInt64$2(o);Layout$3.u16be=o=>new UIntBE$2(2,o);Layout$3.u24be=o=>new UIntBE$2(3,o);Layout$3.u32be=o=>new UIntBE$2(4,o);Layout$3.u40be=o=>new UIntBE$2(5,o);Layout$3.u48be=o=>new UIntBE$2(6,o);Layout$3.nu64be=o=>new NearUInt64BE(o);Layout$3.s8=o=>new Int(1,o);Layout$3.s16=o=>new Int(2,o);Layout$3.s24=o=>new Int(3,o);Layout$3.s32=o=>new Int(4,o);Layout$3.s40=o=>new Int(5,o);Layout$3.s48=o=>new Int(6,o);Layout$3.ns64=o=>new NearInt64$2(o);Layout$3.s16be=o=>new IntBE(2,o);Layout$3.s24be=o=>new IntBE(3,o);Layout$3.s32be=o=>new IntBE(4,o);Layout$3.s40be=o=>new IntBE(5,o);Layout$3.s48be=o=>new IntBE(6,o);Layout$3.ns64be=o=>new NearInt64BE(o);Layout$3.f32=o=>new Float(o);Layout$3.f32be=o=>new FloatBE(o);Layout$3.f64=o=>new Double(o);Layout$3.f64be=o=>new DoubleBE(o);Layout$3.struct=(o,e,a)=>new Structure$2(o,e,a);Layout$3.bits=(o,e,a)=>new BitStructure(o,e,a);Layout$3.seq=(o,e,a)=>new Sequence(o,e,a);Layout$3.union=(o,e,a)=>new Union$2(o,e,a);Layout$3.unionLayoutDiscriminator=(o,e)=>new UnionLayoutDiscriminator$2(o,e);Layout$3.blob=(o,e)=>new Blob$2(o,e);Layout$3.cstr=o=>new CString(o);Layout$3.utf8=(o,e)=>new UTF8(o,e);Layout$3.const=(o,e)=>new Constant(o,e);const require$$5=getAugmentedNamespace(index_browser_esm);(function(o){var e=commonjsGlobal$2&&commonjsGlobal$2.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(o,"__esModule",{value:!0}),o.map=o.array=o.rustEnum=o.str=o.vecU8=o.tagged=o.vec=o.bool=o.option=o.publicKey=o.i256=o.u256=o.i128=o.u128=o.i64=o.u64=o.struct=o.f64=o.f32=o.i32=o.u32=o.i16=o.u16=o.i8=o.u8=void 0;const a=Layout$3,c=require$$5,d=e(bnExports$6);var h=Layout$3;Object.defineProperty(o,"u8",{enumerable:!0,get:function(){return h.u8}}),Object.defineProperty(o,"i8",{enumerable:!0,get:function(){return h.s8}}),Object.defineProperty(o,"u16",{enumerable:!0,get:function(){return h.u16}}),Object.defineProperty(o,"i16",{enumerable:!0,get:function(){return h.s16}}),Object.defineProperty(o,"u32",{enumerable:!0,get:function(){return h.u32}}),Object.defineProperty(o,"i32",{enumerable:!0,get:function(){return h.s32}}),Object.defineProperty(o,"f32",{enumerable:!0,get:function(){return h.f32}}),Object.defineProperty(o,"f64",{enumerable:!0,get:function(){return h.f64}}),Object.defineProperty(o,"struct",{enumerable:!0,get:function(){return h.struct}});class j extends a.Layout{constructor(b,$,_e){super(b,_e),this.blob=(0,a.blob)(b),this.signed=$}decode(b,$=0){const _e=new d.default(this.blob.decode(b,$),10,"le");return this.signed?_e.fromTwos(this.span*8).clone():_e}encode(b,$,_e=0){return this.signed&&(b=b.toTwos(this.span*8)),this.blob.encode(b.toArrayLike(Buffer$1$1,"le",this.span),$,_e)}}function et(g){return new j(8,!1,g)}o.u64=et;function nt(g){return new j(8,!0,g)}o.i64=nt;function st(g){return new j(16,!1,g)}o.u128=st;function ot(g){return new j(16,!0,g)}o.i128=ot;function ht(g){return new j(32,!1,g)}o.u256=ht;function pt(g){return new j(32,!0,g)}o.i256=pt;class dt extends a.Layout{constructor(b,$,_e,rt){super(b.span,rt),this.layout=b,this.decoder=$,this.encoder=_e}decode(b,$){return this.decoder(this.layout.decode(b,$))}encode(b,$,_e){return this.layout.encode(this.encoder(b),$,_e)}getSpan(b,$){return this.layout.getSpan(b,$)}}function gt(g){return new dt((0,a.blob)(32),b=>new c.PublicKey(b),b=>b.toBuffer(),g)}o.publicKey=gt;class wt extends a.Layout{constructor(b,$){super(-1,$),this.layout=b,this.discriminator=(0,a.u8)()}encode(b,$,_e=0){return b==null?this.discriminator.encode(0,$,_e):(this.discriminator.encode(1,$,_e),this.layout.encode(b,$,_e+1)+1)}decode(b,$=0){const _e=this.discriminator.decode(b,$);if(_e===0)return null;if(_e===1)return this.layout.decode(b,$+1);throw new Error("Invalid option "+this.property)}getSpan(b,$=0){const _e=this.discriminator.decode(b,$);if(_e===0)return 1;if(_e===1)return this.layout.getSpan(b,$+1)+1;throw new Error("Invalid option "+this.property)}}function St(g,b){return new wt(g,b)}o.option=St;function _t(g){return new dt((0,a.u8)(),mt,bt,g)}o.bool=_t;function mt(g){if(g===0)return!1;if(g===1)return!0;throw new Error("Invalid bool: "+g)}function bt(g){return g?1:0}function $t(g,b){const $=(0,a.u32)("length"),_e=(0,a.struct)([$,(0,a.seq)(g,(0,a.offset)($,-$.span),"values")]);return new dt(_e,({values:rt})=>rt,rt=>({values:rt}),b)}o.vec=$t;function Bt(g,b,$){const _e=(0,a.struct)([et("tag"),b.replicate("data")]);function rt({tag:at,data:lt}){if(!at.eq(g))throw new Error("Invalid tag, expected: "+g.toString("hex")+", got: "+at.toString("hex"));return lt}return new dt(_e,rt,at=>({tag:g,data:at}),$)}o.tagged=Bt;function Dt(g){const b=(0,a.u32)("length"),$=(0,a.struct)([b,(0,a.blob)((0,a.offset)(b,-b.span),"data")]);return new dt($,({data:_e})=>_e,_e=>({data:_e}),g)}o.vecU8=Dt;function Ht(g){return new dt(Dt(),b=>b.toString("utf-8"),b=>Buffer$1$1.from(b,"utf-8"),g)}o.str=Ht;function qt(g,b,$){const _e=(0,a.union)($??(0,a.u8)(),b);return g.forEach((rt,at)=>_e.addVariant(at,rt,rt.property)),_e}o.rustEnum=qt;function Pt(g,b,$){const _e=(0,a.struct)([(0,a.seq)(g,b,"values")]);return new dt(_e,({values:rt})=>rt,rt=>({values:rt}),$)}o.array=Pt;class Gt extends a.Layout{constructor(b,$,_e){super(b.span+$.span,_e),this.keyLayout=b,this.valueLayout=$}decode(b,$){$=$||0;const _e=this.keyLayout.decode(b,$),rt=this.valueLayout.decode(b,$+this.keyLayout.getSpan(b,$));return[_e,rt]}encode(b,$,_e){_e=_e||0;const rt=this.keyLayout.encode(b[0],$,_e),at=this.valueLayout.encode(b[1],$,_e+rt);return rt+at}getSpan(b,$){return this.keyLayout.getSpan(b,$)+this.valueLayout.getSpan(b,$)}}function ct(g,b,$){const _e=(0,a.u32)("length"),rt=(0,a.struct)([_e,(0,a.seq)(new Gt(g,b),(0,a.offset)(_e,-_e.span),"values")]);return new dt(rt,({values:at})=>new Map(at),at=>({values:Array.from(at.entries())}),$)}o.map=ct})(dist$2);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Z_FIXED$1=4,Z_BINARY=0,Z_TEXT=1,Z_UNKNOWN$1=2;function zero$1(o){let e=o.length;for(;--e>=0;)o[e]=0}const STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH$1=3,MAX_MATCH$1=258,LENGTH_CODES$1=29,LITERALS$1=256,L_CODES$1=LITERALS$1+1+LENGTH_CODES$1,D_CODES$1=30,BL_CODES$1=19,HEAP_SIZE$1=2*L_CODES$1+1,MAX_BITS$1=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),extra_dbits=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),extra_blbits=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bl_order=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DIST_CODE_LEN=512,static_ltree=new Array((L_CODES$1+2)*2);zero$1(static_ltree);const static_dtree=new Array(D_CODES$1*2);zero$1(static_dtree);const _dist_code=new Array(DIST_CODE_LEN);zero$1(_dist_code);const _length_code=new Array(MAX_MATCH$1-MIN_MATCH$1+1);zero$1(_length_code);const base_length=new Array(LENGTH_CODES$1);zero$1(base_length);const base_dist=new Array(D_CODES$1);zero$1(base_dist);function StaticTreeDesc(o,e,a,c,d){this.static_tree=o,this.extra_bits=e,this.extra_base=a,this.elems=c,this.max_length=d,this.has_stree=o&&o.length}let static_l_desc,static_d_desc,static_bl_desc;function TreeDesc(o,e){this.dyn_tree=o,this.max_code=0,this.stat_desc=e}const d_code=o=>o<256?_dist_code[o]:_dist_code[256+(o>>>7)],put_short=(o,e)=>{o.pending_buf[o.pending++]=e&255,o.pending_buf[o.pending++]=e>>>8&255},send_bits=(o,e,a)=>{o.bi_valid>Buf_size-a?(o.bi_buf|=e<>Buf_size-o.bi_valid,o.bi_valid+=a-Buf_size):(o.bi_buf|=e<{send_bits(o,a[e*2],a[e*2+1])},bi_reverse=(o,e)=>{let a=0;do a|=o&1,o>>>=1,a<<=1;while(--e>0);return a>>>1},bi_flush=o=>{o.bi_valid===16?(put_short(o,o.bi_buf),o.bi_buf=0,o.bi_valid=0):o.bi_valid>=8&&(o.pending_buf[o.pending++]=o.bi_buf&255,o.bi_buf>>=8,o.bi_valid-=8)},gen_bitlen=(o,e)=>{const a=e.dyn_tree,c=e.max_code,d=e.stat_desc.static_tree,h=e.stat_desc.has_stree,j=e.stat_desc.extra_bits,et=e.stat_desc.extra_base,nt=e.stat_desc.max_length;let st,ot,ht,pt,dt,gt,wt=0;for(pt=0;pt<=MAX_BITS$1;pt++)o.bl_count[pt]=0;for(a[o.heap[o.heap_max]*2+1]=0,st=o.heap_max+1;stnt&&(pt=nt,wt++),a[ot*2+1]=pt,!(ot>c)&&(o.bl_count[pt]++,dt=0,ot>=et&&(dt=j[ot-et]),gt=a[ot*2],o.opt_len+=gt*(pt+dt),h&&(o.static_len+=gt*(d[ot*2+1]+dt)));if(wt!==0){do{for(pt=nt-1;o.bl_count[pt]===0;)pt--;o.bl_count[pt]--,o.bl_count[pt+1]+=2,o.bl_count[nt]--,wt-=2}while(wt>0);for(pt=nt;pt!==0;pt--)for(ot=o.bl_count[pt];ot!==0;)ht=o.heap[--st],!(ht>c)&&(a[ht*2+1]!==pt&&(o.opt_len+=(pt-a[ht*2+1])*a[ht*2],a[ht*2+1]=pt),ot--)}},gen_codes=(o,e,a)=>{const c=new Array(MAX_BITS$1+1);let d=0,h,j;for(h=1;h<=MAX_BITS$1;h++)d=d+a[h-1]<<1,c[h]=d;for(j=0;j<=e;j++){let et=o[j*2+1];et!==0&&(o[j*2]=bi_reverse(c[et]++,et))}},tr_static_init=()=>{let o,e,a,c,d;const h=new Array(MAX_BITS$1+1);for(a=0,c=0;c>=7;c{let e;for(e=0;e{o.bi_valid>8?put_short(o,o.bi_buf):o.bi_valid>0&&(o.pending_buf[o.pending++]=o.bi_buf),o.bi_buf=0,o.bi_valid=0},smaller=(o,e,a,c)=>{const d=e*2,h=a*2;return o[d]{const c=o.heap[a];let d=a<<1;for(;d<=o.heap_len&&(d{let c,d,h=0,j,et;if(o.sym_next!==0)do c=o.pending_buf[o.sym_buf+h++]&255,c+=(o.pending_buf[o.sym_buf+h++]&255)<<8,d=o.pending_buf[o.sym_buf+h++],c===0?send_code(o,d,e):(j=_length_code[d],send_code(o,j+LITERALS$1+1,e),et=extra_lbits[j],et!==0&&(d-=base_length[j],send_bits(o,d,et)),c--,j=d_code(c),send_code(o,j,a),et=extra_dbits[j],et!==0&&(c-=base_dist[j],send_bits(o,c,et)));while(h{const a=e.dyn_tree,c=e.stat_desc.static_tree,d=e.stat_desc.has_stree,h=e.stat_desc.elems;let j,et,nt=-1,st;for(o.heap_len=0,o.heap_max=HEAP_SIZE$1,j=0;j>1;j>=1;j--)pqdownheap(o,a,j);st=h;do j=o.heap[1],o.heap[1]=o.heap[o.heap_len--],pqdownheap(o,a,1),et=o.heap[1],o.heap[--o.heap_max]=j,o.heap[--o.heap_max]=et,a[st*2]=a[j*2]+a[et*2],o.depth[st]=(o.depth[j]>=o.depth[et]?o.depth[j]:o.depth[et])+1,a[j*2+1]=a[et*2+1]=st,o.heap[1]=st++,pqdownheap(o,a,1);while(o.heap_len>=2);o.heap[--o.heap_max]=o.heap[1],gen_bitlen(o,e),gen_codes(a,nt,o.bl_count)},scan_tree=(o,e,a)=>{let c,d=-1,h,j=e[0*2+1],et=0,nt=7,st=4;for(j===0&&(nt=138,st=3),e[(a+1)*2+1]=65535,c=0;c<=a;c++)h=j,j=e[(c+1)*2+1],!(++et{let c,d=-1,h,j=e[0*2+1],et=0,nt=7,st=4;for(j===0&&(nt=138,st=3),c=0;c<=a;c++)if(h=j,j=e[(c+1)*2+1],!(++et{let e;for(scan_tree(o,o.dyn_ltree,o.l_desc.max_code),scan_tree(o,o.dyn_dtree,o.d_desc.max_code),build_tree(o,o.bl_desc),e=BL_CODES$1-1;e>=3&&o.bl_tree[bl_order[e]*2+1]===0;e--);return o.opt_len+=3*(e+1)+5+5+4,e},send_all_trees=(o,e,a,c)=>{let d;for(send_bits(o,e-257,5),send_bits(o,a-1,5),send_bits(o,c-4,4),d=0;d{let e=4093624447,a;for(a=0;a<=31;a++,e>>>=1)if(e&1&&o.dyn_ltree[a*2]!==0)return Z_BINARY;if(o.dyn_ltree[9*2]!==0||o.dyn_ltree[10*2]!==0||o.dyn_ltree[13*2]!==0)return Z_TEXT;for(a=32;a{static_init_done||(tr_static_init(),static_init_done=!0),o.l_desc=new TreeDesc(o.dyn_ltree,static_l_desc),o.d_desc=new TreeDesc(o.dyn_dtree,static_d_desc),o.bl_desc=new TreeDesc(o.bl_tree,static_bl_desc),o.bi_buf=0,o.bi_valid=0,init_block(o)},_tr_stored_block$1=(o,e,a,c)=>{send_bits(o,(STORED_BLOCK<<1)+(c?1:0),3),bi_windup(o),put_short(o,a),put_short(o,~a),a&&o.pending_buf.set(o.window.subarray(e,e+a),o.pending),o.pending+=a},_tr_align$1=o=>{send_bits(o,STATIC_TREES<<1,3),send_code(o,END_BLOCK,static_ltree),bi_flush(o)},_tr_flush_block$1=(o,e,a,c)=>{let d,h,j=0;o.level>0?(o.strm.data_type===Z_UNKNOWN$1&&(o.strm.data_type=detect_data_type(o)),build_tree(o,o.l_desc),build_tree(o,o.d_desc),j=build_bl_tree(o),d=o.opt_len+3+7>>>3,h=o.static_len+3+7>>>3,h<=d&&(d=h)):d=h=a+5,a+4<=d&&e!==-1?_tr_stored_block$1(o,e,a,c):o.strategy===Z_FIXED$1||h===d?(send_bits(o,(STATIC_TREES<<1)+(c?1:0),3),compress_block(o,static_ltree,static_dtree)):(send_bits(o,(DYN_TREES<<1)+(c?1:0),3),send_all_trees(o,o.l_desc.max_code+1,o.d_desc.max_code+1,j+1),compress_block(o,o.dyn_ltree,o.dyn_dtree)),init_block(o),c&&bi_windup(o)},_tr_tally$1=(o,e,a)=>(o.pending_buf[o.sym_buf+o.sym_next++]=e,o.pending_buf[o.sym_buf+o.sym_next++]=e>>8,o.pending_buf[o.sym_buf+o.sym_next++]=a,e===0?o.dyn_ltree[a*2]++:(o.matches++,e--,o.dyn_ltree[(_length_code[a]+LITERALS$1+1)*2]++,o.dyn_dtree[d_code(e)*2]++),o.sym_next===o.sym_end);var _tr_init_1=_tr_init$1,_tr_stored_block_1=_tr_stored_block$1,_tr_flush_block_1=_tr_flush_block$1,_tr_tally_1=_tr_tally$1,_tr_align_1=_tr_align$1,trees={_tr_init:_tr_init_1,_tr_stored_block:_tr_stored_block_1,_tr_flush_block:_tr_flush_block_1,_tr_tally:_tr_tally_1,_tr_align:_tr_align_1};const adler32=(o,e,a,c)=>{let d=o&65535|0,h=o>>>16&65535|0,j=0;for(;a!==0;){j=a>2e3?2e3:a,a-=j;do d=d+e[c++]|0,h=h+d|0;while(--j);d%=65521,h%=65521}return d|h<<16|0};var adler32_1=adler32;const makeTable=()=>{let o,e=[];for(var a=0;a<256;a++){o=a;for(var c=0;c<8;c++)o=o&1?3988292384^o>>>1:o>>>1;e[a]=o}return e},crcTable=new Uint32Array(makeTable()),crc32=(o,e,a,c)=>{const d=crcTable,h=c+a;o^=-1;for(let j=c;j>>8^d[(o^e[j])&255];return o^-1};var crc32_1=crc32,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},constants$2={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init,_tr_stored_block,_tr_flush_block,_tr_tally,_tr_align}=trees,{Z_NO_FLUSH:Z_NO_FLUSH$2,Z_PARTIAL_FLUSH,Z_FULL_FLUSH:Z_FULL_FLUSH$1,Z_FINISH:Z_FINISH$3,Z_BLOCK:Z_BLOCK$1,Z_OK:Z_OK$3,Z_STREAM_END:Z_STREAM_END$3,Z_STREAM_ERROR:Z_STREAM_ERROR$2,Z_DATA_ERROR:Z_DATA_ERROR$2,Z_BUF_ERROR:Z_BUF_ERROR$1,Z_DEFAULT_COMPRESSION:Z_DEFAULT_COMPRESSION$1,Z_FILTERED,Z_HUFFMAN_ONLY,Z_RLE,Z_FIXED,Z_DEFAULT_STRATEGY:Z_DEFAULT_STRATEGY$1,Z_UNKNOWN,Z_DEFLATED:Z_DEFLATED$2}=constants$2,MAX_MEM_LEVEL=9,MAX_WBITS$1=15,DEF_MEM_LEVEL=8,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1,PRESET_DICT=32,INIT_STATE=42,GZIP_STATE=57,EXTRA_STATE=69,NAME_STATE=73,COMMENT_STATE=91,HCRC_STATE=103,BUSY_STATE=113,FINISH_STATE=666,BS_NEED_MORE=1,BS_BLOCK_DONE=2,BS_FINISH_STARTED=3,BS_FINISH_DONE=4,OS_CODE=3,err=(o,e)=>(o.msg=messages[e],e),rank=o=>o*2-(o>4?9:0),zero=o=>{let e=o.length;for(;--e>=0;)o[e]=0},slide_hash=o=>{let e,a,c,d=o.w_size;e=o.hash_size,c=e;do a=o.head[--c],o.head[c]=a>=d?a-d:0;while(--e);e=d,c=e;do a=o.prev[--c],o.prev[c]=a>=d?a-d:0;while(--e)};let HASH_ZLIB=(o,e,a)=>(e<{const e=o.state;let a=e.pending;a>o.avail_out&&(a=o.avail_out),a!==0&&(o.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),o.next_out),o.next_out+=a,e.pending_out+=a,o.total_out+=a,o.avail_out-=a,e.pending-=a,e.pending===0&&(e.pending_out=0))},flush_block_only=(o,e)=>{_tr_flush_block(o,o.block_start>=0?o.block_start:-1,o.strstart-o.block_start,e),o.block_start=o.strstart,flush_pending(o.strm)},put_byte=(o,e)=>{o.pending_buf[o.pending++]=e},putShortMSB=(o,e)=>{o.pending_buf[o.pending++]=e>>>8&255,o.pending_buf[o.pending++]=e&255},read_buf=(o,e,a,c)=>{let d=o.avail_in;return d>c&&(d=c),d===0?0:(o.avail_in-=d,e.set(o.input.subarray(o.next_in,o.next_in+d),a),o.state.wrap===1?o.adler=adler32_1(o.adler,e,d,a):o.state.wrap===2&&(o.adler=crc32_1(o.adler,e,d,a)),o.next_in+=d,o.total_in+=d,d)},longest_match=(o,e)=>{let a=o.max_chain_length,c=o.strstart,d,h,j=o.prev_length,et=o.nice_match;const nt=o.strstart>o.w_size-MIN_LOOKAHEAD?o.strstart-(o.w_size-MIN_LOOKAHEAD):0,st=o.window,ot=o.w_mask,ht=o.prev,pt=o.strstart+MAX_MATCH;let dt=st[c+j-1],gt=st[c+j];o.prev_length>=o.good_match&&(a>>=2),et>o.lookahead&&(et=o.lookahead);do if(d=e,!(st[d+j]!==gt||st[d+j-1]!==dt||st[d]!==st[c]||st[++d]!==st[c+1])){c+=2,d++;do;while(st[++c]===st[++d]&&st[++c]===st[++d]&&st[++c]===st[++d]&&st[++c]===st[++d]&&st[++c]===st[++d]&&st[++c]===st[++d]&&st[++c]===st[++d]&&st[++c]===st[++d]&&cj){if(o.match_start=e,j=h,h>=et)break;dt=st[c+j-1],gt=st[c+j]}}while((e=ht[e&ot])>nt&&--a!==0);return j<=o.lookahead?j:o.lookahead},fill_window=o=>{const e=o.w_size;let a,c,d;do{if(c=o.window_size-o.lookahead-o.strstart,o.strstart>=e+(e-MIN_LOOKAHEAD)&&(o.window.set(o.window.subarray(e,e+e-c),0),o.match_start-=e,o.strstart-=e,o.block_start-=e,o.insert>o.strstart&&(o.insert=o.strstart),slide_hash(o),c+=e),o.strm.avail_in===0)break;if(a=read_buf(o.strm,o.window,o.strstart+o.lookahead,c),o.lookahead+=a,o.lookahead+o.insert>=MIN_MATCH)for(d=o.strstart-o.insert,o.ins_h=o.window[d],o.ins_h=HASH(o,o.ins_h,o.window[d+1]);o.insert&&(o.ins_h=HASH(o,o.ins_h,o.window[d+MIN_MATCH-1]),o.prev[d&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=d,d++,o.insert--,!(o.lookahead+o.insert{let a=o.pending_buf_size-5>o.w_size?o.w_size:o.pending_buf_size-5,c,d,h,j=0,et=o.strm.avail_in;do{if(c=65535,h=o.bi_valid+42>>3,o.strm.avail_outd+o.strm.avail_in&&(c=d+o.strm.avail_in),c>h&&(c=h),c>8,o.pending_buf[o.pending-2]=~c,o.pending_buf[o.pending-1]=~c>>8,flush_pending(o.strm),d&&(d>c&&(d=c),o.strm.output.set(o.window.subarray(o.block_start,o.block_start+d),o.strm.next_out),o.strm.next_out+=d,o.strm.avail_out-=d,o.strm.total_out+=d,o.block_start+=d,c-=d),c&&(read_buf(o.strm,o.strm.output,o.strm.next_out,c),o.strm.next_out+=c,o.strm.avail_out-=c,o.strm.total_out+=c)}while(j===0);return et-=o.strm.avail_in,et&&(et>=o.w_size?(o.matches=2,o.window.set(o.strm.input.subarray(o.strm.next_in-o.w_size,o.strm.next_in),0),o.strstart=o.w_size,o.insert=o.strstart):(o.window_size-o.strstart<=et&&(o.strstart-=o.w_size,o.window.set(o.window.subarray(o.w_size,o.w_size+o.strstart),0),o.matches<2&&o.matches++,o.insert>o.strstart&&(o.insert=o.strstart)),o.window.set(o.strm.input.subarray(o.strm.next_in-et,o.strm.next_in),o.strstart),o.strstart+=et,o.insert+=et>o.w_size-o.insert?o.w_size-o.insert:et),o.block_start=o.strstart),o.high_waterh&&o.block_start>=o.w_size&&(o.block_start-=o.w_size,o.strstart-=o.w_size,o.window.set(o.window.subarray(o.w_size,o.w_size+o.strstart),0),o.matches<2&&o.matches++,h+=o.w_size,o.insert>o.strstart&&(o.insert=o.strstart)),h>o.strm.avail_in&&(h=o.strm.avail_in),h&&(read_buf(o.strm,o.window,o.strstart,h),o.strstart+=h,o.insert+=h>o.w_size-o.insert?o.w_size-o.insert:h),o.high_water>3,h=o.pending_buf_size-h>65535?65535:o.pending_buf_size-h,a=h>o.w_size?o.w_size:h,d=o.strstart-o.block_start,(d>=a||(d||e===Z_FINISH$3)&&e!==Z_NO_FLUSH$2&&o.strm.avail_in===0&&d<=h)&&(c=d>h?h:d,j=e===Z_FINISH$3&&o.strm.avail_in===0&&c===d?1:0,_tr_stored_block(o,o.block_start,c,j),o.block_start+=c,flush_pending(o.strm)),j?BS_FINISH_STARTED:BS_NEED_MORE)},deflate_fast=(o,e)=>{let a,c;for(;;){if(o.lookahead=MIN_MATCH&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+MIN_MATCH-1]),a=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),a!==0&&o.strstart-a<=o.w_size-MIN_LOOKAHEAD&&(o.match_length=longest_match(o,a)),o.match_length>=MIN_MATCH)if(c=_tr_tally(o,o.strstart-o.match_start,o.match_length-MIN_MATCH),o.lookahead-=o.match_length,o.match_length<=o.max_lazy_match&&o.lookahead>=MIN_MATCH){o.match_length--;do o.strstart++,o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+MIN_MATCH-1]),a=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart;while(--o.match_length!==0);o.strstart++}else o.strstart+=o.match_length,o.match_length=0,o.ins_h=o.window[o.strstart],o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+1]);else c=_tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++;if(c&&(flush_block_only(o,!1),o.strm.avail_out===0))return BS_NEED_MORE}return o.insert=o.strstart{let a,c,d;for(;;){if(o.lookahead=MIN_MATCH&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+MIN_MATCH-1]),a=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),o.prev_length=o.match_length,o.prev_match=o.match_start,o.match_length=MIN_MATCH-1,a!==0&&o.prev_length4096)&&(o.match_length=MIN_MATCH-1)),o.prev_length>=MIN_MATCH&&o.match_length<=o.prev_length){d=o.strstart+o.lookahead-MIN_MATCH,c=_tr_tally(o,o.strstart-1-o.prev_match,o.prev_length-MIN_MATCH),o.lookahead-=o.prev_length-1,o.prev_length-=2;do++o.strstart<=d&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+MIN_MATCH-1]),a=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart);while(--o.prev_length!==0);if(o.match_available=0,o.match_length=MIN_MATCH-1,o.strstart++,c&&(flush_block_only(o,!1),o.strm.avail_out===0))return BS_NEED_MORE}else if(o.match_available){if(c=_tr_tally(o,0,o.window[o.strstart-1]),c&&flush_block_only(o,!1),o.strstart++,o.lookahead--,o.strm.avail_out===0)return BS_NEED_MORE}else o.match_available=1,o.strstart++,o.lookahead--}return o.match_available&&(c=_tr_tally(o,0,o.window[o.strstart-1]),o.match_available=0),o.insert=o.strstart{let a,c,d,h;const j=o.window;for(;;){if(o.lookahead<=MAX_MATCH){if(fill_window(o),o.lookahead<=MAX_MATCH&&e===Z_NO_FLUSH$2)return BS_NEED_MORE;if(o.lookahead===0)break}if(o.match_length=0,o.lookahead>=MIN_MATCH&&o.strstart>0&&(d=o.strstart-1,c=j[d],c===j[++d]&&c===j[++d]&&c===j[++d])){h=o.strstart+MAX_MATCH;do;while(c===j[++d]&&c===j[++d]&&c===j[++d]&&c===j[++d]&&c===j[++d]&&c===j[++d]&&c===j[++d]&&c===j[++d]&&do.lookahead&&(o.match_length=o.lookahead)}if(o.match_length>=MIN_MATCH?(a=_tr_tally(o,1,o.match_length-MIN_MATCH),o.lookahead-=o.match_length,o.strstart+=o.match_length,o.match_length=0):(a=_tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++),a&&(flush_block_only(o,!1),o.strm.avail_out===0))return BS_NEED_MORE}return o.insert=0,e===Z_FINISH$3?(flush_block_only(o,!0),o.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):o.sym_next&&(flush_block_only(o,!1),o.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE},deflate_huff=(o,e)=>{let a;for(;;){if(o.lookahead===0&&(fill_window(o),o.lookahead===0)){if(e===Z_NO_FLUSH$2)return BS_NEED_MORE;break}if(o.match_length=0,a=_tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++,a&&(flush_block_only(o,!1),o.strm.avail_out===0))return BS_NEED_MORE}return o.insert=0,e===Z_FINISH$3?(flush_block_only(o,!0),o.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):o.sym_next&&(flush_block_only(o,!1),o.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE};function Config(o,e,a,c,d){this.good_length=o,this.max_lazy=e,this.nice_length=a,this.max_chain=c,this.func=d}const configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)],lm_init=o=>{o.window_size=2*o.w_size,zero(o.head),o.max_lazy_match=configuration_table[o.level].max_lazy,o.good_match=configuration_table[o.level].good_length,o.nice_match=configuration_table[o.level].nice_length,o.max_chain_length=configuration_table[o.level].max_chain,o.strstart=0,o.block_start=0,o.lookahead=0,o.insert=0,o.match_length=o.prev_length=MIN_MATCH-1,o.match_available=0,o.ins_h=0};function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z_DEFLATED$2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(HEAP_SIZE*2),this.dyn_dtree=new Uint16Array((2*D_CODES+1)*2),this.bl_tree=new Uint16Array((2*BL_CODES+1)*2),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(MAX_BITS+1),this.heap=new Uint16Array(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*L_CODES+1),zero(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const deflateStateCheck=o=>{if(!o)return 1;const e=o.state;return!e||e.strm!==o||e.status!==INIT_STATE&&e.status!==GZIP_STATE&&e.status!==EXTRA_STATE&&e.status!==NAME_STATE&&e.status!==COMMENT_STATE&&e.status!==HCRC_STATE&&e.status!==BUSY_STATE&&e.status!==FINISH_STATE?1:0},deflateResetKeep=o=>{if(deflateStateCheck(o))return err(o,Z_STREAM_ERROR$2);o.total_in=o.total_out=0,o.data_type=Z_UNKNOWN;const e=o.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?GZIP_STATE:e.wrap?INIT_STATE:BUSY_STATE,o.adler=e.wrap===2?0:1,e.last_flush=-2,_tr_init(e),Z_OK$3},deflateReset=o=>{const e=deflateResetKeep(o);return e===Z_OK$3&&lm_init(o.state),e},deflateSetHeader=(o,e)=>deflateStateCheck(o)||o.state.wrap!==2?Z_STREAM_ERROR$2:(o.state.gzhead=e,Z_OK$3),deflateInit2=(o,e,a,c,d,h)=>{if(!o)return Z_STREAM_ERROR$2;let j=1;if(e===Z_DEFAULT_COMPRESSION$1&&(e=6),c<0?(j=0,c=-c):c>15&&(j=2,c-=16),d<1||d>MAX_MEM_LEVEL||a!==Z_DEFLATED$2||c<8||c>15||e<0||e>9||h<0||h>Z_FIXED||c===8&&j!==1)return err(o,Z_STREAM_ERROR$2);c===8&&(c=9);const et=new DeflateState;return o.state=et,et.strm=o,et.status=INIT_STATE,et.wrap=j,et.gzhead=null,et.w_bits=c,et.w_size=1<deflateInit2(o,e,Z_DEFLATED$2,MAX_WBITS$1,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY$1),deflate$2=(o,e)=>{if(deflateStateCheck(o)||e>Z_BLOCK$1||e<0)return o?err(o,Z_STREAM_ERROR$2):Z_STREAM_ERROR$2;const a=o.state;if(!o.output||o.avail_in!==0&&!o.input||a.status===FINISH_STATE&&e!==Z_FINISH$3)return err(o,o.avail_out===0?Z_BUF_ERROR$1:Z_STREAM_ERROR$2);const c=a.last_flush;if(a.last_flush=e,a.pending!==0){if(flush_pending(o),o.avail_out===0)return a.last_flush=-1,Z_OK$3}else if(o.avail_in===0&&rank(e)<=rank(c)&&e!==Z_FINISH$3)return err(o,Z_BUF_ERROR$1);if(a.status===FINISH_STATE&&o.avail_in!==0)return err(o,Z_BUF_ERROR$1);if(a.status===INIT_STATE&&a.wrap===0&&(a.status=BUSY_STATE),a.status===INIT_STATE){let d=Z_DEFLATED$2+(a.w_bits-8<<4)<<8,h=-1;if(a.strategy>=Z_HUFFMAN_ONLY||a.level<2?h=0:a.level<6?h=1:a.level===6?h=2:h=3,d|=h<<6,a.strstart!==0&&(d|=PRESET_DICT),d+=31-d%31,putShortMSB(a,d),a.strstart!==0&&(putShortMSB(a,o.adler>>>16),putShortMSB(a,o.adler&65535)),o.adler=1,a.status=BUSY_STATE,flush_pending(o),a.pending!==0)return a.last_flush=-1,Z_OK$3}if(a.status===GZIP_STATE){if(o.adler=0,put_byte(a,31),put_byte(a,139),put_byte(a,8),a.gzhead)put_byte(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),put_byte(a,a.gzhead.time&255),put_byte(a,a.gzhead.time>>8&255),put_byte(a,a.gzhead.time>>16&255),put_byte(a,a.gzhead.time>>24&255),put_byte(a,a.level===9?2:a.strategy>=Z_HUFFMAN_ONLY||a.level<2?4:0),put_byte(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(put_byte(a,a.gzhead.extra.length&255),put_byte(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(o.adler=crc32_1(o.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=EXTRA_STATE;else if(put_byte(a,0),put_byte(a,0),put_byte(a,0),put_byte(a,0),put_byte(a,0),put_byte(a,a.level===9?2:a.strategy>=Z_HUFFMAN_ONLY||a.level<2?4:0),put_byte(a,OS_CODE),a.status=BUSY_STATE,flush_pending(o),a.pending!==0)return a.last_flush=-1,Z_OK$3}if(a.status===EXTRA_STATE){if(a.gzhead.extra){let d=a.pending,h=(a.gzhead.extra.length&65535)-a.gzindex;for(;a.pending+h>a.pending_buf_size;){let et=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+et),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>d&&(o.adler=crc32_1(o.adler,a.pending_buf,a.pending-d,d)),a.gzindex+=et,flush_pending(o),a.pending!==0)return a.last_flush=-1,Z_OK$3;d=0,h-=et}let j=new Uint8Array(a.gzhead.extra);a.pending_buf.set(j.subarray(a.gzindex,a.gzindex+h),a.pending),a.pending+=h,a.gzhead.hcrc&&a.pending>d&&(o.adler=crc32_1(o.adler,a.pending_buf,a.pending-d,d)),a.gzindex=0}a.status=NAME_STATE}if(a.status===NAME_STATE){if(a.gzhead.name){let d=a.pending,h;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>d&&(o.adler=crc32_1(o.adler,a.pending_buf,a.pending-d,d)),flush_pending(o),a.pending!==0)return a.last_flush=-1,Z_OK$3;d=0}a.gzindexd&&(o.adler=crc32_1(o.adler,a.pending_buf,a.pending-d,d)),a.gzindex=0}a.status=COMMENT_STATE}if(a.status===COMMENT_STATE){if(a.gzhead.comment){let d=a.pending,h;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>d&&(o.adler=crc32_1(o.adler,a.pending_buf,a.pending-d,d)),flush_pending(o),a.pending!==0)return a.last_flush=-1,Z_OK$3;d=0}a.gzindexd&&(o.adler=crc32_1(o.adler,a.pending_buf,a.pending-d,d))}a.status=HCRC_STATE}if(a.status===HCRC_STATE){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(flush_pending(o),a.pending!==0))return a.last_flush=-1,Z_OK$3;put_byte(a,o.adler&255),put_byte(a,o.adler>>8&255),o.adler=0}if(a.status=BUSY_STATE,flush_pending(o),a.pending!==0)return a.last_flush=-1,Z_OK$3}if(o.avail_in!==0||a.lookahead!==0||e!==Z_NO_FLUSH$2&&a.status!==FINISH_STATE){let d=a.level===0?deflate_stored(a,e):a.strategy===Z_HUFFMAN_ONLY?deflate_huff(a,e):a.strategy===Z_RLE?deflate_rle(a,e):configuration_table[a.level].func(a,e);if((d===BS_FINISH_STARTED||d===BS_FINISH_DONE)&&(a.status=FINISH_STATE),d===BS_NEED_MORE||d===BS_FINISH_STARTED)return o.avail_out===0&&(a.last_flush=-1),Z_OK$3;if(d===BS_BLOCK_DONE&&(e===Z_PARTIAL_FLUSH?_tr_align(a):e!==Z_BLOCK$1&&(_tr_stored_block(a,0,0,!1),e===Z_FULL_FLUSH$1&&(zero(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),flush_pending(o),o.avail_out===0))return a.last_flush=-1,Z_OK$3}return e!==Z_FINISH$3?Z_OK$3:a.wrap<=0?Z_STREAM_END$3:(a.wrap===2?(put_byte(a,o.adler&255),put_byte(a,o.adler>>8&255),put_byte(a,o.adler>>16&255),put_byte(a,o.adler>>24&255),put_byte(a,o.total_in&255),put_byte(a,o.total_in>>8&255),put_byte(a,o.total_in>>16&255),put_byte(a,o.total_in>>24&255)):(putShortMSB(a,o.adler>>>16),putShortMSB(a,o.adler&65535)),flush_pending(o),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?Z_OK$3:Z_STREAM_END$3)},deflateEnd=o=>{if(deflateStateCheck(o))return Z_STREAM_ERROR$2;const e=o.state.status;return o.state=null,e===BUSY_STATE?err(o,Z_DATA_ERROR$2):Z_OK$3},deflateSetDictionary=(o,e)=>{let a=e.length;if(deflateStateCheck(o))return Z_STREAM_ERROR$2;const c=o.state,d=c.wrap;if(d===2||d===1&&c.status!==INIT_STATE||c.lookahead)return Z_STREAM_ERROR$2;if(d===1&&(o.adler=adler32_1(o.adler,e,a,0)),c.wrap=0,a>=c.w_size){d===0&&(zero(c.head),c.strstart=0,c.block_start=0,c.insert=0);let nt=new Uint8Array(c.w_size);nt.set(e.subarray(a-c.w_size,a),0),e=nt,a=c.w_size}const h=o.avail_in,j=o.next_in,et=o.input;for(o.avail_in=a,o.next_in=0,o.input=e,fill_window(c);c.lookahead>=MIN_MATCH;){let nt=c.strstart,st=c.lookahead-(MIN_MATCH-1);do c.ins_h=HASH(c,c.ins_h,c.window[nt+MIN_MATCH-1]),c.prev[nt&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=nt,nt++;while(--st);c.strstart=nt,c.lookahead=MIN_MATCH-1,fill_window(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=MIN_MATCH-1,c.match_available=0,o.next_in=j,o.input=et,o.avail_in=h,c.wrap=d,Z_OK$3};var deflateInit_1=deflateInit,deflateInit2_1=deflateInit2,deflateReset_1=deflateReset,deflateResetKeep_1=deflateResetKeep,deflateSetHeader_1=deflateSetHeader,deflate_2$1=deflate$2,deflateEnd_1=deflateEnd,deflateSetDictionary_1=deflateSetDictionary,deflateInfo="pako deflate (from Nodeca project)",deflate_1$2={deflateInit:deflateInit_1,deflateInit2:deflateInit2_1,deflateReset:deflateReset_1,deflateResetKeep:deflateResetKeep_1,deflateSetHeader:deflateSetHeader_1,deflate:deflate_2$1,deflateEnd:deflateEnd_1,deflateSetDictionary:deflateSetDictionary_1,deflateInfo};const _has=(o,e)=>Object.prototype.hasOwnProperty.call(o,e);var assign=function(o){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if(typeof a!="object")throw new TypeError(a+"must be non-object");for(const c in a)_has(a,c)&&(o[c]=a[c])}}return o},flattenChunks=o=>{let e=0;for(let c=0,d=o.length;c=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;_utf8len[254]=_utf8len[254]=1;var string2buf=o=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(o);let e,a,c,d,h,j=o.length,et=0;for(d=0;d>>6,e[h++]=128|a&63):a<65536?(e[h++]=224|a>>>12,e[h++]=128|a>>>6&63,e[h++]=128|a&63):(e[h++]=240|a>>>18,e[h++]=128|a>>>12&63,e[h++]=128|a>>>6&63,e[h++]=128|a&63);return e};const buf2binstring=(o,e)=>{if(e<65534&&o.subarray&&STR_APPLY_UIA_OK)return String.fromCharCode.apply(null,o.length===e?o:o.subarray(0,e));let a="";for(let c=0;c{const a=e||o.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(o.subarray(0,e));let c,d;const h=new Array(a*2);for(d=0,c=0;c4){h[d++]=65533,c+=et-1;continue}for(j&=et===2?31:et===3?15:7;et>1&&c1){h[d++]=65533;continue}j<65536?h[d++]=j:(j-=65536,h[d++]=55296|j>>10&1023,h[d++]=56320|j&1023)}return buf2binstring(h,d)},utf8border=(o,e)=>{e=e||o.length,e>o.length&&(e=o.length);let a=e-1;for(;a>=0&&(o[a]&192)===128;)a--;return a<0||a===0?e:a+_utf8len[o[a]]>e?a:e},strings={string2buf,buf2string,utf8border};function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var zstream=ZStream;const toString$1=Object.prototype.toString,{Z_NO_FLUSH:Z_NO_FLUSH$1,Z_SYNC_FLUSH,Z_FULL_FLUSH,Z_FINISH:Z_FINISH$2,Z_OK:Z_OK$2,Z_STREAM_END:Z_STREAM_END$2,Z_DEFAULT_COMPRESSION,Z_DEFAULT_STRATEGY,Z_DEFLATED:Z_DEFLATED$1}=constants$2;function Deflate$1(o){this.options=common$6.assign({level:Z_DEFAULT_COMPRESSION,method:Z_DEFLATED$1,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z_DEFAULT_STRATEGY},o||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let a=deflate_1$2.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==Z_OK$2)throw new Error(messages[a]);if(e.header&&deflate_1$2.deflateSetHeader(this.strm,e.header),e.dictionary){let c;if(typeof e.dictionary=="string"?c=strings.string2buf(e.dictionary):toString$1.call(e.dictionary)==="[object ArrayBuffer]"?c=new Uint8Array(e.dictionary):c=e.dictionary,a=deflate_1$2.deflateSetDictionary(this.strm,c),a!==Z_OK$2)throw new Error(messages[a]);this._dict_set=!0}}Deflate$1.prototype.push=function(o,e){const a=this.strm,c=this.options.chunkSize;let d,h;if(this.ended)return!1;for(e===~~e?h=e:h=e===!0?Z_FINISH$2:Z_NO_FLUSH$1,typeof o=="string"?a.input=strings.string2buf(o):toString$1.call(o)==="[object ArrayBuffer]"?a.input=new Uint8Array(o):a.input=o,a.next_in=0,a.avail_in=a.input.length;;){if(a.avail_out===0&&(a.output=new Uint8Array(c),a.next_out=0,a.avail_out=c),(h===Z_SYNC_FLUSH||h===Z_FULL_FLUSH)&&a.avail_out<=6){this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;continue}if(d=deflate_1$2.deflate(a,h),d===Z_STREAM_END$2)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),d=deflate_1$2.deflateEnd(this.strm),this.onEnd(d),this.ended=!0,d===Z_OK$2;if(a.avail_out===0){this.onData(a.output);continue}if(h>0&&a.next_out>0){this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;continue}if(a.avail_in===0)break}return!0};Deflate$1.prototype.onData=function(o){this.chunks.push(o)};Deflate$1.prototype.onEnd=function(o){o===Z_OK$2&&(this.result=common$6.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg};const BAD$1=16209,TYPE$1=16191;var inffast=function(e,a){let c,d,h,j,et,nt,st,ot,ht,pt,dt,gt,wt,St,_t,mt,bt,$t,Bt,Dt,Ht,qt,Pt,Gt;const ct=e.state;c=e.next_in,Pt=e.input,d=c+(e.avail_in-5),h=e.next_out,Gt=e.output,j=h-(a-e.avail_out),et=h+(e.avail_out-257),nt=ct.dmax,st=ct.wsize,ot=ct.whave,ht=ct.wnext,pt=ct.window,dt=ct.hold,gt=ct.bits,wt=ct.lencode,St=ct.distcode,_t=(1<>>24,dt>>>=$t,gt-=$t,$t=bt>>>16&255,$t===0)Gt[h++]=bt&65535;else if($t&16){Bt=bt&65535,$t&=15,$t&&(gt<$t&&(dt+=Pt[c++]<>>=$t,gt-=$t),gt<15&&(dt+=Pt[c++]<>>24,dt>>>=$t,gt-=$t,$t=bt>>>16&255,$t&16){if(Dt=bt&65535,$t&=15,gt<$t&&(dt+=Pt[c++]<nt){e.msg="invalid distance too far back",ct.mode=BAD$1;break e}if(dt>>>=$t,gt-=$t,$t=h-j,Dt>$t){if($t=Dt-$t,$t>ot&&ct.sane){e.msg="invalid distance too far back",ct.mode=BAD$1;break e}if(Ht=0,qt=pt,ht===0){if(Ht+=st-$t,$t2;)Gt[h++]=qt[Ht++],Gt[h++]=qt[Ht++],Gt[h++]=qt[Ht++],Bt-=3;Bt&&(Gt[h++]=qt[Ht++],Bt>1&&(Gt[h++]=qt[Ht++]))}else{Ht=h-Dt;do Gt[h++]=Gt[Ht++],Gt[h++]=Gt[Ht++],Gt[h++]=Gt[Ht++],Bt-=3;while(Bt>2);Bt&&(Gt[h++]=Gt[Ht++],Bt>1&&(Gt[h++]=Gt[Ht++]))}}else if($t&64){e.msg="invalid distance code",ct.mode=BAD$1;break e}else{bt=St[(bt&65535)+(dt&(1<<$t)-1)];continue r}break}}else if($t&64)if($t&32){ct.mode=TYPE$1;break e}else{e.msg="invalid literal/length code",ct.mode=BAD$1;break e}else{bt=wt[(bt&65535)+(dt&(1<<$t)-1)];continue t}break}}while(c>3,c-=Bt,gt-=Bt<<3,dt&=(1<{const nt=et.bits;let st=0,ot=0,ht=0,pt=0,dt=0,gt=0,wt=0,St=0,_t=0,mt=0,bt,$t,Bt,Dt,Ht,qt=null,Pt;const Gt=new Uint16Array(MAXBITS+1),ct=new Uint16Array(MAXBITS+1);let g=null,b,$,_e;for(st=0;st<=MAXBITS;st++)Gt[st]=0;for(ot=0;ot=1&&Gt[pt]===0;pt--);if(dt>pt&&(dt=pt),pt===0)return d[h++]=1<<24|64<<16|0,d[h++]=1<<24|64<<16|0,et.bits=1,0;for(ht=1;ht0&&(o===CODES$1||pt!==1))return-1;for(ct[1]=0,st=1;stENOUGH_LENS$1||o===DISTS$1&&_t>ENOUGH_DISTS$1)return 1;for(;;){b=st-wt,j[ot]+1=Pt?($=g[j[ot]-Pt],_e=qt[j[ot]-Pt]):($=96,_e=0),bt=1<>wt)+$t]=b<<24|$<<16|_e|0;while($t!==0);for(bt=1<>=1;if(bt!==0?(mt&=bt-1,mt+=bt):mt=0,ot++,--Gt[st]===0){if(st===pt)break;st=e[a+j[ot]]}if(st>dt&&(mt&Dt)!==Bt){for(wt===0&&(wt=dt),Ht+=ht,gt=st-wt,St=1<ENOUGH_LENS$1||o===DISTS$1&&_t>ENOUGH_DISTS$1)return 1;Bt=mt&Dt,d[Bt]=dt<<24|gt<<16|Ht-h|0}}return mt!==0&&(d[Ht+mt]=st-wt<<24|64<<16|0),et.bits=dt,0};var inftrees=inflate_table;const CODES=0,LENS=1,DISTS=2,{Z_FINISH:Z_FINISH$1,Z_BLOCK,Z_TREES,Z_OK:Z_OK$1,Z_STREAM_END:Z_STREAM_END$1,Z_NEED_DICT:Z_NEED_DICT$1,Z_STREAM_ERROR:Z_STREAM_ERROR$1,Z_DATA_ERROR:Z_DATA_ERROR$1,Z_MEM_ERROR:Z_MEM_ERROR$1,Z_BUF_ERROR,Z_DEFLATED}=constants$2,HEAD=16180,FLAGS=16181,TIME=16182,OS=16183,EXLEN=16184,EXTRA=16185,NAME=16186,COMMENT=16187,HCRC=16188,DICTID=16189,DICT=16190,TYPE=16191,TYPEDO=16192,STORED=16193,COPY_=16194,COPY=16195,TABLE=16196,LENLENS=16197,CODELENS=16198,LEN_=16199,LEN=16200,LENEXT=16201,DIST=16202,DISTEXT=16203,MATCH=16204,LIT=16205,CHECK=16206,LENGTH=16207,DONE=16208,BAD=16209,MEM=16210,SYNC=16211,ENOUGH_LENS=852,ENOUGH_DISTS=592,MAX_WBITS=15,DEF_WBITS=MAX_WBITS,zswap32=o=>(o>>>24&255)+(o>>>8&65280)+((o&65280)<<8)+((o&255)<<24);function InflateState(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const inflateStateCheck=o=>{if(!o)return 1;const e=o.state;return!e||e.strm!==o||e.modeSYNC?1:0},inflateResetKeep=o=>{if(inflateStateCheck(o))return Z_STREAM_ERROR$1;const e=o.state;return o.total_in=o.total_out=e.total=0,o.msg="",e.wrap&&(o.adler=e.wrap&1),e.mode=HEAD,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(ENOUGH_LENS),e.distcode=e.distdyn=new Int32Array(ENOUGH_DISTS),e.sane=1,e.back=-1,Z_OK$1},inflateReset=o=>{if(inflateStateCheck(o))return Z_STREAM_ERROR$1;const e=o.state;return e.wsize=0,e.whave=0,e.wnext=0,inflateResetKeep(o)},inflateReset2=(o,e)=>{let a;if(inflateStateCheck(o))return Z_STREAM_ERROR$1;const c=o.state;return e<0?(a=0,e=-e):(a=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Z_STREAM_ERROR$1:(c.window!==null&&c.wbits!==e&&(c.window=null),c.wrap=a,c.wbits=e,inflateReset(o))},inflateInit2=(o,e)=>{if(!o)return Z_STREAM_ERROR$1;const a=new InflateState;o.state=a,a.strm=o,a.window=null,a.mode=HEAD;const c=inflateReset2(o,e);return c!==Z_OK$1&&(o.state=null),c},inflateInit=o=>inflateInit2(o,DEF_WBITS);let virgin=!0,lenfix,distfix;const fixedtables=o=>{if(virgin){lenfix=new Int32Array(512),distfix=new Int32Array(32);let e=0;for(;e<144;)o.lens[e++]=8;for(;e<256;)o.lens[e++]=9;for(;e<280;)o.lens[e++]=7;for(;e<288;)o.lens[e++]=8;for(inftrees(LENS,o.lens,0,288,lenfix,0,o.work,{bits:9}),e=0;e<32;)o.lens[e++]=5;inftrees(DISTS,o.lens,0,32,distfix,0,o.work,{bits:5}),virgin=!1}o.lencode=lenfix,o.lenbits=9,o.distcode=distfix,o.distbits=5},updatewindow=(o,e,a,c)=>{let d;const h=o.state;return h.window===null&&(h.wsize=1<=h.wsize?(h.window.set(e.subarray(a-h.wsize,a),0),h.wnext=0,h.whave=h.wsize):(d=h.wsize-h.wnext,d>c&&(d=c),h.window.set(e.subarray(a-c,a-c+d),h.wnext),c-=d,c?(h.window.set(e.subarray(a-c,a),0),h.wnext=c,h.whave=h.wsize):(h.wnext+=d,h.wnext===h.wsize&&(h.wnext=0),h.whave{let a,c,d,h,j,et,nt,st,ot,ht,pt,dt,gt,wt,St=0,_t,mt,bt,$t,Bt,Dt,Ht,qt;const Pt=new Uint8Array(4);let Gt,ct;const g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(inflateStateCheck(o)||!o.output||!o.input&&o.avail_in!==0)return Z_STREAM_ERROR$1;a=o.state,a.mode===TYPE&&(a.mode=TYPEDO),j=o.next_out,d=o.output,nt=o.avail_out,h=o.next_in,c=o.input,et=o.avail_in,st=a.hold,ot=a.bits,ht=et,pt=nt,qt=Z_OK$1;e:for(;;)switch(a.mode){case HEAD:if(a.wrap===0){a.mode=TYPEDO;break}for(;ot<16;){if(et===0)break e;et--,st+=c[h++]<>>8&255,a.check=crc32_1(a.check,Pt,2,0),st=0,ot=0,a.mode=FLAGS;break}if(a.head&&(a.head.done=!1),!(a.wrap&1)||(((st&255)<<8)+(st>>8))%31){o.msg="incorrect header check",a.mode=BAD;break}if((st&15)!==Z_DEFLATED){o.msg="unknown compression method",a.mode=BAD;break}if(st>>>=4,ot-=4,Ht=(st&15)+8,a.wbits===0&&(a.wbits=Ht),Ht>15||Ht>a.wbits){o.msg="invalid window size",a.mode=BAD;break}a.dmax=1<>8&1),a.flags&512&&a.wrap&4&&(Pt[0]=st&255,Pt[1]=st>>>8&255,a.check=crc32_1(a.check,Pt,2,0)),st=0,ot=0,a.mode=TIME;case TIME:for(;ot<32;){if(et===0)break e;et--,st+=c[h++]<>>8&255,Pt[2]=st>>>16&255,Pt[3]=st>>>24&255,a.check=crc32_1(a.check,Pt,4,0)),st=0,ot=0,a.mode=OS;case OS:for(;ot<16;){if(et===0)break e;et--,st+=c[h++]<>8),a.flags&512&&a.wrap&4&&(Pt[0]=st&255,Pt[1]=st>>>8&255,a.check=crc32_1(a.check,Pt,2,0)),st=0,ot=0,a.mode=EXLEN;case EXLEN:if(a.flags&1024){for(;ot<16;){if(et===0)break e;et--,st+=c[h++]<>>8&255,a.check=crc32_1(a.check,Pt,2,0)),st=0,ot=0}else a.head&&(a.head.extra=null);a.mode=EXTRA;case EXTRA:if(a.flags&1024&&(dt=a.length,dt>et&&(dt=et),dt&&(a.head&&(Ht=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(c.subarray(h,h+dt),Ht)),a.flags&512&&a.wrap&4&&(a.check=crc32_1(a.check,c,dt,h)),et-=dt,h+=dt,a.length-=dt),a.length))break e;a.length=0,a.mode=NAME;case NAME:if(a.flags&2048){if(et===0)break e;dt=0;do Ht=c[h+dt++],a.head&&Ht&&a.length<65536&&(a.head.name+=String.fromCharCode(Ht));while(Ht&&dt>9&1,a.head.done=!0),o.adler=a.check=0,a.mode=TYPE;break;case DICTID:for(;ot<32;){if(et===0)break e;et--,st+=c[h++]<>>=ot&7,ot-=ot&7,a.mode=CHECK;break}for(;ot<3;){if(et===0)break e;et--,st+=c[h++]<>>=1,ot-=1,st&3){case 0:a.mode=STORED;break;case 1:if(fixedtables(a),a.mode=LEN_,e===Z_TREES){st>>>=2,ot-=2;break e}break;case 2:a.mode=TABLE;break;case 3:o.msg="invalid block type",a.mode=BAD}st>>>=2,ot-=2;break;case STORED:for(st>>>=ot&7,ot-=ot&7;ot<32;){if(et===0)break e;et--,st+=c[h++]<>>16^65535)){o.msg="invalid stored block lengths",a.mode=BAD;break}if(a.length=st&65535,st=0,ot=0,a.mode=COPY_,e===Z_TREES)break e;case COPY_:a.mode=COPY;case COPY:if(dt=a.length,dt){if(dt>et&&(dt=et),dt>nt&&(dt=nt),dt===0)break e;d.set(c.subarray(h,h+dt),j),et-=dt,h+=dt,nt-=dt,j+=dt,a.length-=dt;break}a.mode=TYPE;break;case TABLE:for(;ot<14;){if(et===0)break e;et--,st+=c[h++]<>>=5,ot-=5,a.ndist=(st&31)+1,st>>>=5,ot-=5,a.ncode=(st&15)+4,st>>>=4,ot-=4,a.nlen>286||a.ndist>30){o.msg="too many length or distance symbols",a.mode=BAD;break}a.have=0,a.mode=LENLENS;case LENLENS:for(;a.have>>=3,ot-=3}for(;a.have<19;)a.lens[g[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,Gt={bits:a.lenbits},qt=inftrees(CODES,a.lens,0,19,a.lencode,0,a.work,Gt),a.lenbits=Gt.bits,qt){o.msg="invalid code lengths set",a.mode=BAD;break}a.have=0,a.mode=CODELENS;case CODELENS:for(;a.have>>24,mt=St>>>16&255,bt=St&65535,!(_t<=ot);){if(et===0)break e;et--,st+=c[h++]<>>=_t,ot-=_t,a.lens[a.have++]=bt;else{if(bt===16){for(ct=_t+2;ot>>=_t,ot-=_t,a.have===0){o.msg="invalid bit length repeat",a.mode=BAD;break}Ht=a.lens[a.have-1],dt=3+(st&3),st>>>=2,ot-=2}else if(bt===17){for(ct=_t+3;ot>>=_t,ot-=_t,Ht=0,dt=3+(st&7),st>>>=3,ot-=3}else{for(ct=_t+7;ot>>=_t,ot-=_t,Ht=0,dt=11+(st&127),st>>>=7,ot-=7}if(a.have+dt>a.nlen+a.ndist){o.msg="invalid bit length repeat",a.mode=BAD;break}for(;dt--;)a.lens[a.have++]=Ht}}if(a.mode===BAD)break;if(a.lens[256]===0){o.msg="invalid code -- missing end-of-block",a.mode=BAD;break}if(a.lenbits=9,Gt={bits:a.lenbits},qt=inftrees(LENS,a.lens,0,a.nlen,a.lencode,0,a.work,Gt),a.lenbits=Gt.bits,qt){o.msg="invalid literal/lengths set",a.mode=BAD;break}if(a.distbits=6,a.distcode=a.distdyn,Gt={bits:a.distbits},qt=inftrees(DISTS,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,Gt),a.distbits=Gt.bits,qt){o.msg="invalid distances set",a.mode=BAD;break}if(a.mode=LEN_,e===Z_TREES)break e;case LEN_:a.mode=LEN;case LEN:if(et>=6&&nt>=258){o.next_out=j,o.avail_out=nt,o.next_in=h,o.avail_in=et,a.hold=st,a.bits=ot,inffast(o,pt),j=o.next_out,d=o.output,nt=o.avail_out,h=o.next_in,c=o.input,et=o.avail_in,st=a.hold,ot=a.bits,a.mode===TYPE&&(a.back=-1);break}for(a.back=0;St=a.lencode[st&(1<>>24,mt=St>>>16&255,bt=St&65535,!(_t<=ot);){if(et===0)break e;et--,st+=c[h++]<>$t)],_t=St>>>24,mt=St>>>16&255,bt=St&65535,!($t+_t<=ot);){if(et===0)break e;et--,st+=c[h++]<>>=$t,ot-=$t,a.back+=$t}if(st>>>=_t,ot-=_t,a.back+=_t,a.length=bt,mt===0){a.mode=LIT;break}if(mt&32){a.back=-1,a.mode=TYPE;break}if(mt&64){o.msg="invalid literal/length code",a.mode=BAD;break}a.extra=mt&15,a.mode=LENEXT;case LENEXT:if(a.extra){for(ct=a.extra;ot>>=a.extra,ot-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=DIST;case DIST:for(;St=a.distcode[st&(1<>>24,mt=St>>>16&255,bt=St&65535,!(_t<=ot);){if(et===0)break e;et--,st+=c[h++]<>$t)],_t=St>>>24,mt=St>>>16&255,bt=St&65535,!($t+_t<=ot);){if(et===0)break e;et--,st+=c[h++]<>>=$t,ot-=$t,a.back+=$t}if(st>>>=_t,ot-=_t,a.back+=_t,mt&64){o.msg="invalid distance code",a.mode=BAD;break}a.offset=bt,a.extra=mt&15,a.mode=DISTEXT;case DISTEXT:if(a.extra){for(ct=a.extra;ot>>=a.extra,ot-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){o.msg="invalid distance too far back",a.mode=BAD;break}a.mode=MATCH;case MATCH:if(nt===0)break e;if(dt=pt-nt,a.offset>dt){if(dt=a.offset-dt,dt>a.whave&&a.sane){o.msg="invalid distance too far back",a.mode=BAD;break}dt>a.wnext?(dt-=a.wnext,gt=a.wsize-dt):gt=a.wnext-dt,dt>a.length&&(dt=a.length),wt=a.window}else wt=d,gt=j-a.offset,dt=a.length;dt>nt&&(dt=nt),nt-=dt,a.length-=dt;do d[j++]=wt[gt++];while(--dt);a.length===0&&(a.mode=LEN);break;case LIT:if(nt===0)break e;d[j++]=a.length,nt--,a.mode=LEN;break;case CHECK:if(a.wrap){for(;ot<32;){if(et===0)break e;et--,st|=c[h++]<{if(inflateStateCheck(o))return Z_STREAM_ERROR$1;let e=o.state;return e.window&&(e.window=null),o.state=null,Z_OK$1},inflateGetHeader=(o,e)=>{if(inflateStateCheck(o))return Z_STREAM_ERROR$1;const a=o.state;return a.wrap&2?(a.head=e,e.done=!1,Z_OK$1):Z_STREAM_ERROR$1},inflateSetDictionary=(o,e)=>{const a=e.length;let c,d,h;return inflateStateCheck(o)||(c=o.state,c.wrap!==0&&c.mode!==DICT)?Z_STREAM_ERROR$1:c.mode===DICT&&(d=1,d=adler32_1(d,e,a,0),d!==c.check)?Z_DATA_ERROR$1:(h=updatewindow(o,e,a,a),h?(c.mode=MEM,Z_MEM_ERROR$1):(c.havedict=1,Z_OK$1))};var inflateReset_1=inflateReset,inflateReset2_1=inflateReset2,inflateResetKeep_1=inflateResetKeep,inflateInit_1=inflateInit,inflateInit2_1=inflateInit2,inflate_2$1=inflate$2,inflateEnd_1=inflateEnd,inflateGetHeader_1=inflateGetHeader,inflateSetDictionary_1=inflateSetDictionary,inflateInfo="pako inflate (from Nodeca project)",inflate_1$2={inflateReset:inflateReset_1,inflateReset2:inflateReset2_1,inflateResetKeep:inflateResetKeep_1,inflateInit:inflateInit_1,inflateInit2:inflateInit2_1,inflate:inflate_2$1,inflateEnd:inflateEnd_1,inflateGetHeader:inflateGetHeader_1,inflateSetDictionary:inflateSetDictionary_1,inflateInfo};function GZheader(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gzheader=GZheader;const toString$2=Object.prototype.toString,{Z_NO_FLUSH,Z_FINISH,Z_OK,Z_STREAM_END,Z_NEED_DICT,Z_STREAM_ERROR,Z_DATA_ERROR,Z_MEM_ERROR}=constants$2;function Inflate$1(o){this.options=common$6.assign({chunkSize:1024*64,windowBits:15,to:""},o||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(o&&o.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let a=inflate_1$2.inflateInit2(this.strm,e.windowBits);if(a!==Z_OK)throw new Error(messages[a]);if(this.header=new gzheader,inflate_1$2.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=strings.string2buf(e.dictionary):toString$2.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=inflate_1$2.inflateSetDictionary(this.strm,e.dictionary),a!==Z_OK)))throw new Error(messages[a])}Inflate$1.prototype.push=function(o,e){const a=this.strm,c=this.options.chunkSize,d=this.options.dictionary;let h,j,et;if(this.ended)return!1;for(e===~~e?j=e:j=e===!0?Z_FINISH:Z_NO_FLUSH,toString$2.call(o)==="[object ArrayBuffer]"?a.input=new Uint8Array(o):a.input=o,a.next_in=0,a.avail_in=a.input.length;;){for(a.avail_out===0&&(a.output=new Uint8Array(c),a.next_out=0,a.avail_out=c),h=inflate_1$2.inflate(a,j),h===Z_NEED_DICT&&d&&(h=inflate_1$2.inflateSetDictionary(a,d),h===Z_OK?h=inflate_1$2.inflate(a,j):h===Z_DATA_ERROR&&(h=Z_NEED_DICT));a.avail_in>0&&h===Z_STREAM_END&&a.state.wrap>0&&o[a.next_in]!==0;)inflate_1$2.inflateReset(a),h=inflate_1$2.inflate(a,j);switch(h){case Z_STREAM_ERROR:case Z_DATA_ERROR:case Z_NEED_DICT:case Z_MEM_ERROR:return this.onEnd(h),this.ended=!0,!1}if(et=a.avail_out,a.next_out&&(a.avail_out===0||h===Z_STREAM_END))if(this.options.to==="string"){let nt=strings.utf8border(a.output,a.next_out),st=a.next_out-nt,ot=strings.buf2string(a.output,nt);a.next_out=st,a.avail_out=c-st,st&&a.output.set(a.output.subarray(nt,nt+st),0),this.onData(ot)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(!(h===Z_OK&&et===0)){if(h===Z_STREAM_END)return h=inflate_1$2.inflateEnd(this.strm),this.onEnd(h),this.ended=!0,!0;if(a.avail_in===0)break}}return!0};Inflate$1.prototype.onData=function(o){this.chunks.push(o)};Inflate$1.prototype.onEnd=function(o){o===Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=common$6.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg};function inflate$1(o,e){const a=new Inflate$1(e);if(a.push(o),a.err)throw a.msg||messages[a.err];return a.result}function inflateRaw$1(o,e){return e=e||{},e.raw=!0,inflate$1(o,e)}var Inflate_1$1=Inflate$1,inflate_2=inflate$1,inflateRaw_1$1=inflateRaw$1,ungzip$1=inflate$1,constants$1=constants$2,inflate_1$1={Inflate:Inflate_1$1,inflate:inflate_2,inflateRaw:inflateRaw_1$1,ungzip:ungzip$1,constants:constants$1};const{Inflate,inflate,inflateRaw,ungzip}=inflate_1$1;var inflate_1=inflate;function chunks(o,e){return Array.apply(0,new Array(Math.ceil(o.length/e))).map((a,c)=>o.slice(c*e,(c+1)*e))}const isVersionedTransaction=o=>"version"in o;function encode$3(o){return o.reduce((e,a)=>e+a.toString(16).padStart(2,"0"),"0x")}function decode$3(o){o.indexOf("0x")===0&&(o=o.substr(2)),o.length%2===1&&(o="0"+o);let e=o.match(/.{2}/g);return e===null?Buffer$1$1.from([]):Buffer$1$1.from(e.map(a=>parseInt(a,16)))}var hex=Object.freeze({__proto__:null,encode:encode$3,decode:decode$3});function decode$2(o){return new TextDecoder("utf-8").decode(o)}function encode$2(o){return new TextEncoder().encode(o)}var utf8=Object.freeze({__proto__:null,decode:decode$2,encode:encode$2});function encode$1(o){return bs58$4.encode(o)}function decode$1(o){return bs58$4.decode(o)}var bs58=Object.freeze({__proto__:null,encode:encode$1,decode:decode$1});function encode(o){return o.toString("base64")}function decode(o){return Buffer$1$1.from(o,"base64")}var base64=Object.freeze({__proto__:null,encode,decode}),index$1=Object.freeze({__proto__:null,hex,utf8,bs58,base64});function isCompositeAccounts(o){return"accounts"in o}async function idlAddress(o){const e=(await PublicKey$1.findProgramAddress([],o))[0];return await PublicKey$1.createWithSeed(e,seed(),o)}function seed(){return"anchor:idl"}const IDL_ACCOUNT_LAYOUT=dist$2.struct([dist$2.publicKey("authority"),dist$2.vecU8("data")]);function decodeIdlAccount(o){return IDL_ACCOUNT_LAYOUT.decode(o)}function convertIdlToCamelCase(o){const e=["name","path","account","relations","generic"],a=h=>h.split(".").map(camelCase$1).join("."),c=h=>{for(const j in h){const et=h[j];e.includes(j)?h[j]=Array.isArray(et)?et.map(a):a(et):typeof et=="object"&&c(et)}},d=structuredClone(o);return c(d),d}function handleDefinedFields(o,e,a,c){return o!=null&&o.length?o[0].name?a(o):c(o):e()}function parseIdlErrors(o){const e=new Map;return o.errors&&o.errors.forEach(a=>{var c;let d=(c=a.msg)!==null&&c!==void 0?c:a.name;e.set(a.code,d)}),e}function toInstruction(o,...e){if(o.args.length!=e.length)throw new Error("Invalid argument length");const a={};let c=0;return o.args.forEach(d=>{a[d.name]=e[c],c+=1}),a}function validateAccounts(o,e={}){o.forEach(a=>{if(isCompositeAccounts(a))validateAccounts(a.accounts,e[a.name]);else if(!e[a.name])throw new Error(`Account \`${a.name}\` not provided.`)})}function translateAddress(o){return o instanceof PublicKey$1?o:new PublicKey$1(o)}let StructError$1=class extends TypeError{constructor(e,a){let c;const{message:d,...h}=e,{path:j}=e,et=j.length===0?d:"At path: "+j.join(".")+" -- "+d;super(et),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,h),this.name=this.constructor.name,this.failures=()=>{var nt;return(nt=c)!=null?nt:c=[e,...a()]}}};function isIterable$1(o){return isObject$2(o)&&typeof o[Symbol.iterator]=="function"}function isObject$2(o){return typeof o=="object"&&o!=null}function print$1(o){return typeof o=="string"?JSON.stringify(o):""+o}function shiftIterator$1(o){const{done:e,value:a}=o.next();return e?void 0:a}function toFailure$1(o,e,a,c){if(o===!0)return;o===!1?o={}:typeof o=="string"&&(o={message:o});const{path:d,branch:h}=e,{type:j}=a,{refinement:et,message:nt="Expected a value of type `"+j+"`"+(et?" with refinement `"+et+"`":"")+", but received: `"+print$1(c)+"`"}=o;return{value:c,type:j,refinement:et,key:d[d.length-1],path:d,branch:h,...o,message:nt}}function*toFailures$1(o,e,a,c){isIterable$1(o)||(o=[o]);for(const d of o){const h=toFailure$1(d,e,a,c);h&&(yield h)}}function*run$1(o,e,a){a===void 0&&(a={});const{path:c=[],branch:d=[o],coerce:h=!1,mask:j=!1}=a,et={path:c,branch:d};if(h&&(o=e.coercer(o,et),j&&e.type!=="type"&&isObject$2(e.schema)&&isObject$2(o)&&!Array.isArray(o)))for(const st in o)e.schema[st]===void 0&&delete o[st];let nt=!0;for(const st of e.validator(o,et))nt=!1,yield[st,void 0];for(let[st,ot,ht]of e.entries(o,et)){const pt=run$1(ot,ht,{path:st===void 0?c:[...c,st],branch:st===void 0?d:[...d,ot],coerce:h,mask:j});for(const dt of pt)dt[0]?(nt=!1,yield[dt[0],void 0]):h&&(ot=dt[1],st===void 0?o=ot:o instanceof Map?o.set(st,ot):o instanceof Set?o.add(ot):isObject$2(o)&&(o[st]=ot))}if(nt)for(const st of e.refiner(o,et))nt=!1,yield[st,void 0];nt&&(yield[void 0,o])}let Struct$1=class{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:a,schema:c,validator:d,refiner:h,coercer:j=nt=>nt,entries:et=function*(){}}=e;this.type=a,this.schema=c,this.entries=et,this.coercer=j,d?this.validator=(nt,st)=>{const ot=d(nt,st);return toFailures$1(ot,st,this,nt)}:this.validator=()=>[],h?this.refiner=(nt,st)=>{const ot=h(nt,st);return toFailures$1(ot,st,this,nt)}:this.refiner=()=>[]}assert(e){return assert$l(e,this)}create(e){return create$1(e,this)}is(e){return is$1(e,this)}mask(e){return mask$1(e,this)}validate(e,a){return a===void 0&&(a={}),validate$1(e,this,a)}};function assert$l(o,e){const a=validate$1(o,e);if(a[0])throw a[0]}function create$1(o,e){const a=validate$1(o,e,{coerce:!0});if(a[0])throw a[0];return a[1]}function mask$1(o,e){const a=validate$1(o,e,{coerce:!0,mask:!0});if(a[0])throw a[0];return a[1]}function is$1(o,e){return!validate$1(o,e)[0]}function validate$1(o,e,a){a===void 0&&(a={});const c=run$1(o,e,a),d=shiftIterator$1(c);return d[0]?[new StructError$1(d[0],function*(){for(const j of c)j[0]&&(yield j[0])}),void 0]:[void 0,d[1]]}function define$1(o,e){return new Struct$1({type:o,schema:null,validator:e})}function any$1(){return define$1("any",()=>!0)}function array$1(o){return new Struct$1({type:"array",schema:o,*entries(e){if(o&&Array.isArray(e))for(const[a,c]of e.entries())yield[a,c,o]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+print$1(e)}})}function boolean$1(){return define$1("boolean",o=>typeof o=="boolean")}function literal$1(o){const e=print$1(o);return new Struct$1({type:"literal",schema:o,validator(a){return a===o||"Expected the literal `"+e+"`, but received: "+print$1(a)}})}function nullable$1(o){return new Struct$1({...o,validator:(e,a)=>e===null||o.validator(e,a),refiner:(e,a)=>e===null||o.refiner(e,a)})}function number$1(){return define$1("number",o=>typeof o=="number"&&!isNaN(o)||"Expected a number, but received: "+print$1(o))}function optional$1(o){return new Struct$1({...o,validator:(e,a)=>e===void 0||o.validator(e,a),refiner:(e,a)=>e===void 0||o.refiner(e,a)})}function string$1(){return define$1("string",o=>typeof o=="string"||"Expected a string, but received: "+print$1(o))}function type$2(o){const e=Object.keys(o);return new Struct$1({type:"type",schema:o,*entries(a){if(isObject$2(a))for(const c of e)yield[c,a[c],o[c]]},validator(a){return isObject$2(a)||"Expected an object, but received: "+print$1(a)}})}function union$1$1(o){const e=o.map(a=>a.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(a,c){return(o.find(h=>{const[j]=h.validate(a,{coerce:!0});return!j})||unknown$1()).coercer(a,c)},validator(a,c){const d=[];for(const h of o){const[...j]=run$1(a,h,c),[et]=j;if(et[0])for(const[nt]of j)nt&&d.push(nt);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+print$1(a),...d]}})}function unknown$1(){return define$1("unknown",()=>!0)}function coerce$1(o,e,a){return new Struct$1({...o,coercer:(c,d)=>is$1(c,e)?o.coercer(a(c,d),d):o.coercer(c,d)})}async function invoke(o,e,a,c){o=translateAddress(o),c||(c=getProvider());const d=new Transaction;if(d.add(new TransactionInstruction({programId:o,keys:e??[],data:a})),c.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await c.sendAndConfirm(d,[])}const GET_MULTIPLE_ACCOUNTS_LIMIT=99;async function getMultipleAccounts(o,e,a){return(await getMultipleAccountsAndContext(o,e,a)).map(d=>d?{publicKey:d.publicKey,account:d.account}:null)}async function getMultipleAccountsAndContext(o,e,a){if(e.length<=GET_MULTIPLE_ACCOUNTS_LIMIT)return await getMultipleAccountsAndContextCore(o,e,a);{const c=chunks(e,GET_MULTIPLE_ACCOUNTS_LIMIT);return(await Promise.all(c.map(h=>getMultipleAccountsAndContextCore(o,h,a)))).flat()}}async function getMultipleAccountsAndContextCore(o,e,a){const c=a??o.commitment,{value:d,context:h}=await o.getMultipleAccountsInfoAndContext(e,c);return d.map((et,nt)=>et===null?null:{publicKey:e[nt],account:et,context:h})}async function simulateTransaction(o,e,a,c,d){var h;a&&a.length>0&&e.sign(...a);const j=e._compile(),et=j.serialize(),st=e._serialize(et).toString("base64"),ot={encoding:"base64",commitment:c??o.commitment};if(d){const gt=(Array.isArray(d)?d:j.nonProgramIds()).map(wt=>wt.toBase58());ot.accounts={encoding:"base64",addresses:gt}}a&&a.length>0&&(ot.sigVerify=!0);const ht=[st,ot],pt=await o._rpcRequest("simulateTransaction",ht),dt=create$1(pt,SimulatedTransactionResponseStruct);if("error"in dt){let gt;if("data"in dt.error&&(gt=(h=dt.error.data)===null||h===void 0?void 0:h.logs,gt&&Array.isArray(gt))){const wt=` + `,St=wt+gt.join(wt);console.error(dt.error.message,St)}throw new SendTransactionError("failed to simulate transaction: "+dt.error.message,gt)}return dt.result}function jsonRpcResult$1(o){return coerce$1(createRpcResult$1(o),UnknownRpcResult$1,e=>"error"in e?e:{...e,result:create$1(e.result,o)})}const UnknownRpcResult$1=createRpcResult$1(unknown$1());function createRpcResult$1(o){return union$1$1([type$2({jsonrpc:literal$1("2.0"),id:string$1(),result:o}),type$2({jsonrpc:literal$1("2.0"),id:string$1(),error:type$2({code:unknown$1(),message:string$1(),data:optional$1(any$1())})})])}function jsonRpcResultAndContext$1(o){return jsonRpcResult$1(type$2({context:type$2({slot:number$1()}),value:o}))}const SimulatedTransactionResponseStruct=jsonRpcResultAndContext$1(type$2({err:nullable$1(union$1$1([type$2({}),string$1()])),logs:nullable$1(array$1(string$1())),accounts:optional$1(nullable$1(array$1(nullable$1(type$2({executable:boolean$1(),owner:string$1(),lamports:number$1(),data:array$1(string$1()),rentEpoch:optional$1(number$1())}))))),unitsConsumed:optional$1(number$1())}));var rpc=Object.freeze({__proto__:null,invoke,getMultipleAccounts,getMultipleAccountsAndContext,simulateTransaction});class AnchorProvider{constructor(e,a,c=AnchorProvider.defaultOptions()){this.connection=e,this.wallet=a,this.opts=c,this.publicKey=a==null?void 0:a.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(e,a=AnchorProvider.defaultOptions()){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(e,a,c){var d,h,j,et;if(c===void 0&&(c=this.opts),isVersionedTransaction(e))a&&e.sign(a);else if(e.feePayer=(d=e.feePayer)!==null&&d!==void 0?d:this.wallet.publicKey,e.recentBlockhash=(await this.connection.getLatestBlockhash(c.preflightCommitment)).blockhash,a)for(const st of a)e.partialSign(st);e=await this.wallet.signTransaction(e);const nt=e.serialize();try{return await sendAndConfirmRawTransaction(this.connection,nt,c)}catch(st){if(st instanceof ConfirmError){const ot=encode$1(isVersionedTransaction(e)?((h=e.signatures)===null||h===void 0?void 0:h[0])||new Uint8Array:(j=e.signature)!==null&&j!==void 0?j:new Uint8Array),ht=isVersionedTransaction(e)?0:void 0,pt=await this.connection.getTransaction(ot,{commitment:"confirmed",maxSupportedTransactionVersion:ht});if(pt){const dt=(et=pt.meta)===null||et===void 0?void 0:et.logMessages;throw dt?new SendTransactionError(st.message,dt):st}else throw st}else throw st}}async sendAll(e,a){var c,d,h;a===void 0&&(a=this.opts);const j=(await this.connection.getLatestBlockhash(a.preflightCommitment)).blockhash;let et=e.map(ot=>{var ht,pt;if(isVersionedTransaction(ot.tx)){let dt=ot.tx;return ot.signers&&dt.sign(ot.signers),dt}else{let dt=ot.tx,gt=(ht=ot.signers)!==null&&ht!==void 0?ht:[];return dt.feePayer=(pt=dt.feePayer)!==null&&pt!==void 0?pt:this.wallet.publicKey,dt.recentBlockhash=j,gt.forEach(wt=>{dt.partialSign(wt)}),dt}});const nt=await this.wallet.signAllTransactions(et),st=[];for(let ot=0;ot0&&(e.sign(a),e=await this.wallet.signTransaction(e)),j=await this.connection.simulateTransaction(e,{commitment:c})):(e.feePayer=e.feePayer||this.wallet.publicKey,e.recentBlockhash=h,a&&a.length>0&&(e=await this.wallet.signTransaction(e)),j=await simulateTransaction(this.connection,e,a,c,d)),j.value.err)throw new SimulateError(j.value);return j.value}}class SimulateError extends Error{constructor(e,a){super(a),this.simulationResponse=e}}async function sendAndConfirmRawTransaction(o,e,a){const c=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment},d=await o.sendRawTransaction(e,c),h=(await o.confirmTransaction(d,a&&a.commitment)).value;if(h.err)throw new ConfirmError(`Raw transaction ${d} failed (${JSON.stringify(h)})`);return d}class ConfirmError extends Error{constructor(e){super(e)}}function getProvider(){return AnchorProvider.local()}var commonjsGlobal$1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var dist$1={};Object.defineProperty(dist$1,"__esModule",{value:!0});var ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=ANCHOR_ERROR__REQUIRE_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_VIOLATED=ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=dist$1.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=dist$1.ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=dist$1.ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=ANCHOR_ERROR__CONSTRAINT_SPACE=dist$1.ANCHOR_ERROR__CONSTRAINT_SPACE=ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=dist$1.ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=dist$1.ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=ANCHOR_ERROR__CONSTRAINT_ZERO=dist$1.ANCHOR_ERROR__CONSTRAINT_ZERO=ANCHOR_ERROR__CONSTRAINT_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_ADDRESS=ANCHOR_ERROR__CONSTRAINT_CLOSE=dist$1.ANCHOR_ERROR__CONSTRAINT_CLOSE=ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=dist$1.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=dist$1.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=ANCHOR_ERROR__CONSTRAINT_STATE=dist$1.ANCHOR_ERROR__CONSTRAINT_STATE=ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=dist$1.ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=ANCHOR_ERROR__CONSTRAINT_SEEDS=dist$1.ANCHOR_ERROR__CONSTRAINT_SEEDS=ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=dist$1.ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=ANCHOR_ERROR__CONSTRAINT_OWNER=dist$1.ANCHOR_ERROR__CONSTRAINT_OWNER=ANCHOR_ERROR__CONSTRAINT_RAW=dist$1.ANCHOR_ERROR__CONSTRAINT_RAW=ANCHOR_ERROR__CONSTRAINT_SIGNER=dist$1.ANCHOR_ERROR__CONSTRAINT_SIGNER=ANCHOR_ERROR__CONSTRAINT_HAS_ONE=dist$1.ANCHOR_ERROR__CONSTRAINT_HAS_ONE=ANCHOR_ERROR__CONSTRAINT_MUT=dist$1.ANCHOR_ERROR__CONSTRAINT_MUT=ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=dist$1.ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=dist$1.ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=dist$1.ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=ANCHOR_ERROR__IDL_INSTRUCTION_STUB=dist$1.ANCHOR_ERROR__IDL_INSTRUCTION_STUB=ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=dist$1.ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=dist$1.ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=dist$1.ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=ANCHOR_ERROR__INSTRUCTION_MISSING=dist$1.ANCHOR_ERROR__INSTRUCTION_MISSING=void 0,ANCHOR_ERROR__DEPRECATED=dist$1.ANCHOR_ERROR__DEPRECATED=ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=dist$1.ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=dist$1.ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=dist$1.ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=dist$1.ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=dist$1.ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=dist$1.ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=dist$1.ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=ANCHOR_ERROR__INVALID_PROGRAM_ID=dist$1.ANCHOR_ERROR__INVALID_PROGRAM_ID=ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=dist$1.ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=dist$1.ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=dist$1.ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=dist$1.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=dist$1.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=dist$1.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=ANCHOR_ERROR__REQUIRE_GT_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_GT_VIOLATED=ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=void 0,ANCHOR_ERROR__INSTRUCTION_MISSING=dist$1.ANCHOR_ERROR__INSTRUCTION_MISSING=100,ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=dist$1.ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=101,ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=dist$1.ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=102,ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=dist$1.ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=103,ANCHOR_ERROR__IDL_INSTRUCTION_STUB=dist$1.ANCHOR_ERROR__IDL_INSTRUCTION_STUB=1e3,ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=dist$1.ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=1001,ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=dist$1.ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=1002,ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=dist$1.ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=1500,ANCHOR_ERROR__CONSTRAINT_MUT=dist$1.ANCHOR_ERROR__CONSTRAINT_MUT=2e3,ANCHOR_ERROR__CONSTRAINT_HAS_ONE=dist$1.ANCHOR_ERROR__CONSTRAINT_HAS_ONE=2001,ANCHOR_ERROR__CONSTRAINT_SIGNER=dist$1.ANCHOR_ERROR__CONSTRAINT_SIGNER=2002,ANCHOR_ERROR__CONSTRAINT_RAW=dist$1.ANCHOR_ERROR__CONSTRAINT_RAW=2003,ANCHOR_ERROR__CONSTRAINT_OWNER=dist$1.ANCHOR_ERROR__CONSTRAINT_OWNER=2004,ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=dist$1.ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=2005,ANCHOR_ERROR__CONSTRAINT_SEEDS=dist$1.ANCHOR_ERROR__CONSTRAINT_SEEDS=2006,ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=dist$1.ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=2007,ANCHOR_ERROR__CONSTRAINT_STATE=dist$1.ANCHOR_ERROR__CONSTRAINT_STATE=2008,ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=dist$1.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=2009,ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=dist$1.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=2010,ANCHOR_ERROR__CONSTRAINT_CLOSE=dist$1.ANCHOR_ERROR__CONSTRAINT_CLOSE=2011,ANCHOR_ERROR__CONSTRAINT_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_ADDRESS=2012,ANCHOR_ERROR__CONSTRAINT_ZERO=dist$1.ANCHOR_ERROR__CONSTRAINT_ZERO=2013,ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=dist$1.ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=2014,ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=dist$1.ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=2015,ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=2016,ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=2017,ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=2018,ANCHOR_ERROR__CONSTRAINT_SPACE=dist$1.ANCHOR_ERROR__CONSTRAINT_SPACE=2019,ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=dist$1.ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=2020,ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=dist$1.ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=2021,ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=2022,ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=dist$1.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=2023,ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=2024,ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=2025,ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=2026,ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=2027,ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=2028,ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=2029,ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=2030,ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=2031,ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=2032,ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=2033,ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=2034,ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=2035,ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=2036,ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=2037,ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=2038,ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=dist$1.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=2039,ANCHOR_ERROR__REQUIRE_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_VIOLATED=2500;ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=2501;var ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=2502,ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=2503,ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=2504,ANCHOR_ERROR__REQUIRE_GT_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_GT_VIOLATED=2505,ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=dist$1.ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=2506,ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=dist$1.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=3e3,ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=dist$1.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=3001,ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=dist$1.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=3002,ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=dist$1.ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=3003,ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=dist$1.ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=3004,ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=3005,ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=3006,ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=dist$1.ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=3007,ANCHOR_ERROR__INVALID_PROGRAM_ID=dist$1.ANCHOR_ERROR__INVALID_PROGRAM_ID=3008,ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=dist$1.ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=3009,ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=3010,ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=3011,ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=3012,ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=3013,ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=dist$1.ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=3014,ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=dist$1.ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=3015,ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=dist$1.ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=3016,ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=dist$1.ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=3017,ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=dist$1.ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=4100,ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=dist$1.ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=4101,ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=dist$1.ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=4102;ANCHOR_ERROR__DEPRECATED=dist$1.ANCHOR_ERROR__DEPRECATED=5e3;const _AVAILABLE_FEATURES=new Set(["debug-logs"]),_FEATURES=new Map;function set(o){if(!_AVAILABLE_FEATURES.has(o))throw new Error("Invalid feature");_FEATURES.set(o,!0)}function isSet(o){return _FEATURES.get(o)!==void 0}var features=Object.freeze({__proto__:null,set,isSet});class IdlError extends Error{constructor(e){super(e),this.name="IdlError"}}class ProgramErrorStack{constructor(e){this.stack=e}static parse(e){var a;const c=/^Program (\w*) invoke/,d=/^Program \w* success/,h=[];for(let j=0;jpt.startsWith("Program log: AnchorError"));if(a===-1)return null;const c=e[a],d=[c];let h;if(a+11)return null;d=et[0].match(/([0-9]+)/g)[0]}let h;try{h=parseInt(d)}catch{return null}let j=a.get(h);return j!==void 0?new ProgramError(h,j,e.logs):(j=LangErrorMessage.get(h),j!==void 0?new ProgramError(h,j,e.logs):null)}get program(){var e;return(e=this._programErrorStack)===null||e===void 0?void 0:e.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var e;return(e=this._programErrorStack)===null||e===void 0?void 0:e.stack}toString(){return this.msg}}function translateError(o,e){isSet("debug-logs")&&console.log("Translating error:",o);const a=AnchorError.parse(o.logs);if(a)return a;const c=ProgramError.parse(o,e);if(c)return c;if(o.logs){const d={get:function(h,j){return j==="programErrorStack"?h.programErrorStack.stack:j==="program"?h.programErrorStack.stack[o.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return o.programErrorStack=ProgramErrorStack.parse(o.logs),new Proxy(o,d)}return o}const LangErrorCode={InstructionMissing:ANCHOR_ERROR__INSTRUCTION_MISSING,InstructionFallbackNotFound:ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND,InstructionDidNotDeserialize:ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE,InstructionDidNotSerialize:ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE,IdlInstructionStub:ANCHOR_ERROR__IDL_INSTRUCTION_STUB,IdlInstructionInvalidProgram:ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM,IdlAccountNotEmpty:ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY,EventInstructionStub:ANCHOR_ERROR__EVENT_INSTRUCTION_STUB,ConstraintMut:ANCHOR_ERROR__CONSTRAINT_MUT,ConstraintHasOne:ANCHOR_ERROR__CONSTRAINT_HAS_ONE,ConstraintSigner:ANCHOR_ERROR__CONSTRAINT_SIGNER,ConstraintRaw:ANCHOR_ERROR__CONSTRAINT_RAW,ConstraintOwner:ANCHOR_ERROR__CONSTRAINT_OWNER,ConstraintRentExempt:ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT,ConstraintSeeds:ANCHOR_ERROR__CONSTRAINT_SEEDS,ConstraintExecutable:ANCHOR_ERROR__CONSTRAINT_EXECUTABLE,ConstraintState:ANCHOR_ERROR__CONSTRAINT_STATE,ConstraintAssociated:ANCHOR_ERROR__CONSTRAINT_ASSOCIATED,ConstraintAssociatedInit:ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT,ConstraintClose:ANCHOR_ERROR__CONSTRAINT_CLOSE,ConstraintAddress:ANCHOR_ERROR__CONSTRAINT_ADDRESS,ConstraintZero:ANCHOR_ERROR__CONSTRAINT_ZERO,ConstraintTokenMint:ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT,ConstraintTokenOwner:ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER,ConstraintMintMintAuthority:ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY,ConstraintMintFreezeAuthority:ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY,ConstraintMintDecimals:ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS,ConstraintSpace:ANCHOR_ERROR__CONSTRAINT_SPACE,ConstraintAccountIsNone:ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE,ConstraintTokenTokenProgram:ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM,ConstraintMintTokenProgram:ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM,ConstraintAssociatedTokenTokenProgram:ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM,ConstraintMintGroupPointerExtension:ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION,ConstraintMintGroupPointerExtensionAuthority:ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY,ConstraintMintGroupPointerExtensionGroupAddress:ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS,ConstraintMintGroupMemberPointerExtension:ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION,ConstraintMintGroupMemberPointerExtensionAuthority:ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY,ConstraintMintGroupMemberPointerExtensionMemberAddress:ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS,ConstraintMintMetadataPointerExtension:ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION,ConstraintMintMetadataPointerExtensionAuthority:ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY,ConstraintMintMetadataPointerExtensionMetadataAddress:ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS,ConstraintMintCloseAuthorityExtension:ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION,ConstraintMintCloseAuthorityExtensionAuthority:ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY,ConstraintMintPermanentDelegateExtension:ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION,ConstraintMintPermanentDelegateExtensionDelegate:ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE,ConstraintMintTransferHookExtension:ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION,ConstraintMintTransferHookExtensionAuthority:ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY,ConstraintMintTransferHookExtensionProgramId:ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID,RequireViolated:ANCHOR_ERROR__REQUIRE_VIOLATED,RequireEqViolated:ANCHOR_ERROR__REQUIRE_EQ_VIOLATED,RequireKeysEqViolated:ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED,RequireNeqViolated:ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED,RequireKeysNeqViolated:ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED,RequireGtViolated:ANCHOR_ERROR__REQUIRE_GT_VIOLATED,RequireGteViolated:ANCHOR_ERROR__REQUIRE_GTE_VIOLATED,AccountDiscriminatorAlreadySet:ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET,AccountDiscriminatorNotFound:ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND,AccountDiscriminatorMismatch:ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH,AccountDidNotDeserialize:ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE,AccountDidNotSerialize:ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE,AccountNotEnoughKeys:ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS,AccountNotMutable:ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE,AccountOwnedByWrongProgram:ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM,InvalidProgramId:ANCHOR_ERROR__INVALID_PROGRAM_ID,InvalidProgramExecutable:ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE,AccountNotSigner:ANCHOR_ERROR__ACCOUNT_NOT_SIGNER,AccountNotSystemOwned:ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED,AccountNotInitialized:ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED,AccountNotProgramData:ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA,AccountNotAssociatedTokenAccount:ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT,AccountSysvarMismatch:ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH,AccountReallocExceedsLimit:ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT,AccountDuplicateReallocs:ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS,DeclaredProgramIdMismatch:ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH,TryingToInitPayerAsProgramAccount:ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT,InvalidNumericConversion:ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION,Deprecated:ANCHOR_ERROR__DEPRECATED},LangErrorMessage=new Map([[LangErrorCode.InstructionMissing,"8 byte instruction identifier not provided"],[LangErrorCode.InstructionFallbackNotFound,"Fallback functions are not supported"],[LangErrorCode.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[LangErrorCode.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[LangErrorCode.IdlInstructionStub,"The program was compiled without idl instructions"],[LangErrorCode.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[LangErrorCode.IdlAccountNotEmpty,"IDL account must be empty in order to resize, try closing first"],[LangErrorCode.EventInstructionStub,"The program was compiled without `event-cpi` feature"],[LangErrorCode.ConstraintMut,"A mut constraint was violated"],[LangErrorCode.ConstraintHasOne,"A has one constraint was violated"],[LangErrorCode.ConstraintSigner,"A signer constraint was violated"],[LangErrorCode.ConstraintRaw,"A raw constraint was violated"],[LangErrorCode.ConstraintOwner,"An owner constraint was violated"],[LangErrorCode.ConstraintRentExempt,"A rent exemption constraint was violated"],[LangErrorCode.ConstraintSeeds,"A seeds constraint was violated"],[LangErrorCode.ConstraintExecutable,"An executable constraint was violated"],[LangErrorCode.ConstraintState,"Deprecated Error, feel free to replace with something else"],[LangErrorCode.ConstraintAssociated,"An associated constraint was violated"],[LangErrorCode.ConstraintAssociatedInit,"An associated init constraint was violated"],[LangErrorCode.ConstraintClose,"A close constraint was violated"],[LangErrorCode.ConstraintAddress,"An address constraint was violated"],[LangErrorCode.ConstraintZero,"Expected zero account discriminant"],[LangErrorCode.ConstraintTokenMint,"A token mint constraint was violated"],[LangErrorCode.ConstraintTokenOwner,"A token owner constraint was violated"],[LangErrorCode.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[LangErrorCode.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[LangErrorCode.ConstraintMintDecimals,"A mint decimals constraint was violated"],[LangErrorCode.ConstraintSpace,"A space constraint was violated"],[LangErrorCode.ConstraintAccountIsNone,"A required account for the constraint is None"],[LangErrorCode.ConstraintTokenTokenProgram,"A token account token program constraint was violated"],[LangErrorCode.ConstraintMintTokenProgram,"A mint token program constraint was violated"],[LangErrorCode.ConstraintAssociatedTokenTokenProgram,"An associated token account token program constraint was violated"],[LangErrorCode.ConstraintMintGroupPointerExtension,"A group pointer extension constraint was violated"],[LangErrorCode.ConstraintMintGroupPointerExtensionAuthority,"A group pointer extension authority constraint was violated"],[LangErrorCode.ConstraintMintGroupPointerExtensionGroupAddress,"A group pointer extension group address constraint was violated"],[LangErrorCode.ConstraintMintGroupMemberPointerExtension,"A group member pointer extension constraint was violated"],[LangErrorCode.ConstraintMintGroupMemberPointerExtensionAuthority,"A group member pointer extension authority constraint was violated"],[LangErrorCode.ConstraintMintGroupMemberPointerExtensionMemberAddress,"A group member pointer extension group address constraint was violated"],[LangErrorCode.ConstraintMintMetadataPointerExtension,"A metadata pointer extension constraint was violated"],[LangErrorCode.ConstraintMintMetadataPointerExtensionAuthority,"A metadata pointer extension authority constraint was violated"],[LangErrorCode.ConstraintMintMetadataPointerExtensionMetadataAddress,"A metadata pointer extension metadata address constraint was violated"],[LangErrorCode.ConstraintMintCloseAuthorityExtension,"A close authority constraint was violated"],[LangErrorCode.ConstraintMintCloseAuthorityExtensionAuthority,"A close authority extension authority constraint was violated"],[LangErrorCode.ConstraintMintPermanentDelegateExtension,"A permanent delegate extension constraint was violated"],[LangErrorCode.ConstraintMintPermanentDelegateExtensionDelegate,"A permanent delegate extension delegate constraint was violated"],[LangErrorCode.ConstraintMintTransferHookExtension,"A transfer hook extension constraint was violated"],[LangErrorCode.ConstraintMintTransferHookExtensionAuthority,"A transfer hook extension authority constraint was violated"],[LangErrorCode.ConstraintMintTransferHookExtensionProgramId,"A transfer hook extension transfer hook program id constraint was violated"],[LangErrorCode.RequireViolated,"A require expression was violated"],[LangErrorCode.RequireEqViolated,"A require_eq expression was violated"],[LangErrorCode.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[LangErrorCode.RequireNeqViolated,"A require_neq expression was violated"],[LangErrorCode.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[LangErrorCode.RequireGtViolated,"A require_gt expression was violated"],[LangErrorCode.RequireGteViolated,"A require_gte expression was violated"],[LangErrorCode.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[LangErrorCode.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[LangErrorCode.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[LangErrorCode.AccountDidNotDeserialize,"Failed to deserialize the account"],[LangErrorCode.AccountDidNotSerialize,"Failed to serialize the account"],[LangErrorCode.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[LangErrorCode.AccountNotMutable,"The given account is not mutable"],[LangErrorCode.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[LangErrorCode.InvalidProgramId,"Program ID was not as expected"],[LangErrorCode.InvalidProgramExecutable,"Program account is not executable"],[LangErrorCode.AccountNotSigner,"The given account did not sign"],[LangErrorCode.AccountNotSystemOwned,"The given account is not owned by the system program"],[LangErrorCode.AccountNotInitialized,"The program expected this account to be already initialized"],[LangErrorCode.AccountNotProgramData,"The given account is not a program data account"],[LangErrorCode.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[LangErrorCode.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[LangErrorCode.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[LangErrorCode.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[LangErrorCode.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[LangErrorCode.TryingToInitPayerAsProgramAccount,"You cannot/should not initialize the payer account as a program account"],[LangErrorCode.InvalidNumericConversion,"The program could not perform the numeric conversion, out of range integral type conversion attempted"],[LangErrorCode.Deprecated,"The API being used is deprecated and should no longer be used"]]);class IdlCoder{static fieldLayout(e,a=[],c){const d=e.name;switch(e.type){case"bool":return dist$2.bool(d);case"u8":return dist$2.u8(d);case"i8":return dist$2.i8(d);case"u16":return dist$2.u16(d);case"i16":return dist$2.i16(d);case"u32":return dist$2.u32(d);case"i32":return dist$2.i32(d);case"f32":return dist$2.f32(d);case"u64":return dist$2.u64(d);case"i64":return dist$2.i64(d);case"f64":return dist$2.f64(d);case"u128":return dist$2.u128(d);case"i128":return dist$2.i128(d);case"u256":return dist$2.u256(d);case"i256":return dist$2.i256(d);case"bytes":return dist$2.vecU8(d);case"string":return dist$2.str(d);case"pubkey":return dist$2.publicKey(d);default:{if("option"in e.type)return dist$2.option(IdlCoder.fieldLayout({type:e.type.option},a,c),d);if("vec"in e.type)return dist$2.vec(IdlCoder.fieldLayout({type:e.type.vec},a,c),d);if("array"in e.type){let[h,j]=e.type.array;return j=IdlCoder.resolveArrayLen(j,c),dist$2.array(IdlCoder.fieldLayout({type:h},a,c),j,d)}if("defined"in e.type){if(!a)throw new IdlError("User defined types not provided");const h=e.type.defined.name,j=a.find(et=>et.name===h);if(!j)throw new IdlError(`Type not found: ${e.name}`);return IdlCoder.typeDefLayout({typeDef:j,types:a,genericArgs:c??e.type.defined.generics,name:d})}if("generic"in e.type){const h=c==null?void 0:c.at(0);if((h==null?void 0:h.kind)!=="type")throw new IdlError(`Invalid generic field: ${e.name}`);return IdlCoder.fieldLayout({...e,type:h.type},a)}throw new IdlError(`Not yet implemented: ${JSON.stringify(e.type)}`)}}}static typeDefLayout({typeDef:e,types:a,name:c,genericArgs:d}){switch(e.type.kind){case"struct":{const h=handleDefinedFields(e.type.fields,()=>[],j=>j.map(et=>{const nt=d&&IdlCoder.resolveGenericArgs({type:et.type,typeDef:e,genericArgs:d});return IdlCoder.fieldLayout(et,a,nt)}),j=>j.map((et,nt)=>{const st=d&&IdlCoder.resolveGenericArgs({type:et,typeDef:e,genericArgs:d});return IdlCoder.fieldLayout({name:nt.toString(),type:et},a,st)}));return dist$2.struct(h,c)}case"enum":{const h=e.type.variants.map(j=>{const et=handleDefinedFields(j.fields,()=>[],nt=>nt.map(st=>{const ot=d&&IdlCoder.resolveGenericArgs({type:st.type,typeDef:e,genericArgs:d});return IdlCoder.fieldLayout(st,a,ot)}),nt=>nt.map((st,ot)=>{const ht=d&&IdlCoder.resolveGenericArgs({type:st,typeDef:e,genericArgs:d});return IdlCoder.fieldLayout({name:ot.toString(),type:st},a,ht)}));return dist$2.struct(et,j.name)});return c!==void 0?dist$2.rustEnum(h).replicate(c):dist$2.rustEnum(h,c)}case"type":return IdlCoder.fieldLayout({type:e.type.alias,name:c},a)}}static typeSize(e,a,c){var d;switch(e){case"bool":return 1;case"u8":return 1;case"i8":return 1;case"i16":return 2;case"u16":return 2;case"u32":return 4;case"i32":return 4;case"f32":return 4;case"u64":return 8;case"i64":return 8;case"f64":return 8;case"u128":return 16;case"i128":return 16;case"u256":return 32;case"i256":return 32;case"bytes":return 1;case"string":return 1;case"pubkey":return 32;default:if("option"in e)return 1+IdlCoder.typeSize(e.option,a,c);if("coption"in e)return 4+IdlCoder.typeSize(e.coption,a,c);if("vec"in e)return 1;if("array"in e){let[h,j]=e.array;return j=IdlCoder.resolveArrayLen(j,c),IdlCoder.typeSize(h,a,c)*j}if("defined"in e){const h=(d=a.types)===null||d===void 0?void 0:d.find(et=>et.name===e.defined.name);if(!h)throw new IdlError(`Type not found: ${JSON.stringify(e)}`);const j=et=>{const nt=c??e.defined.generics,st=nt&&IdlCoder.resolveGenericArgs({type:et,typeDef:h,genericArgs:nt});return IdlCoder.typeSize(et,a,st)};switch(h.type.kind){case"struct":return handleDefinedFields(h.type.fields,()=>[0],et=>et.map(nt=>j(nt.type)),et=>et.map(nt=>j(nt))).reduce((et,nt)=>et+nt,0);case"enum":{const et=h.type.variants.map(nt=>handleDefinedFields(nt.fields,()=>[0],st=>st.map(ot=>j(ot.type)),st=>st.map(ot=>j(ot))).reduce((st,ot)=>st+ot,0));return Math.max(...et)+1}case"type":return IdlCoder.typeSize(h.type.alias,a,c)}}if("generic"in e){const h=c==null?void 0:c.at(0);if((h==null?void 0:h.kind)!=="type")throw new IdlError(`Invalid generic: ${e.generic}`);return IdlCoder.typeSize(h.type,a,c)}throw new Error(`Invalid type ${JSON.stringify(e)}`)}}static resolveArrayLen(e,a){if(typeof e=="number")return e;if(a){const c=a.find(d=>d.kind==="const");(c==null?void 0:c.kind)==="const"&&(e=+c.value)}if(typeof e!="number")throw new IdlError("Generic array length did not resolve");return e}static resolveGenericArgs({type:e,typeDef:a,genericArgs:c,isDefined:d}){if(typeof e!="object")return null;for(const h in a.generics){const j=a.generics[h];if("generic"in e&&j.name===e.generic)return[c[h]];if("option"in e){const et=IdlCoder.resolveGenericArgs({type:e.option,typeDef:a,genericArgs:c,isDefined:d});if(!et||!d)return et;if(et[0].kind==="type")return[{kind:"type",type:{option:et[0].type}}]}if("vec"in e){const et=IdlCoder.resolveGenericArgs({type:e.vec,typeDef:a,genericArgs:c,isDefined:d});if(!et||!d)return et;if(et[0].kind==="type")return[{kind:"type",type:{vec:et[0].type}}]}if("array"in e){const[et,nt]=e.array,st=typeof nt=="object",ot=IdlCoder.resolveGenericArgs({type:et,typeDef:a,genericArgs:c,isDefined:d});if(ot){for(const ht in a.generics.slice(+h)){const pt=+h+ +ht;st&&a.generics[pt].name===nt.generic&&ot.push(c[pt])}if(!d)return ot;if(ot[0].kind==="type"&&ot[1].kind==="const")return[{kind:"type",type:{array:[ot[0].type,+ot[1].value]}}]}if(st&&j.name===nt.generic){const ht=c[h];return d?[{kind:"type",type:{array:[et,+ht.value]}}]:[ht]}return null}if("defined"in e)return e.defined.generics?e.defined.generics.flatMap(et=>{switch(et.kind){case"type":return IdlCoder.resolveGenericArgs({type:et.type,typeDef:a,genericArgs:c,isDefined:!0});case"const":return[et]}}).filter(et=>et!==null):null}return null}}class BorshInstructionCoder{constructor(e){this.idl=e;const a=e.instructions.map(d=>{const h=d.name,j=d.args.map(nt=>IdlCoder.fieldLayout(nt,e.types)),et=dist$2.struct(j,h);return[h,{discriminator:d.discriminator,layout:et}]});this.ixLayouts=new Map(a);const c=a.map(([d,{discriminator:h,layout:j}])=>[bs58$4.encode(h),{name:d,layout:j}]);this.sighashLayouts=new Map(c)}encode(e,a){const c=Buffer$1$1.alloc(1e3),d=this.ixLayouts.get(e);if(!d)throw new Error(`Unknown method: ${e}`);const h=d.layout.encode(a,c),j=c.slice(0,h);return Buffer$1$1.concat([Buffer$1$1.from(d.discriminator),j])}decode(e,a="hex"){typeof e=="string"&&(e=a==="hex"?Buffer$1$1.from(e,"hex"):bs58$4.decode(e));const c=e.slice(0,DISCRIMINATOR_SIZE),d=e.slice(DISCRIMINATOR_SIZE),h=this.sighashLayouts.get(bs58$4.encode(c));return h?{name:h.name,data:h.layout.decode(d)}:null}format(e,a){return InstructionFormatter.format(e,a,this.idl)}}class InstructionFormatter{static format(e,a,c){const d=c.instructions.find(nt=>e.name===nt.name);if(!d)return console.error("Invalid instruction given"),null;const h=d.args.map(nt=>({name:nt.name,type:InstructionFormatter.formatIdlType(nt.type),data:InstructionFormatter.formatIdlData(nt,e.data[nt.name],c.types)})),j=InstructionFormatter.flattenIdlAccounts(d.accounts),et=a.map((nt,st)=>st`;if("coption"in e)return`COption<${this.formatIdlType(e.coption)}>`;if("vec"in e)return`Vec<${this.formatIdlType(e.vec)}>`;if("array"in e)return`Array<${e.array[0]}; ${e.array[1]}>`;if("defined"in e){const a=e.defined.name;if(e.defined.generics){const c=e.defined.generics.map(d=>{switch(d.kind){case"type":return InstructionFormatter.formatIdlType(d.type);case"const":return d.value}}).join(", ");return`${a}<${c}>`}return a}throw new Error(`Unknown IDL type: ${e}`)}static formatIdlData(e,a,c){if(typeof e.type=="string")return a.toString();if("vec"in e.type)return"["+a.map(d=>this.formatIdlData({name:"",type:e.type.vec},d,c)).join(", ")+"]";if("option"in e.type)return a===null?"null":this.formatIdlData({name:"",type:e.type.option},a,c);if("defined"in e.type){if(!c)throw new Error("User defined types not provided");const d=e.type.defined.name,h=c.find(j=>j.name===d);if(!h)throw new Error(`Type not found: ${d}`);return InstructionFormatter.formatIdlDataDefined(h,a,c)}return"unknown"}static formatIdlDataDefined(e,a,c){switch(e.type.kind){case"struct":return"{ "+handleDefinedFields(e.type.fields,()=>"",d=>Object.entries(a).map(([h,j])=>{const et=d.find(nt=>nt.name===h);if(!et)throw new Error(`Field not found: ${h}`);return h+": "+InstructionFormatter.formatIdlData(et,j,c)}).join(", "),d=>Object.entries(a).map(([h,j])=>h+": "+InstructionFormatter.formatIdlData({name:"",type:d[h]},j,c)).join(", "))+" }";case"enum":{const d=Object.keys(a)[0],h=e.type.variants.find(et=>et.name===d);if(!h)throw new Error(`Unable to find variant: ${d}`);const j=a[d];return handleDefinedFields(h.fields,()=>d,et=>{const nt=Object.keys(j).map(st=>{const ot=j[st],ht=et.find(pt=>pt.name===st);if(!ht)throw new Error(`Field not found: ${st}`);return st+": "+InstructionFormatter.formatIdlData(ht,ot,c)}).join(", ");return`${d} { ${nt} }`},et=>{const nt=Object.entries(j).map(([st,ot])=>st+": "+InstructionFormatter.formatIdlData({name:"",type:et[st]},ot,c)).join(", ");return`${d} { ${nt} }`})}case"type":return InstructionFormatter.formatIdlType(e.type.alias)}}static flattenIdlAccounts(e,a){return e.map(c=>{const d=sentenceCase(c.name);if(c.hasOwnProperty("accounts")){const h=a?`${a} > ${d}`:d;return InstructionFormatter.flattenIdlAccounts(c.accounts,h)}else return{...c,name:a?`${a} > ${d}`:d}}).flat()}}function sentenceCase(o){const e=o.replace(/([A-Z])/g," $1");return e.charAt(0).toUpperCase()+e.slice(1)}const DISCRIMINATOR_SIZE=8;class BorshAccountsCoder{constructor(e){if(this.idl=e,!e.accounts){this.accountLayouts=new Map;return}const a=e.types;if(!a)throw new Error("Accounts require `idl.types`");const c=e.accounts.map(d=>{const h=a.find(j=>j.name===d.name);if(!h)throw new Error(`Account not found: ${d.name}`);return[d.name,IdlCoder.typeDefLayout({typeDef:h,types:a})]});this.accountLayouts=new Map(c)}async encode(e,a){const c=Buffer$1$1.alloc(1e3),d=this.accountLayouts.get(e);if(!d)throw new Error(`Unknown account: ${e}`);const h=d.encode(a,c),j=c.slice(0,h),et=this.accountDiscriminator(e);return Buffer$1$1.concat([et,j])}decode(e,a){if(this.accountDiscriminator(e).compare(a.slice(0,DISCRIMINATOR_SIZE)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(e,a)}decodeAny(e){const a=e.slice(0,DISCRIMINATOR_SIZE),c=Array.from(this.accountLayouts.keys()).find(d=>this.accountDiscriminator(d).equals(a));if(!c)throw new Error("Account not found");return this.decodeUnchecked(c,e)}decodeUnchecked(e,a){const c=a.subarray(DISCRIMINATOR_SIZE),d=this.accountLayouts.get(e);if(!d)throw new Error(`Unknown account: ${e}`);return d.decode(c)}memcmp(e,a){const c=this.accountDiscriminator(e);return{offset:0,bytes:bs58$4.encode(a?Buffer$1$1.concat([c,a]):c)}}size(e){return DISCRIMINATOR_SIZE+IdlCoder.typeSize({defined:{name:e}},this.idl)}accountDiscriminator(e){var a;const c=(a=this.idl.accounts)===null||a===void 0?void 0:a.find(d=>d.name===e);if(!c)throw new Error(`Account not found: ${e}`);return Buffer$1$1.from(c.discriminator)}}class BorshEventCoder{constructor(e){var a;if(!e.events){this.layouts=new Map;return}const c=e.types;if(!c)throw new Error("Events require `idl.types`");const d=e.events.map(h=>{const j=c.find(et=>et.name===h.name);if(!j)throw new Error(`Event not found: ${h.name}`);return[h.name,IdlCoder.typeDefLayout({typeDef:j,types:c})]});this.layouts=new Map(d),this.discriminators=new Map(((a=e.events)!==null&&a!==void 0?a:[]).map(h=>[encode(Buffer$1$1.from(h.discriminator)),h.name]))}decode(e){let a;try{a=decode(e)}catch{return null}const c=encode(a.slice(0,8)),d=this.discriminators.get(c);if(!d)return null;const h=this.layouts.get(d);if(!h)throw new Error(`Unknown event: ${d}`);return{data:h.decode(a.slice(8)),name:d}}}class BorshTypesCoder{constructor(e){const a=e.types;if(!a){this.typeLayouts=new Map;return}const c=a.filter(d=>!d.generics).map(d=>[d.name,IdlCoder.typeDefLayout({typeDef:d,types:a})]);this.typeLayouts=new Map(c)}encode(e,a){const c=Buffer$1$1.alloc(1e3),d=this.typeLayouts.get(e);if(!d)throw new Error(`Unknown type: ${e}`);const h=d.encode(a,c);return c.slice(0,h)}decode(e,a){const c=this.typeLayouts.get(e);if(!c)throw new Error(`Unknown type: ${e}`);return c.decode(a)}}class BorshCoder{constructor(e){this.instruction=new BorshInstructionCoder(e),this.accounts=new BorshAccountsCoder(e),this.events=new BorshEventCoder(e),this.types=new BorshTypesCoder(e)}}let Layout$1=class{constructor(e,a){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=a}makeDestinationObject(){return{}}decode(e,a){throw new Error("Layout is abstract")}encode(e,a,c){throw new Error("Layout is abstract")}getSpan(e,a){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const a=Object.create(this.constructor.prototype);return Object.assign(a,this),a.property=e,a}fromArray(e){}};var Layout_2$1=Layout$1;function nameWithProperty$1(o,e){return e.property?o+"["+e.property+"]":o}let ExternalLayout$1=class extends Layout$1{isCount(){throw new Error("ExternalLayout is abstract")}},OffsetLayout$1=class extends ExternalLayout$1{constructor(e,a,c){if(!(e instanceof Layout$1))throw new TypeError("layout must be a Layout");if(a===void 0)a=0;else if(!Number.isInteger(a))throw new TypeError("offset must be integer or undefined");super(e.span,c||e.property),this.layout=e,this.offset=a}isCount(){return this.layout instanceof UInt$1||this.layout instanceof UIntBE$1}decode(e,a){return a===void 0&&(a=0),this.layout.decode(e,a+this.offset)}encode(e,a,c){return c===void 0&&(c=0),this.layout.encode(e,a,c+this.offset)}},UInt$1=class extends Layout$1{constructor(e,a){if(super(e,a),6h&&j instanceof Layout$1,!0)))throw new TypeError("fields must be array of Layout instances");typeof a=="boolean"&&c===void 0&&(c=a,a=void 0);for(const h of e)if(0>h.span&&h.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let d=-1;try{d=e.reduce((h,j)=>h+j.getSpan(),0)}catch{}super(d,a),this.fields=e,this.decodePrefixes=!!c}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let c=0;try{c=this.fields.reduce((d,h)=>{const j=h.getSpan(e,a);return a+=j,d+j},0)}catch{throw new RangeError("indeterminate span")}return c}decode(e,a){a===void 0&&(a=0);const c=this.makeDestinationObject();for(const d of this.fields)if(d.property!==void 0&&(c[d.property]=d.decode(e,a)),a+=d.getSpan(e,a),this.decodePrefixes&&e.length===a)break;return c}encode(e,a,c){c===void 0&&(c=0);const d=c;let h=0,j=0;for(const et of this.fields){let nt=et.span;if(j=0nt&&(nt=et.getSpan(a,c)))}h=c,c+=nt}return h+j-d}fromArray(e){const a=this.makeDestinationObject();for(const c of this.fields)c.property!==void 0&&0c.span?a=-1:0<=a&&(a+=c.span)}}},UnionDiscriminator$1=class{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}},UnionLayoutDiscriminator$1=class extends UnionDiscriminator$1{constructor(e,a){if(!(e instanceof ExternalLayout$1&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(a||e.property||"variant"),this.layout=e}decode(e,a){return this.layout.decode(e,a)}encode(e,a,c){return this.layout.encode(e,a,c)}},Union$1=class extends Layout$1{constructor(e,a,c){const d=e instanceof UInt$1||e instanceof UIntBE$1;if(d)e=new UnionLayoutDiscriminator$1(new OffsetLayout$1(e));else if(e instanceof ExternalLayout$1&&e.isCount())e=new UnionLayoutDiscriminator$1(e);else if(!(e instanceof UnionDiscriminator$1))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(a===void 0&&(a=null),!(a===null||a instanceof Layout$1))throw new TypeError("defaultLayout must be null or a Layout");if(a!==null){if(0>a.span)throw new Error("defaultLayout must have constant span");a.property===void 0&&(a=a.replicate("content"))}let h=-1;a&&(h=a.span,0<=h&&d&&(h+=e.layout.span)),super(h,c),this.discriminator=e,this.usesPrefixDiscriminator=d,this.defaultLayout=a,this.registry={};let j=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(et){return j(et)},this.configGetSourceVariant=function(et){j=et.bind(this)}}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);const c=this.getVariant(e,a);if(!c)throw new Error("unable to determine span for unrecognized variant");return c.getSpan(e,a)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const a=this.registry[e[this.discriminator.property]];if(a&&(!a.layout||e.hasOwnProperty(a.property)))return a}else for(const a in this.registry){const c=this.registry[a];if(e.hasOwnProperty(c.property))return c}throw new Error("unable to infer src variant")}decode(e,a){a===void 0&&(a=0);let c;const d=this.discriminator,h=d.decode(e,a);let j=this.registry[h];if(j===void 0){let et=0;j=this.defaultLayout,this.usesPrefixDiscriminator&&(et=d.layout.span),c=this.makeDestinationObject(),c[d.property]=h,c[j.property]=this.defaultLayout.decode(e,a+et)}else c=j.decode(e,a);return c}encode(e,a,c){c===void 0&&(c=0);const d=this.getSourceVariant(e);if(d===void 0){const h=this.discriminator,j=this.defaultLayout;let et=0;return this.usesPrefixDiscriminator&&(et=h.layout.span),h.encode(e[h.property],a,c),et+j.encode(e[j.property],a,c+et)}return d.encode(e,a,c)}addVariant(e,a,c){const d=new VariantLayout$1(this,e,a,c);return this.registry[e]=d,d}getVariant(e,a){let c=e;return Buffer$1$1.isBuffer(e)&&(a===void 0&&(a=0),c=this.discriminator.decode(e,a)),this.registry[c]}},VariantLayout$1=class extends Layout$1{constructor(e,a,c,d){if(!(e instanceof Union$1))throw new TypeError("union must be a Union");if(!Number.isInteger(a)||0>a)throw new TypeError("variant must be a (non-negative) integer");if(typeof c=="string"&&d===void 0&&(d=c,c=null),c){if(!(c instanceof Layout$1))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=c.span&&c.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof d!="string")throw new TypeError("variant must have a String property")}let h=e.span;0>e.span&&(h=c?c.span:0,0<=h&&e.usesPrefixDiscriminator&&(h+=e.discriminator.layout.span)),super(h,d),this.union=e,this.variant=a,this.layout=c||null}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let c=0;return this.union.usesPrefixDiscriminator&&(c=this.union.discriminator.layout.span),c+this.layout.getSpan(e,a+c)}decode(e,a){const c=this.makeDestinationObject();if(a===void 0&&(a=0),this!==this.union.getVariant(e,a))throw new Error("variant mismatch");let d=0;return this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout?c[this.property]=this.layout.decode(e,a+d):this.property?c[this.property]=!0:this.union.usesPrefixDiscriminator&&(c[this.union.discriminator.property]=this.variant),c}encode(e,a,c){c===void 0&&(c=0);let d=0;if(this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,a,c);let h=d;if(this.layout&&(this.layout.encode(e[this.property],a,c+d),h+=this.layout.getSpan(a,c+d),0<=this.union.span&&h>this.union.span))throw new Error("encoded variant overruns containing union");return h}fromArray(e){if(this.layout)return this.layout.fromArray(e)}},Blob$1$1=class extends Layout$1{constructor(e,a){if(!(e instanceof ExternalLayout$1&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let c=-1;e instanceof ExternalLayout$1||(c=e),super(c,a),this.length=e}getSpan(e,a){let c=this.span;return 0>c&&(c=this.length.decode(e,a)),c}decode(e,a){a===void 0&&(a=0);let c=this.span;return 0>c&&(c=this.length.decode(e,a)),e.slice(a,a+c)}encode(e,a,c){let d=this.length;if(this.length instanceof ExternalLayout$1&&(d=e.length),!(Buffer$1$1.isBuffer(e)&&d===e.length))throw new TypeError(nameWithProperty$1("Blob.encode",this)+" requires (length "+d+") Buffer as src");if(c+d>a.length)throw new RangeError("encoding overruns Buffer");return a.write(e.toString("hex"),c,d,"hex"),this.length instanceof ExternalLayout$1&&this.length.encode(d,a,c),d}};var offset$1=(o,e,a)=>new OffsetLayout$1(o,e,a),u8$1=o=>new UInt$1(1,o),u32$1=o=>new UInt$1(4,o),nu64$1=o=>new NearUInt64$1(o),ns64$1=o=>new NearInt64$1(o),struct$1=(o,e,a)=>new Structure$1(o,e,a),union$2=(o,e,a)=>new Union$1(o,e,a),blob$1=(o,e)=>new Blob$1$1(o,e);let RustStringLayout$1=class extends Layout_2$1{constructor(e){super(-1,e),this.property=e,this.layout=struct$1([u32$1("length"),u32$1("lengthPadding"),blob$1(offset$1(u32$1(),-8),"chars")],this.property)}encode(e,a,c=0){if(e==null)return this.layout.span;const d={chars:Buffer$1$1.from(e,"utf8")};return this.layout.encode(d,a,c)}decode(e,a=0){return this.layout.decode(e,a).chars.toString()}getSpan(e,a=0){return u32$1().span+u32$1().span+new BN$b(new Uint8Array(e).slice(a,a+4),10,"le").toNumber()}};function rustStringLayout$1(o){return new RustStringLayout$1(o)}function publicKey$2$1(o){return blob$1(32,o)}const LAYOUT$1=union$2(u32$1("instruction"));LAYOUT$1.addVariant(0,struct$1([ns64$1("lamports"),ns64$1("space"),publicKey$2$1("owner")]),"createAccount");LAYOUT$1.addVariant(1,struct$1([publicKey$2$1("owner")]),"assign");LAYOUT$1.addVariant(2,struct$1([ns64$1("lamports")]),"transfer");LAYOUT$1.addVariant(3,struct$1([publicKey$2$1("base"),rustStringLayout$1("seed"),ns64$1("lamports"),ns64$1("space"),publicKey$2$1("owner")]),"createAccountWithSeed");LAYOUT$1.addVariant(4,struct$1([publicKey$2$1("authorized")]),"advanceNonceAccount");LAYOUT$1.addVariant(5,struct$1([ns64$1("lamports")]),"withdrawNonceAccount");LAYOUT$1.addVariant(6,struct$1([publicKey$2$1("authorized")]),"initializeNonceAccount");LAYOUT$1.addVariant(7,struct$1([publicKey$2$1("authorized")]),"authorizeNonceAccount");LAYOUT$1.addVariant(8,struct$1([ns64$1("space")]),"allocate");LAYOUT$1.addVariant(9,struct$1([publicKey$2$1("base"),rustStringLayout$1("seed"),ns64$1("space"),publicKey$2$1("owner")]),"allocateWithSeed");LAYOUT$1.addVariant(10,struct$1([publicKey$2$1("base"),rustStringLayout$1("seed"),publicKey$2$1("owner")]),"assignWithSeed");LAYOUT$1.addVariant(11,struct$1([ns64$1("lamports"),rustStringLayout$1("seed"),publicKey$2$1("owner")]),"transferWithSeed");Math.max(...Object.values(LAYOUT$1.registry).map(o=>o.span));let WrappedLayout$1$1=class extends Layout_2$1{constructor(e,a,c,d){super(e.span,d),this.layout=e,this.decoder=a,this.encoder=c}decode(e,a){return this.decoder(this.layout.decode(e,a))}encode(e,a,c){return this.layout.encode(this.encoder(e),a,c)}getSpan(e,a){return this.layout.getSpan(e,a)}};function publicKey$1$1(o){return new WrappedLayout$1$1(blob$1(32),e=>new PublicKey$1(e),e=>e.toBuffer(),o)}struct$1([u32$1("version"),u32$1("state"),publicKey$1$1("authorizedPubkey"),publicKey$1$1("nonce"),struct$1([nu64$1("lamportsPerSignature")],"feeCalculator")]);function hash$4(o){return new TextDecoder().decode(sha256$4(o))}var sha256$3=Object.freeze({__proto__:null,hash:hash$4});function createWithSeedSync(o,e,a){const c=Buffer$1$1.concat([o.toBuffer(),Buffer$1$1.from(e),a.toBuffer()]);return new PublicKey$1(sha256$4(c))}var pubkey=Object.freeze({__proto__:null,createWithSeedSync});const TOKEN_PROGRAM_ID$2=new PublicKey$1("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),ASSOCIATED_PROGRAM_ID$1=new PublicKey$1("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function associatedAddress({mint:o,owner:e}){return PublicKey$1.findProgramAddressSync([e.toBuffer(),TOKEN_PROGRAM_ID$2.toBuffer(),o.toBuffer()],ASSOCIATED_PROGRAM_ID$1)[0]}var token=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:TOKEN_PROGRAM_ID$2,ASSOCIATED_PROGRAM_ID:ASSOCIATED_PROGRAM_ID$1,associatedAddress}),browserPonyfill$1={exports:{}};(function(o,e){var a=typeof self<"u"?self:commonjsGlobal$1,c=function(){function h(){this.fetch=!1,this.DOMException=a.DOMException}return h.prototype=a,new h}();(function(h){(function(j){var et={searchParams:"URLSearchParams"in h,iterable:"Symbol"in h&&"iterator"in Symbol,blob:"FileReader"in h&&"Blob"in h&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in h,arrayBuffer:"ArrayBuffer"in h};function nt($){return $&&DataView.prototype.isPrototypeOf($)}if(et.arrayBuffer)var st=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ot=ArrayBuffer.isView||function($){return $&&st.indexOf(Object.prototype.toString.call($))>-1};function ht($){if(typeof $!="string"&&($=String($)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test($))throw new TypeError("Invalid character in header field name");return $.toLowerCase()}function pt($){return typeof $!="string"&&($=String($)),$}function dt($){var _e={next:function(){var rt=$.shift();return{done:rt===void 0,value:rt}}};return et.iterable&&(_e[Symbol.iterator]=function(){return _e}),_e}function gt($){this.map={},$ instanceof gt?$.forEach(function(_e,rt){this.append(rt,_e)},this):Array.isArray($)?$.forEach(function(_e){this.append(_e[0],_e[1])},this):$&&Object.getOwnPropertyNames($).forEach(function(_e){this.append(_e,$[_e])},this)}gt.prototype.append=function($,_e){$=ht($),_e=pt(_e);var rt=this.map[$];this.map[$]=rt?rt+", "+_e:_e},gt.prototype.delete=function($){delete this.map[ht($)]},gt.prototype.get=function($){return $=ht($),this.has($)?this.map[$]:null},gt.prototype.has=function($){return this.map.hasOwnProperty(ht($))},gt.prototype.set=function($,_e){this.map[ht($)]=pt(_e)},gt.prototype.forEach=function($,_e){for(var rt in this.map)this.map.hasOwnProperty(rt)&&$.call(_e,this.map[rt],rt,this)},gt.prototype.keys=function(){var $=[];return this.forEach(function(_e,rt){$.push(rt)}),dt($)},gt.prototype.values=function(){var $=[];return this.forEach(function(_e){$.push(_e)}),dt($)},gt.prototype.entries=function(){var $=[];return this.forEach(function(_e,rt){$.push([rt,_e])}),dt($)},et.iterable&&(gt.prototype[Symbol.iterator]=gt.prototype.entries);function wt($){if($.bodyUsed)return Promise.reject(new TypeError("Already read"));$.bodyUsed=!0}function St($){return new Promise(function(_e,rt){$.onload=function(){_e($.result)},$.onerror=function(){rt($.error)}})}function _t($){var _e=new FileReader,rt=St(_e);return _e.readAsArrayBuffer($),rt}function mt($){var _e=new FileReader,rt=St(_e);return _e.readAsText($),rt}function bt($){for(var _e=new Uint8Array($),rt=new Array(_e.length),at=0;at<_e.length;at++)rt[at]=String.fromCharCode(_e[at]);return rt.join("")}function $t($){if($.slice)return $.slice(0);var _e=new Uint8Array($.byteLength);return _e.set(new Uint8Array($)),_e.buffer}function Bt(){return this.bodyUsed=!1,this._initBody=function($){this._bodyInit=$,$?typeof $=="string"?this._bodyText=$:et.blob&&Blob.prototype.isPrototypeOf($)?this._bodyBlob=$:et.formData&&FormData.prototype.isPrototypeOf($)?this._bodyFormData=$:et.searchParams&&URLSearchParams.prototype.isPrototypeOf($)?this._bodyText=$.toString():et.arrayBuffer&&et.blob&&nt($)?(this._bodyArrayBuffer=$t($.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):et.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf($)||ot($))?this._bodyArrayBuffer=$t($):this._bodyText=$=Object.prototype.toString.call($):this._bodyText="",this.headers.get("content-type")||(typeof $=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):et.searchParams&&URLSearchParams.prototype.isPrototypeOf($)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},et.blob&&(this.blob=function(){var $=wt(this);if($)return $;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?wt(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_t)}),this.text=function(){var $=wt(this);if($)return $;if(this._bodyBlob)return mt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(bt(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},et.formData&&(this.formData=function(){return this.text().then(Pt)}),this.json=function(){return this.text().then(JSON.parse)},this}var Dt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Ht($){var _e=$.toUpperCase();return Dt.indexOf(_e)>-1?_e:$}function qt($,_e){_e=_e||{};var rt=_e.body;if($ instanceof qt){if($.bodyUsed)throw new TypeError("Already read");this.url=$.url,this.credentials=$.credentials,_e.headers||(this.headers=new gt($.headers)),this.method=$.method,this.mode=$.mode,this.signal=$.signal,!rt&&$._bodyInit!=null&&(rt=$._bodyInit,$.bodyUsed=!0)}else this.url=String($);if(this.credentials=_e.credentials||this.credentials||"same-origin",(_e.headers||!this.headers)&&(this.headers=new gt(_e.headers)),this.method=Ht(_e.method||this.method||"GET"),this.mode=_e.mode||this.mode||null,this.signal=_e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&rt)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(rt)}qt.prototype.clone=function(){return new qt(this,{body:this._bodyInit})};function Pt($){var _e=new FormData;return $.trim().split("&").forEach(function(rt){if(rt){var at=rt.split("="),lt=at.shift().replace(/\+/g," "),tt=at.join("=").replace(/\+/g," ");_e.append(decodeURIComponent(lt),decodeURIComponent(tt))}}),_e}function Gt($){var _e=new gt,rt=$.replace(/\r?\n[\t ]+/g," ");return rt.split(/\r?\n/).forEach(function(at){var lt=at.split(":"),tt=lt.shift().trim();if(tt){var _=lt.join(":").trim();_e.append(tt,_)}}),_e}Bt.call(qt.prototype);function ct($,_e){_e||(_e={}),this.type="default",this.status=_e.status===void 0?200:_e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in _e?_e.statusText:"OK",this.headers=new gt(_e.headers),this.url=_e.url||"",this._initBody($)}Bt.call(ct.prototype),ct.prototype.clone=function(){return new ct(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new gt(this.headers),url:this.url})},ct.error=function(){var $=new ct(null,{status:0,statusText:""});return $.type="error",$};var g=[301,302,303,307,308];ct.redirect=function($,_e){if(g.indexOf(_e)===-1)throw new RangeError("Invalid status code");return new ct(null,{status:_e,headers:{location:$}})},j.DOMException=h.DOMException;try{new j.DOMException}catch{j.DOMException=function(_e,rt){this.message=_e,this.name=rt;var at=Error(_e);this.stack=at.stack},j.DOMException.prototype=Object.create(Error.prototype),j.DOMException.prototype.constructor=j.DOMException}function b($,_e){return new Promise(function(rt,at){var lt=new qt($,_e);if(lt.signal&<.signal.aborted)return at(new j.DOMException("Aborted","AbortError"));var tt=new XMLHttpRequest;function _(){tt.abort()}tt.onload=function(){var it={status:tt.status,statusText:tt.statusText,headers:Gt(tt.getAllResponseHeaders()||"")};it.url="responseURL"in tt?tt.responseURL:it.headers.get("X-Request-URL");var yt="response"in tt?tt.response:tt.responseText;rt(new ct(yt,it))},tt.onerror=function(){at(new TypeError("Network request failed"))},tt.ontimeout=function(){at(new TypeError("Network request failed"))},tt.onabort=function(){at(new j.DOMException("Aborted","AbortError"))},tt.open(lt.method,lt.url,!0),lt.credentials==="include"?tt.withCredentials=!0:lt.credentials==="omit"&&(tt.withCredentials=!1),"responseType"in tt&&et.blob&&(tt.responseType="blob"),lt.headers.forEach(function(it,yt){tt.setRequestHeader(yt,it)}),lt.signal&&(lt.signal.addEventListener("abort",_),tt.onreadystatechange=function(){tt.readyState===4&<.signal.removeEventListener("abort",_)}),tt.send(typeof lt._bodyInit>"u"?null:lt._bodyInit)})}return b.polyfill=!0,h.fetch||(h.fetch=b,h.Headers=gt,h.Request=qt,h.Response=ct),j.Headers=gt,j.Request=qt,j.Response=ct,j.fetch=b,Object.defineProperty(j,"__esModule",{value:!0}),j})({})})(c),c.fetch.ponyfill=!0,delete c.fetch.polyfill;var d=c;e=d.fetch,e.default=d.fetch,e.fetch=d.fetch,e.Headers=d.Headers,e.Request=d.Request,e.Response=d.Response,o.exports=e})(browserPonyfill$1,browserPonyfill$1.exports);var fetch$1=getDefaultExportFromCjs$1(browserPonyfill$1.exports);async function verifiedBuild(o,e,a=5){const c=`https://api.apr.dev/api/v0/program/${e.toString()}/latest?limit=${a}`,[d,h]=await Promise.all([fetchData(o,e),fetch$1(c)]),j=(await h.json()).filter(nt=>!nt.aborted&&nt.state==="Built"&&nt.verified==="Verified");if(j.length===0)return null;const et=j[0];return d.slot.toNumber()!==et.verified_slot?null:et}async function fetchData(o,e){const a=await o.getAccountInfo(e);if(a===null)throw new Error("program account not found");const{program:c}=decodeUpgradeableLoaderState(a.data),d=await o.getAccountInfo(c.programdataAddress);if(d===null)throw new Error("program data account not found");const{programData:h}=decodeUpgradeableLoaderState(d.data);return h}const UPGRADEABLE_LOADER_STATE_LAYOUT=dist$2.rustEnum([dist$2.struct([],"uninitialized"),dist$2.struct([dist$2.option(dist$2.publicKey(),"authorityAddress")],"buffer"),dist$2.struct([dist$2.publicKey("programdataAddress")],"program"),dist$2.struct([dist$2.u64("slot"),dist$2.option(dist$2.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,dist$2.u32());function decodeUpgradeableLoaderState(o){return UPGRADEABLE_LOADER_STATE_LAYOUT.decode(o)}var registry=Object.freeze({__proto__:null,verifiedBuild,fetchData,decodeUpgradeableLoaderState}),index=Object.freeze({__proto__:null,sha256:sha256$3,rpc,publicKey:pubkey,bytes:index$1,token,features,registry});function splitArgsAndCtx(o,e){var a,c;let d={};const h=o.args?o.args.length:0;if(e.length>h){if(e.length!==h+1)throw new Error(`provided too many arguments ${e} to instruction ${o==null?void 0:o.name} expecting: ${(c=(a=o.args)===null||a===void 0?void 0:a.map(j=>j.name))!==null&&c!==void 0?c:[]}`);d=e.pop()}return[e,d]}class InstructionNamespaceFactory{static build(e,a,c){if(e.name==="_inner")throw new IdlError("the _inner name is reserved");const d=(...h)=>{const[j,et]=splitArgsAndCtx(e,[...h]);validateAccounts(e.accounts,et.accounts),validateInstruction(e,...h);const nt=d.accounts(et.accounts);return et.remainingAccounts!==void 0&&nt.push(...et.remainingAccounts),isSet("debug-logs")&&console.log("Outgoing account metas:",nt),new TransactionInstruction({keys:nt,programId:c,data:a(e.name,toInstruction(e,...j))})};return d.accounts=h=>InstructionNamespaceFactory.accountsArray(h,e.accounts,c,e.name),d}static accountsArray(e,a,c,d){return e?a.map(h=>{if(isCompositeAccounts(h)){const ot=e[h.name];return InstructionNamespaceFactory.accountsArray(ot,h.accounts,c,d).flat()}let j;try{j=translateAddress(e[h.name])}catch{throw new Error(`Wrong input type for account "${h.name}" in the instruction accounts object${d!==void 0?' for instruction "'+d+'"':""}. Expected PublicKey or string.`)}const et=h.optional&&j.equals(c),nt=!!(h.writable&&!et),st=!!(h.signer&&!et);return{pubkey:j,isWritable:nt,isSigner:st}}).flat():[]}}function validateInstruction(o,...e){}class TransactionFactory{static build(e,a){return(...d)=>{var h,j,et;const[,nt]=splitArgsAndCtx(e,[...d]),st=new Transaction;if(nt.preInstructions&&nt.instructions)throw new Error("instructions is deprecated, use preInstructions");return(h=nt.preInstructions)===null||h===void 0||h.forEach(ot=>st.add(ot)),(j=nt.instructions)===null||j===void 0||j.forEach(ot=>st.add(ot)),st.add(a(...d)),(et=nt.postInstructions)===null||et===void 0||et.forEach(ot=>st.add(ot)),st}}}class RpcFactory{static build(e,a,c,d){return async(...j)=>{var et;const nt=a(...j),[,st]=splitArgsAndCtx(e,[...j]);if(d.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await d.sendAndConfirm(nt,(et=st.signers)!==null&&et!==void 0?et:[],st.options)}catch(ot){throw translateError(ot,c)}}}}class AccountFactory{static build(e,a,c,d){var h;return((h=e.accounts)!==null&&h!==void 0?h:[]).reduce((j,et)=>(j[et.name]=new AccountClient(e,et,c,d,a),j),{})}}class AccountClient{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}constructor(e,a,c,d,h){this._idlAccount=a,this._programId=c,this._provider=d??getProvider(),this._coder=h??new BorshCoder(e),this._size=this._coder.accounts.size(a.name)}async fetchNullable(e,a){const{data:c}=await this.fetchNullableAndContext(e,a);return c}async fetchNullableAndContext(e,a){const c=await this.getAccountInfoAndContext(e,a),{value:d,context:h}=c;return{data:d&&d.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,d.data):null,context:h}}async fetch(e,a){const{data:c}=await this.fetchNullableAndContext(e,a);if(c===null)throw new Error(`Account does not exist or has no data ${e.toString()}`);return c}async fetchAndContext(e,a){const{data:c,context:d}=await this.fetchNullableAndContext(e,a);if(c===null)throw new Error(`Account does not exist ${e.toString()}`);return{data:c,context:d}}async fetchMultiple(e,a){return(await this.fetchMultipleAndContext(e,a)).map(d=>d?d.data:null)}async fetchMultipleAndContext(e,a){return(await getMultipleAccountsAndContext(this._provider.connection,e.map(d=>translateAddress(d)),a)).map(d=>{if(d==null)return null;const{account:h,context:j}=d;return{data:this._coder.accounts.decode(this._idlAccount.name,h.data),context:j}})}async all(e){const a=this.coder.accounts.memcmp(this._idlAccount.name,e instanceof Buffer$1$1?e:void 0),c=[];return(a==null?void 0:a.offset)!=null&&(a==null?void 0:a.bytes)!=null&&c.push({memcmp:{offset:a.offset,bytes:a.bytes}}),(a==null?void 0:a.dataSize)!=null&&c.push({dataSize:a.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...c,...Array.isArray(e)?e:[]]})).map(({pubkey:h,account:j})=>({publicKey:h,account:this._coder.accounts.decode(this._idlAccount.name,j.data)}))}subscribe(e,a){const c=subscriptions.get(e.toString());if(c)return c.ee;const d=new EventEmitter$1;e=translateAddress(e);const h=this._provider.connection.onAccountChange(e,j=>{const et=this._coder.accounts.decode(this._idlAccount.name,j.data);d.emit("change",et)},a);return subscriptions.set(e.toString(),{ee:d,listener:h}),d}async unsubscribe(e){let a=subscriptions.get(e.toString());if(!a){console.warn("Address is not subscribed");return}subscriptions&&await this._provider.connection.removeAccountChangeListener(a.listener).then(()=>{subscriptions.delete(e.toString())}).catch(console.error)}async createInstruction(e,a){const c=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return SystemProgram.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:e.publicKey,space:a??c,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(a??c),programId:this._programId})}async getAccountInfo(e,a){return await this._provider.connection.getAccountInfo(translateAddress(e),a)}async getAccountInfoAndContext(e,a){return await this._provider.connection.getAccountInfoAndContext(translateAddress(e),a)}}const subscriptions=new Map,PROGRAM_LOG="Program log: ",PROGRAM_DATA="Program data: ",PROGRAM_LOG_START_INDEX=PROGRAM_LOG.length,PROGRAM_DATA_START_INDEX=PROGRAM_DATA.length;class EventManager{constructor(e,a,c){this._programId=e,this._provider=a,this._eventParser=new EventParser(e,c),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(e,a){var c;let d=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.set(e,((c=this._eventListeners.get(e))!==null&&c!==void 0?c:[]).concat(d)),this._eventCallbacks.set(d,[e,a]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(h,j)=>{if(!h.err)for(const et of this._eventParser.parseLogs(h.logs)){const nt=this._eventListeners.get(et.name);nt&&nt.forEach(st=>{const ot=this._eventCallbacks.get(st);if(ot){const[,ht]=ot;ht(et.data,j.slot,h.signature)}})}})),d}async removeEventListener(e){const a=this._eventCallbacks.get(e);if(!a)throw new Error(`Event listener ${e} doesn't exist!`);const[c]=a;let d=this._eventListeners.get(c);if(!d)throw new Error(`Event listeners don't exist for ${c}!`);if(this._eventCallbacks.delete(e),d=d.filter(h=>h!==e),this._eventListeners.set(c,d),d.length===0&&this._eventListeners.delete(c),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class EventParser{constructor(e,a){this.coder=a,this.programId=e}*parseLogs(e,a=!1){const c=new LogScanner(e),d=new ExecutionContext;let h=c.next();for(;h!==null;){let[j,et,nt]=this.handleLog(d,h,a);j&&(yield j),et&&d.push(et),nt&&d.pop(),h=c.next()}}handleLog(e,a,c){return e.stack.length>0&&e.program()===this.programId.toString()?this.handleProgramLog(a,c):[null,...this.handleSystemLog(a)]}handleProgramLog(e,a){if(e.startsWith(PROGRAM_LOG)||e.startsWith(PROGRAM_DATA)){const c=e.startsWith(PROGRAM_LOG)?e.slice(PROGRAM_LOG_START_INDEX):e.slice(PROGRAM_DATA_START_INDEX),d=this.coder.events.decode(c);if(a&&d===null)throw new Error(`Unable to decode event ${c}`);return[d,null,!1]}else return[null,...this.handleSystemLog(e)]}handleSystemLog(e){const a=e.split(":")[0];return a.match(/^Program (.*) success/g)!==null?[null,!0]:a.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:a.includes("invoke")?["cpi",!1]:[null,!1]}}class ExecutionContext{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(e){this.stack.push(e)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class LogScanner{constructor(e){this.logs=e}next(){if(this.logs.length===0)return null;let e=this.logs[0];return this.logs=this.logs.slice(1),e}}class SimulateFactory{static build(e,a,c,d,h,j,et){return async(...st)=>{var ot;const ht=a(...st),[,pt]=splitArgsAndCtx(e,[...st]);let dt;if(d.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{dt=await d.simulate(ht,pt.signers,(ot=pt.options)===null||ot===void 0?void 0:ot.commitment)}catch(St){throw translateError(St,c)}if(dt===void 0)throw new Error("Unable to simulate transaction");const gt=dt.logs;if(!gt)throw new Error("Simulated logs not found");const wt=[];if(et.events){let St=new EventParser(j,h);for(const _t of St.parseLogs(gt))wt.push(_t)}return{events:wt,raw:gt}}}}function uint64$1(o){return new WrappedLayout$2(blob$1(8),e=>u64$2.fromBuffer(e),e=>e.toBuffer(),o)}function publicKey$4(o){return new WrappedLayout$2(blob$1(32),e=>new PublicKey$1(e),e=>e.toBuffer(),o)}function coption$1(o,e){return new COptionLayout$1(o,e)}let WrappedLayout$2=class extends Layout_2$1{constructor(e,a,c,d){super(e.span,d),this.layout=e,this.decoder=a,this.encoder=c}decode(e,a){return this.decoder(this.layout.decode(e,a))}encode(e,a,c){return this.layout.encode(this.encoder(e),a,c)}getSpan(e,a){return this.layout.getSpan(e,a)}},COptionLayout$1=class extends Layout_2$1{constructor(e,a){super(-1,a),this.layout=e,this.discriminator=u32$1()}encode(e,a,c=0){return e==null?this.layout.span+this.discriminator.encode(0,a,c):(this.discriminator.encode(1,a,c),this.layout.encode(e,a,c+4)+4)}decode(e,a=0){const c=this.discriminator.decode(e,a);if(c===0)return null;if(c===1)return this.layout.decode(e,a+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(e,a=0){return this.layout.getSpan(e,a+4)+4}},u64$2=class ln extends BN$b{toBuffer(){const e=super.toArray().reverse(),a=Buffer$1$1.from(e);if(a.length===8)return a;if(a.length>=8)throw new Error("u64 too large");const c=Buffer$1$1.alloc(8);return a.copy(c),c}static fromBuffer(e){if(e.length!==8)throw new Error(`Invalid buffer length: ${e.length}`);return new ln([...e].reverse().map(a=>`00${a.toString(16)}`.slice(-2)).join(""),16)}};const TOKEN_ACCOUNT_LAYOUT=struct$1([publicKey$4("mint"),publicKey$4("owner"),uint64$1("amount"),coption$1(publicKey$4(),"delegate"),(o=>{const e=union$2(u8$1("discriminator"),null,o);return e.addVariant(0,struct$1([]),"uninitialized"),e.addVariant(1,struct$1([]),"initialized"),e.addVariant(2,struct$1([]),"frozen"),e})("state"),coption$1(uint64$1(),"isNative"),uint64$1("delegatedAmount"),coption$1(publicKey$4(),"closeAuthority")]);function decodeTokenAccount(o){return TOKEN_ACCOUNT_LAYOUT.decode(o)}class AccountsResolver{constructor(e,a,c,d,h,j,et,nt){this._args=e,this._accounts=a,this._provider=c,this._programId=d,this._idlIx=h,this._idlTypes=et,this._customResolver=nt,this._accountStore=new AccountStore(c,j,d)}args(e){this._args=e}async resolve(){this.resolveEventCpi(this._idlIx.accounts),this.resolveConst(this._idlIx.accounts);let e=0;for(;await this.resolvePdasAndRelations(this._idlIx.accounts)+await this.resolveCustom()>0;)if(e++,e===16)throw new Error("Reached maximum depth for account resolution")}resolveOptionals(e){Object.assign(this._accounts,this.resolveOptionalsHelper(e,this._idlIx.accounts))}get(e){const a=e.reduce((c,d)=>c&&c[d],this._accounts);if(a&&a.toBase58)return a}set(e,a){let c=this._accounts;e.forEach((d,h)=>{var j;h===e.length-1&&(c[d]=a),c[d]=(j=c[d])!==null&&j!==void 0?j:{},c=c[d]})}resolveOptionalsHelper(e,a){const c={};for(const d of a){const h=d.name,j=e[h];j!==void 0&&(isPartialAccounts(j)?isCompositeAccounts(d)?c[h]=this.resolveOptionalsHelper(j,d.accounts):c[h]=flattenPartialAccounts(j):j!==null?c[h]=translateAddress(j):d.optional&&(c[h]=this._programId))}return c}async resolveCustom(){if(this._customResolver){const{accounts:e,resolved:a}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=e,a}return 0}resolveEventCpi(e,a=[]){for(const c in e){const d=e[c];isCompositeAccounts(d)&&this.resolveEventCpi(d.accounts,[...a,d.name]);const h=+c+1;if(h===e.length)return;const j=e[c].name,et=e[h].name;if(j==="eventAuthority"&&et==="program"){const nt=[...a,j],st=[...a,et];this.get(nt)||this.set(nt,PublicKey$1.findProgramAddressSync([Buffer$1$1.from("__event_authority")],this._programId)[0]),this.get(st)||this.set(st,this._programId);return}}}resolveConst(e,a=[]){for(const c of e){const d=c.name;if(isCompositeAccounts(c))this.resolveConst(c.accounts,[...a,d]);else{const h=c;if((h.signer||h.address)&&!this.get([...a,d])){if(h.signer){if(!this._provider.wallet)throw new Error("This function requires the `Provider` interface implementor to have a `wallet` field.");this.set([...a,d],this._provider.wallet.publicKey)}h.address&&this.set([...a,d],translateAddress(h.address))}}}}async resolvePdasAndRelations(e,a=[]){let c=0;for(const d of e){const h=d.name;if(isCompositeAccounts(d))c+=await this.resolvePdasAndRelations(d.accounts,[...a,h]);else{const j=d;if((j.pda||j.relations)&&!this.get([...a,h])){c++;try{if(j.pda){const et=await Promise.all(j.pda.seeds.map(ot=>this.toBuffer(ot,a)));if(et.some(ot=>!ot))continue;const nt=await this.parseProgramId(j,a),[st]=PublicKey$1.findProgramAddressSync(et,nt);this.set([...a,h],st)}}catch{}try{if(j.relations){const et=this.get([...a,j.relations[0]]);if(et){const nt=await this._accountStore.fetchAccount({publicKey:et});this.set([...a,h],nt[h])}}}catch{}}}}return c}async parseProgramId(e,a=[]){var c;if(!(!((c=e.pda)===null||c===void 0)&&c.program))return this._programId;const d=await this.toBuffer(e.pda.program,a);if(!d)throw new Error(`Program seed not resolved: ${e.name}`);return new PublicKey$1(d)}async toBuffer(e,a=[]){switch(e.kind){case"const":return this.toBufferConst(e);case"arg":return await this.toBufferArg(e);case"account":return await this.toBufferAccount(e,a);default:throw new Error(`Unexpected seed: ${e}`)}}toBufferConst(e){return this.toBufferValue("bytes",e.value)}async toBufferArg(e){const[a,...c]=e.path.split("."),d=this._idlIx.args.findIndex(et=>et.name===a);if(d===-1)throw new Error(`Unable to find argument for seed: ${a}`);const h=c.reduce((et,nt)=>(et??{})[nt],this._args[d]);if(h===void 0)return;const j=this.getType(this._idlIx.args[d].type,c);return this.toBufferValue(j,h)}async toBufferAccount(e,a=[]){const[c,...d]=e.path.split("."),h=this.get([...a,c]);if(!h)return;if(!d.length)return this.toBufferValue("pubkey",h);if(!e.account)throw new Error(`Seed account is required in order to resolve type: ${e.path}`);let et=await this._accountStore.fetchAccount({publicKey:h,name:e.account}),nt=d;for(;nt.length>0;)et=et[nt[0]],nt=nt.slice(1);if(et===void 0)return;const st=this.getType({defined:{name:e.account}},d);return this.toBufferValue(st,et)}toBufferValue(e,a){switch(e){case"u8":case"i8":return Buffer$1$1.from([a]);case"u16":case"i16":return new BN$b(a).toArrayLike(Buffer$1$1,"le",2);case"u32":case"i32":return new BN$b(a).toArrayLike(Buffer$1$1,"le",4);case"u64":case"i64":return new BN$b(a).toArrayLike(Buffer$1$1,"le",8);case"u128":case"i128":return new BN$b(a).toArrayLike(Buffer$1$1,"le",16);case"u256":case"i256":return new BN$b(a).toArrayLike(Buffer$1$1,"le",32);case"string":return Buffer$1$1.from(a);case"pubkey":return a.toBuffer();case"bytes":return Buffer$1$1.from(a);default:if(e!=null&&e.array)return Buffer$1$1.from(a);throw new Error(`Unexpected seed type: ${e}`)}}getType(e,a=[]){var c;const d=(c=e==null?void 0:e.defined)===null||c===void 0?void 0:c.name;if(d){if(d==="tokenAccount")switch(a.at(0)){case"mint":case"owner":return"pubkey";case"amount":case"delagatedAmount":return"u64";default:throw new Error(`Unknown token account path: ${a}`)}const h=this._idlTypes.find(ot=>ot.name===d);if(!h)throw new Error(`Type not found: ${d}`);const[j,...et]=a,st=h.type.fields.find(ot=>ot.name===j);if(!st)throw new Error(`Field not found: ${j}`);return this.getType(st.type,et)}return e}}class AccountStore{constructor(e,a,c){this._provider=e,this._cache=new Map,this._idls={},this._idls[c.toBase58()]=a}async fetchAccount({publicKey:e,name:a}){const c=e.toBase58();if(!this._cache.has(c)){const d=await this._provider.connection.getAccountInfo(e);if(d===null)throw new Error(`Account not found: ${c}`);if(a==="tokenAccount"){const h=decodeTokenAccount(d.data);this._cache.set(c,h)}else{const h=await this.getAccountsNs(d.owner);if(h){const j=Object.values(h)[0];if(j){const et=j.coder.accounts.decodeAny(d.data);this._cache.set(c,et)}}}}return this._cache.get(c)}async getAccountsNs(e){const a=e.toBase58();if(!this._idls[a]){const c=await Program.fetchIdl(e,this._provider);if(c){const d=new Program(c,this._provider);this._idls[a]=d.account}}return this._idls[a]}}class MethodsBuilderFactory{static build(e,a,c,d,h,j,et,nt,st,ot,ht){return(...pt)=>new MethodsBuilder(pt,d,h,j,et,nt,e,a,c,st,ot,ht)}}function isPartialAccounts(o){return typeof o=="object"&&o!==null&&!("_bn"in o)}function flattenPartialAccounts(o,e){const a={};for(const c in o){const d=o[c];if(d===null)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");a[c]=isPartialAccounts(d)?flattenPartialAccounts(d):translateAddress(d)}return a}class MethodsBuilder{constructor(e,a,c,d,h,j,et,nt,st,ot,ht,pt){this._args=e,this._ixFn=a,this._txFn=c,this._rpcFn=d,this._simulateFn=h,this._viewFn=j,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._resolveAccounts=!0,this._accountsResolver=new AccountsResolver(e,this._accounts,et,nt,st,ot,ht,pt)}args(e){this._args=e,this._accountsResolver.args(e)}accounts(e){return this.accountsPartial(e)}accountsPartial(e){return this._resolveAccounts=!0,this._accountsResolver.resolveOptionals(e),this}accountsStrict(e){return this._resolveAccounts=!1,this._accountsResolver.resolveOptionals(e),this}signers(e){return this._signers=this._signers.concat(e),this}remainingAccounts(e){return this._remainingAccounts=this._remainingAccounts.concat(e),this}preInstructions(e,a=!1){return a?this._preInstructions=e.concat(this._preInstructions):this._preInstructions=this._preInstructions.concat(e),this}postInstructions(e){return this._postInstructions=this._postInstructions.concat(e),this}async pubkeys(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._accounts}async rpc(e){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async rpcAndKeys(e){return{pubkeys:await this.pubkeys(),signature:await this.rpc(e)}}async view(e){if(this._resolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async simulate(e){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async instruction(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:this._signers}}async transaction(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class ViewFactory{static build(e,a,c,d){const h=a.accounts.find(nt=>nt.writable),j=!!a.returns;return h||!j?void 0:async(...nt)=>{let st=await c(...nt);const ot=`Program return: ${e} `;let ht=st.raw.find(wt=>wt.startsWith(ot));if(!ht)throw new Error("View expected return log");let pt=decode(ht.slice(ot.length)),dt=a.returns;if(!dt)throw new Error("View expected return type");return IdlCoder.fieldLayout({type:dt},d.types).decode(pt)}}}class NamespaceFactory{static build(e,a,c,d,h){const j={},et={},nt={},st={},ot={},ht={},pt=parseIdlErrors(e),dt=e.accounts?AccountFactory.build(e,a,c,d):{};return e.instructions.forEach(gt=>{const wt=InstructionNamespaceFactory.build(gt,(Dt,Ht)=>a.instruction.encode(Dt,Ht),c),St=TransactionFactory.build(gt,wt),_t=RpcFactory.build(gt,St,pt,d),mt=SimulateFactory.build(gt,St,pt,d,a,c,e),bt=ViewFactory.build(c,gt,mt,e),$t=MethodsBuilderFactory.build(d,c,gt,wt,St,_t,mt,bt,dt,e.types||[],h==null?void 0:h(gt)),Bt=gt.name;et[Bt]=wt,nt[Bt]=St,j[Bt]=_t,st[Bt]=mt,ot[Bt]=$t,bt&&(ht[Bt]=bt)}),[j,et,nt,dt,st,ot,ht]}}class Program{get programId(){return this._programId}get idl(){return this._idl}get rawIdl(){return this._rawIdl}get coder(){return this._coder}get provider(){return this._provider}constructor(e,a=getProvider(),c,d){const h=convertIdlToCamelCase(e);this._idl=h,this._rawIdl=e,this._provider=a,this._programId=translateAddress(e.address),this._coder=c??new BorshCoder(h),this._events=new EventManager(this._programId,a,this._coder);const[j,et,nt,st,ot,ht,pt]=NamespaceFactory.build(h,this._coder,this._programId,a,d);this.rpc=j,this.instruction=et,this.transaction=nt,this.account=st,this.simulate=ot,this.methods=ht,this.views=pt}static async at(e,a){const c=translateAddress(e),d=await Program.fetchIdl(c,a);if(!d)throw new Error(`IDL not found for program: ${e.toString()}`);return new Program(d,a)}static async fetchIdl(e,a){a=a??getProvider();const c=translateAddress(e),d=await idlAddress(c),h=await a.connection.getAccountInfo(d);if(!h)return null;let j=decodeIdlAccount(h.data.slice(8));const et=inflate_1(j.data);return JSON.parse(decode$2(et))}addEventListener(e,a){return this._events.addEventListener(e,a)}async removeEventListener(e){return await this._events.removeEventListener(e)}}new PublicKey$1("11111111111111111111111111111111");function getDefaultExportFromCjs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var browser$c={exports:{}},process=browser$c.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(o){if(cachedSetTimeout===setTimeout)return setTimeout(o,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(o,0);try{return cachedSetTimeout(o,0)}catch{try{return cachedSetTimeout.call(null,o,0)}catch{return cachedSetTimeout.call(this,o,0)}}}function runClearTimeout(o){if(cachedClearTimeout===clearTimeout)return clearTimeout(o);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(o);try{return cachedClearTimeout(o)}catch{try{return cachedClearTimeout.call(null,o)}catch{return cachedClearTimeout.call(this,o)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var o=runTimeout(cleanUpNextTick);draining=!0;for(var e=queue.length;e;){for(currentQueue=queue,queue=[];++queueIndex1)for(var a=1;a>2]|=o[d]<>2]|=c<>2]|=(192|c>>6)<>2]|=(128|c&63)<=57344?(et[h>>2]|=(224|c>>12)<>2]|=(128|c>>6&63)<>2]|=(128|c&63)<>2]|=(240|c>>18)<>2]|=(128|c>>12&63)<>2]|=(128|c>>6&63)<>2]|=(128|c&63)<=64?(this.block=et[16],this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var o=this.blocks,e=this.lastByteIndex;o[16]=this.block,o[e>>2]|=EXTRA[e&3],this.block=o[16],e>=56&&(this.hashed||this.hash(),o[0]=this.block,o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),o[14]=this.hBytes<<3|this.bytes>>>29,o[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var o=this.h0,e=this.h1,a=this.h2,c=this.h3,d=this.h4,h=this.h5,j=this.h6,et=this.h7,nt=this.blocks,st,ot,ht,pt,dt,gt,wt,St,_t,mt,bt;for(st=16;st<64;++st)dt=nt[st-15],ot=(dt>>>7|dt<<25)^(dt>>>18|dt<<14)^dt>>>3,dt=nt[st-2],ht=(dt>>>17|dt<<15)^(dt>>>19|dt<<13)^dt>>>10,nt[st]=nt[st-16]+ot+nt[st-7]+ht<<0;for(bt=e&a,st=0;st<64;st+=4)this.first?(this.is224?(St=300032,dt=nt[0]-1413257819,et=dt-150054599<<0,c=dt+24177077<<0):(St=704751109,dt=nt[0]-210244248,et=dt-1521486534<<0,c=dt+143694565<<0),this.first=!1):(ot=(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10),ht=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),St=o&e,pt=St^o&a^bt,wt=d&h^~d&j,dt=et+ht+wt+K[st]+nt[st],gt=ot+pt,et=c+dt<<0,c=dt+gt<<0),ot=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),ht=(et>>>6|et<<26)^(et>>>11|et<<21)^(et>>>25|et<<7),_t=c&o,pt=_t^c&e^St,wt=et&d^~et&h,dt=j+ht+wt+K[st+1]+nt[st+1],gt=ot+pt,j=a+dt<<0,a=dt+gt<<0,ot=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10),ht=(j>>>6|j<<26)^(j>>>11|j<<21)^(j>>>25|j<<7),mt=a&c,pt=mt^a&o^_t,wt=j&et^~j&d,dt=h+ht+wt+K[st+2]+nt[st+2],gt=ot+pt,h=e+dt<<0,e=dt+gt<<0,ot=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),ht=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),bt=e&a,pt=bt^e&c^mt,wt=h&j^~h&et,dt=d+ht+wt+K[st+3]+nt[st+3],gt=ot+pt,d=o+dt<<0,o=dt+gt<<0;this.h0=this.h0+o<<0,this.h1=this.h1+e<<0,this.h2=this.h2+a<<0,this.h3=this.h3+c<<0,this.h4=this.h4+d<<0,this.h5=this.h5+h<<0,this.h6=this.h6+j<<0,this.h7=this.h7+et<<0},Sha256.prototype.hex=function(){this.finalize();var o=this.h0,e=this.h1,a=this.h2,c=this.h3,d=this.h4,h=this.h5,j=this.h6,et=this.h7,nt=HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]+HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>4&15]+HEX_CHARS[d&15]+HEX_CHARS[h>>28&15]+HEX_CHARS[h>>24&15]+HEX_CHARS[h>>20&15]+HEX_CHARS[h>>16&15]+HEX_CHARS[h>>12&15]+HEX_CHARS[h>>8&15]+HEX_CHARS[h>>4&15]+HEX_CHARS[h&15]+HEX_CHARS[j>>28&15]+HEX_CHARS[j>>24&15]+HEX_CHARS[j>>20&15]+HEX_CHARS[j>>16&15]+HEX_CHARS[j>>12&15]+HEX_CHARS[j>>8&15]+HEX_CHARS[j>>4&15]+HEX_CHARS[j&15];return this.is224||(nt+=HEX_CHARS[et>>28&15]+HEX_CHARS[et>>24&15]+HEX_CHARS[et>>20&15]+HEX_CHARS[et>>16&15]+HEX_CHARS[et>>12&15]+HEX_CHARS[et>>8&15]+HEX_CHARS[et>>4&15]+HEX_CHARS[et&15]),nt},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var o=this.h0,e=this.h1,a=this.h2,c=this.h3,d=this.h4,h=this.h5,j=this.h6,et=this.h7,nt=[o>>24&255,o>>16&255,o>>8&255,o&255,e>>24&255,e>>16&255,e>>8&255,e&255,a>>24&255,a>>16&255,a>>8&255,a&255,c>>24&255,c>>16&255,c>>8&255,c&255,d>>24&255,d>>16&255,d>>8&255,d&255,h>>24&255,h>>16&255,h>>8&255,h&255,j>>24&255,j>>16&255,j>>8&255,j&255];return this.is224||nt.push(et>>24&255,et>>16&255,et>>8&255,et&255),nt},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var o=new ArrayBuffer(this.is224?28:32),e=new DataView(o);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),o};function HmacSha256(o,e,a){var c,d=typeof o;if(d==="string"){var h=[],j=o.length,et=0,nt;for(c=0;c>6,h[et++]=128|nt&63):nt<55296||nt>=57344?(h[et++]=224|nt>>12,h[et++]=128|nt>>6&63,h[et++]=128|nt&63):(nt=65536+((nt&1023)<<10|o.charCodeAt(++c)&1023),h[et++]=240|nt>>18,h[et++]=128|nt>>12&63,h[et++]=128|nt>>6&63,h[et++]=128|nt&63);o=h}else if(d==="object"){if(o===null)throw new Error(ERROR);if(ARRAY_BUFFER&&o.constructor===ArrayBuffer)o=new Uint8Array(o);else if(!Array.isArray(o)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(o)))throw new Error(ERROR)}else throw new Error(ERROR);o.length>64&&(o=new Sha256(e,!0).update(o).array());var st=[],ot=[];for(c=0;c<64;++c){var ht=o[c]||0;st[c]=92^ht,ot[c]=54^ht}Sha256.call(this,e,a),this.update(ot),this.oKeyPad=st,this.inner=!0,this.sharedMemory=a}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var o=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(o),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224)})()})(sha256$2);var dist={};(function(o){var e=commonjsGlobal$2&&commonjsGlobal$2.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(o,"__esModule",{value:!0}),o.map=o.array=o.rustEnum=o.str=o.vecU8=o.tagged=o.vec=o.bool=o.option=o.publicKey=o.i256=o.u256=o.i128=o.u128=o.i64=o.u64=o.struct=o.f64=o.f32=o.i32=o.u32=o.i16=o.u16=o.i8=o.u8=void 0;const a=Layout$3,c=require$$5,d=e(bnExports$6);var h=Layout$3;Object.defineProperty(o,"u8",{enumerable:!0,get:function(){return h.u8}}),Object.defineProperty(o,"i8",{enumerable:!0,get:function(){return h.s8}}),Object.defineProperty(o,"u16",{enumerable:!0,get:function(){return h.u16}}),Object.defineProperty(o,"i16",{enumerable:!0,get:function(){return h.s16}}),Object.defineProperty(o,"u32",{enumerable:!0,get:function(){return h.u32}}),Object.defineProperty(o,"i32",{enumerable:!0,get:function(){return h.s32}}),Object.defineProperty(o,"f32",{enumerable:!0,get:function(){return h.f32}}),Object.defineProperty(o,"f64",{enumerable:!0,get:function(){return h.f64}}),Object.defineProperty(o,"struct",{enumerable:!0,get:function(){return h.struct}});class j extends a.Layout{constructor(b,$,_e){super(b,_e),this.blob=(0,a.blob)(b),this.signed=$}decode(b,$=0){const _e=new d.default(this.blob.decode(b,$),10,"le");return this.signed?_e.fromTwos(this.span*8).clone():_e}encode(b,$,_e=0){return this.signed&&(b=b.toTwos(this.span*8)),this.blob.encode(b.toArrayLike(Buffer$1$1,"le",this.span),$,_e)}}function et(g){return new j(8,!1,g)}o.u64=et;function nt(g){return new j(8,!0,g)}o.i64=nt;function st(g){return new j(16,!1,g)}o.u128=st;function ot(g){return new j(16,!0,g)}o.i128=ot;function ht(g){return new j(32,!1,g)}o.u256=ht;function pt(g){return new j(32,!0,g)}o.i256=pt;class dt extends a.Layout{constructor(b,$,_e,rt){super(b.span,rt),this.layout=b,this.decoder=$,this.encoder=_e}decode(b,$){return this.decoder(this.layout.decode(b,$))}encode(b,$,_e){return this.layout.encode(this.encoder(b),$,_e)}getSpan(b,$){return this.layout.getSpan(b,$)}}function gt(g){return new dt((0,a.blob)(32),b=>new c.PublicKey(b),b=>b.toBuffer(),g)}o.publicKey=gt;class wt extends a.Layout{constructor(b,$){super(-1,$),this.layout=b,this.discriminator=(0,a.u8)()}encode(b,$,_e=0){return b==null?this.discriminator.encode(0,$,_e):(this.discriminator.encode(1,$,_e),this.layout.encode(b,$,_e+1)+1)}decode(b,$=0){const _e=this.discriminator.decode(b,$);if(_e===0)return null;if(_e===1)return this.layout.decode(b,$+1);throw new Error("Invalid option "+this.property)}getSpan(b,$=0){const _e=this.discriminator.decode(b,$);if(_e===0)return 1;if(_e===1)return this.layout.getSpan(b,$+1)+1;throw new Error("Invalid option "+this.property)}}function St(g,b){return new wt(g,b)}o.option=St;function _t(g){return new dt((0,a.u8)(),mt,bt,g)}o.bool=_t;function mt(g){if(g===0)return!1;if(g===1)return!0;throw new Error("Invalid bool: "+g)}function bt(g){return g?1:0}function $t(g,b){const $=(0,a.u32)("length"),_e=(0,a.struct)([$,(0,a.seq)(g,(0,a.offset)($,-$.span),"values")]);return new dt(_e,({values:rt})=>rt,rt=>({values:rt}),b)}o.vec=$t;function Bt(g,b,$){const _e=(0,a.struct)([et("tag"),b.replicate("data")]);function rt({tag:at,data:lt}){if(!at.eq(g))throw new Error("Invalid tag, expected: "+g.toString("hex")+", got: "+at.toString("hex"));return lt}return new dt(_e,rt,at=>({tag:g,data:at}),$)}o.tagged=Bt;function Dt(g){const b=(0,a.u32)("length"),$=(0,a.struct)([b,(0,a.blob)((0,a.offset)(b,-b.span),"data")]);return new dt($,({data:_e})=>_e,_e=>({data:_e}),g)}o.vecU8=Dt;function Ht(g){return new dt(Dt(),b=>b.toString("utf-8"),b=>Buffer$1$1.from(b,"utf-8"),g)}o.str=Ht;function qt(g,b,$){const _e=(0,a.union)($??(0,a.u8)(),b);return g.forEach((rt,at)=>_e.addVariant(at,rt,rt.property)),_e}o.rustEnum=qt;function Pt(g,b,$){const _e=(0,a.struct)([(0,a.seq)(g,b,"values")]);return new dt(_e,({values:rt})=>rt,rt=>({values:rt}),$)}o.array=Pt;class Gt extends a.Layout{constructor(b,$,_e){super(b.span+$.span,_e),this.keyLayout=b,this.valueLayout=$}decode(b,$){$=$||0;const _e=this.keyLayout.decode(b,$),rt=this.valueLayout.decode(b,$+this.keyLayout.getSpan(b,$));return[_e,rt]}encode(b,$,_e){_e=_e||0;const rt=this.keyLayout.encode(b[0],$,_e),at=this.valueLayout.encode(b[1],$,_e+rt);return rt+at}getSpan(b,$){return this.keyLayout.getSpan(b,$)+this.valueLayout.getSpan(b,$)}}function ct(g,b,$){const _e=(0,a.u32)("length"),rt=(0,a.struct)([_e,(0,a.seq)(new Gt(g,b),(0,a.offset)(_e,-_e.span),"values")]);return new dt(rt,({values:at})=>new Map(at),at=>({values:Array.from(at.entries())}),$)}o.map=ct})(dist);var assert$k={exports:{}},errors={},util$3={},types={},shams$1,hasRequiredShams$1;function requireShams$1(){return hasRequiredShams$1||(hasRequiredShams$1=1,shams$1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},a=Symbol("test"),c=Object(a);if(typeof a=="string"||Object.prototype.toString.call(a)!=="[object Symbol]"||Object.prototype.toString.call(c)!=="[object Symbol]")return!1;var d=42;e[a]=d;for(a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var h=Object.getOwnPropertySymbols(e);if(h.length!==1||h[0]!==a||!Object.prototype.propertyIsEnumerable.call(e,a))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var j=Object.getOwnPropertyDescriptor(e,a);if(j.value!==d||j.enumerable!==!0)return!1}return!0}),shams$1}var shams,hasRequiredShams;function requireShams(){if(hasRequiredShams)return shams;hasRequiredShams=1;var o=requireShams$1();return shams=function(){return o()&&!!Symbol.toStringTag},shams}var esErrors,hasRequiredEsErrors;function requireEsErrors(){return hasRequiredEsErrors||(hasRequiredEsErrors=1,esErrors=Error),esErrors}var _eval,hasRequired_eval;function require_eval(){return hasRequired_eval||(hasRequired_eval=1,_eval=EvalError),_eval}var range,hasRequiredRange;function requireRange(){return hasRequiredRange||(hasRequiredRange=1,range=RangeError),range}var ref,hasRequiredRef;function requireRef(){return hasRequiredRef||(hasRequiredRef=1,ref=ReferenceError),ref}var syntax,hasRequiredSyntax;function requireSyntax(){return hasRequiredSyntax||(hasRequiredSyntax=1,syntax=SyntaxError),syntax}var type$1,hasRequiredType;function requireType(){return hasRequiredType||(hasRequiredType=1,type$1=TypeError),type$1}var uri,hasRequiredUri;function requireUri(){return hasRequiredUri||(hasRequiredUri=1,uri=URIError),uri}var hasSymbols$1,hasRequiredHasSymbols;function requireHasSymbols(){if(hasRequiredHasSymbols)return hasSymbols$1;hasRequiredHasSymbols=1;var o=typeof Symbol<"u"&&Symbol,e=requireShams$1();return hasSymbols$1=function(){return typeof o!="function"||typeof Symbol!="function"||typeof o("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},hasSymbols$1}var hasProto,hasRequiredHasProto;function requireHasProto(){if(hasRequiredHasProto)return hasProto;hasRequiredHasProto=1;var o={__proto__:null,foo:{}},e=Object;return hasProto=function(){return{__proto__:o}.foo===o.foo&&!(o instanceof e)},hasProto}var implementation$6,hasRequiredImplementation$2;function requireImplementation$2(){if(hasRequiredImplementation$2)return implementation$6;hasRequiredImplementation$2=1;var o="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,a=Math.max,c="[object Function]",d=function(nt,st){for(var ot=[],ht=0;ht"u"||!wt?o:wt(Uint8Array),mt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?o:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?o:ArrayBuffer,"%ArrayIteratorPrototype%":dt&&wt?wt([][Symbol.iterator]()):o,"%AsyncFromSyncIteratorPrototype%":o,"%AsyncFunction%":St,"%AsyncGenerator%":St,"%AsyncGeneratorFunction%":St,"%AsyncIteratorPrototype%":St,"%Atomics%":typeof Atomics>"u"?o:Atomics,"%BigInt%":typeof BigInt>"u"?o:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?o:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?o:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?o:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":a,"%Float32Array%":typeof Float32Array>"u"?o:Float32Array,"%Float64Array%":typeof Float64Array>"u"?o:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?o:FinalizationRegistry,"%Function%":nt,"%GeneratorFunction%":St,"%Int8Array%":typeof Int8Array>"u"?o:Int8Array,"%Int16Array%":typeof Int16Array>"u"?o:Int16Array,"%Int32Array%":typeof Int32Array>"u"?o:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dt&&wt?wt(wt([][Symbol.iterator]())):o,"%JSON%":typeof JSON=="object"?JSON:o,"%Map%":typeof Map>"u"?o:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dt||!wt?o:wt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?o:Promise,"%Proxy%":typeof Proxy>"u"?o:Proxy,"%RangeError%":c,"%ReferenceError%":d,"%Reflect%":typeof Reflect>"u"?o:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?o:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dt||!wt?o:wt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?o:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dt&&wt?wt(""[Symbol.iterator]()):o,"%Symbol%":dt?Symbol:o,"%SyntaxError%":h,"%ThrowTypeError%":pt,"%TypedArray%":_t,"%TypeError%":j,"%Uint8Array%":typeof Uint8Array>"u"?o:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?o:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?o:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?o:Uint32Array,"%URIError%":et,"%WeakMap%":typeof WeakMap>"u"?o:WeakMap,"%WeakRef%":typeof WeakRef>"u"?o:WeakRef,"%WeakSet%":typeof WeakSet>"u"?o:WeakSet};if(wt)try{null.error}catch(at){var bt=wt(wt(at));mt["%Error.prototype%"]=bt}var $t=function at(lt){var tt;if(lt==="%AsyncFunction%")tt=st("async function () {}");else if(lt==="%GeneratorFunction%")tt=st("function* () {}");else if(lt==="%AsyncGeneratorFunction%")tt=st("async function* () {}");else if(lt==="%AsyncGenerator%"){var _=at("%AsyncGeneratorFunction%");_&&(tt=_.prototype)}else if(lt==="%AsyncIteratorPrototype%"){var it=at("%AsyncGenerator%");it&&wt&&(tt=wt(it.prototype))}return mt[lt]=tt,tt},Bt={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Dt=requireFunctionBind(),Ht=requireHasown(),qt=Dt.call(Function.call,Array.prototype.concat),Pt=Dt.call(Function.apply,Array.prototype.splice),Gt=Dt.call(Function.call,String.prototype.replace),ct=Dt.call(Function.call,String.prototype.slice),g=Dt.call(Function.call,RegExp.prototype.exec),b=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$=/\\(\\)?/g,_e=function(lt){var tt=ct(lt,0,1),_=ct(lt,-1);if(tt==="%"&&_!=="%")throw new h("invalid intrinsic syntax, expected closing `%`");if(_==="%"&&tt!=="%")throw new h("invalid intrinsic syntax, expected opening `%`");var it=[];return Gt(lt,b,function(yt,vt,Rt,Tt){it[it.length]=Rt?Gt(Tt,$,"$1"):vt||yt}),it},rt=function(lt,tt){var _=lt,it;if(Ht(Bt,_)&&(it=Bt[_],_="%"+it[0]+"%"),Ht(mt,_)){var yt=mt[_];if(yt===St&&(yt=$t(_)),typeof yt>"u"&&!tt)throw new j("intrinsic "+lt+" exists, but is not available. Please file an issue!");return{alias:it,name:_,value:yt}}throw new h("intrinsic "+lt+" does not exist!")};return getIntrinsic=function(lt,tt){if(typeof lt!="string"||lt.length===0)throw new j("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof tt!="boolean")throw new j('"allowMissing" argument must be a boolean');if(g(/^%?[^%]*%?$/,lt)===null)throw new h("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var _=_e(lt),it=_.length>0?_[0]:"",yt=rt("%"+it+"%",tt),vt=yt.name,Rt=yt.value,Tt=!1,Mt=yt.alias;Mt&&(it=Mt[0],Pt(_,qt([0,1],Mt)));for(var At=1,Ot=!0;At<_.length;At+=1){var Ct=_[At],Ut=ct(Ct,0,1),Lt=ct(Ct,-1);if((Ut==='"'||Ut==="'"||Ut==="`"||Lt==='"'||Lt==="'"||Lt==="`")&&Ut!==Lt)throw new h("property names with quotes must have matching quotes");if((Ct==="constructor"||!Ot)&&(Tt=!0),it+="."+Ct,vt="%"+it+"%",Ht(mt,vt))Rt=mt[vt];else if(Rt!=null){if(!(Ct in Rt)){if(!tt)throw new j("base intrinsic for "+lt+" exists, but the property is not available.");return}if(ot&&At+1>=_.length){var Nt=ot(Rt,Ct);Ot=!!Nt,Ot&&"get"in Nt&&!("originalValue"in Nt.get)?Rt=Nt.get:Rt=Rt[Ct]}else Ot=Ht(Rt,Ct),Rt=Rt[Ct];Ot&&!Tt&&(mt[vt]=Rt)}}return Rt},getIntrinsic}var callBind={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var o=requireGetIntrinsic(),e=o("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return esDefineProperty=e,esDefineProperty}var gopd,hasRequiredGopd;function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var o=requireGetIntrinsic(),e=o("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return gopd=e,gopd}var defineDataProperty,hasRequiredDefineDataProperty;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var o=requireEsDefineProperty(),e=requireSyntax(),a=requireType(),c=requireGopd();return defineDataProperty=function(h,j,et){if(!h||typeof h!="object"&&typeof h!="function")throw new a("`obj` must be an object or a function`");if(typeof j!="string"&&typeof j!="symbol")throw new a("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new a("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new a("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new a("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new a("`loose`, if provided, must be a boolean");var nt=arguments.length>3?arguments[3]:null,st=arguments.length>4?arguments[4]:null,ot=arguments.length>5?arguments[5]:null,ht=arguments.length>6?arguments[6]:!1,pt=!!c&&c(h,j);if(o)o(h,j,{configurable:ot===null&&pt?pt.configurable:!ot,enumerable:nt===null&&pt?pt.enumerable:!nt,value:et,writable:st===null&&pt?pt.writable:!st});else if(ht||!nt&&!st&&!ot)h[j]=et;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},defineDataProperty}var hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors;function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var o=requireEsDefineProperty(),e=function(){return!!o};return e.hasArrayLengthDefineBug=function(){if(!o)return null;try{return o([],"length",{value:1}).length!==1}catch{return!0}},hasPropertyDescriptors_1=e,hasPropertyDescriptors_1}var setFunctionLength,hasRequiredSetFunctionLength;function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var o=requireGetIntrinsic(),e=requireDefineDataProperty(),a=requireHasPropertyDescriptors()(),c=requireGopd(),d=requireType(),h=o("%Math.floor%");return setFunctionLength=function(et,nt){if(typeof et!="function")throw new d("`fn` is not a function");if(typeof nt!="number"||nt<0||nt>4294967295||h(nt)!==nt)throw new d("`length` must be a positive 32-bit integer");var st=arguments.length>2&&!!arguments[2],ot=!0,ht=!0;if("length"in et&&c){var pt=c(et,"length");pt&&!pt.configurable&&(ot=!1),pt&&!pt.writable&&(ht=!1)}return(ot||ht||!st)&&(a?e(et,"length",nt,!0,!0):e(et,"length",nt)),et},setFunctionLength}var hasRequiredCallBind;function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,function(o){var e=requireFunctionBind(),a=requireGetIntrinsic(),c=requireSetFunctionLength(),d=requireType(),h=a("%Function.prototype.apply%"),j=a("%Function.prototype.call%"),et=a("%Reflect.apply%",!0)||e.call(j,h),nt=requireEsDefineProperty(),st=a("%Math.max%");o.exports=function(pt){if(typeof pt!="function")throw new d("a function is required");var dt=et(e,j,arguments);return c(dt,1+st(0,pt.length-(arguments.length-1)),!0)};var ot=function(){return et(e,h,arguments)};nt?nt(o.exports,"apply",{value:ot}):o.exports.apply=ot}(callBind)),callBind.exports}var callBound$1,hasRequiredCallBound;function requireCallBound(){if(hasRequiredCallBound)return callBound$1;hasRequiredCallBound=1;var o=requireGetIntrinsic(),e=requireCallBind(),a=e(o("String.prototype.indexOf"));return callBound$1=function(d,h){var j=o(d,!!h);return typeof j=="function"&&a(d,".prototype.")>-1?e(j):j},callBound$1}var isArguments$1,hasRequiredIsArguments;function requireIsArguments(){if(hasRequiredIsArguments)return isArguments$1;hasRequiredIsArguments=1;var o=requireShams()(),e=requireCallBound(),a=e("Object.prototype.toString"),c=function(et){return o&&et&&typeof et=="object"&&Symbol.toStringTag in et?!1:a(et)==="[object Arguments]"},d=function(et){return c(et)?!0:et!==null&&typeof et=="object"&&typeof et.length=="number"&&et.length>=0&&a(et)!=="[object Array]"&&a(et.callee)==="[object Function]"},h=function(){return c(arguments)}();return c.isLegacyArguments=d,isArguments$1=h?c:d,isArguments$1}var isGeneratorFunction,hasRequiredIsGeneratorFunction;function requireIsGeneratorFunction(){if(hasRequiredIsGeneratorFunction)return isGeneratorFunction;hasRequiredIsGeneratorFunction=1;var o=Object.prototype.toString,e=Function.prototype.toString,a=/^\s*(?:function)?\*/,c=requireShams()(),d=Object.getPrototypeOf,h=function(){if(!c)return!1;try{return Function("return function*() {}")()}catch{}},j;return isGeneratorFunction=function(nt){if(typeof nt!="function")return!1;if(a.test(e.call(nt)))return!0;if(!c){var st=o.call(nt);return st==="[object GeneratorFunction]"}if(!d)return!1;if(typeof j>"u"){var ot=h();j=ot?d(ot):!1}return d(nt)===j},isGeneratorFunction}var isCallable,hasRequiredIsCallable;function requireIsCallable(){if(hasRequiredIsCallable)return isCallable;hasRequiredIsCallable=1;var o=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,a,c;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{a=Object.defineProperty({},"length",{get:function(){throw c}}),c={},e(function(){throw 42},null,a)}catch(mt){mt!==c&&(e=null)}else e=null;var d=/^\s*class\b/,h=function(bt){try{var $t=o.call(bt);return d.test($t)}catch{return!1}},j=function(bt){try{return h(bt)?!1:(o.call(bt),!0)}catch{return!1}},et=Object.prototype.toString,nt="[object Object]",st="[object Function]",ot="[object GeneratorFunction]",ht="[object HTMLAllCollection]",pt="[object HTML document.all class]",dt="[object HTMLCollection]",gt=typeof Symbol=="function"&&!!Symbol.toStringTag,wt=!(0 in[,]),St=function(){return!1};if(typeof document=="object"){var _t=document.all;et.call(_t)===et.call(document.all)&&(St=function(bt){if((wt||!bt)&&(typeof bt>"u"||typeof bt=="object"))try{var $t=et.call(bt);return($t===ht||$t===pt||$t===dt||$t===nt)&&bt("")==null}catch{}return!1})}return isCallable=e?function(bt){if(St(bt))return!0;if(!bt||typeof bt!="function"&&typeof bt!="object")return!1;try{e(bt,null,a)}catch($t){if($t!==c)return!1}return!h(bt)&&j(bt)}:function(bt){if(St(bt))return!0;if(!bt||typeof bt!="function"&&typeof bt!="object")return!1;if(gt)return j(bt);if(h(bt))return!1;var $t=et.call(bt);return $t!==st&&$t!==ot&&!/^\[object HTML/.test($t)?!1:j(bt)},isCallable}var forEach_1,hasRequiredForEach;function requireForEach(){if(hasRequiredForEach)return forEach_1;hasRequiredForEach=1;var o=requireIsCallable(),e=Object.prototype.toString,a=Object.prototype.hasOwnProperty,c=function(nt,st,ot){for(var ht=0,pt=nt.length;ht=3&&(ht=ot),e.call(nt)==="[object Array]"?c(nt,st,ht):typeof nt=="string"?d(nt,st,ht):h(nt,st,ht)};return forEach_1=j,forEach_1}var possibleTypedArrayNames,hasRequiredPossibleTypedArrayNames;function requirePossibleTypedArrayNames(){return hasRequiredPossibleTypedArrayNames||(hasRequiredPossibleTypedArrayNames=1,possibleTypedArrayNames=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),possibleTypedArrayNames}var availableTypedArrays,hasRequiredAvailableTypedArrays;function requireAvailableTypedArrays(){if(hasRequiredAvailableTypedArrays)return availableTypedArrays;hasRequiredAvailableTypedArrays=1;var o=requirePossibleTypedArrayNames(),e=globalThis;return availableTypedArrays=function(){for(var c=[],d=0;d-1?_t:_t!=="Object"?!1:gt(St)}return d?dt(St):null},whichTypedArray}var isTypedArray,hasRequiredIsTypedArray;function requireIsTypedArray(){if(hasRequiredIsTypedArray)return isTypedArray;hasRequiredIsTypedArray=1;var o=requireWhichTypedArray();return isTypedArray=function(a){return!!o(a)},isTypedArray}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(o){var e=requireIsArguments(),a=requireIsGeneratorFunction(),c=requireWhichTypedArray(),d=requireIsTypedArray();function h(Vt){return Vt.call.bind(Vt)}var j=typeof BigInt<"u",et=typeof Symbol<"u",nt=h(Object.prototype.toString),st=h(Number.prototype.valueOf),ot=h(String.prototype.valueOf),ht=h(Boolean.prototype.valueOf);if(j)var pt=h(BigInt.prototype.valueOf);if(et)var dt=h(Symbol.prototype.valueOf);function gt(Vt,Ir){if(typeof Vt!="object")return!1;try{return Ir(Vt),!0}catch{return!1}}o.isArgumentsObject=e,o.isGeneratorFunction=a,o.isTypedArray=d;function wt(Vt){return typeof Promise<"u"&&Vt instanceof Promise||Vt!==null&&typeof Vt=="object"&&typeof Vt.then=="function"&&typeof Vt.catch=="function"}o.isPromise=wt;function St(Vt){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(Vt):d(Vt)||vt(Vt)}o.isArrayBufferView=St;function _t(Vt){return c(Vt)==="Uint8Array"}o.isUint8Array=_t;function mt(Vt){return c(Vt)==="Uint8ClampedArray"}o.isUint8ClampedArray=mt;function bt(Vt){return c(Vt)==="Uint16Array"}o.isUint16Array=bt;function $t(Vt){return c(Vt)==="Uint32Array"}o.isUint32Array=$t;function Bt(Vt){return c(Vt)==="Int8Array"}o.isInt8Array=Bt;function Dt(Vt){return c(Vt)==="Int16Array"}o.isInt16Array=Dt;function Ht(Vt){return c(Vt)==="Int32Array"}o.isInt32Array=Ht;function qt(Vt){return c(Vt)==="Float32Array"}o.isFloat32Array=qt;function Pt(Vt){return c(Vt)==="Float64Array"}o.isFloat64Array=Pt;function Gt(Vt){return c(Vt)==="BigInt64Array"}o.isBigInt64Array=Gt;function ct(Vt){return c(Vt)==="BigUint64Array"}o.isBigUint64Array=ct;function g(Vt){return nt(Vt)==="[object Map]"}g.working=typeof Map<"u"&&g(new Map);function b(Vt){return typeof Map>"u"?!1:g.working?g(Vt):Vt instanceof Map}o.isMap=b;function $(Vt){return nt(Vt)==="[object Set]"}$.working=typeof Set<"u"&&$(new Set);function _e(Vt){return typeof Set>"u"?!1:$.working?$(Vt):Vt instanceof Set}o.isSet=_e;function rt(Vt){return nt(Vt)==="[object WeakMap]"}rt.working=typeof WeakMap<"u"&&rt(new WeakMap);function at(Vt){return typeof WeakMap>"u"?!1:rt.working?rt(Vt):Vt instanceof WeakMap}o.isWeakMap=at;function lt(Vt){return nt(Vt)==="[object WeakSet]"}lt.working=typeof WeakSet<"u"&<(new WeakSet);function tt(Vt){return lt(Vt)}o.isWeakSet=tt;function _(Vt){return nt(Vt)==="[object ArrayBuffer]"}_.working=typeof ArrayBuffer<"u"&&_(new ArrayBuffer);function it(Vt){return typeof ArrayBuffer>"u"?!1:_.working?_(Vt):Vt instanceof ArrayBuffer}o.isArrayBuffer=it;function yt(Vt){return nt(Vt)==="[object DataView]"}yt.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&yt(new DataView(new ArrayBuffer(1),0,1));function vt(Vt){return typeof DataView>"u"?!1:yt.working?yt(Vt):Vt instanceof DataView}o.isDataView=vt;var Rt=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Tt(Vt){return nt(Vt)==="[object SharedArrayBuffer]"}function Mt(Vt){return typeof Rt>"u"?!1:(typeof Tt.working>"u"&&(Tt.working=Tt(new Rt)),Tt.working?Tt(Vt):Vt instanceof Rt)}o.isSharedArrayBuffer=Mt;function At(Vt){return nt(Vt)==="[object AsyncFunction]"}o.isAsyncFunction=At;function Ot(Vt){return nt(Vt)==="[object Map Iterator]"}o.isMapIterator=Ot;function Ct(Vt){return nt(Vt)==="[object Set Iterator]"}o.isSetIterator=Ct;function Ut(Vt){return nt(Vt)==="[object Generator]"}o.isGeneratorObject=Ut;function Lt(Vt){return nt(Vt)==="[object WebAssembly.Module]"}o.isWebAssemblyCompiledModule=Lt;function Nt(Vt){return gt(Vt,st)}o.isNumberObject=Nt;function Kt(Vt){return gt(Vt,ot)}o.isStringObject=Kt;function yr(Vt){return gt(Vt,ht)}o.isBooleanObject=yr;function Xt(Vt){return j&>(Vt,pt)}o.isBigIntObject=Xt;function Jt(Vt){return et&>(Vt,dt)}o.isSymbolObject=Jt;function Ar(Vt){return Nt(Vt)||Kt(Vt)||yr(Vt)||Xt(Vt)||Jt(Vt)}o.isBoxedPrimitive=Ar;function er(Vt){return typeof Uint8Array<"u"&&(it(Vt)||Mt(Vt))}o.isAnyArrayBuffer=er,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(Vt){Object.defineProperty(o,Vt,{enumerable:!1,value:function(){throw new Error(Vt+" is not supported in userland")}})})}(types)),types}var isBufferBrowser,hasRequiredIsBufferBrowser;function requireIsBufferBrowser(){return hasRequiredIsBufferBrowser||(hasRequiredIsBufferBrowser=1,isBufferBrowser=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),isBufferBrowser}var inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(e,a){a&&(e.super_=a,e.prototype=Object.create(a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(e,a){if(a){e.super_=a;var c=function(){};c.prototype=a.prototype,e.prototype=new c,e.prototype.constructor=e}};var inherits_browserExports=inherits_browser.exports,hasRequiredUtil;function requireUtil(){return hasRequiredUtil||(hasRequiredUtil=1,function(o){var e={},a=Object.getOwnPropertyDescriptors||function(Rt){for(var Tt=Object.keys(Rt),Mt={},At=0;At=At)return Ut;switch(Ut){case"%s":return String(Mt[Tt++]);case"%d":return Number(Mt[Tt++]);case"%j":try{return JSON.stringify(Mt[Tt++])}catch{return"[Circular]"}default:return Ut}}),Ct=Mt[Tt];Tt"u")return function(){return o.deprecate(vt,Rt).apply(this,arguments)};var Tt=!1;function Mt(){if(!Tt){if(process$1.throwDeprecation)throw new Error(Rt);process$1.traceDeprecation?console.trace(Rt):console.error(Rt),Tt=!0}return vt.apply(this,arguments)}return Mt};var d={},h=/^$/;if(e.NODE_DEBUG){var j=e.NODE_DEBUG;j=j.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),h=new RegExp("^"+j+"$","i")}o.debuglog=function(vt){if(vt=vt.toUpperCase(),!d[vt])if(h.test(vt)){var Rt=process$1.pid;d[vt]=function(){var Tt=o.format.apply(o,arguments);console.error("%s %d: %s",vt,Rt,Tt)}}else d[vt]=function(){};return d[vt]};function et(vt,Rt){var Tt={seen:[],stylize:st};return arguments.length>=3&&(Tt.depth=arguments[2]),arguments.length>=4&&(Tt.colors=arguments[3]),mt(Rt)?Tt.showHidden=Rt:Rt&&o._extend(Tt,Rt),qt(Tt.showHidden)&&(Tt.showHidden=!1),qt(Tt.depth)&&(Tt.depth=2),qt(Tt.colors)&&(Tt.colors=!1),qt(Tt.customInspect)&&(Tt.customInspect=!0),Tt.colors&&(Tt.stylize=nt),ht(Tt,vt,Tt.depth)}o.inspect=et,et.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},et.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function nt(vt,Rt){var Tt=et.styles[Rt];return Tt?"\x1B["+et.colors[Tt][0]+"m"+vt+"\x1B["+et.colors[Tt][1]+"m":vt}function st(vt,Rt){return vt}function ot(vt){var Rt={};return vt.forEach(function(Tt,Mt){Rt[Tt]=!0}),Rt}function ht(vt,Rt,Tt){if(vt.customInspect&&Rt&&b(Rt.inspect)&&Rt.inspect!==o.inspect&&!(Rt.constructor&&Rt.constructor.prototype===Rt)){var Mt=Rt.inspect(Tt,vt);return Dt(Mt)||(Mt=ht(vt,Mt,Tt)),Mt}var At=pt(vt,Rt);if(At)return At;var Ot=Object.keys(Rt),Ct=ot(Ot);if(vt.showHidden&&(Ot=Object.getOwnPropertyNames(Rt)),g(Rt)&&(Ot.indexOf("message")>=0||Ot.indexOf("description")>=0))return dt(Rt);if(Ot.length===0){if(b(Rt)){var Ut=Rt.name?": "+Rt.name:"";return vt.stylize("[Function"+Ut+"]","special")}if(Pt(Rt))return vt.stylize(RegExp.prototype.toString.call(Rt),"regexp");if(ct(Rt))return vt.stylize(Date.prototype.toString.call(Rt),"date");if(g(Rt))return dt(Rt)}var Lt="",Nt=!1,Kt=["{","}"];if(_t(Rt)&&(Nt=!0,Kt=["[","]"]),b(Rt)){var yr=Rt.name?": "+Rt.name:"";Lt=" [Function"+yr+"]"}if(Pt(Rt)&&(Lt=" "+RegExp.prototype.toString.call(Rt)),ct(Rt)&&(Lt=" "+Date.prototype.toUTCString.call(Rt)),g(Rt)&&(Lt=" "+dt(Rt)),Ot.length===0&&(!Nt||Rt.length==0))return Kt[0]+Lt+Kt[1];if(Tt<0)return Pt(Rt)?vt.stylize(RegExp.prototype.toString.call(Rt),"regexp"):vt.stylize("[Object]","special");vt.seen.push(Rt);var Xt;return Nt?Xt=gt(vt,Rt,Tt,Ct,Ot):Xt=Ot.map(function(Jt){return wt(vt,Rt,Tt,Ct,Jt,Nt)}),vt.seen.pop(),St(Xt,Lt,Kt)}function pt(vt,Rt){if(qt(Rt))return vt.stylize("undefined","undefined");if(Dt(Rt)){var Tt="'"+JSON.stringify(Rt).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return vt.stylize(Tt,"string")}if(Bt(Rt))return vt.stylize(""+Rt,"number");if(mt(Rt))return vt.stylize(""+Rt,"boolean");if(bt(Rt))return vt.stylize("null","null")}function dt(vt){return"["+Error.prototype.toString.call(vt)+"]"}function gt(vt,Rt,Tt,Mt,At){for(var Ot=[],Ct=0,Ut=Rt.length;Ct-1&&(Ot?Ut=Ut.split(` +`).map(function(Nt){return" "+Nt}).join(` +`).slice(2):Ut=` +`+Ut.split(` +`).map(function(Nt){return" "+Nt}).join(` +`))):Ut=vt.stylize("[Circular]","special")),qt(Ct)){if(Ot&&At.match(/^\d+$/))return Ut;Ct=JSON.stringify(""+At),Ct.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Ct=Ct.slice(1,-1),Ct=vt.stylize(Ct,"name")):(Ct=Ct.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Ct=vt.stylize(Ct,"string"))}return Ct+": "+Ut}function St(vt,Rt,Tt){var Mt=vt.reduce(function(At,Ot){return Ot.indexOf(` +`)>=0,At+Ot.replace(/\u001b\[\d\d?m/g,"").length+1},0);return Mt>60?Tt[0]+(Rt===""?"":Rt+` + `)+" "+vt.join(`, + `)+" "+Tt[1]:Tt[0]+Rt+" "+vt.join(", ")+" "+Tt[1]}o.types=requireTypes();function _t(vt){return Array.isArray(vt)}o.isArray=_t;function mt(vt){return typeof vt=="boolean"}o.isBoolean=mt;function bt(vt){return vt===null}o.isNull=bt;function $t(vt){return vt==null}o.isNullOrUndefined=$t;function Bt(vt){return typeof vt=="number"}o.isNumber=Bt;function Dt(vt){return typeof vt=="string"}o.isString=Dt;function Ht(vt){return typeof vt=="symbol"}o.isSymbol=Ht;function qt(vt){return vt===void 0}o.isUndefined=qt;function Pt(vt){return Gt(vt)&&_e(vt)==="[object RegExp]"}o.isRegExp=Pt,o.types.isRegExp=Pt;function Gt(vt){return typeof vt=="object"&&vt!==null}o.isObject=Gt;function ct(vt){return Gt(vt)&&_e(vt)==="[object Date]"}o.isDate=ct,o.types.isDate=ct;function g(vt){return Gt(vt)&&(_e(vt)==="[object Error]"||vt instanceof Error)}o.isError=g,o.types.isNativeError=g;function b(vt){return typeof vt=="function"}o.isFunction=b;function $(vt){return vt===null||typeof vt=="boolean"||typeof vt=="number"||typeof vt=="string"||typeof vt=="symbol"||typeof vt>"u"}o.isPrimitive=$,o.isBuffer=requireIsBufferBrowser();function _e(vt){return Object.prototype.toString.call(vt)}function rt(vt){return vt<10?"0"+vt.toString(10):vt.toString(10)}var at=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function lt(){var vt=new Date,Rt=[rt(vt.getHours()),rt(vt.getMinutes()),rt(vt.getSeconds())].join(":");return[vt.getDate(),at[vt.getMonth()],Rt].join(" ")}o.log=function(){console.log("%s - %s",lt(),o.format.apply(o,arguments))},o.inherits=inherits_browserExports,o._extend=function(vt,Rt){if(!Rt||!Gt(Rt))return vt;for(var Tt=Object.keys(Rt),Mt=Tt.length;Mt--;)vt[Tt[Mt]]=Rt[Tt[Mt]];return vt};function tt(vt,Rt){return Object.prototype.hasOwnProperty.call(vt,Rt)}var _=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;o.promisify=function(Rt){if(typeof Rt!="function")throw new TypeError('The "original" argument must be of type Function');if(_&&Rt[_]){var Tt=Rt[_];if(typeof Tt!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Tt,_,{value:Tt,enumerable:!1,writable:!1,configurable:!0}),Tt}function Tt(){for(var Mt,At,Ot=new Promise(function(Lt,Nt){Mt=Lt,At=Nt}),Ct=[],Ut=0;Ut"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function st(mt){return st=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},st(mt)}var ot={},ht,pt;function dt(mt,bt,$t){$t||($t=Error);function Bt(Ht,qt,Pt){return typeof bt=="string"?bt:bt(Ht,qt,Pt)}var Dt=function(Ht){c(Pt,Ht);var qt=h(Pt);function Pt(Gt,ct,g){var b;return a(this,Pt),b=qt.call(this,Bt(Gt,ct,g)),b.code=mt,b}return e(Pt)}($t);ot[mt]=Dt}function gt(mt,bt){if(Array.isArray(mt)){var $t=mt.length;return mt=mt.map(function(Bt){return String(Bt)}),$t>2?"one of ".concat(bt," ").concat(mt.slice(0,$t-1).join(", "),", or ")+mt[$t-1]:$t===2?"one of ".concat(bt," ").concat(mt[0]," or ").concat(mt[1]):"of ".concat(bt," ").concat(mt[0])}else return"of ".concat(bt," ").concat(String(mt))}function wt(mt,bt,$t){return mt.substr(0,bt.length)===bt}function St(mt,bt,$t){return($t===void 0||$t>mt.length)&&($t=mt.length),mt.substring($t-bt.length,$t)===bt}function _t(mt,bt,$t){return typeof $t!="number"&&($t=0),$t+bt.length>mt.length?!1:mt.indexOf(bt,$t)!==-1}return dt("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),dt("ERR_INVALID_ARG_TYPE",function(mt,bt,$t){ht===void 0&&(ht=requireAssert()),ht(typeof mt=="string","'name' must be a string");var Bt;typeof bt=="string"&&wt(bt,"not ")?(Bt="must not be",bt=bt.replace(/^not /,"")):Bt="must be";var Dt;if(St(mt," argument"))Dt="The ".concat(mt," ").concat(Bt," ").concat(gt(bt,"type"));else{var Ht=_t(mt,".")?"property":"argument";Dt='The "'.concat(mt,'" ').concat(Ht," ").concat(Bt," ").concat(gt(bt,"type"))}return Dt+=". Received type ".concat(o($t)),Dt},TypeError),dt("ERR_INVALID_ARG_VALUE",function(mt,bt){var $t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";pt===void 0&&(pt=requireUtil());var Bt=pt.inspect(bt);return Bt.length>128&&(Bt="".concat(Bt.slice(0,128),"...")),"The argument '".concat(mt,"' ").concat($t,". Received ").concat(Bt)},TypeError),dt("ERR_INVALID_RETURN_VALUE",function(mt,bt,$t){var Bt;return $t&&$t.constructor&&$t.constructor.name?Bt="instance of ".concat($t.constructor.name):Bt="type ".concat(o($t)),"Expected ".concat(mt,' to be returned from the "').concat(bt,'"')+" function but got ".concat(Bt,".")},TypeError),dt("ERR_MISSING_ARGS",function(){for(var mt=arguments.length,bt=new Array(mt),$t=0;$t0,"At least one arg needs to be specified");var Bt="The ",Dt=bt.length;switch(bt=bt.map(function(Ht){return'"'.concat(Ht,'"')}),Dt){case 1:Bt+="".concat(bt[0]," argument");break;case 2:Bt+="".concat(bt[0]," and ").concat(bt[1]," arguments");break;default:Bt+=bt.slice(0,Dt-1).join(", "),Bt+=", and ".concat(bt[Dt-1]," arguments");break}return"".concat(Bt," must be specified")},TypeError),errors.codes=ot,errors}var assertion_error,hasRequiredAssertion_error;function requireAssertion_error(){if(hasRequiredAssertion_error)return assertion_error;hasRequiredAssertion_error=1;function o(tt,_){var it=Object.keys(tt);if(Object.getOwnPropertySymbols){var yt=Object.getOwnPropertySymbols(tt);_&&(yt=yt.filter(function(vt){return Object.getOwnPropertyDescriptor(tt,vt).enumerable})),it.push.apply(it,yt)}return it}function e(tt){for(var _=1;_"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function wt(tt){return Function.toString.call(tt).indexOf("[native code]")!==-1}function St(tt,_){return St=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(yt,vt){return yt.__proto__=vt,yt},St(tt,_)}function _t(tt){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(it){return it.__proto__||Object.getPrototypeOf(it)},_t(tt)}function mt(tt){"@babel/helpers - typeof";return mt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},mt(tt)}var bt=requireUtil(),$t=bt.inspect,Bt=requireErrors(),Dt=Bt.codes.ERR_INVALID_ARG_TYPE;function Ht(tt,_,it){return(it===void 0||it>tt.length)&&(it=tt.length),tt.substring(it-_.length,it)===_}function qt(tt,_){if(_=Math.floor(_),tt.length==0||_==0)return"";var it=tt.length*_;for(_=Math.floor(Math.log(_)/Math.log(2));_;)tt+=tt,_--;return tt+=tt.substring(0,it-tt.length),tt}var Pt="",Gt="",ct="",g="",b={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},$=10;function _e(tt){var _=Object.keys(tt),it=Object.create(Object.getPrototypeOf(tt));return _.forEach(function(yt){it[yt]=tt[yt]}),Object.defineProperty(it,"message",{value:tt.message}),it}function rt(tt){return $t(tt,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function at(tt,_,it){var yt="",vt="",Rt=0,Tt="",Mt=!1,At=rt(tt),Ot=At.split(` +`),Ct=rt(_).split(` +`),Ut=0,Lt="";if(it==="strictEqual"&&mt(tt)==="object"&&mt(_)==="object"&&tt!==null&&_!==null&&(it="strictEqualObject"),Ot.length===1&&Ct.length===1&&Ot[0]!==Ct[0]){var Nt=Ot[0].length+Ct[0].length;if(Nt<=$){if((mt(tt)!=="object"||tt===null)&&(mt(_)!=="object"||_===null)&&(tt!==0||_!==0))return"".concat(b[it],` + +`)+"".concat(Ot[0]," !== ").concat(Ct[0],` +`)}else if(it!=="strictEqualObject"){var Kt=process$1.stderr&&process$1.stderr.isTTY?process$1.stderr.columns:80;if(Nt2&&(Lt=` + `.concat(qt(" ",Ut),"^"),Ut=0)}}}for(var yr=Ot[Ot.length-1],Xt=Ct[Ct.length-1];yr===Xt&&(Ut++<2?Tt=` + `.concat(yr).concat(Tt):yt=yr,Ot.pop(),Ct.pop(),!(Ot.length===0||Ct.length===0));)yr=Ot[Ot.length-1],Xt=Ct[Ct.length-1];var Jt=Math.max(Ot.length,Ct.length);if(Jt===0){var Ar=At.split(` +`);if(Ar.length>30)for(Ar[26]="".concat(Pt,"...").concat(g);Ar.length>27;)Ar.pop();return"".concat(b.notIdentical,` + +`).concat(Ar.join(` +`),` +`)}Ut>3&&(Tt=` +`.concat(Pt,"...").concat(g).concat(Tt),Mt=!0),yt!==""&&(Tt=` + `.concat(yt).concat(Tt),yt="");var er=0,Vt=b[it]+` +`.concat(Gt,"+ actual").concat(g," ").concat(ct,"- expected").concat(g),Ir=" ".concat(Pt,"...").concat(g," Lines skipped");for(Ut=0;Ut1&&Ut>2&&(nr>4?(vt+=` +`.concat(Pt,"...").concat(g),Mt=!0):nr>3&&(vt+=` + `.concat(Ct[Ut-2]),er++),vt+=` + `.concat(Ct[Ut-1]),er++),Rt=Ut,yt+=` +`.concat(ct,"-").concat(g," ").concat(Ct[Ut]),er++;else if(Ct.length1&&Ut>2&&(nr>4?(vt+=` +`.concat(Pt,"...").concat(g),Mt=!0):nr>3&&(vt+=` + `.concat(Ot[Ut-2]),er++),vt+=` + `.concat(Ot[Ut-1]),er++),Rt=Ut,vt+=` +`.concat(Gt,"+").concat(g," ").concat(Ot[Ut]),er++;else{var or=Ct[Ut],xr=Ot[Ut],Ft=xr!==or&&(!Ht(xr,",")||xr.slice(0,-1)!==or);Ft&&Ht(or,",")&&or.slice(0,-1)===xr&&(Ft=!1,xr+=","),Ft?(nr>1&&Ut>2&&(nr>4?(vt+=` +`.concat(Pt,"...").concat(g),Mt=!0):nr>3&&(vt+=` + `.concat(Ot[Ut-2]),er++),vt+=` + `.concat(Ot[Ut-1]),er++),Rt=Ut,vt+=` +`.concat(Gt,"+").concat(g," ").concat(xr),yt+=` +`.concat(ct,"-").concat(g," ").concat(or),er+=2):(vt+=yt,yt="",(nr===1||Ut===0)&&(vt+=` + `.concat(xr),er++))}if(er>20&&Ut30)for(Nt[26]="".concat(Pt,"...").concat(g);Nt.length>27;)Nt.pop();Nt.length===1?Rt=it.call(this,"".concat(Lt," ").concat(Nt[0])):Rt=it.call(this,"".concat(Lt,` + +`).concat(Nt.join(` +`),` +`))}else{var Kt=rt(Ot),yr="",Xt=b[Mt];Mt==="notDeepEqual"||Mt==="notEqual"?(Kt="".concat(b[Mt],` + +`).concat(Kt),Kt.length>1024&&(Kt="".concat(Kt.slice(0,1021),"..."))):(yr="".concat(rt(Ct)),Kt.length>512&&(Kt="".concat(Kt.slice(0,509),"...")),yr.length>512&&(yr="".concat(yr.slice(0,509),"...")),Mt==="deepEqual"||Mt==="equal"?Kt="".concat(Xt,` + +`).concat(Kt,` + +should equal + +`):yr=" ".concat(Mt," ").concat(yr)),Rt=it.call(this,"".concat(Kt).concat(yr))}return Error.stackTraceLimit=Ut,Rt.generatedMessage=!Tt,Object.defineProperty(ht(Rt),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),Rt.code="ERR_ASSERTION",Rt.actual=Ot,Rt.expected=Ct,Rt.operator=Mt,Error.captureStackTrace&&Error.captureStackTrace(ht(Rt),At),Rt.stack,Rt.name="AssertionError",ot(Rt)}return h(yt,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:_,value:function(Rt,Tt){return $t(this,e(e({},Tt),{},{customInspect:!1,depth:0}))}}]),yt}(pt(Error),$t.custom);return assertion_error=lt,assertion_error}var toStr=Object.prototype.toString,isArguments=function o(e){var a=toStr.call(e),c=a==="[object Arguments]";return c||(c=a!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&toStr.call(e.callee)==="[object Function]"),c},implementation$5,hasRequiredImplementation$1;function requireImplementation$1(){if(hasRequiredImplementation$1)return implementation$5;hasRequiredImplementation$1=1;var o;if(!Object.keys){var e=Object.prototype.hasOwnProperty,a=Object.prototype.toString,c=isArguments,d=Object.prototype.propertyIsEnumerable,h=!d.call({toString:null},"toString"),j=d.call(function(){},"prototype"),et=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],nt=function(pt){var dt=pt.constructor;return dt&&dt.prototype===pt},st={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},ot=function(){if(typeof window>"u")return!1;for(var pt in window)try{if(!st["$"+pt]&&e.call(window,pt)&&window[pt]!==null&&typeof window[pt]=="object")try{nt(window[pt])}catch{return!0}}catch{return!0}return!1}(),ht=function(pt){if(typeof window>"u"||!ot)return nt(pt);try{return nt(pt)}catch{return!1}};o=function(dt){var gt=dt!==null&&typeof dt=="object",wt=a.call(dt)==="[object Function]",St=c(dt),_t=gt&&a.call(dt)==="[object String]",mt=[];if(!gt&&!wt&&!St)throw new TypeError("Object.keys called on a non-object");var bt=j&&wt;if(_t&&dt.length>0&&!e.call(dt,0))for(var $t=0;$t0)for(var Bt=0;Bt2?arguments[2]:{},pt=o(ot);e&&(pt=c.call(pt,Object.getOwnPropertySymbols(ot)));for(var dt=0;dtFt.length)&&(jt=Ft.length);for(var Rr=0,Yt=new Array(jt);Rr10)return!0;for(var jt=0;jt57)return!0}return Ft.length===10&&Ft>=Math.pow(2,32)}function lt(Ft){return Object.keys(Ft).filter(at).concat(ht(Ft).filter(Object.prototype.propertyIsEnumerable.bind(Ft)))}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */function tt(Ft,jt){if(Ft===jt)return 0;for(var Rr=Ft.length,Yt=jt.length,Zt=0,$r=Math.min(Rr,Yt);Zt<$r;++Zt)if(Ft[Zt]!==jt[Zt]){Rr=Ft[Zt],Yt=jt[Zt];break}return Rr1?Mt-1:0),Ot=1;Ot1?Mt-1:0),Ot=1;Ot1?Mt-1:0),Ot=1;Ot1?Mt-1:0),Ot=1;Ot{var nt;return(nt=c)!=null?nt:c=[e,...a()]}}}function isIterable(o){return isObject$1(o)&&typeof o[Symbol.iterator]=="function"}function isObject$1(o){return typeof o=="object"&&o!=null}function print(o){return typeof o=="string"?JSON.stringify(o):""+o}function shiftIterator(o){const{done:e,value:a}=o.next();return e?void 0:a}function toFailure(o,e,a,c){if(o===!0)return;o===!1?o={}:typeof o=="string"&&(o={message:o});const{path:d,branch:h}=e,{type:j}=a,{refinement:et,message:nt="Expected a value of type `"+j+"`"+(et?" with refinement `"+et+"`":"")+", but received: `"+print(c)+"`"}=o;return{value:c,type:j,refinement:et,key:d[d.length-1],path:d,branch:h,...o,message:nt}}function*toFailures(o,e,a,c){isIterable(o)||(o=[o]);for(const d of o){const h=toFailure(d,e,a,c);h&&(yield h)}}function*run(o,e,a){a===void 0&&(a={});const{path:c=[],branch:d=[o],coerce:h=!1,mask:j=!1}=a,et={path:c,branch:d};if(h&&(o=e.coercer(o,et),j&&e.type!=="type"&&isObject$1(e.schema)&&isObject$1(o)&&!Array.isArray(o)))for(const st in o)e.schema[st]===void 0&&delete o[st];let nt=!0;for(const st of e.validator(o,et))nt=!1,yield[st,void 0];for(let[st,ot,ht]of e.entries(o,et)){const pt=run(ot,ht,{path:st===void 0?c:[...c,st],branch:st===void 0?d:[...d,ot],coerce:h,mask:j});for(const dt of pt)dt[0]?(nt=!1,yield[dt[0],void 0]):h&&(ot=dt[1],st===void 0?o=ot:o instanceof Map?o.set(st,ot):o instanceof Set?o.add(ot):isObject$1(o)&&(o[st]=ot))}if(nt)for(const st of e.refiner(o,et))nt=!1,yield[st,void 0];nt&&(yield[void 0,o])}class Struct{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:a,schema:c,validator:d,refiner:h,coercer:j=nt=>nt,entries:et=function*(){}}=e;this.type=a,this.schema=c,this.entries=et,this.coercer=j,d?this.validator=(nt,st)=>{const ot=d(nt,st);return toFailures(ot,st,this,nt)}:this.validator=()=>[],h?this.refiner=(nt,st)=>{const ot=h(nt,st);return toFailures(ot,st,this,nt)}:this.refiner=()=>[]}assert(e){return assert$j(e,this)}create(e){return create(e,this)}is(e){return is(e,this)}mask(e){return mask(e,this)}validate(e,a){return a===void 0&&(a={}),validate(e,this,a)}}function assert$j(o,e){const a=validate(o,e);if(a[0])throw a[0]}function create(o,e){const a=validate(o,e,{coerce:!0});if(a[0])throw a[0];return a[1]}function mask(o,e){const a=validate(o,e,{coerce:!0,mask:!0});if(a[0])throw a[0];return a[1]}function is(o,e){return!validate(o,e)[0]}function validate(o,e,a){a===void 0&&(a={});const c=run(o,e,a),d=shiftIterator(c);return d[0]?[new StructError(d[0],function*(){for(const j of c)j[0]&&(yield j[0])}),void 0]:[void 0,d[1]]}function define(o,e){return new Struct({type:o,schema:null,validator:e})}function any(){return define("any",()=>!0)}function array(o){return new Struct({type:"array",schema:o,*entries(e){if(o&&Array.isArray(e))for(const[a,c]of e.entries())yield[a,c,o]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+print(e)}})}function boolean(){return define("boolean",o=>typeof o=="boolean")}function literal(o){const e=print(o);return new Struct({type:"literal",schema:o,validator(a){return a===o||"Expected the literal `"+e+"`, but received: "+print(a)}})}function nullable(o){return new Struct({...o,validator:(e,a)=>e===null||o.validator(e,a),refiner:(e,a)=>e===null||o.refiner(e,a)})}function number(){return define("number",o=>typeof o=="number"&&!isNaN(o)||"Expected a number, but received: "+print(o))}function optional(o){return new Struct({...o,validator:(e,a)=>e===void 0||o.validator(e,a),refiner:(e,a)=>e===void 0||o.refiner(e,a)})}function string(){return define("string",o=>typeof o=="string"||"Expected a string, but received: "+print(o))}function type(o){const e=Object.keys(o);return new Struct({type:"type",schema:o,*entries(a){if(isObject$1(a))for(const c of e)yield[c,a[c],o[c]]},validator(a){return isObject$1(a)||"Expected an object, but received: "+print(a)}})}function union$1(o){const e=o.map(a=>a.type).join(" | ");return new Struct({type:"union",schema:null,coercer(a,c){return(o.find(h=>{const[j]=h.validate(a,{coerce:!0});return!j})||unknown()).coercer(a,c)},validator(a,c){const d=[];for(const h of o){const[...j]=run(a,h,c),[et]=j;if(et[0])for(const[nt]of j)nt&&d.push(nt);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+print(a),...d]}})}function unknown(){return define("unknown",()=>!0)}function coerce(o,e,a){return new Struct({...o,coercer:(c,d)=>is(c,e)?o.coercer(a(c,d),d):o.coercer(c,d)})}function jsonRpcResult(o){return coerce(createRpcResult(o),UnknownRpcResult,e=>"error"in e?e:{...e,result:create(e.result,o)})}const UnknownRpcResult=createRpcResult(unknown());function createRpcResult(o){return union$1([type({jsonrpc:literal("2.0"),id:string(),result:o}),type({jsonrpc:literal("2.0"),id:string(),error:type({code:unknown(),message:string(),data:optional(any())})})])}function jsonRpcResultAndContext(o){return jsonRpcResult(type({context:type({slot:number()}),value:o}))}jsonRpcResultAndContext(type({err:nullable(union$1([type({}),string()])),logs:nullable(array(string())),accounts:optional(nullable(array(nullable(type({executable:boolean(),owner:string(),lamports:number(),data:array(string()),rentEpoch:optional(number())}))))),unitsConsumed:optional(number())}));var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};class Layout{constructor(e,a){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=a}makeDestinationObject(){return{}}decode(e,a){throw new Error("Layout is abstract")}encode(e,a,c){throw new Error("Layout is abstract")}getSpan(e,a){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const a=Object.create(this.constructor.prototype);return Object.assign(a,this),a.property=e,a}fromArray(e){}}var Layout_2=Layout;function nameWithProperty(o,e){return e.property?o+"["+e.property+"]":o}class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}class OffsetLayout extends ExternalLayout{constructor(e,a,c){if(!(e instanceof Layout))throw new TypeError("layout must be a Layout");if(a===void 0)a=0;else if(!Number.isInteger(a))throw new TypeError("offset must be integer or undefined");super(e.span,c||e.property),this.layout=e,this.offset=a}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(e,a){return a===void 0&&(a=0),this.layout.decode(e,a+this.offset)}encode(e,a,c){return c===void 0&&(c=0),this.layout.encode(e,a,c+this.offset)}}class UInt extends Layout{constructor(e,a){if(super(e,a),6h&&j instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof a=="boolean"&&c===void 0&&(c=a,a=void 0);for(const h of e)if(0>h.span&&h.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let d=-1;try{d=e.reduce((h,j)=>h+j.getSpan(),0)}catch{}super(d,a),this.fields=e,this.decodePrefixes=!!c}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let c=0;try{c=this.fields.reduce((d,h)=>{const j=h.getSpan(e,a);return a+=j,d+j},0)}catch{throw new RangeError("indeterminate span")}return c}decode(e,a){a===void 0&&(a=0);const c=this.makeDestinationObject();for(const d of this.fields)if(d.property!==void 0&&(c[d.property]=d.decode(e,a)),a+=d.getSpan(e,a),this.decodePrefixes&&e.length===a)break;return c}encode(e,a,c){c===void 0&&(c=0);const d=c;let h=0,j=0;for(const et of this.fields){let nt=et.span;if(j=0nt&&(nt=et.getSpan(a,c)))}h=c,c+=nt}return h+j-d}fromArray(e){const a=this.makeDestinationObject();for(const c of this.fields)c.property!==void 0&&0c.span?a=-1:0<=a&&(a+=c.span)}}}class UnionDiscriminator{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(e,a){if(!(e instanceof ExternalLayout&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(a||e.property||"variant"),this.layout=e}decode(e,a){return this.layout.decode(e,a)}encode(e,a,c){return this.layout.encode(e,a,c)}}class Union extends Layout{constructor(e,a,c){const d=e instanceof UInt||e instanceof UIntBE;if(d)e=new UnionLayoutDiscriminator(new OffsetLayout(e));else if(e instanceof ExternalLayout&&e.isCount())e=new UnionLayoutDiscriminator(e);else if(!(e instanceof UnionDiscriminator))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(a===void 0&&(a=null),!(a===null||a instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(a!==null){if(0>a.span)throw new Error("defaultLayout must have constant span");a.property===void 0&&(a=a.replicate("content"))}let h=-1;a&&(h=a.span,0<=h&&d&&(h+=e.layout.span)),super(h,c),this.discriminator=e,this.usesPrefixDiscriminator=d,this.defaultLayout=a,this.registry={};let j=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(et){return j(et)},this.configGetSourceVariant=function(et){j=et.bind(this)}}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);const c=this.getVariant(e,a);if(!c)throw new Error("unable to determine span for unrecognized variant");return c.getSpan(e,a)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const a=this.registry[e[this.discriminator.property]];if(a&&(!a.layout||e.hasOwnProperty(a.property)))return a}else for(const a in this.registry){const c=this.registry[a];if(e.hasOwnProperty(c.property))return c}throw new Error("unable to infer src variant")}decode(e,a){a===void 0&&(a=0);let c;const d=this.discriminator,h=d.decode(e,a);let j=this.registry[h];if(j===void 0){let et=0;j=this.defaultLayout,this.usesPrefixDiscriminator&&(et=d.layout.span),c=this.makeDestinationObject(),c[d.property]=h,c[j.property]=this.defaultLayout.decode(e,a+et)}else c=j.decode(e,a);return c}encode(e,a,c){c===void 0&&(c=0);const d=this.getSourceVariant(e);if(d===void 0){const h=this.discriminator,j=this.defaultLayout;let et=0;return this.usesPrefixDiscriminator&&(et=h.layout.span),h.encode(e[h.property],a,c),et+j.encode(e[j.property],a,c+et)}return d.encode(e,a,c)}addVariant(e,a,c){const d=new VariantLayout(this,e,a,c);return this.registry[e]=d,d}getVariant(e,a){let c=e;return Buffer$1$1.isBuffer(e)&&(a===void 0&&(a=0),c=this.discriminator.decode(e,a)),this.registry[c]}}class VariantLayout extends Layout{constructor(e,a,c,d){if(!(e instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(a)||0>a)throw new TypeError("variant must be a (non-negative) integer");if(typeof c=="string"&&d===void 0&&(d=c,c=null),c){if(!(c instanceof Layout))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=c.span&&c.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof d!="string")throw new TypeError("variant must have a String property")}let h=e.span;0>e.span&&(h=c?c.span:0,0<=h&&e.usesPrefixDiscriminator&&(h+=e.discriminator.layout.span)),super(h,d),this.union=e,this.variant=a,this.layout=c||null}getSpan(e,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let c=0;return this.union.usesPrefixDiscriminator&&(c=this.union.discriminator.layout.span),c+this.layout.getSpan(e,a+c)}decode(e,a){const c=this.makeDestinationObject();if(a===void 0&&(a=0),this!==this.union.getVariant(e,a))throw new Error("variant mismatch");let d=0;return this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout?c[this.property]=this.layout.decode(e,a+d):this.property?c[this.property]=!0:this.union.usesPrefixDiscriminator&&(c[this.union.discriminator.property]=this.variant),c}encode(e,a,c){c===void 0&&(c=0);let d=0;if(this.union.usesPrefixDiscriminator&&(d=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,a,c);let h=d;if(this.layout&&(this.layout.encode(e[this.property],a,c+d),h+=this.layout.getSpan(a,c+d),0<=this.union.span&&h>this.union.span))throw new Error("encoded variant overruns containing union");return h}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}class Blob$1 extends Layout{constructor(e,a){if(!(e instanceof ExternalLayout&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let c=-1;e instanceof ExternalLayout||(c=e),super(c,a),this.length=e}getSpan(e,a){let c=this.span;return 0>c&&(c=this.length.decode(e,a)),c}decode(e,a){a===void 0&&(a=0);let c=this.span;return 0>c&&(c=this.length.decode(e,a)),e.slice(a,a+c)}encode(e,a,c){let d=this.length;if(this.length instanceof ExternalLayout&&(d=e.length),!(Buffer$1$1.isBuffer(e)&&d===e.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+d+") Buffer as src");if(c+d>a.length)throw new RangeError("encoding overruns Buffer");return a.write(e.toString("hex"),c,d,"hex"),this.length instanceof ExternalLayout&&this.length.encode(d,a,c),d}}var offset=(o,e,a)=>new OffsetLayout(o,e,a),u8=o=>new UInt(1,o),u32=o=>new UInt(4,o),nu64=o=>new NearUInt64(o),ns64=o=>new NearInt64(o),struct=(o,e,a)=>new Structure(o,e,a),union=(o,e,a)=>new Union(o,e,a),blob=(o,e)=>new Blob$1(o,e);class RustStringLayout extends Layout_2{constructor(e){super(-1,e),this.property=e,this.layout=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],this.property)}encode(e,a,c=0){if(e==null)return this.layout.span;const d={chars:Buffer$1$1.from(e,"utf8")};return this.layout.encode(d,a,c)}decode(e,a=0){return this.layout.decode(e,a).chars.toString()}getSpan(e,a=0){return u32().span+u32().span+new BN$b(new Uint8Array(e).slice(a,a+4),10,"le").toNumber()}}function rustStringLayout(o){return new RustStringLayout(o)}function publicKey$2(o){return blob(32,o)}const LAYOUT=union(u32("instruction"));LAYOUT.addVariant(0,struct([ns64("lamports"),ns64("space"),publicKey$2("owner")]),"createAccount");LAYOUT.addVariant(1,struct([publicKey$2("owner")]),"assign");LAYOUT.addVariant(2,struct([ns64("lamports")]),"transfer");LAYOUT.addVariant(3,struct([publicKey$2("base"),rustStringLayout("seed"),ns64("lamports"),ns64("space"),publicKey$2("owner")]),"createAccountWithSeed");LAYOUT.addVariant(4,struct([publicKey$2("authorized")]),"advanceNonceAccount");LAYOUT.addVariant(5,struct([ns64("lamports")]),"withdrawNonceAccount");LAYOUT.addVariant(6,struct([publicKey$2("authorized")]),"initializeNonceAccount");LAYOUT.addVariant(7,struct([publicKey$2("authorized")]),"authorizeNonceAccount");LAYOUT.addVariant(8,struct([ns64("space")]),"allocate");LAYOUT.addVariant(9,struct([publicKey$2("base"),rustStringLayout("seed"),ns64("space"),publicKey$2("owner")]),"allocateWithSeed");LAYOUT.addVariant(10,struct([publicKey$2("base"),rustStringLayout("seed"),publicKey$2("owner")]),"assignWithSeed");LAYOUT.addVariant(11,struct([ns64("lamports"),rustStringLayout("seed"),publicKey$2("owner")]),"transferWithSeed");Math.max(...Object.values(LAYOUT.registry).map(o=>o.span));class WrappedLayout$1 extends Layout_2{constructor(e,a,c,d){super(e.span,d),this.layout=e,this.decoder=a,this.encoder=c}decode(e,a){return this.decoder(this.layout.decode(e,a))}encode(e,a,c){return this.layout.encode(this.encoder(e),a,c)}getSpan(e,a){return this.layout.getSpan(e,a)}}function publicKey$1(o){return new WrappedLayout$1(blob(32),e=>new PublicKey$1(e),e=>e.toBuffer(),o)}struct([u32("version"),u32("state"),publicKey$1("authorizedPubkey"),publicKey$1("nonce"),struct([nu64("lamportsPerSignature")],"feeCalculator")]);const TOKEN_PROGRAM_ID$1=new PublicKey$1("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),ASSOCIATED_PROGRAM_ID=new PublicKey$1("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var browserPonyfill={exports:{}};(function(o,e){var a=typeof self<"u"?self:commonjsGlobal,c=function(){function h(){this.fetch=!1,this.DOMException=a.DOMException}return h.prototype=a,new h}();(function(h){(function(j){var et={searchParams:"URLSearchParams"in h,iterable:"Symbol"in h&&"iterator"in Symbol,blob:"FileReader"in h&&"Blob"in h&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in h,arrayBuffer:"ArrayBuffer"in h};function nt($){return $&&DataView.prototype.isPrototypeOf($)}if(et.arrayBuffer)var st=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ot=ArrayBuffer.isView||function($){return $&&st.indexOf(Object.prototype.toString.call($))>-1};function ht($){if(typeof $!="string"&&($=String($)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test($))throw new TypeError("Invalid character in header field name");return $.toLowerCase()}function pt($){return typeof $!="string"&&($=String($)),$}function dt($){var _e={next:function(){var rt=$.shift();return{done:rt===void 0,value:rt}}};return et.iterable&&(_e[Symbol.iterator]=function(){return _e}),_e}function gt($){this.map={},$ instanceof gt?$.forEach(function(_e,rt){this.append(rt,_e)},this):Array.isArray($)?$.forEach(function(_e){this.append(_e[0],_e[1])},this):$&&Object.getOwnPropertyNames($).forEach(function(_e){this.append(_e,$[_e])},this)}gt.prototype.append=function($,_e){$=ht($),_e=pt(_e);var rt=this.map[$];this.map[$]=rt?rt+", "+_e:_e},gt.prototype.delete=function($){delete this.map[ht($)]},gt.prototype.get=function($){return $=ht($),this.has($)?this.map[$]:null},gt.prototype.has=function($){return this.map.hasOwnProperty(ht($))},gt.prototype.set=function($,_e){this.map[ht($)]=pt(_e)},gt.prototype.forEach=function($,_e){for(var rt in this.map)this.map.hasOwnProperty(rt)&&$.call(_e,this.map[rt],rt,this)},gt.prototype.keys=function(){var $=[];return this.forEach(function(_e,rt){$.push(rt)}),dt($)},gt.prototype.values=function(){var $=[];return this.forEach(function(_e){$.push(_e)}),dt($)},gt.prototype.entries=function(){var $=[];return this.forEach(function(_e,rt){$.push([rt,_e])}),dt($)},et.iterable&&(gt.prototype[Symbol.iterator]=gt.prototype.entries);function wt($){if($.bodyUsed)return Promise.reject(new TypeError("Already read"));$.bodyUsed=!0}function St($){return new Promise(function(_e,rt){$.onload=function(){_e($.result)},$.onerror=function(){rt($.error)}})}function _t($){var _e=new FileReader,rt=St(_e);return _e.readAsArrayBuffer($),rt}function mt($){var _e=new FileReader,rt=St(_e);return _e.readAsText($),rt}function bt($){for(var _e=new Uint8Array($),rt=new Array(_e.length),at=0;at<_e.length;at++)rt[at]=String.fromCharCode(_e[at]);return rt.join("")}function $t($){if($.slice)return $.slice(0);var _e=new Uint8Array($.byteLength);return _e.set(new Uint8Array($)),_e.buffer}function Bt(){return this.bodyUsed=!1,this._initBody=function($){this._bodyInit=$,$?typeof $=="string"?this._bodyText=$:et.blob&&Blob.prototype.isPrototypeOf($)?this._bodyBlob=$:et.formData&&FormData.prototype.isPrototypeOf($)?this._bodyFormData=$:et.searchParams&&URLSearchParams.prototype.isPrototypeOf($)?this._bodyText=$.toString():et.arrayBuffer&&et.blob&&nt($)?(this._bodyArrayBuffer=$t($.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):et.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf($)||ot($))?this._bodyArrayBuffer=$t($):this._bodyText=$=Object.prototype.toString.call($):this._bodyText="",this.headers.get("content-type")||(typeof $=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):et.searchParams&&URLSearchParams.prototype.isPrototypeOf($)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},et.blob&&(this.blob=function(){var $=wt(this);if($)return $;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?wt(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_t)}),this.text=function(){var $=wt(this);if($)return $;if(this._bodyBlob)return mt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(bt(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},et.formData&&(this.formData=function(){return this.text().then(Pt)}),this.json=function(){return this.text().then(JSON.parse)},this}var Dt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Ht($){var _e=$.toUpperCase();return Dt.indexOf(_e)>-1?_e:$}function qt($,_e){_e=_e||{};var rt=_e.body;if($ instanceof qt){if($.bodyUsed)throw new TypeError("Already read");this.url=$.url,this.credentials=$.credentials,_e.headers||(this.headers=new gt($.headers)),this.method=$.method,this.mode=$.mode,this.signal=$.signal,!rt&&$._bodyInit!=null&&(rt=$._bodyInit,$.bodyUsed=!0)}else this.url=String($);if(this.credentials=_e.credentials||this.credentials||"same-origin",(_e.headers||!this.headers)&&(this.headers=new gt(_e.headers)),this.method=Ht(_e.method||this.method||"GET"),this.mode=_e.mode||this.mode||null,this.signal=_e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&rt)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(rt)}qt.prototype.clone=function(){return new qt(this,{body:this._bodyInit})};function Pt($){var _e=new FormData;return $.trim().split("&").forEach(function(rt){if(rt){var at=rt.split("="),lt=at.shift().replace(/\+/g," "),tt=at.join("=").replace(/\+/g," ");_e.append(decodeURIComponent(lt),decodeURIComponent(tt))}}),_e}function Gt($){var _e=new gt,rt=$.replace(/\r?\n[\t ]+/g," ");return rt.split(/\r?\n/).forEach(function(at){var lt=at.split(":"),tt=lt.shift().trim();if(tt){var _=lt.join(":").trim();_e.append(tt,_)}}),_e}Bt.call(qt.prototype);function ct($,_e){_e||(_e={}),this.type="default",this.status=_e.status===void 0?200:_e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in _e?_e.statusText:"OK",this.headers=new gt(_e.headers),this.url=_e.url||"",this._initBody($)}Bt.call(ct.prototype),ct.prototype.clone=function(){return new ct(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new gt(this.headers),url:this.url})},ct.error=function(){var $=new ct(null,{status:0,statusText:""});return $.type="error",$};var g=[301,302,303,307,308];ct.redirect=function($,_e){if(g.indexOf(_e)===-1)throw new RangeError("Invalid status code");return new ct(null,{status:_e,headers:{location:$}})},j.DOMException=h.DOMException;try{new j.DOMException}catch{j.DOMException=function(_e,rt){this.message=_e,this.name=rt;var at=Error(_e);this.stack=at.stack},j.DOMException.prototype=Object.create(Error.prototype),j.DOMException.prototype.constructor=j.DOMException}function b($,_e){return new Promise(function(rt,at){var lt=new qt($,_e);if(lt.signal&<.signal.aborted)return at(new j.DOMException("Aborted","AbortError"));var tt=new XMLHttpRequest;function _(){tt.abort()}tt.onload=function(){var it={status:tt.status,statusText:tt.statusText,headers:Gt(tt.getAllResponseHeaders()||"")};it.url="responseURL"in tt?tt.responseURL:it.headers.get("X-Request-URL");var yt="response"in tt?tt.response:tt.responseText;rt(new ct(yt,it))},tt.onerror=function(){at(new TypeError("Network request failed"))},tt.ontimeout=function(){at(new TypeError("Network request failed"))},tt.onabort=function(){at(new j.DOMException("Aborted","AbortError"))},tt.open(lt.method,lt.url,!0),lt.credentials==="include"?tt.withCredentials=!0:lt.credentials==="omit"&&(tt.withCredentials=!1),"responseType"in tt&&et.blob&&(tt.responseType="blob"),lt.headers.forEach(function(it,yt){tt.setRequestHeader(yt,it)}),lt.signal&&(lt.signal.addEventListener("abort",_),tt.onreadystatechange=function(){tt.readyState===4&<.signal.removeEventListener("abort",_)}),tt.send(typeof lt._bodyInit>"u"?null:lt._bodyInit)})}return b.polyfill=!0,h.fetch||(h.fetch=b,h.Headers=gt,h.Request=qt,h.Response=ct),j.Headers=gt,j.Request=qt,j.Response=ct,j.fetch=b,Object.defineProperty(j,"__esModule",{value:!0}),j})({})})(c),c.fetch.ponyfill=!0,delete c.fetch.polyfill;var d=c;e=d.fetch,e.default=d.fetch,e.fetch=d.fetch,e.Headers=d.Headers,e.Request=d.Request,e.Response=d.Response,o.exports=e})(browserPonyfill,browserPonyfill.exports);dist.rustEnum([dist.struct([],"uninitialized"),dist.struct([dist.option(dist.publicKey(),"authorityAddress")],"buffer"),dist.struct([dist.publicKey("programdataAddress")],"program"),dist.struct([dist.u64("slot"),dist.option(dist.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,dist.u32());dist.struct([dist.publicKey("authority"),dist.vecU8("data")]);function uint64(o){return new WrappedLayout(blob(8),e=>u64$1.fromBuffer(e),e=>e.toBuffer(),o)}function publicKey$3(o){return new WrappedLayout(blob(32),e=>new PublicKey$1(e),e=>e.toBuffer(),o)}function coption(o,e){return new COptionLayout(o,e)}class WrappedLayout extends Layout_2{constructor(e,a,c,d){super(e.span,d),this.layout=e,this.decoder=a,this.encoder=c}decode(e,a){return this.decoder(this.layout.decode(e,a))}encode(e,a,c){return this.layout.encode(this.encoder(e),a,c)}getSpan(e,a){return this.layout.getSpan(e,a)}}class COptionLayout extends Layout_2{constructor(e,a){super(-1,a),this.layout=e,this.discriminator=u32()}encode(e,a,c=0){return e==null?this.layout.span+this.discriminator.encode(0,a,c):(this.discriminator.encode(1,a,c),this.layout.encode(e,a,c+4)+4)}decode(e,a=0){const c=this.discriminator.decode(e,a);if(c===0)return null;if(c===1)return this.layout.decode(e,a+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(e,a=0){return this.layout.getSpan(e,a+4)+4}}let u64$1=class fn extends BN$b{toBuffer(){const e=super.toArray().reverse(),a=Buffer$1$1.from(e);if(a.length===8)return a;if(a.length>=8)throw new Error("u64 too large");const c=Buffer$1$1.alloc(8);return a.copy(c),c}static fromBuffer(e){if(e.length!==8)throw new Error(`Invalid buffer length: ${e.length}`);return new fn([...e].reverse().map(a=>`00${a.toString(16)}`.slice(-2)).join(""),16)}};struct([publicKey$3("mint"),publicKey$3("owner"),uint64("amount"),coption(publicKey$3(),"delegate"),(o=>{const e=union(u8("discriminator"),null,o);return e.addVariant(0,struct([]),"uninitialized"),e.addVariant(1,struct([]),"initialized"),e.addVariant(2,struct([]),"frozen"),e})("state"),coption(uint64(),"isNative"),uint64("delegatedAmount"),coption(publicKey$3(),"closeAuthority")]);SystemProgram.programId;new PublicKey$1("11111111111111111111111111111111");const TOKEN_PROGRAM_ID=new PublicKey$1("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new PublicKey$1("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const ASSOCIATED_TOKEN_PROGRAM_ID=new PublicKey$1("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new PublicKey$1("So11111111111111111111111111111111111111112");new PublicKey$1("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const encodeDecode=o=>{const e=o.decode.bind(o),a=o.encode.bind(o);return{decode:e,encode:a}},bigInt=o=>e=>{const a=blob$2(o,e),{encode:c,decode:d}=encodeDecode(a),h=a;return h.decode=(j,et)=>{const nt=d(j,et);return toBigIntLE_1(Buffer$1$1.from(nt))},h.encode=(j,et,nt)=>{const st=toBufferLE_1(j,o);return c(st,et,nt)},h},u64=bigInt(8),bool=o=>{const e=u8$2(o),{encode:a,decode:c}=encodeDecode(e),d=e;return d.decode=(h,j)=>!!c(h,j),d.encode=(h,j,et)=>{const nt=Number(h);return a(nt,j,et)},d},publicKey=o=>{const e=blob$2(32,o),{encode:a,decode:c}=encodeDecode(e),d=e;return d.decode=(h,j)=>{const et=c(h,j);return new PublicKey$1(et)},d.encode=(h,j,et)=>{const nt=h.toBuffer();return a(nt,j,et)},d};class TokenError extends Error{constructor(e){super(e)}}class TokenAccountNotFoundError extends TokenError{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class TokenInvalidAccountError extends TokenError{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}}class TokenInvalidAccountOwnerError extends TokenError{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class TokenInvalidAccountSizeError extends TokenError{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class TokenInvalidMintError extends TokenError{constructor(){super(...arguments),this.name="TokenInvalidMintError"}}class TokenOwnerOffCurveError extends TokenError{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var AccountType;(function(o){o[o.Uninitialized=0]="Uninitialized",o[o.Mint=1]="Mint",o[o.Account=2]="Account"})(AccountType||(AccountType={}));const ACCOUNT_TYPE_SIZE=1,MultisigLayout=struct$2([u8$2("m"),u8$2("n"),bool("isInitialized"),publicKey("signer1"),publicKey("signer2"),publicKey("signer3"),publicKey("signer4"),publicKey("signer5"),publicKey("signer6"),publicKey("signer7"),publicKey("signer8"),publicKey("signer9"),publicKey("signer10"),publicKey("signer11")]),MULTISIG_SIZE=MultisigLayout.span;var AccountState;(function(o){o[o.Uninitialized=0]="Uninitialized",o[o.Initialized=1]="Initialized",o[o.Frozen=2]="Frozen"})(AccountState||(AccountState={}));const AccountLayout=struct$2([publicKey("mint"),publicKey("owner"),u64("amount"),u32$2("delegateOption"),publicKey("delegate"),u8$2("state"),u32$2("isNativeOption"),u64("isNative"),u64("delegatedAmount"),u32$2("closeAuthorityOption"),publicKey("closeAuthority")]),ACCOUNT_SIZE=AccountLayout.span;async function getAccount(o,e,a,c=TOKEN_PROGRAM_ID){const d=await o.getAccountInfo(e,a);return unpackAccount(e,d,c)}function unpackAccount(o,e,a=TOKEN_PROGRAM_ID){if(!e)throw new TokenAccountNotFoundError;if(!e.owner.equals(a))throw new TokenInvalidAccountOwnerError;if(e.data.lengthACCOUNT_SIZE){if(e.data.length===MULTISIG_SIZE)throw new TokenInvalidAccountSizeError;if(e.data[ACCOUNT_SIZE]!=AccountType.Account)throw new TokenInvalidAccountError;d=e.data.slice(ACCOUNT_SIZE+ACCOUNT_TYPE_SIZE)}return{address:o,mint:c.mint,owner:c.owner,amount:c.amount,delegate:c.delegateOption?c.delegate:null,delegatedAmount:c.delegatedAmount,isInitialized:c.state!==AccountState.Uninitialized,isFrozen:c.state===AccountState.Frozen,isNative:!!c.isNativeOption,rentExemptReserve:c.isNativeOption?c.isNative:null,closeAuthority:c.closeAuthorityOption?c.closeAuthority:null,tlvData:d}}const MintLayout=struct$2([u32$2("mintAuthorityOption"),publicKey("mintAuthority"),u64("supply"),u8$2("decimals"),bool("isInitialized"),u32$2("freezeAuthorityOption"),publicKey("freezeAuthority")]),MINT_SIZE=MintLayout.span;async function getMint(o,e,a,c=TOKEN_PROGRAM_ID){const d=await o.getAccountInfo(e,a);return unpackMint(e,d,c)}function unpackMint(o,e,a=TOKEN_PROGRAM_ID){if(!e)throw new TokenAccountNotFoundError;if(!e.owner.equals(a))throw new TokenInvalidAccountOwnerError;if(e.data.lengthMINT_SIZE){if(e.data.length<=ACCOUNT_SIZE)throw new TokenInvalidAccountSizeError;if(e.data.length===MULTISIG_SIZE)throw new TokenInvalidAccountSizeError;if(e.data[ACCOUNT_SIZE]!=AccountType.Mint)throw new TokenInvalidMintError;d=e.data.slice(ACCOUNT_SIZE+ACCOUNT_TYPE_SIZE)}return{address:o,mintAuthority:c.mintAuthorityOption?c.mintAuthority:null,supply:c.supply,decimals:c.decimals,isInitialized:c.isInitialized,freezeAuthority:c.freezeAuthorityOption?c.freezeAuthority:null,tlvData:d}}async function getAssociatedTokenAddress(o,e,a=!1,c=TOKEN_PROGRAM_ID,d=ASSOCIATED_TOKEN_PROGRAM_ID){if(!a&&!PublicKey$1.isOnCurve(e.toBuffer()))throw new TokenOwnerOffCurveError;const[h]=await PublicKey$1.findProgramAddress([e.toBuffer(),c.toBuffer(),o.toBuffer()],d);return h}function getAssociatedTokenAddressSync(o,e,a=!1,c=TOKEN_PROGRAM_ID,d=ASSOCIATED_TOKEN_PROGRAM_ID){if(!a&&!PublicKey$1.isOnCurve(e.toBuffer()))throw new TokenOwnerOffCurveError;const[h]=PublicKey$1.findProgramAddressSync([e.toBuffer(),c.toBuffer(),o.toBuffer()],d);return h}var events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function o(e,a,c){return Function.prototype.apply.call(e,a,c)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ReflectOwnKeys=function(e){return Object.getOwnPropertyNames(e)};function ProcessEmitWarning(o){console&&console.warn&&console.warn(o)}var NumberIsNaN=Number.isNaN||function o(e){return e!==e};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter;events.exports.once=once;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=void 0;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(o){if(typeof o!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof o)}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(o){if(typeof o!="number"||o<0||NumberIsNaN(o))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+o+".");defaultMaxListeners=o}});EventEmitter.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};EventEmitter.prototype.setMaxListeners=function o(e){if(typeof e!="number"||e<0||NumberIsNaN(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function _getMaxListeners(o){return o._maxListeners===void 0?EventEmitter.defaultMaxListeners:o._maxListeners}EventEmitter.prototype.getMaxListeners=function o(){return _getMaxListeners(this)};EventEmitter.prototype.emit=function o(e){for(var a=[],c=1;c0&&(j=a[0]),j instanceof Error)throw j;var et=new Error("Unhandled error."+(j?" ("+j.message+")":""));throw et.context=j,et}var nt=h[e];if(nt===void 0)return!1;if(typeof nt=="function")ReflectApply(nt,this,a);else for(var st=nt.length,ot=arrayClone(nt,st),c=0;c0&&j.length>d&&!j.warned){j.warned=!0;var et=new Error("Possible EventEmitter memory leak detected. "+j.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");et.name="MaxListenersExceededWarning",et.emitter=o,et.type=e,et.count=j.length,ProcessEmitWarning(et)}return o}EventEmitter.prototype.addListener=function o(e,a){return _addListener(this,e,a,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function o(e,a){return _addListener(this,e,a,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(o,e,a){var c={fired:!1,wrapFn:void 0,target:o,type:e,listener:a},d=onceWrapper.bind(c);return d.listener=a,c.wrapFn=d,d}EventEmitter.prototype.once=function o(e,a){return checkListener(a),this.on(e,_onceWrap(this,e,a)),this};EventEmitter.prototype.prependOnceListener=function o(e,a){return checkListener(a),this.prependListener(e,_onceWrap(this,e,a)),this};EventEmitter.prototype.removeListener=function o(e,a){var c,d,h,j,et;if(checkListener(a),d=this._events,d===void 0)return this;if(c=d[e],c===void 0)return this;if(c===a||c.listener===a)--this._eventsCount===0?this._events=Object.create(null):(delete d[e],d.removeListener&&this.emit("removeListener",e,c.listener||a));else if(typeof c!="function"){for(h=-1,j=c.length-1;j>=0;j--)if(c[j]===a||c[j].listener===a){et=c[j].listener,h=j;break}if(h<0)return this;h===0?c.shift():spliceOne(c,h),c.length===1&&(d[e]=c[0]),d.removeListener!==void 0&&this.emit("removeListener",e,et||a)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function o(e){var a,c,d;if(c=this._events,c===void 0)return this;if(c.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):c[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete c[e]),this;if(arguments.length===0){var h=Object.keys(c),j;for(d=0;d=0;d--)this.removeListener(e,a[d]);return this};function _listeners(o,e,a){var c=o._events;if(c===void 0)return[];var d=c[e];return d===void 0?[]:typeof d=="function"?a?[d.listener||d]:[d]:a?unwrapListeners(d):arrayClone(d,d.length)}EventEmitter.prototype.listeners=function o(e){return _listeners(this,e,!0)};EventEmitter.prototype.rawListeners=function o(e){return _listeners(this,e,!1)};EventEmitter.listenerCount=function(o,e){return typeof o.listenerCount=="function"?o.listenerCount(e):listenerCount.call(o,e)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(o){var e=this._events;if(e!==void 0){var a=e[o];if(typeof a=="function")return 1;if(a!==void 0)return a.length}return 0}EventEmitter.prototype.eventNames=function o(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(o,e){for(var a=new Array(e),c=0;c"u"||typeof document>"u"?WalletReadyState.Unsupported:WalletReadyState.NotDetected,this._disconnected=()=>{const a=this._wallet;a&&(a.off("disconnect",this._disconnected),a.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null,this.emit("error",new WalletDisconnectedError),this.emit("disconnect"))},this._accountChanged=a=>{const c=this._publicKey;if(c){try{a=new PublicKey$1(a.toBytes())}catch(d){this.emit("error",new WalletPublicKeyError(d==null?void 0:d.message,d));return}c.equals(a)||(this._publicKey=a,this.emit("connect",a))}},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==WalletReadyState.Unsupported&&(isIosAndRedirectable()?(this._readyState=WalletReadyState.Loadable,this.emit("readyStateChange",this._readyState)):scopePollingDetectionStrategy(()=>{var a,c,d;return(c=(a=window.phantom)==null?void 0:a.solana)!=null&&c.isPhantom||(d=window.solana)!=null&&d.isPhantom?(this._readyState=WalletReadyState.Installed,this.emit("readyStateChange",this._readyState),!0):!1}))}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async autoConnect(){this.readyState===WalletReadyState.Installed&&await this.connect()}async connect(){var e;try{if(this.connected||this.connecting)return;if(this.readyState===WalletReadyState.Loadable){const d=encodeURIComponent(window.location.href),h=encodeURIComponent(window.location.origin);window.location.href=`https://phantom.app/ul/browse/${d}?ref=${h}`;return}if(this.readyState!==WalletReadyState.Installed)throw new WalletNotReadyError;this._connecting=!0;const a=((e=window.phantom)==null?void 0:e.solana)||window.solana;if(!a.isConnected)try{await a.connect()}catch(d){throw new WalletConnectionError(d==null?void 0:d.message,d)}if(!a.publicKey)throw new WalletAccountError;let c;try{c=new PublicKey$1(a.publicKey.toBytes())}catch(d){throw new WalletPublicKeyError(d==null?void 0:d.message,d)}a.on("disconnect",this._disconnected),a.on("accountChanged",this._accountChanged),this._wallet=a,this._publicKey=c,this.emit("connect",c)}catch(a){throw this.emit("error",a),a}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(a){this.emit("error",new WalletDisconnectionError(a==null?void 0:a.message,a))}}this.emit("disconnect")}async sendTransaction(e,a,c={}){try{const d=this._wallet;if(!d)throw new WalletNotConnectedError;try{const{signers:h,...j}=c;isVersionedTransaction$2(e)?h!=null&&h.length&&e.sign(h):(e=await this.prepareTransaction(e,a,j),h!=null&&h.length&&e.partialSign(...h)),j.preflightCommitment=j.preflightCommitment||a.commitment;const{signature:et}=await d.signAndSendTransaction(e,j);return et}catch(h){throw h instanceof WalletError?h:new WalletSendTransactionError(h==null?void 0:h.message,h)}}catch(d){throw this.emit("error",d),d}}async signTransaction(e){try{const a=this._wallet;if(!a)throw new WalletNotConnectedError;try{return await a.signTransaction(e)||e}catch(c){throw new WalletSignTransactionError(c==null?void 0:c.message,c)}}catch(a){throw this.emit("error",a),a}}async signAllTransactions(e){try{const a=this._wallet;if(!a)throw new WalletNotConnectedError;try{return await a.signAllTransactions(e)||e}catch(c){throw new WalletSignTransactionError(c==null?void 0:c.message,c)}}catch(a){throw this.emit("error",a),a}}async signMessage(e){try{const a=this._wallet;if(!a)throw new WalletNotConnectedError;try{const{signature:c}=await a.signMessage(e);return c}catch(c){throw new WalletSignMessageError(c==null?void 0:c.message,c)}}catch(a){throw this.emit("error",a),a}}}var streamBrowser$1,hasRequiredStreamBrowser;function requireStreamBrowser(){return hasRequiredStreamBrowser||(hasRequiredStreamBrowser=1,streamBrowser$1=eventsExports.EventEmitter),streamBrowser$1}var buffer_list,hasRequiredBuffer_list;function requireBuffer_list(){if(hasRequiredBuffer_list)return buffer_list;hasRequiredBuffer_list=1;function o(gt,wt){var St=Object.keys(gt);if(Object.getOwnPropertySymbols){var _t=Object.getOwnPropertySymbols(gt);wt&&(_t=_t.filter(function(mt){return Object.getOwnPropertyDescriptor(gt,mt).enumerable})),St.push.apply(St,_t)}return St}function e(gt){for(var wt=1;wt0?this.tail.next=_t:this.head=_t,this.tail=_t,++this.length}},{key:"unshift",value:function(St){var _t={data:St,next:this.head};this.length===0&&(this.tail=_t),this.head=_t,++this.length}},{key:"shift",value:function(){if(this.length!==0){var St=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,St}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(St){if(this.length===0)return"";for(var _t=this.head,mt=""+_t.data;_t=_t.next;)mt+=St+_t.data;return mt}},{key:"concat",value:function(St){if(this.length===0)return st.alloc(0);for(var _t=st.allocUnsafe(St>>>0),mt=this.head,bt=0;mt;)dt(mt.data,_t,bt),bt+=mt.data.length,mt=mt.next;return _t}},{key:"consume",value:function(St,_t){var mt;return St$t.length?$t.length:St;if(Bt===$t.length?bt+=$t:bt+=$t.slice(0,St),St-=Bt,St===0){Bt===$t.length?(++mt,_t.next?this.head=_t.next:this.head=this.tail=null):(this.head=_t,_t.data=$t.slice(Bt));break}++mt}return this.length-=mt,bt}},{key:"_getBuffer",value:function(St){var _t=st.allocUnsafe(St),mt=this.head,bt=1;for(mt.data.copy(_t),St-=mt.data.length;mt=mt.next;){var $t=mt.data,Bt=St>$t.length?$t.length:St;if($t.copy(_t,_t.length-St,0,Bt),St-=Bt,St===0){Bt===$t.length?(++bt,mt.next?this.head=mt.next:this.head=this.tail=null):(this.head=mt,mt.data=$t.slice(Bt));break}++bt}return this.length-=bt,_t}},{key:pt,value:function(St,_t){return ht(this,e(e({},_t),{},{depth:0,customInspect:!1}))}}]),gt}(),buffer_list}var destroy_1$1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1$1;hasRequiredDestroy=1;function o(j,et){var nt=this,st=this._readableState&&this._readableState.destroyed,ot=this._writableState&&this._writableState.destroyed;return st||ot?(et?et(j):j&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1.nextTick(d,this,j)):process$1.nextTick(d,this,j)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(j||null,function(ht){!et&&ht?nt._writableState?nt._writableState.errorEmitted?process$1.nextTick(a,nt):(nt._writableState.errorEmitted=!0,process$1.nextTick(e,nt,ht)):process$1.nextTick(e,nt,ht):et?(process$1.nextTick(a,nt),et(ht)):process$1.nextTick(a,nt)}),this)}function e(j,et){d(j,et),a(j)}function a(j){j._writableState&&!j._writableState.emitClose||j._readableState&&!j._readableState.emitClose||j.emit("close")}function c(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function d(j,et){j.emit("error",et)}function h(j,et){var nt=j._readableState,st=j._writableState;nt&&nt.autoDestroy||st&&st.autoDestroy?j.destroy(et):j.emit("error",et)}return destroy_1$1={destroy:o,undestroy:c,errorOrDestroy:h},destroy_1$1}var errorsBrowser={},hasRequiredErrorsBrowser;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;function o(et,nt){et.prototype=Object.create(nt.prototype),et.prototype.constructor=et,et.__proto__=nt}var e={};function a(et,nt,st){st||(st=Error);function ot(pt,dt,gt){return typeof nt=="string"?nt:nt(pt,dt,gt)}var ht=function(pt){o(dt,pt);function dt(gt,wt,St){return pt.call(this,ot(gt,wt,St))||this}return dt}(st);ht.prototype.name=st.name,ht.prototype.code=et,e[et]=ht}function c(et,nt){if(Array.isArray(et)){var st=et.length;return et=et.map(function(ot){return String(ot)}),st>2?"one of ".concat(nt," ").concat(et.slice(0,st-1).join(", "),", or ")+et[st-1]:st===2?"one of ".concat(nt," ").concat(et[0]," or ").concat(et[1]):"of ".concat(nt," ").concat(et[0])}else return"of ".concat(nt," ").concat(String(et))}function d(et,nt,st){return et.substr(0,nt.length)===nt}function h(et,nt,st){return(st===void 0||st>et.length)&&(st=et.length),et.substring(st-nt.length,st)===nt}function j(et,nt,st){return typeof st!="number"&&(st=0),st+nt.length>et.length?!1:et.indexOf(nt,st)!==-1}return a("ERR_INVALID_OPT_VALUE",function(et,nt){return'The value "'+nt+'" is invalid for option "'+et+'"'},TypeError),a("ERR_INVALID_ARG_TYPE",function(et,nt,st){var ot;typeof nt=="string"&&d(nt,"not ")?(ot="must not be",nt=nt.replace(/^not /,"")):ot="must be";var ht;if(h(et," argument"))ht="The ".concat(et," ").concat(ot," ").concat(c(nt,"type"));else{var pt=j(et,".")?"property":"argument";ht='The "'.concat(et,'" ').concat(pt," ").concat(ot," ").concat(c(nt,"type"))}return ht+=". Received type ".concat(typeof st),ht},TypeError),a("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),a("ERR_METHOD_NOT_IMPLEMENTED",function(et){return"The "+et+" method is not implemented"}),a("ERR_STREAM_PREMATURE_CLOSE","Premature close"),a("ERR_STREAM_DESTROYED",function(et){return"Cannot call "+et+" after a stream was destroyed"}),a("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),a("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),a("ERR_STREAM_WRITE_AFTER_END","write after end"),a("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),a("ERR_UNKNOWN_ENCODING",function(et){return"Unknown encoding: "+et},TypeError),a("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=e,errorsBrowser}var state,hasRequiredState;function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var o=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;function e(c,d,h){return c.highWaterMark!=null?c.highWaterMark:d?c[h]:null}function a(c,d,h,j){var et=e(d,j,h);if(et!=null){if(!(isFinite(et)&&Math.floor(et)===et)||et<0){var nt=j?h:"highWaterMark";throw new o(nt,et)}return Math.floor(et)}return c.objectMode?16:16*1024}return state={getHighWaterMark:a},state}var browser$b,hasRequiredBrowser$3;function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$b;hasRequiredBrowser$3=1,browser$b=o;function o(a,c){if(e("noDeprecation"))return a;var d=!1;function h(){if(!d){if(e("throwDeprecation"))throw new Error(c);e("traceDeprecation")?console.trace(c):console.warn(c),d=!0}return a.apply(this,arguments)}return h}function e(a){try{if(!globalThis.localStorage)return!1}catch{return!1}var c=globalThis.localStorage[a];return c==null?!1:String(c).toLowerCase()==="true"}return browser$b}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=qt;function o(Mt){var At=this;this.next=null,this.entry=null,this.finish=function(){Tt(At,Mt)}}var e;qt.WritableState=Dt;var a={deprecate:requireBrowser$3()},c=requireStreamBrowser(),d=require$$0$1.Buffer,h=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function j(Mt){return d.from(Mt)}function et(Mt){return d.isBuffer(Mt)||Mt instanceof h}var nt=requireDestroy(),st=requireState(),ot=st.getHighWaterMark,ht=requireErrorsBrowser().codes,pt=ht.ERR_INVALID_ARG_TYPE,dt=ht.ERR_METHOD_NOT_IMPLEMENTED,gt=ht.ERR_MULTIPLE_CALLBACK,wt=ht.ERR_STREAM_CANNOT_PIPE,St=ht.ERR_STREAM_DESTROYED,_t=ht.ERR_STREAM_NULL_VALUES,mt=ht.ERR_STREAM_WRITE_AFTER_END,bt=ht.ERR_UNKNOWN_ENCODING,$t=nt.errorOrDestroy;inherits_browserExports(qt,c);function Bt(){}function Dt(Mt,At,Ot){e=e||require_stream_duplex$1(),Mt=Mt||{},typeof Ot!="boolean"&&(Ot=At instanceof e),this.objectMode=!!Mt.objectMode,Ot&&(this.objectMode=this.objectMode||!!Mt.writableObjectMode),this.highWaterMark=ot(this,Mt,"writableHighWaterMark",Ot),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ct=Mt.decodeStrings===!1;this.decodeStrings=!Ct,this.defaultEncoding=Mt.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Ut){rt(At,Ut)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Mt.emitClose!==!1,this.autoDestroy=!!Mt.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}Dt.prototype.getBuffer=function(){for(var At=this.bufferedRequest,Ot=[];At;)Ot.push(At),At=At.next;return Ot},function(){try{Object.defineProperty(Dt.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var Ht;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ht=Function.prototype[Symbol.hasInstance],Object.defineProperty(qt,Symbol.hasInstance,{value:function(At){return Ht.call(this,At)?!0:this!==qt?!1:At&&At._writableState instanceof Dt}})):Ht=function(At){return At instanceof this};function qt(Mt){e=e||require_stream_duplex$1();var At=this instanceof e;if(!At&&!Ht.call(qt,this))return new qt(Mt);this._writableState=new Dt(Mt,this,At),this.writable=!0,Mt&&(typeof Mt.write=="function"&&(this._write=Mt.write),typeof Mt.writev=="function"&&(this._writev=Mt.writev),typeof Mt.destroy=="function"&&(this._destroy=Mt.destroy),typeof Mt.final=="function"&&(this._final=Mt.final)),c.call(this)}qt.prototype.pipe=function(){$t(this,new wt)};function Pt(Mt,At){var Ot=new mt;$t(Mt,Ot),process$1.nextTick(At,Ot)}function Gt(Mt,At,Ot,Ct){var Ut;return Ot===null?Ut=new _t:typeof Ot!="string"&&!At.objectMode&&(Ut=new pt("chunk",["string","Buffer"],Ot)),Ut?($t(Mt,Ut),process$1.nextTick(Ct,Ut),!1):!0}qt.prototype.write=function(Mt,At,Ot){var Ct=this._writableState,Ut=!1,Lt=!Ct.objectMode&&et(Mt);return Lt&&!d.isBuffer(Mt)&&(Mt=j(Mt)),typeof At=="function"&&(Ot=At,At=null),Lt?At="buffer":At||(At=Ct.defaultEncoding),typeof Ot!="function"&&(Ot=Bt),Ct.ending?Pt(this,Ot):(Lt||Gt(this,Ct,Mt,Ot))&&(Ct.pendingcb++,Ut=g(this,Ct,Lt,Mt,At,Ot)),Ut},qt.prototype.cork=function(){this._writableState.corked++},qt.prototype.uncork=function(){var Mt=this._writableState;Mt.corked&&(Mt.corked--,!Mt.writing&&!Mt.corked&&!Mt.bufferProcessing&&Mt.bufferedRequest&&tt(this,Mt))},qt.prototype.setDefaultEncoding=function(At){if(typeof At=="string"&&(At=At.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((At+"").toLowerCase())>-1))throw new bt(At);return this._writableState.defaultEncoding=At,this},Object.defineProperty(qt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ct(Mt,At,Ot){return!Mt.objectMode&&Mt.decodeStrings!==!1&&typeof At=="string"&&(At=d.from(At,Ot)),At}Object.defineProperty(qt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function g(Mt,At,Ot,Ct,Ut,Lt){if(!Ot){var Nt=ct(At,Ct,Ut);Ct!==Nt&&(Ot=!0,Ut="buffer",Ct=Nt)}var Kt=At.objectMode?1:Ct.length;At.length+=Kt;var yr=At.length>5===6?2:o>>4===14?3:o>>3===30?4:o>>6===2?-1:-2}function utf8CheckIncomplete(o,e,a){var c=e.length-1;if(c=0?(d>0&&(o.lastNeed=d-1),d):--c=0?(d>0&&(o.lastNeed=d-2),d):--c=0?(d>0&&(d===2?d=0:o.lastNeed=d-3),d):0))}function utf8CheckExtraBytes(o,e,a){if((e[0]&192)!==128)return o.lastNeed=0,"�";if(o.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return o.lastNeed=1,"�";if(o.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return o.lastNeed=2,"�"}}function utf8FillLast(o){var e=this.lastTotal-this.lastNeed,a=utf8CheckExtraBytes(this,o);if(a!==void 0)return a;if(this.lastNeed<=o.length)return o.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);o.copy(this.lastChar,e,0,o.length),this.lastNeed-=o.length}function utf8Text(o,e){var a=utf8CheckIncomplete(this,o,e);if(!this.lastNeed)return o.toString("utf8",e);this.lastTotal=a;var c=o.length-(a-this.lastNeed);return o.copy(this.lastChar,0,c),o.toString("utf8",e,c)}function utf8End(o){var e=o&&o.length?this.write(o):"";return this.lastNeed?e+"�":e}function utf16Text(o,e){if((o.length-e)%2===0){var a=o.toString("utf16le",e);if(a){var c=a.charCodeAt(a.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=o[o.length-2],this.lastChar[1]=o[o.length-1],a.slice(0,-1)}return a}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=o[o.length-1],o.toString("utf16le",e,o.length-1)}function utf16End(o){var e=o&&o.length?this.write(o):"";if(this.lastNeed){var a=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,a)}return e}function base64Text(o,e){var a=(o.length-e)%3;return a===0?o.toString("base64",e):(this.lastNeed=3-a,this.lastTotal=3,a===1?this.lastChar[0]=o[o.length-1]:(this.lastChar[0]=o[o.length-2],this.lastChar[1]=o[o.length-1]),o.toString("base64",e,o.length-a))}function base64End(o){var e=o&&o.length?this.write(o):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function simpleWrite(o){return o.toString(this.encoding)}function simpleEnd(o){return o&&o.length?this.write(o):""}var endOfStream,hasRequiredEndOfStream;function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var o=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function e(h){var j=!1;return function(){if(!j){j=!0;for(var et=arguments.length,nt=new Array(et),st=0;st0)if(typeof Nt!="string"&&!Jt.objectMode&&Object.getPrototypeOf(Nt)!==c.prototype&&(Nt=h(Nt)),yr)Jt.endEmitted?Bt(Lt,new _t):ct(Lt,Jt,Nt,!0);else if(Jt.ended)Bt(Lt,new wt);else{if(Jt.destroyed)return!1;Jt.reading=!1,Jt.decoder&&!Kt?(Nt=Jt.decoder.write(Nt),Jt.objectMode||Nt.length!==0?ct(Lt,Jt,Nt,!1):tt(Lt,Jt)):ct(Lt,Jt,Nt,!1)}else yr||(Jt.reading=!1,tt(Lt,Jt))}return!Jt.ended&&(Jt.length=b?Lt=b:(Lt--,Lt|=Lt>>>1,Lt|=Lt>>>2,Lt|=Lt>>>4,Lt|=Lt>>>8,Lt|=Lt>>>16,Lt++),Lt}function _e(Lt,Nt){return Lt<=0||Nt.length===0&&Nt.ended?0:Nt.objectMode?1:Lt!==Lt?Nt.flowing&&Nt.length?Nt.buffer.head.data.length:Nt.length:(Lt>Nt.highWaterMark&&(Nt.highWaterMark=$(Lt)),Lt<=Nt.length?Lt:Nt.ended?Nt.length:(Nt.needReadable=!0,0))}Pt.prototype.read=function(Lt){nt("read",Lt),Lt=parseInt(Lt,10);var Nt=this._readableState,Kt=Lt;if(Lt!==0&&(Nt.emittedReadable=!1),Lt===0&&Nt.needReadable&&((Nt.highWaterMark!==0?Nt.length>=Nt.highWaterMark:Nt.length>0)||Nt.ended))return nt("read: emitReadable",Nt.length,Nt.ended),Nt.length===0&&Nt.ended?Ot(this):at(this),null;if(Lt=_e(Lt,Nt),Lt===0&&Nt.ended)return Nt.length===0&&Ot(this),null;var yr=Nt.needReadable;nt("need readable",yr),(Nt.length===0||Nt.length-Lt0?Xt=At(Lt,Nt):Xt=null,Xt===null?(Nt.needReadable=Nt.length<=Nt.highWaterMark,Lt=0):(Nt.length-=Lt,Nt.awaitDrain=0),Nt.length===0&&(Nt.ended||(Nt.needReadable=!0),Kt!==Lt&&Nt.ended&&Ot(this)),Xt!==null&&this.emit("data",Xt),Xt};function rt(Lt,Nt){if(nt("onEofChunk"),!Nt.ended){if(Nt.decoder){var Kt=Nt.decoder.end();Kt&&Kt.length&&(Nt.buffer.push(Kt),Nt.length+=Nt.objectMode?1:Kt.length)}Nt.ended=!0,Nt.sync?at(Lt):(Nt.needReadable=!1,Nt.emittedReadable||(Nt.emittedReadable=!0,lt(Lt)))}}function at(Lt){var Nt=Lt._readableState;nt("emitReadable",Nt.needReadable,Nt.emittedReadable),Nt.needReadable=!1,Nt.emittedReadable||(nt("emitReadable",Nt.flowing),Nt.emittedReadable=!0,process$1.nextTick(lt,Lt))}function lt(Lt){var Nt=Lt._readableState;nt("emitReadable_",Nt.destroyed,Nt.length,Nt.ended),!Nt.destroyed&&(Nt.length||Nt.ended)&&(Lt.emit("readable"),Nt.emittedReadable=!1),Nt.needReadable=!Nt.flowing&&!Nt.ended&&Nt.length<=Nt.highWaterMark,Mt(Lt)}function tt(Lt,Nt){Nt.readingMore||(Nt.readingMore=!0,process$1.nextTick(_,Lt,Nt))}function _(Lt,Nt){for(;!Nt.reading&&!Nt.ended&&(Nt.length1&&Ut(yr.pipes,Lt)!==-1)&&!Ir&&(nt("false write response, pause",yr.awaitDrain),yr.awaitDrain++),Kt.pause())}function xr(Yt){nt("onerror",Yt),Rr(),Lt.removeListener("error",xr),e(Lt,"error")===0&&Bt(Lt,Yt)}Ht(Lt,"error",xr);function Ft(){Lt.removeListener("finish",jt),Rr()}Lt.once("close",Ft);function jt(){nt("onfinish"),Lt.removeListener("close",Ft),Rr()}Lt.once("finish",jt);function Rr(){nt("unpipe"),Kt.unpipe(Lt)}return Lt.emit("pipe",Kt),yr.flowing||(nt("pipe resume"),Kt.resume()),Lt};function it(Lt){return function(){var Kt=Lt._readableState;nt("pipeOnDrain",Kt.awaitDrain),Kt.awaitDrain&&Kt.awaitDrain--,Kt.awaitDrain===0&&e(Lt,"data")&&(Kt.flowing=!0,Mt(Lt))}}Pt.prototype.unpipe=function(Lt){var Nt=this._readableState,Kt={hasUnpiped:!1};if(Nt.pipesCount===0)return this;if(Nt.pipesCount===1)return Lt&&Lt!==Nt.pipes?this:(Lt||(Lt=Nt.pipes),Nt.pipes=null,Nt.pipesCount=0,Nt.flowing=!1,Lt&&Lt.emit("unpipe",this,Kt),this);if(!Lt){var yr=Nt.pipes,Xt=Nt.pipesCount;Nt.pipes=null,Nt.pipesCount=0,Nt.flowing=!1;for(var Jt=0;Jt0,yr.flowing!==!1&&this.resume()):Lt==="readable"&&!yr.endEmitted&&!yr.readableListening&&(yr.readableListening=yr.needReadable=!0,yr.flowing=!1,yr.emittedReadable=!1,nt("on readable",yr.length,yr.reading),yr.length?at(this):yr.reading||process$1.nextTick(vt,this)),Kt},Pt.prototype.addListener=Pt.prototype.on,Pt.prototype.removeListener=function(Lt,Nt){var Kt=a.prototype.removeListener.call(this,Lt,Nt);return Lt==="readable"&&process$1.nextTick(yt,this),Kt},Pt.prototype.removeAllListeners=function(Lt){var Nt=a.prototype.removeAllListeners.apply(this,arguments);return(Lt==="readable"||Lt===void 0)&&process$1.nextTick(yt,this),Nt};function yt(Lt){var Nt=Lt._readableState;Nt.readableListening=Lt.listenerCount("readable")>0,Nt.resumeScheduled&&!Nt.paused?Nt.flowing=!0:Lt.listenerCount("data")>0&&Lt.resume()}function vt(Lt){nt("readable nexttick read 0"),Lt.read(0)}Pt.prototype.resume=function(){var Lt=this._readableState;return Lt.flowing||(nt("resume"),Lt.flowing=!Lt.readableListening,Rt(this,Lt)),Lt.paused=!1,this};function Rt(Lt,Nt){Nt.resumeScheduled||(Nt.resumeScheduled=!0,process$1.nextTick(Tt,Lt,Nt))}function Tt(Lt,Nt){nt("resume",Nt.reading),Nt.reading||Lt.read(0),Nt.resumeScheduled=!1,Lt.emit("resume"),Mt(Lt),Nt.flowing&&!Nt.reading&&Lt.read(0)}Pt.prototype.pause=function(){return nt("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(nt("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Mt(Lt){var Nt=Lt._readableState;for(nt("flow",Nt.flowing);Nt.flowing&&Lt.read()!==null;);}Pt.prototype.wrap=function(Lt){var Nt=this,Kt=this._readableState,yr=!1;Lt.on("end",function(){if(nt("wrapped end"),Kt.decoder&&!Kt.ended){var Ar=Kt.decoder.end();Ar&&Ar.length&&Nt.push(Ar)}Nt.push(null)}),Lt.on("data",function(Ar){if(nt("wrapped data"),Kt.decoder&&(Ar=Kt.decoder.write(Ar)),!(Kt.objectMode&&Ar==null)&&!(!Kt.objectMode&&(!Ar||!Ar.length))){var er=Nt.push(Ar);er||(yr=!0,Lt.pause())}});for(var Xt in Lt)this[Xt]===void 0&&typeof Lt[Xt]=="function"&&(this[Xt]=function(er){return function(){return Lt[er].apply(Lt,arguments)}}(Xt));for(var Jt=0;Jt=Nt.length?(Nt.decoder?Kt=Nt.buffer.join(""):Nt.buffer.length===1?Kt=Nt.buffer.first():Kt=Nt.buffer.concat(Nt.length),Nt.buffer.clear()):Kt=Nt.buffer.consume(Lt,Nt.decoder),Kt}function Ot(Lt){var Nt=Lt._readableState;nt("endReadable",Nt.endEmitted),Nt.endEmitted||(Nt.ended=!0,process$1.nextTick(Ct,Nt,Lt))}function Ct(Lt,Nt){if(nt("endReadableNT",Lt.endEmitted,Lt.length),!Lt.endEmitted&&Lt.length===0&&(Lt.endEmitted=!0,Nt.readable=!1,Nt.emit("end"),Lt.autoDestroy)){var Kt=Nt._writableState;(!Kt||Kt.autoDestroy&&Kt.finished)&&Nt.destroy()}}typeof Symbol=="function"&&(Pt.from=function(Lt,Nt){return $t===void 0&&($t=requireFromBrowser()),$t(Pt,Lt,Nt)});function Ut(Lt,Nt){for(var Kt=0,yr=Lt.length;Kt0;return et(mt,$t,Bt,function(Dt){St||(St=Dt),Dt&&_t.forEach(nt),!$t&&(_t.forEach(nt),wt(St))})});return dt.reduce(st)}return pipeline_1=ht,pipeline_1}var streamBrowserify=Stream,EE=eventsExports.EventEmitter,inherits$q=inherits_browserExports;inherits$q(Stream,EE);Stream.Readable=require_stream_readable$1();Stream.Writable=require_stream_writable$1();Stream.Duplex=require_stream_duplex$1();Stream.Transform=require_stream_transform();Stream.PassThrough=require_stream_passthrough();Stream.finished=requireEndOfStream();Stream.pipeline=requirePipeline();Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(o,e){var a=this;function c(ot){o.writable&&o.write(ot)===!1&&a.pause&&a.pause()}a.on("data",c);function d(){a.readable&&a.resume&&a.resume()}o.on("drain",d),!o._isStdio&&(!e||e.end!==!1)&&(a.on("end",j),a.on("close",et));var h=!1;function j(){h||(h=!0,o.end())}function et(){h||(h=!0,typeof o.destroy=="function"&&o.destroy())}function nt(ot){if(st(),EE.listenerCount(this,"error")===0)throw ot}a.on("error",nt),o.on("error",nt);function st(){a.removeListener("data",c),o.removeListener("drain",d),a.removeListener("end",j),a.removeListener("close",et),a.removeListener("error",nt),o.removeListener("error",nt),a.removeListener("end",st),a.removeListener("close",st),o.removeListener("close",st)}return a.on("end",st),a.on("close",st),o.on("close",st),o.emit("pipe",a),o};var cryptoBrowserify={},browser$a={exports:{}},MAX_BYTES=65536,MAX_UINT32=4294967295;function oldBrowser$1(){throw new Error(`Secure random number generation is not supported by this browser. +Use Chrome, Firefox or Internet Explorer 11`)}var Buffer$A=safeBufferExports$1.Buffer,crypto$2=globalThis.crypto||globalThis.msCrypto;crypto$2&&crypto$2.getRandomValues?browser$a.exports=randomBytes$2:browser$a.exports=oldBrowser$1;function randomBytes$2(o,e){if(o>MAX_UINT32)throw new RangeError("requested too many random bytes");var a=Buffer$A.allocUnsafe(o);if(o>0)if(o>MAX_BYTES)for(var c=0;c=this._blockSize;){for(var d=this._blockOffset;d0;++h)this._length[h]+=j,j=this._length[h]/4294967296|0,j>0&&(this._length[h]-=4294967296*j);return this};HashBase$2.prototype._update=function(){throw new Error("_update is not implemented")};HashBase$2.prototype.digest=function(o){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();o!==void 0&&(e=e.toString(o)),this._block.fill(0),this._blockOffset=0;for(var a=0;a<4;++a)this._length[a]=0;return e};HashBase$2.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$2,inherits$o=inherits_browserExports,HashBase$1=hashBase,Buffer$y=safeBufferExports$1.Buffer,ARRAY16$1=new Array(16);function MD5$3(){HashBase$1.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits$o(MD5$3,HashBase$1);MD5$3.prototype._update=function(){for(var o=ARRAY16$1,e=0;e<16;++e)o[e]=this._block.readInt32LE(e*4);var a=this._a,c=this._b,d=this._c,h=this._d;a=fnF(a,c,d,h,o[0],3614090360,7),h=fnF(h,a,c,d,o[1],3905402710,12),d=fnF(d,h,a,c,o[2],606105819,17),c=fnF(c,d,h,a,o[3],3250441966,22),a=fnF(a,c,d,h,o[4],4118548399,7),h=fnF(h,a,c,d,o[5],1200080426,12),d=fnF(d,h,a,c,o[6],2821735955,17),c=fnF(c,d,h,a,o[7],4249261313,22),a=fnF(a,c,d,h,o[8],1770035416,7),h=fnF(h,a,c,d,o[9],2336552879,12),d=fnF(d,h,a,c,o[10],4294925233,17),c=fnF(c,d,h,a,o[11],2304563134,22),a=fnF(a,c,d,h,o[12],1804603682,7),h=fnF(h,a,c,d,o[13],4254626195,12),d=fnF(d,h,a,c,o[14],2792965006,17),c=fnF(c,d,h,a,o[15],1236535329,22),a=fnG(a,c,d,h,o[1],4129170786,5),h=fnG(h,a,c,d,o[6],3225465664,9),d=fnG(d,h,a,c,o[11],643717713,14),c=fnG(c,d,h,a,o[0],3921069994,20),a=fnG(a,c,d,h,o[5],3593408605,5),h=fnG(h,a,c,d,o[10],38016083,9),d=fnG(d,h,a,c,o[15],3634488961,14),c=fnG(c,d,h,a,o[4],3889429448,20),a=fnG(a,c,d,h,o[9],568446438,5),h=fnG(h,a,c,d,o[14],3275163606,9),d=fnG(d,h,a,c,o[3],4107603335,14),c=fnG(c,d,h,a,o[8],1163531501,20),a=fnG(a,c,d,h,o[13],2850285829,5),h=fnG(h,a,c,d,o[2],4243563512,9),d=fnG(d,h,a,c,o[7],1735328473,14),c=fnG(c,d,h,a,o[12],2368359562,20),a=fnH(a,c,d,h,o[5],4294588738,4),h=fnH(h,a,c,d,o[8],2272392833,11),d=fnH(d,h,a,c,o[11],1839030562,16),c=fnH(c,d,h,a,o[14],4259657740,23),a=fnH(a,c,d,h,o[1],2763975236,4),h=fnH(h,a,c,d,o[4],1272893353,11),d=fnH(d,h,a,c,o[7],4139469664,16),c=fnH(c,d,h,a,o[10],3200236656,23),a=fnH(a,c,d,h,o[13],681279174,4),h=fnH(h,a,c,d,o[0],3936430074,11),d=fnH(d,h,a,c,o[3],3572445317,16),c=fnH(c,d,h,a,o[6],76029189,23),a=fnH(a,c,d,h,o[9],3654602809,4),h=fnH(h,a,c,d,o[12],3873151461,11),d=fnH(d,h,a,c,o[15],530742520,16),c=fnH(c,d,h,a,o[2],3299628645,23),a=fnI(a,c,d,h,o[0],4096336452,6),h=fnI(h,a,c,d,o[7],1126891415,10),d=fnI(d,h,a,c,o[14],2878612391,15),c=fnI(c,d,h,a,o[5],4237533241,21),a=fnI(a,c,d,h,o[12],1700485571,6),h=fnI(h,a,c,d,o[3],2399980690,10),d=fnI(d,h,a,c,o[10],4293915773,15),c=fnI(c,d,h,a,o[1],2240044497,21),a=fnI(a,c,d,h,o[8],1873313359,6),h=fnI(h,a,c,d,o[15],4264355552,10),d=fnI(d,h,a,c,o[6],2734768916,15),c=fnI(c,d,h,a,o[13],1309151649,21),a=fnI(a,c,d,h,o[4],4149444226,6),h=fnI(h,a,c,d,o[11],3174756917,10),d=fnI(d,h,a,c,o[2],718787259,15),c=fnI(c,d,h,a,o[9],3951481745,21),this._a=this._a+a|0,this._b=this._b+c|0,this._c=this._c+d|0,this._d=this._d+h|0};MD5$3.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var o=Buffer$y.allocUnsafe(16);return o.writeInt32LE(this._a,0),o.writeInt32LE(this._b,4),o.writeInt32LE(this._c,8),o.writeInt32LE(this._d,12),o};function rotl$1(o,e){return o<>>32-e}function fnF(o,e,a,c,d,h,j){return rotl$1(o+(e&a|~e&c)+d+h|0,j)+e|0}function fnG(o,e,a,c,d,h,j){return rotl$1(o+(e&c|a&~c)+d+h|0,j)+e|0}function fnH(o,e,a,c,d,h,j){return rotl$1(o+(e^a^c)+d+h|0,j)+e|0}function fnI(o,e,a,c,d,h,j){return rotl$1(o+(a^(e|~c))+d+h|0,j)+e|0}var md5_js=MD5$3,Buffer$x=require$$0$1.Buffer,inherits$n=inherits_browserExports,HashBase=hashBase,ARRAY16=new Array(16),zl=[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],zr=[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],sl=[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],sr=[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],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160$4(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}inherits$n(RIPEMD160$4,HashBase);RIPEMD160$4.prototype._update=function(){for(var o=ARRAY16,e=0;e<16;++e)o[e]=this._block.readInt32LE(e*4);for(var a=this._a|0,c=this._b|0,d=this._c|0,h=this._d|0,j=this._e|0,et=this._a|0,nt=this._b|0,st=this._c|0,ot=this._d|0,ht=this._e|0,pt=0;pt<80;pt+=1){var dt,gt;pt<16?(dt=fn1(a,c,d,h,j,o[zl[pt]],hl[0],sl[pt]),gt=fn5(et,nt,st,ot,ht,o[zr[pt]],hr[0],sr[pt])):pt<32?(dt=fn2(a,c,d,h,j,o[zl[pt]],hl[1],sl[pt]),gt=fn4(et,nt,st,ot,ht,o[zr[pt]],hr[1],sr[pt])):pt<48?(dt=fn3(a,c,d,h,j,o[zl[pt]],hl[2],sl[pt]),gt=fn3(et,nt,st,ot,ht,o[zr[pt]],hr[2],sr[pt])):pt<64?(dt=fn4(a,c,d,h,j,o[zl[pt]],hl[3],sl[pt]),gt=fn2(et,nt,st,ot,ht,o[zr[pt]],hr[3],sr[pt])):(dt=fn5(a,c,d,h,j,o[zl[pt]],hl[4],sl[pt]),gt=fn1(et,nt,st,ot,ht,o[zr[pt]],hr[4],sr[pt])),a=j,j=h,h=rotl(d,10),d=c,c=dt,et=ht,ht=ot,ot=rotl(st,10),st=nt,nt=gt}var wt=this._b+d+ot|0;this._b=this._c+h+ht|0,this._c=this._d+j+et|0,this._d=this._e+a+nt|0,this._e=this._a+c+st|0,this._a=wt};RIPEMD160$4.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var o=Buffer$x.alloc?Buffer$x.alloc(20):new Buffer$x(20);return o.writeInt32LE(this._a,0),o.writeInt32LE(this._b,4),o.writeInt32LE(this._c,8),o.writeInt32LE(this._d,12),o.writeInt32LE(this._e,16),o};function rotl(o,e){return o<>>32-e}function fn1(o,e,a,c,d,h,j,et){return rotl(o+(e^a^c)+h+j|0,et)+d|0}function fn2(o,e,a,c,d,h,j,et){return rotl(o+(e&a|~e&c)+h+j|0,et)+d|0}function fn3(o,e,a,c,d,h,j,et){return rotl(o+((e|~a)^c)+h+j|0,et)+d|0}function fn4(o,e,a,c,d,h,j,et){return rotl(o+(e&c|a&~c)+h+j|0,et)+d|0}function fn5(o,e,a,c,d,h,j,et){return rotl(o+(e^(a|~c))+h+j|0,et)+d|0}var ripemd160=RIPEMD160$4,sha_js={exports:{}},Buffer$w=safeBufferExports$1.Buffer;function Hash$7(o,e){this._block=Buffer$w.alloc(o),this._finalSize=e,this._blockSize=o,this._len=0}Hash$7.prototype.update=function(o,e){typeof o=="string"&&(e=e||"utf8",o=Buffer$w.from(o,e));for(var a=this._block,c=this._blockSize,d=o.length,h=this._len,j=0;j=this._finalSize&&(this._update(this._block),this._block.fill(0));var a=this._len*8;if(a<=4294967295)this._block.writeUInt32BE(a,this._blockSize-4);else{var c=(a&4294967295)>>>0,d=(a-c)/4294967296;this._block.writeUInt32BE(d,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var h=this._hash();return o?h.toString(o):h};Hash$7.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$3=Hash$7,inherits$m=inherits_browserExports,Hash$6=hash$3,Buffer$v=safeBufferExports$1.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$6.call(this,64,56)}inherits$m(Sha,Hash$6);Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(o){return o<<5|o>>>27}function rotl30$1(o){return o<<30|o>>>2}function ft$1(o,e,a,c){return o===0?e&a|~e&c:o===2?e&a|e&c|a&c:e^a^c}Sha.prototype._update=function(o){for(var e=this._w,a=this._a|0,c=this._b|0,d=this._c|0,h=this._d|0,j=this._e|0,et=0;et<16;++et)e[et]=o.readInt32BE(et*4);for(;et<80;++et)e[et]=e[et-3]^e[et-8]^e[et-14]^e[et-16];for(var nt=0;nt<80;++nt){var st=~~(nt/20),ot=rotl5$1(a)+ft$1(st,c,d,h)+j+e[nt]+K$4[st]|0;j=h,h=d,d=rotl30$1(c),c=a,a=ot}this._a=a+this._a|0,this._b=c+this._b|0,this._c=d+this._c|0,this._d=h+this._d|0,this._e=j+this._e|0};Sha.prototype._hash=function(){var o=Buffer$v.allocUnsafe(20);return o.writeInt32BE(this._a|0,0),o.writeInt32BE(this._b|0,4),o.writeInt32BE(this._c|0,8),o.writeInt32BE(this._d|0,12),o.writeInt32BE(this._e|0,16),o};var sha$4=Sha,inherits$l=inherits_browserExports,Hash$5=hash$3,Buffer$u=safeBufferExports$1.Buffer,K$3=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$5.call(this,64,56)}inherits$l(Sha1,Hash$5);Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(o){return o<<1|o>>>31}function rotl5(o){return o<<5|o>>>27}function rotl30(o){return o<<30|o>>>2}function ft(o,e,a,c){return o===0?e&a|~e&c:o===2?e&a|e&c|a&c:e^a^c}Sha1.prototype._update=function(o){for(var e=this._w,a=this._a|0,c=this._b|0,d=this._c|0,h=this._d|0,j=this._e|0,et=0;et<16;++et)e[et]=o.readInt32BE(et*4);for(;et<80;++et)e[et]=rotl1(e[et-3]^e[et-8]^e[et-14]^e[et-16]);for(var nt=0;nt<80;++nt){var st=~~(nt/20),ot=rotl5(a)+ft(st,c,d,h)+j+e[nt]+K$3[st]|0;j=h,h=d,d=rotl30(c),c=a,a=ot}this._a=a+this._a|0,this._b=c+this._b|0,this._c=d+this._c|0,this._d=h+this._d|0,this._e=j+this._e|0};Sha1.prototype._hash=function(){var o=Buffer$u.allocUnsafe(20);return o.writeInt32BE(this._a|0,0),o.writeInt32BE(this._b|0,4),o.writeInt32BE(this._c|0,8),o.writeInt32BE(this._d|0,12),o.writeInt32BE(this._e|0,16),o};var sha1=Sha1,inherits$k=inherits_browserExports,Hash$4=hash$3,Buffer$t=safeBufferExports$1.Buffer,K$2=[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],W$3=new Array(64);function Sha256$1(){this.init(),this._w=W$3,Hash$4.call(this,64,56)}inherits$k(Sha256$1,Hash$4);Sha256$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ch(o,e,a){return a^o&(e^a)}function maj$1(o,e,a){return o&e|a&(o|e)}function sigma0$1(o){return(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10)}function sigma1$1(o){return(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7)}function gamma0(o){return(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3}function gamma1(o){return(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10}Sha256$1.prototype._update=function(o){for(var e=this._w,a=this._a|0,c=this._b|0,d=this._c|0,h=this._d|0,j=this._e|0,et=this._f|0,nt=this._g|0,st=this._h|0,ot=0;ot<16;++ot)e[ot]=o.readInt32BE(ot*4);for(;ot<64;++ot)e[ot]=gamma1(e[ot-2])+e[ot-7]+gamma0(e[ot-15])+e[ot-16]|0;for(var ht=0;ht<64;++ht){var pt=st+sigma1$1(j)+ch(j,et,nt)+K$2[ht]+e[ht]|0,dt=sigma0$1(a)+maj$1(a,c,d)|0;st=nt,nt=et,et=j,j=h+pt|0,h=d,d=c,c=a,a=pt+dt|0}this._a=a+this._a|0,this._b=c+this._b|0,this._c=d+this._c|0,this._d=h+this._d|0,this._e=j+this._e|0,this._f=et+this._f|0,this._g=nt+this._g|0,this._h=st+this._h|0};Sha256$1.prototype._hash=function(){var o=Buffer$t.allocUnsafe(32);return o.writeInt32BE(this._a,0),o.writeInt32BE(this._b,4),o.writeInt32BE(this._c,8),o.writeInt32BE(this._d,12),o.writeInt32BE(this._e,16),o.writeInt32BE(this._f,20),o.writeInt32BE(this._g,24),o.writeInt32BE(this._h,28),o};var sha256$1=Sha256$1,inherits$j=inherits_browserExports,Sha256=sha256$1,Hash$3=hash$3,Buffer$s=safeBufferExports$1.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$3.call(this,64,56)}inherits$j(Sha224,Sha256);Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Sha224.prototype._hash=function(){var o=Buffer$s.allocUnsafe(28);return o.writeInt32BE(this._a,0),o.writeInt32BE(this._b,4),o.writeInt32BE(this._c,8),o.writeInt32BE(this._d,12),o.writeInt32BE(this._e,16),o.writeInt32BE(this._f,20),o.writeInt32BE(this._g,24),o};var sha224$1=Sha224,inherits$i=inherits_browserExports,Hash$2=hash$3,Buffer$r=safeBufferExports$1.Buffer,K$1=[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],W$1=new Array(160);function Sha512(){this.init(),this._w=W$1,Hash$2.call(this,128,112)}inherits$i(Sha512,Hash$2);Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ch(o,e,a){return a^o&(e^a)}function maj(o,e,a){return o&e|a&(o|e)}function sigma0(o,e){return(o>>>28|e<<4)^(e>>>2|o<<30)^(e>>>7|o<<25)}function sigma1(o,e){return(o>>>14|e<<18)^(o>>>18|e<<14)^(e>>>9|o<<23)}function Gamma0(o,e){return(o>>>1|e<<31)^(o>>>8|e<<24)^o>>>7}function Gamma0l(o,e){return(o>>>1|e<<31)^(o>>>8|e<<24)^(o>>>7|e<<25)}function Gamma1(o,e){return(o>>>19|e<<13)^(e>>>29|o<<3)^o>>>6}function Gamma1l(o,e){return(o>>>19|e<<13)^(e>>>29|o<<3)^(o>>>6|e<<26)}function getCarry(o,e){return o>>>0>>0?1:0}Sha512.prototype._update=function(o){for(var e=this._w,a=this._ah|0,c=this._bh|0,d=this._ch|0,h=this._dh|0,j=this._eh|0,et=this._fh|0,nt=this._gh|0,st=this._hh|0,ot=this._al|0,ht=this._bl|0,pt=this._cl|0,dt=this._dl|0,gt=this._el|0,wt=this._fl|0,St=this._gl|0,_t=this._hl|0,mt=0;mt<32;mt+=2)e[mt]=o.readInt32BE(mt*4),e[mt+1]=o.readInt32BE(mt*4+4);for(;mt<160;mt+=2){var bt=e[mt-30],$t=e[mt-15*2+1],Bt=Gamma0(bt,$t),Dt=Gamma0l($t,bt);bt=e[mt-2*2],$t=e[mt-2*2+1];var Ht=Gamma1(bt,$t),qt=Gamma1l($t,bt),Pt=e[mt-7*2],Gt=e[mt-7*2+1],ct=e[mt-16*2],g=e[mt-16*2+1],b=Dt+Gt|0,$=Bt+Pt+getCarry(b,Dt)|0;b=b+qt|0,$=$+Ht+getCarry(b,qt)|0,b=b+g|0,$=$+ct+getCarry(b,g)|0,e[mt]=$,e[mt+1]=b}for(var _e=0;_e<160;_e+=2){$=e[_e],b=e[_e+1];var rt=maj(a,c,d),at=maj(ot,ht,pt),lt=sigma0(a,ot),tt=sigma0(ot,a),_=sigma1(j,gt),it=sigma1(gt,j),yt=K$1[_e],vt=K$1[_e+1],Rt=Ch(j,et,nt),Tt=Ch(gt,wt,St),Mt=_t+it|0,At=st+_+getCarry(Mt,_t)|0;Mt=Mt+Tt|0,At=At+Rt+getCarry(Mt,Tt)|0,Mt=Mt+vt|0,At=At+yt+getCarry(Mt,vt)|0,Mt=Mt+b|0,At=At+$+getCarry(Mt,b)|0;var Ot=tt+at|0,Ct=lt+rt+getCarry(Ot,tt)|0;st=nt,_t=St,nt=et,St=wt,et=j,wt=gt,gt=dt+Mt|0,j=h+At+getCarry(gt,dt)|0,h=d,dt=pt,d=c,pt=ht,c=a,ht=ot,ot=Mt+Ot|0,a=At+Ct+getCarry(ot,Mt)|0}this._al=this._al+ot|0,this._bl=this._bl+ht|0,this._cl=this._cl+pt|0,this._dl=this._dl+dt|0,this._el=this._el+gt|0,this._fl=this._fl+wt|0,this._gl=this._gl+St|0,this._hl=this._hl+_t|0,this._ah=this._ah+a+getCarry(this._al,ot)|0,this._bh=this._bh+c+getCarry(this._bl,ht)|0,this._ch=this._ch+d+getCarry(this._cl,pt)|0,this._dh=this._dh+h+getCarry(this._dl,dt)|0,this._eh=this._eh+j+getCarry(this._el,gt)|0,this._fh=this._fh+et+getCarry(this._fl,wt)|0,this._gh=this._gh+nt+getCarry(this._gl,St)|0,this._hh=this._hh+st+getCarry(this._hl,_t)|0};Sha512.prototype._hash=function(){var o=Buffer$r.allocUnsafe(64);function e(a,c,d){o.writeInt32BE(a,d),o.writeInt32BE(c,d+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),o};var sha512$1=Sha512,inherits$h=inherits_browserExports,SHA512$2=sha512$1,Hash$1=hash$3,Buffer$q=safeBufferExports$1.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$1.call(this,128,112)}inherits$h(Sha384,SHA512$2);Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Sha384.prototype._hash=function(){var o=Buffer$q.allocUnsafe(48);function e(a,c,d){o.writeInt32BE(a,d),o.writeInt32BE(c,d+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),o};var sha384$1=Sha384,exports=sha_js.exports=function o(e){e=e.toLowerCase();var a=exports[e];if(!a)throw new Error(e+" is not supported (we accept pull requests)");return new a};exports.sha=sha$4;exports.sha1=sha1;exports.sha224=sha224$1;exports.sha256=sha256$1;exports.sha384=sha384$1;exports.sha512=sha512$1;var sha_jsExports=sha_js.exports,Buffer$p=safeBufferExports$1.Buffer,Transform$6=streamBrowserify.Transform,StringDecoder=string_decoder.StringDecoder,inherits$g=inherits_browserExports;function CipherBase$1(o){Transform$6.call(this),this.hashMode=typeof o=="string",this.hashMode?this[o]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$g(CipherBase$1,Transform$6);var useUint8Array=typeof Uint8Array<"u",useArrayBuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(Buffer$p.prototype instanceof Uint8Array||Buffer$p.TYPED_ARRAY_SUPPORT);CipherBase$1.prototype.update=function(o,e,a){var c;if(o instanceof Buffer$p)c=o;else if(typeof o=="string")c=Buffer$p.from(o,e);else if(useArrayBuffer&&ArrayBuffer.isView(o))c=Buffer$p.from(o.buffer,o.byteOffset,o.byteLength);else if(useUint8Array&&o instanceof Uint8Array)c=Buffer$p.from(o);else if(Buffer$p.isBuffer(o)&&o.constructor&&o.constructor.isBuffer&&o.constructor.isBuffer(o))c=Buffer$p.from(o);else throw new Error('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.');var d=this._update(c);return this.hashMode?this:(a&&(d=this._toString(d,a)),d)};CipherBase$1.prototype.setAutoPadding=function(){};CipherBase$1.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};CipherBase$1.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};CipherBase$1.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};CipherBase$1.prototype._transform=function(o,e,a){var c;try{this.hashMode?this._update(o):this.push(this._update(o))}catch(d){c=d}finally{a(c)}};CipherBase$1.prototype._flush=function(o){var e;try{this.push(this.__final())}catch(a){e=a}o(e)};CipherBase$1.prototype._finalOrDigest=function(o){var e=this.__final()||Buffer$p.alloc(0);return o&&(e=this._toString(e,o,!0)),e};CipherBase$1.prototype._toString=function(o,e,a){if(this._decoder||(this._decoder=new StringDecoder(e),this._encoding=e),this._encoding!==e)throw new Error("can’t switch encodings");var c=this._decoder.write(o);return a&&(c+=this._decoder.end()),c};var cipherBase=CipherBase$1,inherits$f=inherits_browserExports,MD5$2=md5_js,RIPEMD160$3=ripemd160,sha$3=sha_jsExports,Base$5=cipherBase;function Hash(o){Base$5.call(this,"digest"),this._hash=o}inherits$f(Hash,Base$5);Hash.prototype._update=function(o){this._hash.update(o)};Hash.prototype._final=function(){return this._hash.digest()};var browser$9=function o(e){return e=e.toLowerCase(),e==="md5"?new MD5$2:e==="rmd160"||e==="ripemd160"?new RIPEMD160$3:new Hash(sha$3(e))},inherits$e=inherits_browserExports,Buffer$o=safeBufferExports$1.Buffer,Base$4=cipherBase,ZEROS$2=Buffer$o.alloc(128),blocksize=64;function Hmac$3(o,e){Base$4.call(this,"digest"),typeof e=="string"&&(e=Buffer$o.from(e)),this._alg=o,this._key=e,e.length>blocksize?e=o(e):e.lengtha){var c=o==="rmd160"?new RIPEMD160$2:sha$2(o);e=c.update(e).digest()}else e.lengthMAX_ALLOC||e!==e)throw new TypeError("Bad key length")},defaultEncoding$2;if(globalThis.process&&globalThis.process.browser)defaultEncoding$2="utf-8";else if(globalThis.process&&globalThis.process.version){var pVersionMajor=parseInt(process$1.version.split(".")[0].slice(1),10);defaultEncoding$2=pVersionMajor>=6?"utf-8":"binary"}else defaultEncoding$2="utf-8";var defaultEncoding_1=defaultEncoding$2,Buffer$m=safeBufferExports$1.Buffer,toBuffer$2=function(o,e,a){if(Buffer$m.isBuffer(o))return o;if(typeof o=="string")return Buffer$m.from(o,e);if(ArrayBuffer.isView(o))return Buffer$m.from(o.buffer);throw new TypeError(a+" must be a string, a Buffer, a typed array or a DataView")},md5=md5$2,RIPEMD160$1=ripemd160,sha$1=sha_jsExports,Buffer$l=safeBufferExports$1.Buffer,checkParameters$1=precondition,defaultEncoding$1=defaultEncoding_1,toBuffer$1=toBuffer$2,ZEROS=Buffer$l.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac$1(o,e,a){var c=getDigest(o),d=o==="sha512"||o==="sha384"?128:64;e.length>d?e=c(e):e.length>>0};utils$n.writeUInt32BE=function o(e,a,c){e[0+c]=a>>>24,e[1+c]=a>>>16&255,e[2+c]=a>>>8&255,e[3+c]=a&255};utils$n.ip=function o(e,a,c,d){for(var h=0,j=0,et=6;et>=0;et-=2){for(var nt=0;nt<=24;nt+=8)h<<=1,h|=a>>>nt+et&1;for(var nt=0;nt<=24;nt+=8)h<<=1,h|=e>>>nt+et&1}for(var et=6;et>=0;et-=2){for(var nt=1;nt<=25;nt+=8)j<<=1,j|=a>>>nt+et&1;for(var nt=1;nt<=25;nt+=8)j<<=1,j|=e>>>nt+et&1}c[d+0]=h>>>0,c[d+1]=j>>>0};utils$n.rip=function o(e,a,c,d){for(var h=0,j=0,et=0;et<4;et++)for(var nt=24;nt>=0;nt-=8)h<<=1,h|=a>>>nt+et&1,h<<=1,h|=e>>>nt+et&1;for(var et=4;et<8;et++)for(var nt=24;nt>=0;nt-=8)j<<=1,j|=a>>>nt+et&1,j<<=1,j|=e>>>nt+et&1;c[d+0]=h>>>0,c[d+1]=j>>>0};utils$n.pc1=function o(e,a,c,d){for(var h=0,j=0,et=7;et>=5;et--){for(var nt=0;nt<=24;nt+=8)h<<=1,h|=a>>nt+et&1;for(var nt=0;nt<=24;nt+=8)h<<=1,h|=e>>nt+et&1}for(var nt=0;nt<=24;nt+=8)h<<=1,h|=a>>nt+et&1;for(var et=1;et<=3;et++){for(var nt=0;nt<=24;nt+=8)j<<=1,j|=a>>nt+et&1;for(var nt=0;nt<=24;nt+=8)j<<=1,j|=e>>nt+et&1}for(var nt=0;nt<=24;nt+=8)j<<=1,j|=e>>nt+et&1;c[d+0]=h>>>0,c[d+1]=j>>>0};utils$n.r28shl=function o(e,a){return e<>>28-a};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$n.pc2=function o(e,a,c,d){for(var h=0,j=0,et=pc2table.length>>>1,nt=0;nt>>pc2table[nt]&1;for(var nt=et;nt>>pc2table[nt]&1;c[d+0]=h>>>0,c[d+1]=j>>>0};utils$n.expand=function o(e,a,c){var d=0,h=0;d=(e&1)<<5|e>>>27;for(var j=23;j>=15;j-=4)d<<=6,d|=e>>>j&63;for(var j=11;j>=3;j-=4)h|=e>>>j&63,h<<=6;h|=(e&31)<<1|e>>>31,a[c+0]=d>>>0,a[c+1]=h>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$n.substitute=function o(e,a){for(var c=0,d=0;d<4;d++){var h=e>>>18-d*6&63,j=sTable[d*64+h];c<<=4,c|=j}for(var d=0;d<4;d++){var h=a>>>18-d*6&63,j=sTable[4*64+d*64+h];c<<=4,c|=j}return c>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];utils$n.permute=function o(e){for(var a=0,c=0;c>>permuteTable[c]&1;return a>>>0};utils$n.padSplit=function o(e,a,c){for(var d=e.toString(2);d.length0;d--)a+=this._buffer(e,a),c+=this._flushBuffer(h,c);return a+=this._buffer(e,a),h};Cipher$3.prototype.final=function o(e){var a;e&&(a=this.update(e));var c;return this.type==="encrypt"?c=this._finalEncrypt():c=this._finalDecrypt(),a?a.concat(c):c};Cipher$3.prototype._pad=function o(e,a){if(a===0)return!1;for(;a>>1];c=utils$m.r28shl(c,j),d=utils$m.r28shl(d,j),utils$m.pc2(c,d,e.keys,h)}};DES$3.prototype._update=function o(e,a,c,d){var h=this._desState,j=utils$m.readUInt32BE(e,a),et=utils$m.readUInt32BE(e,a+4);utils$m.ip(j,et,h.tmp,0),j=h.tmp[0],et=h.tmp[1],this.type==="encrypt"?this._encrypt(h,j,et,h.tmp,0):this._decrypt(h,j,et,h.tmp,0),j=h.tmp[0],et=h.tmp[1],utils$m.writeUInt32BE(c,j,d),utils$m.writeUInt32BE(c,et,d+4)};DES$3.prototype._pad=function o(e,a){if(this.padding===!1)return!1;for(var c=e.length-a,d=a;d>>0,j=dt}utils$m.rip(et,j,d,h)};DES$3.prototype._decrypt=function o(e,a,c,d,h){for(var j=c,et=a,nt=e.keys.length-2;nt>=0;nt-=2){var st=e.keys[nt],ot=e.keys[nt+1];utils$m.expand(j,e.tmp,0),st^=e.tmp[0],ot^=e.tmp[1];var ht=utils$m.substitute(st,ot),pt=utils$m.permute(ht),dt=j;j=(et^pt)>>>0,et=dt}utils$m.rip(j,et,d,h)};var cbc$1={},assert$f=minimalisticAssert,inherits$b=inherits_browserExports,proto={};function CBCState(o){assert$f.equal(o.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e>d%8,o._prev=shiftIn(o._prev,a?et:nt);return j}function shiftIn(o,e){var a=o.length,c=-1,d=Buffer$g.allocUnsafe(o.length);for(o=Buffer$g.concat([o,Buffer$g.from([e])]);++c>7;return d}cfb1.encrypt=function(o,e,a){for(var c=e.length,d=Buffer$g.allocUnsafe(c),h=-1;++h>>24]^j[ot>>>16&255]^et[ht>>>8&255]^nt[pt&255]^e[_t++],gt=h[ot>>>24]^j[ht>>>16&255]^et[pt>>>8&255]^nt[st&255]^e[_t++],wt=h[ht>>>24]^j[pt>>>16&255]^et[st>>>8&255]^nt[ot&255]^e[_t++],St=h[pt>>>24]^j[st>>>16&255]^et[ot>>>8&255]^nt[ht&255]^e[_t++],st=dt,ot=gt,ht=wt,pt=St;return dt=(c[st>>>24]<<24|c[ot>>>16&255]<<16|c[ht>>>8&255]<<8|c[pt&255])^e[_t++],gt=(c[ot>>>24]<<24|c[ht>>>16&255]<<16|c[pt>>>8&255]<<8|c[st&255])^e[_t++],wt=(c[ht>>>24]<<24|c[pt>>>16&255]<<16|c[st>>>8&255]<<8|c[ot&255])^e[_t++],St=(c[pt>>>24]<<24|c[st>>>16&255]<<16|c[ot>>>8&255]<<8|c[ht&255])^e[_t++],dt=dt>>>0,gt=gt>>>0,wt=wt>>>0,St=St>>>0,[dt,gt,wt,St]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var o=new Array(256),e=0;e<256;e++)e<128?o[e]=e<<1:o[e]=e<<1^283;for(var a=[],c=[],d=[[],[],[],[]],h=[[],[],[],[]],j=0,et=0,nt=0;nt<256;++nt){var st=et^et<<1^et<<2^et<<3^et<<4;st=st>>>8^st&255^99,a[j]=st,c[st]=j;var ot=o[j],ht=o[ot],pt=o[ht],dt=o[st]*257^st*16843008;d[0][j]=dt<<24|dt>>>8,d[1][j]=dt<<16|dt>>>16,d[2][j]=dt<<8|dt>>>24,d[3][j]=dt,dt=pt*16843009^ht*65537^ot*257^j*16843008,h[0][st]=dt<<24|dt>>>8,h[1][st]=dt<<16|dt>>>16,h[2][st]=dt<<8|dt>>>24,h[3][st]=dt,j===0?j=et=1:(j=ot^o[o[o[pt^ot]]],et^=o[o[et]])}return{SBOX:a,INV_SBOX:c,SUB_MIX:d,INV_SUB_MIX:h}}();function AES(o){this._key=asUInt32Array(o),this._reset()}AES.blockSize=4*4;AES.keySize=256/8;AES.prototype.blockSize=AES.blockSize;AES.prototype.keySize=AES.keySize;AES.prototype._reset=function(){for(var o=this._key,e=o.length,a=e+6,c=(a+1)*4,d=[],h=0;h>>24,j=G.SBOX[j>>>24]<<24|G.SBOX[j>>>16&255]<<16|G.SBOX[j>>>8&255]<<8|G.SBOX[j&255],j^=RCON[h/e|0]<<24):e>6&&h%e===4&&(j=G.SBOX[j>>>24]<<24|G.SBOX[j>>>16&255]<<16|G.SBOX[j>>>8&255]<<8|G.SBOX[j&255]),d[h]=d[h-e]^j}for(var et=[],nt=0;nt>>24]]^G.INV_SUB_MIX[1][G.SBOX[ot>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[ot>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[ot&255]]}this._nRounds=a,this._keySchedule=d,this._invKeySchedule=et};AES.prototype.encryptBlockRaw=function(o){return o=asUInt32Array(o),cryptBlock(o,this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)};AES.prototype.encryptBlock=function(o){var e=this.encryptBlockRaw(o),a=Buffer$e.allocUnsafe(16);return a.writeUInt32BE(e[0],0),a.writeUInt32BE(e[1],4),a.writeUInt32BE(e[2],8),a.writeUInt32BE(e[3],12),a};AES.prototype.decryptBlock=function(o){o=asUInt32Array(o);var e=o[1];o[1]=o[3],o[3]=e;var a=cryptBlock(o,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),c=Buffer$e.allocUnsafe(16);return c.writeUInt32BE(a[0],0),c.writeUInt32BE(a[3],4),c.writeUInt32BE(a[2],8),c.writeUInt32BE(a[1],12),c};AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)};aes$5.AES=AES;var Buffer$d=safeBufferExports$1.Buffer,ZEROES=Buffer$d.alloc(16,0);function toArray$1(o){return[o.readUInt32BE(0),o.readUInt32BE(4),o.readUInt32BE(8),o.readUInt32BE(12)]}function fromArray(o){var e=Buffer$d.allocUnsafe(16);return e.writeUInt32BE(o[0]>>>0,0),e.writeUInt32BE(o[1]>>>0,4),e.writeUInt32BE(o[2]>>>0,8),e.writeUInt32BE(o[3]>>>0,12),e}function GHASH$1(o){this.h=o,this.state=Buffer$d.alloc(16,0),this.cache=Buffer$d.allocUnsafe(0)}GHASH$1.prototype.ghash=function(o){for(var e=-1;++e0;a--)o[a]=o[a]>>>1|(o[a-1]&1)<<31;o[0]=o[0]>>>1,d&&(o[0]=o[0]^225<<24)}this.state=fromArray(e)};GHASH$1.prototype.update=function(o){this.cache=Buffer$d.concat([this.cache,o]);for(var e;this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)};GHASH$1.prototype.final=function(o,e){return this.cache.length&&this.ghash(Buffer$d.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,o,0,e])),this.state};var ghash=GHASH$1,aes$4=aes$5,Buffer$c=safeBufferExports$1.Buffer,Transform$5=cipherBase,inherits$8=inherits_browserExports,GHASH=ghash,xor$3=bufferXor,incr32=incr32_1;function xorTest(o,e){var a=0;o.length!==e.length&&a++;for(var c=Math.min(o.length,e.length),d=0;d0||c>0;){var nt=new MD5;nt.update(et),nt.update(o),e&&nt.update(e),et=nt.digest();var st=0;if(d>0){var ot=h.length-d;st=Math.min(d,et.length),et.copy(h,ot,0,st),d-=st}if(st0){var ht=j.length-c,pt=Math.min(c,et.length-st);et.copy(j,ht,st,st+pt),c-=pt}}return et.fill(0),{key:h,iv:j}}var evp_bytestokey=EVP_BytesToKey,MODES$1=modes_1,AuthCipher$1=authCipher,Buffer$9=safeBufferExports$1.Buffer,StreamCipher$1=streamCipher,Transform$3=cipherBase,aes$2=aes$5,ebtk$2=evp_bytestokey,inherits$6=inherits_browserExports;function Cipher(o,e,a){Transform$3.call(this),this._cache=new Splitter$1,this._cipher=new aes$2.AES(e),this._prev=Buffer$9.from(a),this._mode=o,this._autopadding=!0}inherits$6(Cipher,Transform$3);Cipher.prototype._update=function(o){this._cache.add(o);for(var e,a,c=[];e=this._cache.get();)a=this._mode.encrypt(this,e),c.push(a);return Buffer$9.concat(c)};var PADDING=Buffer$9.alloc(16,16);Cipher.prototype._final=function(){var o=this._cache.flush();if(this._autopadding)return o=this._mode.encrypt(this,o),this._cipher.scrub(),o;if(!o.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")};Cipher.prototype.setAutoPadding=function(o){return this._autopadding=!!o,this};function Splitter$1(){this.cache=Buffer$9.allocUnsafe(0)}Splitter$1.prototype.add=function(o){this.cache=Buffer$9.concat([this.cache,o])};Splitter$1.prototype.get=function(){if(this.cache.length>15){var o=this.cache.slice(0,16);return this.cache=this.cache.slice(16),o}return null};Splitter$1.prototype.flush=function(){for(var o=16-this.cache.length,e=Buffer$9.allocUnsafe(o),a=-1;++a16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null};Splitter.prototype.flush=function(){if(this.cache.length)return this.cache};function unpad(o){var e=o[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var a=-1;++a0?g:b},h.min=function(g,b){return g.cmp(b)<0?g:b},h.prototype._init=function(g,b,$){if(typeof g=="number")return this._initNumber(g,b,$);if(typeof g=="object")return this._initArray(g,b,$);b==="hex"&&(b=16),c(b===(b|0)&&b>=2&&b<=36),g=g.toString().replace(/\s+/g,"");var _e=0;g[0]==="-"&&(_e++,this.negative=1),_e=0;_e-=3)at=g[_e]|g[_e-1]<<8|g[_e-2]<<16,this.words[rt]|=at<>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);else if($==="le")for(_e=0,rt=0;_e>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);return this.strip()};function et(ct,g){var b=ct.charCodeAt(g);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function nt(ct,g,b){var $=et(ct,b);return b-1>=g&&($|=et(ct,b-1)<<4),$}h.prototype._parseHex=function(g,b,$){this.length=Math.ceil((g.length-b)/6),this.words=new Array(this.length);for(var _e=0;_e=b;_e-=2)lt=nt(g,b,_e)<=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8;else{var tt=g.length-b;for(_e=tt%2===0?b+1:b;_e=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8}this.strip()};function st(ct,g,b,$){for(var _e=0,rt=Math.min(ct.length,b),at=g;at=49?_e+=lt-49+10:lt>=17?_e+=lt-17+10:_e+=lt}return _e}h.prototype._parseBase=function(g,b,$){this.words=[0],this.length=1;for(var _e=0,rt=1;rt<=67108863;rt*=b)_e++;_e--,rt=rt/b|0;for(var at=g.length-$,lt=at%_e,tt=Math.min(at,at-lt)+$,_=0,it=$;it1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var ot=["","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"],ht=[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],pt=[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];h.prototype.toString=function(g,b){g=g||10,b=b|0||1;var $;if(g===16||g==="hex"){$="";for(var _e=0,rt=0,at=0;at>>24-_e&16777215,_e+=2,_e>=26&&(_e-=26,at--),rt!==0||at!==this.length-1?$=ot[6-tt.length]+tt+$:$=tt+$}for(rt!==0&&($=rt.toString(16)+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}if(g===(g|0)&&g>=2&&g<=36){var _=ht[g],it=pt[g];$="";var yt=this.clone();for(yt.negative=0;!yt.isZero();){var vt=yt.modn(it).toString(g);yt=yt.idivn(it),yt.isZero()?$=vt+$:$=ot[_-vt.length]+vt+$}for(this.isZero()&&($="0"+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}c(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(g,b){return c(typeof j<"u"),this.toArrayLike(j,g,b)},h.prototype.toArray=function(g,b){return this.toArrayLike(Array,g,b)},h.prototype.toArrayLike=function(g,b,$){var _e=this.byteLength(),rt=$||Math.max(1,_e);c(_e<=rt,"byte array longer than desired length"),c(rt>0,"Requested array length <= 0"),this.strip();var at=b==="le",lt=new g(rt),tt,_,it=this.clone();if(at){for(_=0;!it.isZero();_++)tt=it.andln(255),it.iushrn(8),lt[_]=tt;for(;_=4096&&($+=13,b>>>=13),b>=64&&($+=7,b>>>=7),b>=8&&($+=4,b>>>=4),b>=2&&($+=2,b>>>=2),$+b},h.prototype._zeroBits=function(g){if(g===0)return 26;var b=g,$=0;return b&8191||($+=13,b>>>=13),b&127||($+=7,b>>>=7),b&15||($+=4,b>>>=4),b&3||($+=2,b>>>=2),b&1||$++,$},h.prototype.bitLength=function(){var g=this.words[this.length-1],b=this._countBits(g);return(this.length-1)*26+b};function dt(ct){for(var g=new Array(ct.bitLength()),b=0;b>>_e}return g}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,b=0;bg.length?this.clone().ior(g):g.clone().ior(this)},h.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},h.prototype.iuand=function(g){var b;this.length>g.length?b=g:b=this;for(var $=0;$g.length?this.clone().iand(g):g.clone().iand(this)},h.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},h.prototype.iuxor=function(g){var b,$;this.length>g.length?(b=this,$=g):(b=g,$=this);for(var _e=0;_e<$.length;_e++)this.words[_e]=b.words[_e]^$.words[_e];if(this!==b)for(;_eg.length?this.clone().ixor(g):g.clone().ixor(this)},h.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},h.prototype.inotn=function(g){c(typeof g=="number"&&g>=0);var b=Math.ceil(g/26)|0,$=g%26;this._expand(b),$>0&&b--;for(var _e=0;_e0&&(this.words[_e]=~this.words[_e]&67108863>>26-$),this.strip()},h.prototype.notn=function(g){return this.clone().inotn(g)},h.prototype.setn=function(g,b){c(typeof g=="number"&&g>=0);var $=g/26|0,_e=g%26;return this._expand($+1),b?this.words[$]=this.words[$]|1<<_e:this.words[$]=this.words[$]&~(1<<_e),this.strip()},h.prototype.iadd=function(g){var b;if(this.negative!==0&&g.negative===0)return this.negative=0,b=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,b=this.isub(g),g.negative=1,b._normSign();var $,_e;this.length>g.length?($=this,_e=g):($=g,_e=this);for(var rt=0,at=0;at<_e.length;at++)b=($.words[at]|0)+(_e.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;for(;rt!==0&&at<$.length;at++)b=($.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;if(this.length=$.length,rt!==0)this.words[this.length]=rt,this.length++;else if($!==this)for(;at<$.length;at++)this.words[at]=$.words[at];return this},h.prototype.add=function(g){var b;return g.negative!==0&&this.negative===0?(g.negative=0,b=this.sub(g),g.negative^=1,b):g.negative===0&&this.negative!==0?(this.negative=0,b=g.sub(this),this.negative=1,b):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},h.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var b=this.iadd(g);return g.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var $=this.cmp(g);if($===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _e,rt;$>0?(_e=this,rt=g):(_e=g,rt=this);for(var at=0,lt=0;lt>26,this.words[lt]=b&67108863;for(;at!==0&<<_e.length;lt++)b=(_e.words[lt]|0)+at,at=b>>26,this.words[lt]=b&67108863;if(at===0&<<_e.length&&_e!==this)for(;lt<_e.length;lt++)this.words[lt]=_e.words[lt];return this.length=Math.max(this.length,lt),_e!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(g){return this.clone().isub(g)};function gt(ct,g,b){b.negative=g.negative^ct.negative;var $=ct.length+g.length|0;b.length=$,$=$-1|0;var _e=ct.words[0]|0,rt=g.words[0]|0,at=_e*rt,lt=at&67108863,tt=at/67108864|0;b.words[0]=lt;for(var _=1;_<$;_++){for(var it=tt>>>26,yt=tt&67108863,vt=Math.min(_,g.length-1),Rt=Math.max(0,_-ct.length+1);Rt<=vt;Rt++){var Tt=_-Rt|0;_e=ct.words[Tt]|0,rt=g.words[Rt]|0,at=_e*rt+yt,it+=at/67108864|0,yt=at&67108863}b.words[_]=yt|0,tt=it|0}return tt!==0?b.words[_]=tt|0:b.length--,b.strip()}var wt=function(g,b,$){var _e=g.words,rt=b.words,at=$.words,lt=0,tt,_,it,yt=_e[0]|0,vt=yt&8191,Rt=yt>>>13,Tt=_e[1]|0,Mt=Tt&8191,At=Tt>>>13,Ot=_e[2]|0,Ct=Ot&8191,Ut=Ot>>>13,Lt=_e[3]|0,Nt=Lt&8191,Kt=Lt>>>13,yr=_e[4]|0,Xt=yr&8191,Jt=yr>>>13,Ar=_e[5]|0,er=Ar&8191,Vt=Ar>>>13,Ir=_e[6]|0,nr=Ir&8191,or=Ir>>>13,xr=_e[7]|0,Ft=xr&8191,jt=xr>>>13,Rr=_e[8]|0,Yt=Rr&8191,Zt=Rr>>>13,$r=_e[9]|0,It=$r&8191,Et=$r>>>13,xt=rt[0]|0,kt=xt&8191,zt=xt>>>13,Qt=rt[1]|0,Wt=Qt&8191,rr=Qt>>>13,Mr=rt[2]|0,tr=Mr&8191,ir=Mr>>>13,Tr=rt[3]|0,ar=Tr&8191,gr=Tr>>>13,Cr=rt[4]|0,ur=Cr&8191,vr=Cr>>>13,Br=rt[5]|0,lr=Br&8191,_r=Br>>>13,kr=rt[6]|0,fr=kr&8191,br=kr>>>13,Lr=rt[7]|0,cr=Lr&8191,wr=Lr>>>13,Pr=rt[8]|0,dr=Pr&8191,Er=Pr>>>13,Dr=rt[9]|0,pr=Dr&8191,Sr=Dr>>>13;$.negative=g.negative^b.negative,$.length=19,tt=Math.imul(vt,kt),_=Math.imul(vt,zt),_=_+Math.imul(Rt,kt)|0,it=Math.imul(Rt,zt);var Or=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Or>>>26)|0,Or&=67108863,tt=Math.imul(Mt,kt),_=Math.imul(Mt,zt),_=_+Math.imul(At,kt)|0,it=Math.imul(At,zt),tt=tt+Math.imul(vt,Wt)|0,_=_+Math.imul(vt,rr)|0,_=_+Math.imul(Rt,Wt)|0,it=it+Math.imul(Rt,rr)|0;var Nr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,tt=Math.imul(Ct,kt),_=Math.imul(Ct,zt),_=_+Math.imul(Ut,kt)|0,it=Math.imul(Ut,zt),tt=tt+Math.imul(Mt,Wt)|0,_=_+Math.imul(Mt,rr)|0,_=_+Math.imul(At,Wt)|0,it=it+Math.imul(At,rr)|0,tt=tt+Math.imul(vt,tr)|0,_=_+Math.imul(vt,ir)|0,_=_+Math.imul(Rt,tr)|0,it=it+Math.imul(Rt,ir)|0;var Ur=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,tt=Math.imul(Nt,kt),_=Math.imul(Nt,zt),_=_+Math.imul(Kt,kt)|0,it=Math.imul(Kt,zt),tt=tt+Math.imul(Ct,Wt)|0,_=_+Math.imul(Ct,rr)|0,_=_+Math.imul(Ut,Wt)|0,it=it+Math.imul(Ut,rr)|0,tt=tt+Math.imul(Mt,tr)|0,_=_+Math.imul(Mt,ir)|0,_=_+Math.imul(At,tr)|0,it=it+Math.imul(At,ir)|0,tt=tt+Math.imul(vt,ar)|0,_=_+Math.imul(vt,gr)|0,_=_+Math.imul(Rt,ar)|0,it=it+Math.imul(Rt,gr)|0;var Hr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,tt=Math.imul(Xt,kt),_=Math.imul(Xt,zt),_=_+Math.imul(Jt,kt)|0,it=Math.imul(Jt,zt),tt=tt+Math.imul(Nt,Wt)|0,_=_+Math.imul(Nt,rr)|0,_=_+Math.imul(Kt,Wt)|0,it=it+Math.imul(Kt,rr)|0,tt=tt+Math.imul(Ct,tr)|0,_=_+Math.imul(Ct,ir)|0,_=_+Math.imul(Ut,tr)|0,it=it+Math.imul(Ut,ir)|0,tt=tt+Math.imul(Mt,ar)|0,_=_+Math.imul(Mt,gr)|0,_=_+Math.imul(At,ar)|0,it=it+Math.imul(At,gr)|0,tt=tt+Math.imul(vt,ur)|0,_=_+Math.imul(vt,vr)|0,_=_+Math.imul(Rt,ur)|0,it=it+Math.imul(Rt,vr)|0;var Fr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,tt=Math.imul(er,kt),_=Math.imul(er,zt),_=_+Math.imul(Vt,kt)|0,it=Math.imul(Vt,zt),tt=tt+Math.imul(Xt,Wt)|0,_=_+Math.imul(Xt,rr)|0,_=_+Math.imul(Jt,Wt)|0,it=it+Math.imul(Jt,rr)|0,tt=tt+Math.imul(Nt,tr)|0,_=_+Math.imul(Nt,ir)|0,_=_+Math.imul(Kt,tr)|0,it=it+Math.imul(Kt,ir)|0,tt=tt+Math.imul(Ct,ar)|0,_=_+Math.imul(Ct,gr)|0,_=_+Math.imul(Ut,ar)|0,it=it+Math.imul(Ut,gr)|0,tt=tt+Math.imul(Mt,ur)|0,_=_+Math.imul(Mt,vr)|0,_=_+Math.imul(At,ur)|0,it=it+Math.imul(At,vr)|0,tt=tt+Math.imul(vt,lr)|0,_=_+Math.imul(vt,_r)|0,_=_+Math.imul(Rt,lr)|0,it=it+Math.imul(Rt,_r)|0;var qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(qr>>>26)|0,qr&=67108863,tt=Math.imul(nr,kt),_=Math.imul(nr,zt),_=_+Math.imul(or,kt)|0,it=Math.imul(or,zt),tt=tt+Math.imul(er,Wt)|0,_=_+Math.imul(er,rr)|0,_=_+Math.imul(Vt,Wt)|0,it=it+Math.imul(Vt,rr)|0,tt=tt+Math.imul(Xt,tr)|0,_=_+Math.imul(Xt,ir)|0,_=_+Math.imul(Jt,tr)|0,it=it+Math.imul(Jt,ir)|0,tt=tt+Math.imul(Nt,ar)|0,_=_+Math.imul(Nt,gr)|0,_=_+Math.imul(Kt,ar)|0,it=it+Math.imul(Kt,gr)|0,tt=tt+Math.imul(Ct,ur)|0,_=_+Math.imul(Ct,vr)|0,_=_+Math.imul(Ut,ur)|0,it=it+Math.imul(Ut,vr)|0,tt=tt+Math.imul(Mt,lr)|0,_=_+Math.imul(Mt,_r)|0,_=_+Math.imul(At,lr)|0,it=it+Math.imul(At,_r)|0,tt=tt+Math.imul(vt,fr)|0,_=_+Math.imul(vt,br)|0,_=_+Math.imul(Rt,fr)|0,it=it+Math.imul(Rt,br)|0;var Kr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,tt=Math.imul(Ft,kt),_=Math.imul(Ft,zt),_=_+Math.imul(jt,kt)|0,it=Math.imul(jt,zt),tt=tt+Math.imul(nr,Wt)|0,_=_+Math.imul(nr,rr)|0,_=_+Math.imul(or,Wt)|0,it=it+Math.imul(or,rr)|0,tt=tt+Math.imul(er,tr)|0,_=_+Math.imul(er,ir)|0,_=_+Math.imul(Vt,tr)|0,it=it+Math.imul(Vt,ir)|0,tt=tt+Math.imul(Xt,ar)|0,_=_+Math.imul(Xt,gr)|0,_=_+Math.imul(Jt,ar)|0,it=it+Math.imul(Jt,gr)|0,tt=tt+Math.imul(Nt,ur)|0,_=_+Math.imul(Nt,vr)|0,_=_+Math.imul(Kt,ur)|0,it=it+Math.imul(Kt,vr)|0,tt=tt+Math.imul(Ct,lr)|0,_=_+Math.imul(Ct,_r)|0,_=_+Math.imul(Ut,lr)|0,it=it+Math.imul(Ut,_r)|0,tt=tt+Math.imul(Mt,fr)|0,_=_+Math.imul(Mt,br)|0,_=_+Math.imul(At,fr)|0,it=it+Math.imul(At,br)|0,tt=tt+Math.imul(vt,cr)|0,_=_+Math.imul(vt,wr)|0,_=_+Math.imul(Rt,cr)|0,it=it+Math.imul(Rt,wr)|0;var jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(jr>>>26)|0,jr&=67108863,tt=Math.imul(Yt,kt),_=Math.imul(Yt,zt),_=_+Math.imul(Zt,kt)|0,it=Math.imul(Zt,zt),tt=tt+Math.imul(Ft,Wt)|0,_=_+Math.imul(Ft,rr)|0,_=_+Math.imul(jt,Wt)|0,it=it+Math.imul(jt,rr)|0,tt=tt+Math.imul(nr,tr)|0,_=_+Math.imul(nr,ir)|0,_=_+Math.imul(or,tr)|0,it=it+Math.imul(or,ir)|0,tt=tt+Math.imul(er,ar)|0,_=_+Math.imul(er,gr)|0,_=_+Math.imul(Vt,ar)|0,it=it+Math.imul(Vt,gr)|0,tt=tt+Math.imul(Xt,ur)|0,_=_+Math.imul(Xt,vr)|0,_=_+Math.imul(Jt,ur)|0,it=it+Math.imul(Jt,vr)|0,tt=tt+Math.imul(Nt,lr)|0,_=_+Math.imul(Nt,_r)|0,_=_+Math.imul(Kt,lr)|0,it=it+Math.imul(Kt,_r)|0,tt=tt+Math.imul(Ct,fr)|0,_=_+Math.imul(Ct,br)|0,_=_+Math.imul(Ut,fr)|0,it=it+Math.imul(Ut,br)|0,tt=tt+Math.imul(Mt,cr)|0,_=_+Math.imul(Mt,wr)|0,_=_+Math.imul(At,cr)|0,it=it+Math.imul(At,wr)|0,tt=tt+Math.imul(vt,dr)|0,_=_+Math.imul(vt,Er)|0,_=_+Math.imul(Rt,dr)|0,it=it+Math.imul(Rt,Er)|0;var Wr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,tt=Math.imul(It,kt),_=Math.imul(It,zt),_=_+Math.imul(Et,kt)|0,it=Math.imul(Et,zt),tt=tt+Math.imul(Yt,Wt)|0,_=_+Math.imul(Yt,rr)|0,_=_+Math.imul(Zt,Wt)|0,it=it+Math.imul(Zt,rr)|0,tt=tt+Math.imul(Ft,tr)|0,_=_+Math.imul(Ft,ir)|0,_=_+Math.imul(jt,tr)|0,it=it+Math.imul(jt,ir)|0,tt=tt+Math.imul(nr,ar)|0,_=_+Math.imul(nr,gr)|0,_=_+Math.imul(or,ar)|0,it=it+Math.imul(or,gr)|0,tt=tt+Math.imul(er,ur)|0,_=_+Math.imul(er,vr)|0,_=_+Math.imul(Vt,ur)|0,it=it+Math.imul(Vt,vr)|0,tt=tt+Math.imul(Xt,lr)|0,_=_+Math.imul(Xt,_r)|0,_=_+Math.imul(Jt,lr)|0,it=it+Math.imul(Jt,_r)|0,tt=tt+Math.imul(Nt,fr)|0,_=_+Math.imul(Nt,br)|0,_=_+Math.imul(Kt,fr)|0,it=it+Math.imul(Kt,br)|0,tt=tt+Math.imul(Ct,cr)|0,_=_+Math.imul(Ct,wr)|0,_=_+Math.imul(Ut,cr)|0,it=it+Math.imul(Ut,wr)|0,tt=tt+Math.imul(Mt,dr)|0,_=_+Math.imul(Mt,Er)|0,_=_+Math.imul(At,dr)|0,it=it+Math.imul(At,Er)|0,tt=tt+Math.imul(vt,pr)|0,_=_+Math.imul(vt,Sr)|0,_=_+Math.imul(Rt,pr)|0,it=it+Math.imul(Rt,Sr)|0;var Vr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,tt=Math.imul(It,Wt),_=Math.imul(It,rr),_=_+Math.imul(Et,Wt)|0,it=Math.imul(Et,rr),tt=tt+Math.imul(Yt,tr)|0,_=_+Math.imul(Yt,ir)|0,_=_+Math.imul(Zt,tr)|0,it=it+Math.imul(Zt,ir)|0,tt=tt+Math.imul(Ft,ar)|0,_=_+Math.imul(Ft,gr)|0,_=_+Math.imul(jt,ar)|0,it=it+Math.imul(jt,gr)|0,tt=tt+Math.imul(nr,ur)|0,_=_+Math.imul(nr,vr)|0,_=_+Math.imul(or,ur)|0,it=it+Math.imul(or,vr)|0,tt=tt+Math.imul(er,lr)|0,_=_+Math.imul(er,_r)|0,_=_+Math.imul(Vt,lr)|0,it=it+Math.imul(Vt,_r)|0,tt=tt+Math.imul(Xt,fr)|0,_=_+Math.imul(Xt,br)|0,_=_+Math.imul(Jt,fr)|0,it=it+Math.imul(Jt,br)|0,tt=tt+Math.imul(Nt,cr)|0,_=_+Math.imul(Nt,wr)|0,_=_+Math.imul(Kt,cr)|0,it=it+Math.imul(Kt,wr)|0,tt=tt+Math.imul(Ct,dr)|0,_=_+Math.imul(Ct,Er)|0,_=_+Math.imul(Ut,dr)|0,it=it+Math.imul(Ut,Er)|0,tt=tt+Math.imul(Mt,pr)|0,_=_+Math.imul(Mt,Sr)|0,_=_+Math.imul(At,pr)|0,it=it+Math.imul(At,Sr)|0;var Gr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,tt=Math.imul(It,tr),_=Math.imul(It,ir),_=_+Math.imul(Et,tr)|0,it=Math.imul(Et,ir),tt=tt+Math.imul(Yt,ar)|0,_=_+Math.imul(Yt,gr)|0,_=_+Math.imul(Zt,ar)|0,it=it+Math.imul(Zt,gr)|0,tt=tt+Math.imul(Ft,ur)|0,_=_+Math.imul(Ft,vr)|0,_=_+Math.imul(jt,ur)|0,it=it+Math.imul(jt,vr)|0,tt=tt+Math.imul(nr,lr)|0,_=_+Math.imul(nr,_r)|0,_=_+Math.imul(or,lr)|0,it=it+Math.imul(or,_r)|0,tt=tt+Math.imul(er,fr)|0,_=_+Math.imul(er,br)|0,_=_+Math.imul(Vt,fr)|0,it=it+Math.imul(Vt,br)|0,tt=tt+Math.imul(Xt,cr)|0,_=_+Math.imul(Xt,wr)|0,_=_+Math.imul(Jt,cr)|0,it=it+Math.imul(Jt,wr)|0,tt=tt+Math.imul(Nt,dr)|0,_=_+Math.imul(Nt,Er)|0,_=_+Math.imul(Kt,dr)|0,it=it+Math.imul(Kt,Er)|0,tt=tt+Math.imul(Ct,pr)|0,_=_+Math.imul(Ct,Sr)|0,_=_+Math.imul(Ut,pr)|0,it=it+Math.imul(Ut,Sr)|0;var Yr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,tt=Math.imul(It,ar),_=Math.imul(It,gr),_=_+Math.imul(Et,ar)|0,it=Math.imul(Et,gr),tt=tt+Math.imul(Yt,ur)|0,_=_+Math.imul(Yt,vr)|0,_=_+Math.imul(Zt,ur)|0,it=it+Math.imul(Zt,vr)|0,tt=tt+Math.imul(Ft,lr)|0,_=_+Math.imul(Ft,_r)|0,_=_+Math.imul(jt,lr)|0,it=it+Math.imul(jt,_r)|0,tt=tt+Math.imul(nr,fr)|0,_=_+Math.imul(nr,br)|0,_=_+Math.imul(or,fr)|0,it=it+Math.imul(or,br)|0,tt=tt+Math.imul(er,cr)|0,_=_+Math.imul(er,wr)|0,_=_+Math.imul(Vt,cr)|0,it=it+Math.imul(Vt,wr)|0,tt=tt+Math.imul(Xt,dr)|0,_=_+Math.imul(Xt,Er)|0,_=_+Math.imul(Jt,dr)|0,it=it+Math.imul(Jt,Er)|0,tt=tt+Math.imul(Nt,pr)|0,_=_+Math.imul(Nt,Sr)|0,_=_+Math.imul(Kt,pr)|0,it=it+Math.imul(Kt,Sr)|0;var Zr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,tt=Math.imul(It,ur),_=Math.imul(It,vr),_=_+Math.imul(Et,ur)|0,it=Math.imul(Et,vr),tt=tt+Math.imul(Yt,lr)|0,_=_+Math.imul(Yt,_r)|0,_=_+Math.imul(Zt,lr)|0,it=it+Math.imul(Zt,_r)|0,tt=tt+Math.imul(Ft,fr)|0,_=_+Math.imul(Ft,br)|0,_=_+Math.imul(jt,fr)|0,it=it+Math.imul(jt,br)|0,tt=tt+Math.imul(nr,cr)|0,_=_+Math.imul(nr,wr)|0,_=_+Math.imul(or,cr)|0,it=it+Math.imul(or,wr)|0,tt=tt+Math.imul(er,dr)|0,_=_+Math.imul(er,Er)|0,_=_+Math.imul(Vt,dr)|0,it=it+Math.imul(Vt,Er)|0,tt=tt+Math.imul(Xt,pr)|0,_=_+Math.imul(Xt,Sr)|0,_=_+Math.imul(Jt,pr)|0,it=it+Math.imul(Jt,Sr)|0;var Xr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,tt=Math.imul(It,lr),_=Math.imul(It,_r),_=_+Math.imul(Et,lr)|0,it=Math.imul(Et,_r),tt=tt+Math.imul(Yt,fr)|0,_=_+Math.imul(Yt,br)|0,_=_+Math.imul(Zt,fr)|0,it=it+Math.imul(Zt,br)|0,tt=tt+Math.imul(Ft,cr)|0,_=_+Math.imul(Ft,wr)|0,_=_+Math.imul(jt,cr)|0,it=it+Math.imul(jt,wr)|0,tt=tt+Math.imul(nr,dr)|0,_=_+Math.imul(nr,Er)|0,_=_+Math.imul(or,dr)|0,it=it+Math.imul(or,Er)|0,tt=tt+Math.imul(er,pr)|0,_=_+Math.imul(er,Sr)|0,_=_+Math.imul(Vt,pr)|0,it=it+Math.imul(Vt,Sr)|0;var Jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,tt=Math.imul(It,fr),_=Math.imul(It,br),_=_+Math.imul(Et,fr)|0,it=Math.imul(Et,br),tt=tt+Math.imul(Yt,cr)|0,_=_+Math.imul(Yt,wr)|0,_=_+Math.imul(Zt,cr)|0,it=it+Math.imul(Zt,wr)|0,tt=tt+Math.imul(Ft,dr)|0,_=_+Math.imul(Ft,Er)|0,_=_+Math.imul(jt,dr)|0,it=it+Math.imul(jt,Er)|0,tt=tt+Math.imul(nr,pr)|0,_=_+Math.imul(nr,Sr)|0,_=_+Math.imul(or,pr)|0,it=it+Math.imul(or,Sr)|0;var Qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,tt=Math.imul(It,cr),_=Math.imul(It,wr),_=_+Math.imul(Et,cr)|0,it=Math.imul(Et,wr),tt=tt+Math.imul(Yt,dr)|0,_=_+Math.imul(Yt,Er)|0,_=_+Math.imul(Zt,dr)|0,it=it+Math.imul(Zt,Er)|0,tt=tt+Math.imul(Ft,pr)|0,_=_+Math.imul(Ft,Sr)|0,_=_+Math.imul(jt,pr)|0,it=it+Math.imul(jt,Sr)|0;var en=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(en>>>26)|0,en&=67108863,tt=Math.imul(It,dr),_=Math.imul(It,Er),_=_+Math.imul(Et,dr)|0,it=Math.imul(Et,Er),tt=tt+Math.imul(Yt,pr)|0,_=_+Math.imul(Yt,Sr)|0,_=_+Math.imul(Zt,pr)|0,it=it+Math.imul(Zt,Sr)|0;var tn=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(tn>>>26)|0,tn&=67108863,tt=Math.imul(It,pr),_=Math.imul(It,Sr),_=_+Math.imul(Et,pr)|0,it=Math.imul(Et,Sr);var rn=(lt+tt|0)+((_&8191)<<13)|0;return lt=(it+(_>>>13)|0)+(rn>>>26)|0,rn&=67108863,at[0]=Or,at[1]=Nr,at[2]=Ur,at[3]=Hr,at[4]=Fr,at[5]=qr,at[6]=Kr,at[7]=jr,at[8]=Wr,at[9]=Vr,at[10]=Gr,at[11]=Yr,at[12]=Zr,at[13]=Xr,at[14]=Jr,at[15]=Qr,at[16]=en,at[17]=tn,at[18]=rn,lt!==0&&(at[19]=lt,$.length++),$};Math.imul||(wt=gt);function St(ct,g,b){b.negative=g.negative^ct.negative,b.length=ct.length+g.length;for(var $=0,_e=0,rt=0;rt>>26)|0,_e+=at>>>26,at&=67108863}b.words[rt]=lt,$=at,at=_e}return $!==0?b.words[rt]=$:b.length--,b.strip()}function _t(ct,g,b){var $=new mt;return $.mulp(ct,g,b)}h.prototype.mulTo=function(g,b){var $,_e=this.length+g.length;return this.length===10&&g.length===10?$=wt(this,g,b):_e<63?$=gt(this,g,b):_e<1024?$=St(this,g,b):$=_t(this,g,b),$};function mt(ct,g){this.x=ct,this.y=g}mt.prototype.makeRBT=function(g){for(var b=new Array(g),$=h.prototype._countBits(g)-1,_e=0;_e>=1;return _e},mt.prototype.permute=function(g,b,$,_e,rt,at){for(var lt=0;lt>>1)rt++;return 1<>>13,$[2*at+1]=rt&8191,rt=rt>>>13;for(at=2*b;at<_e;++at)$[at]=0;c(rt===0),c((rt&-8192)===0)},mt.prototype.stub=function(g){for(var b=new Array(g),$=0;$>=26,b+=_e/67108864|0,b+=rt>>>26,this.words[$]=rt&67108863}return b!==0&&(this.words[$]=b,this.length++),this},h.prototype.muln=function(g){return this.clone().imuln(g)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(g){var b=dt(g);if(b.length===0)return new h(1);for(var $=this,_e=0;_e=0);var b=g%26,$=(g-b)/26,_e=67108863>>>26-b<<26-b,rt;if(b!==0){var at=0;for(rt=0;rt>>26-b}at&&(this.words[rt]=at,this.length++)}if($!==0){for(rt=this.length-1;rt>=0;rt--)this.words[rt+$]=this.words[rt];for(rt=0;rt<$;rt++)this.words[rt]=0;this.length+=$}return this.strip()},h.prototype.ishln=function(g){return c(this.negative===0),this.iushln(g)},h.prototype.iushrn=function(g,b,$){c(typeof g=="number"&&g>=0);var _e;b?_e=(b-b%26)/26:_e=0;var rt=g%26,at=Math.min((g-rt)/26,this.length),lt=67108863^67108863>>>rt<at)for(this.length-=at,_=0;_=0&&(it!==0||_>=_e);_--){var yt=this.words[_]|0;this.words[_]=it<<26-rt|yt>>>rt,it=yt<}return tt&&it!==0&&(tt.words[tt.length++]=it),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(g,b,$){return c(this.negative===0),this.iushrn(g,b,$)},h.prototype.shln=function(g){return this.clone().ishln(g)},h.prototype.ushln=function(g){return this.clone().iushln(g)},h.prototype.shrn=function(g){return this.clone().ishrn(g)},h.prototype.ushrn=function(g){return this.clone().iushrn(g)},h.prototype.testn=function(g){c(typeof g=="number"&&g>=0);var b=g%26,$=(g-b)/26,_e=1<=0);var b=g%26,$=(g-b)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=$)return this;if(b!==0&&$++,this.length=Math.min($,this.length),b!==0){var _e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},h.prototype.isubn=function(g){if(c(typeof g=="number"),c(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(tt/67108864|0),this.words[rt+$]=at&67108863}for(;rt>26,this.words[rt+$]=at&67108863;if(lt===0)return this.strip();for(c(lt===-1),lt=0,rt=0;rt>26,this.words[rt]=at&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(g,b){var $=this.length-g.length,_e=this.clone(),rt=g,at=rt.words[rt.length-1]|0,lt=this._countBits(at);$=26-lt,$!==0&&(rt=rt.ushln($),_e.iushln($),at=rt.words[rt.length-1]|0);var tt=_e.length-rt.length,_;if(b!=="mod"){_=new h(null),_.length=tt+1,_.words=new Array(_.length);for(var it=0;it<_.length;it++)_.words[it]=0}var yt=_e.clone()._ishlnsubmul(rt,1,tt);yt.negative===0&&(_e=yt,_&&(_.words[tt]=1));for(var vt=tt-1;vt>=0;vt--){var Rt=(_e.words[rt.length+vt]|0)*67108864+(_e.words[rt.length+vt-1]|0);for(Rt=Math.min(Rt/at|0,67108863),_e._ishlnsubmul(rt,Rt,vt);_e.negative!==0;)Rt--,_e.negative=0,_e._ishlnsubmul(rt,1,vt),_e.isZero()||(_e.negative^=1);_&&(_.words[vt]=Rt)}return _&&_.strip(),_e.strip(),b!=="div"&&$!==0&&_e.iushrn($),{div:_||null,mod:_e}},h.prototype.divmod=function(g,b,$){if(c(!g.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var _e,rt,at;return this.negative!==0&&g.negative===0?(at=this.neg().divmod(g,b),b!=="mod"&&(_e=at.div.neg()),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.iadd(g)),{div:_e,mod:rt}):this.negative===0&&g.negative!==0?(at=this.divmod(g.neg(),b),b!=="mod"&&(_e=at.div.neg()),{div:_e,mod:at.mod}):this.negative&g.negative?(at=this.neg().divmod(g.neg(),b),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.isub(g)),{div:at.div,mod:rt}):g.length>this.length||this.cmp(g)<0?{div:new h(0),mod:this}:g.length===1?b==="div"?{div:this.divn(g.words[0]),mod:null}:b==="mod"?{div:null,mod:new h(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new h(this.modn(g.words[0]))}:this._wordDiv(g,b)},h.prototype.div=function(g){return this.divmod(g,"div",!1).div},h.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},h.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},h.prototype.divRound=function(g){var b=this.divmod(g);if(b.mod.isZero())return b.div;var $=b.div.negative!==0?b.mod.isub(g):b.mod,_e=g.ushrn(1),rt=g.andln(1),at=$.cmp(_e);return at<0||rt===1&&at===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},h.prototype.modn=function(g){c(g<=67108863);for(var b=(1<<26)%g,$=0,_e=this.length-1;_e>=0;_e--)$=(b*$+(this.words[_e]|0))%g;return $},h.prototype.idivn=function(g){c(g<=67108863);for(var b=0,$=this.length-1;$>=0;$--){var _e=(this.words[$]|0)+b*67108864;this.words[$]=_e/g|0,b=_e%g}return this.strip()},h.prototype.divn=function(g){return this.clone().idivn(g)},h.prototype.egcd=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=new h(0),lt=new h(1),tt=0;b.isEven()&&$.isEven();)b.iushrn(1),$.iushrn(1),++tt;for(var _=$.clone(),it=b.clone();!b.isZero();){for(var yt=0,vt=1;!(b.words[0]&vt)&&yt<26;++yt,vt<<=1);if(yt>0)for(b.iushrn(yt);yt-- >0;)(_e.isOdd()||rt.isOdd())&&(_e.iadd(_),rt.isub(it)),_e.iushrn(1),rt.iushrn(1);for(var Rt=0,Tt=1;!($.words[0]&Tt)&&Rt<26;++Rt,Tt<<=1);if(Rt>0)for($.iushrn(Rt);Rt-- >0;)(at.isOdd()||lt.isOdd())&&(at.iadd(_),lt.isub(it)),at.iushrn(1),lt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(at),rt.isub(lt)):($.isub(b),at.isub(_e),lt.isub(rt))}return{a:at,b:lt,gcd:$.iushln(tt)}},h.prototype._invmp=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=$.clone();b.cmpn(1)>0&&$.cmpn(1)>0;){for(var lt=0,tt=1;!(b.words[0]&tt)&<<26;++lt,tt<<=1);if(lt>0)for(b.iushrn(lt);lt-- >0;)_e.isOdd()&&_e.iadd(at),_e.iushrn(1);for(var _=0,it=1;!($.words[0]&it)&&_<26;++_,it<<=1);if(_>0)for($.iushrn(_);_-- >0;)rt.isOdd()&&rt.iadd(at),rt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(rt)):($.isub(b),rt.isub(_e))}var yt;return b.cmpn(1)===0?yt=_e:yt=rt,yt.cmpn(0)<0&&yt.iadd(g),yt},h.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var b=this.clone(),$=g.clone();b.negative=0,$.negative=0;for(var _e=0;b.isEven()&&$.isEven();_e++)b.iushrn(1),$.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;$.isEven();)$.iushrn(1);var rt=b.cmp($);if(rt<0){var at=b;b=$,$=at}else if(rt===0||$.cmpn(1)===0)break;b.isub($)}while(!0);return $.iushln(_e)},h.prototype.invm=function(g){return this.egcd(g).a.umod(g)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(g){return this.words[0]&g},h.prototype.bincn=function(g){c(typeof g=="number");var b=g%26,$=(g-b)/26,_e=1<>>26,lt&=67108863,this.words[at]=lt}return rt!==0&&(this.words[at]=rt,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(g){var b=g<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this.strip();var $;if(this.length>1)$=1;else{b&&(g=-g),c(g<=67108863,"Number is too big");var _e=this.words[0]|0;$=_e===g?0:_eg.length)return 1;if(this.length=0;$--){var _e=this.words[$]|0,rt=g.words[$]|0;if(_e!==rt){_ert&&(b=1);break}}return b},h.prototype.gtn=function(g){return this.cmpn(g)===1},h.prototype.gt=function(g){return this.cmp(g)===1},h.prototype.gten=function(g){return this.cmpn(g)>=0},h.prototype.gte=function(g){return this.cmp(g)>=0},h.prototype.ltn=function(g){return this.cmpn(g)===-1},h.prototype.lt=function(g){return this.cmp(g)===-1},h.prototype.lten=function(g){return this.cmpn(g)<=0},h.prototype.lte=function(g){return this.cmp(g)<=0},h.prototype.eqn=function(g){return this.cmpn(g)===0},h.prototype.eq=function(g){return this.cmp(g)===0},h.red=function(g){return new Pt(g)},h.prototype.toRed=function(g){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},h.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(g){return this.red=g,this},h.prototype.forceRed=function(g){return c(!this.red,"Already a number in reduction context"),this._forceRed(g)},h.prototype.redAdd=function(g){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},h.prototype.redIAdd=function(g){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},h.prototype.redSub=function(g){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},h.prototype.redISub=function(g){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},h.prototype.redShl=function(g){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},h.prototype.redMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},h.prototype.redIMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},h.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(g){return c(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var bt={k256:null,p224:null,p192:null,p25519:null};function $t(ct,g){this.name=ct,this.p=new h(g,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$t.prototype._tmp=function(){var g=new h(null);return g.words=new Array(Math.ceil(this.n/13)),g},$t.prototype.ireduce=function(g){var b=g,$;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),$=b.bitLength();while($>this.n);var _e=$0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},$t.prototype.split=function(g,b){g.iushrn(this.n,0,b)},$t.prototype.imulK=function(g){return g.imul(this.k)};function Bt(){$t.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Bt,$t),Bt.prototype.split=function(g,b){for(var $=4194303,_e=Math.min(g.length,9),rt=0;rt<_e;rt++)b.words[rt]=g.words[rt];if(b.length=_e,g.length<=9){g.words[0]=0,g.length=1;return}var at=g.words[9];for(b.words[b.length++]=at&$,rt=10;rt>>22,at=lt}at>>>=22,g.words[rt-10]=at,at===0&&g.length>10?g.length-=10:g.length-=9},Bt.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var b=0,$=0;$>>=26,g.words[$]=rt,b=_e}return b!==0&&(g.words[g.length++]=b),g},h._prime=function(g){if(bt[g])return bt[g];var b;if(g==="k256")b=new Bt;else if(g==="p224")b=new Dt;else if(g==="p192")b=new Ht;else if(g==="p25519")b=new qt;else throw new Error("Unknown prime "+g);return bt[g]=b,b};function Pt(ct){if(typeof ct=="string"){var g=h._prime(ct);this.m=g.p,this.prime=g}else c(ct.gtn(1),"modulus must be greater than 1"),this.m=ct,this.prime=null}Pt.prototype._verify1=function(g){c(g.negative===0,"red works only with positives"),c(g.red,"red works only with red numbers")},Pt.prototype._verify2=function(g,b){c((g.negative|b.negative)===0,"red works only with positives"),c(g.red&&g.red===b.red,"red works only with red numbers")},Pt.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},Pt.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},Pt.prototype.add=function(g,b){this._verify2(g,b);var $=g.add(b);return $.cmp(this.m)>=0&&$.isub(this.m),$._forceRed(this)},Pt.prototype.iadd=function(g,b){this._verify2(g,b);var $=g.iadd(b);return $.cmp(this.m)>=0&&$.isub(this.m),$},Pt.prototype.sub=function(g,b){this._verify2(g,b);var $=g.sub(b);return $.cmpn(0)<0&&$.iadd(this.m),$._forceRed(this)},Pt.prototype.isub=function(g,b){this._verify2(g,b);var $=g.isub(b);return $.cmpn(0)<0&&$.iadd(this.m),$},Pt.prototype.shl=function(g,b){return this._verify1(g),this.imod(g.ushln(b))},Pt.prototype.imul=function(g,b){return this._verify2(g,b),this.imod(g.imul(b))},Pt.prototype.mul=function(g,b){return this._verify2(g,b),this.imod(g.mul(b))},Pt.prototype.isqr=function(g){return this.imul(g,g.clone())},Pt.prototype.sqr=function(g){return this.mul(g,g)},Pt.prototype.sqrt=function(g){if(g.isZero())return g.clone();var b=this.m.andln(3);if(c(b%2===1),b===3){var $=this.m.add(new h(1)).iushrn(2);return this.pow(g,$)}for(var _e=this.m.subn(1),rt=0;!_e.isZero()&&_e.andln(1)===0;)rt++,_e.iushrn(1);c(!_e.isZero());var at=new h(1).toRed(this),lt=at.redNeg(),tt=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new h(2*_*_).toRed(this);this.pow(_,tt).cmp(lt)!==0;)_.redIAdd(lt);for(var it=this.pow(_,_e),yt=this.pow(g,_e.addn(1).iushrn(1)),vt=this.pow(g,_e),Rt=rt;vt.cmp(at)!==0;){for(var Tt=vt,Mt=0;Tt.cmp(at)!==0;Mt++)Tt=Tt.redSqr();c(Mt=0;rt--){for(var it=b.words[rt],yt=_-1;yt>=0;yt--){var vt=it>>yt&1;if(at!==_e[0]&&(at=this.sqr(at)),vt===0&<===0){tt=0;continue}lt<<=1,lt|=vt,tt++,!(tt!==$&&(rt!==0||yt!==0))&&(at=this.mul(at,_e[lt]),tt=0,lt=0)}_=26}return at},Pt.prototype.convertTo=function(g){var b=g.umod(this.m);return b===g?b.clone():b},Pt.prototype.convertFrom=function(g){var b=g.clone();return b.red=null,b},h.mont=function(g){return new Gt(g)};function Gt(ct){Pt.call(this,ct),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}d(Gt,Pt),Gt.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},Gt.prototype.convertFrom=function(g){var b=this.imod(g.mul(this.rinv));return b.red=null,b},Gt.prototype.imul=function(g,b){if(g.isZero()||b.isZero())return g.words[0]=0,g.length=1,g;var $=g.imul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.mul=function(g,b){if(g.isZero()||b.isZero())return new h(0)._forceRed(this);var $=g.mul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.invm=function(g){var b=this.imod(g._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(o,commonjsGlobal$2)})(bn$5);var bnExports$5=bn$5.exports,bn$4={exports:{}};bn$4.exports;(function(o){(function(e,a){function c(ct,g){if(!ct)throw new Error(g||"Assertion failed")}function d(ct,g){ct.super_=g;var b=function(){};b.prototype=g.prototype,ct.prototype=new b,ct.prototype.constructor=ct}function h(ct,g,b){if(h.isBN(ct))return ct;this.negative=0,this.words=null,this.length=0,this.red=null,ct!==null&&((g==="le"||g==="be")&&(b=g,g=10),this._init(ct||0,g||10,b||"be"))}typeof e=="object"?e.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var j;try{typeof window<"u"&&typeof window.Buffer<"u"?j=window.Buffer:j=require$$0$1.Buffer}catch{}h.isBN=function(g){return g instanceof h?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===h.wordSize&&Array.isArray(g.words)},h.max=function(g,b){return g.cmp(b)>0?g:b},h.min=function(g,b){return g.cmp(b)<0?g:b},h.prototype._init=function(g,b,$){if(typeof g=="number")return this._initNumber(g,b,$);if(typeof g=="object")return this._initArray(g,b,$);b==="hex"&&(b=16),c(b===(b|0)&&b>=2&&b<=36),g=g.toString().replace(/\s+/g,"");var _e=0;g[0]==="-"&&(_e++,this.negative=1),_e=0;_e-=3)at=g[_e]|g[_e-1]<<8|g[_e-2]<<16,this.words[rt]|=at<>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);else if($==="le")for(_e=0,rt=0;_e>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);return this.strip()};function et(ct,g){var b=ct.charCodeAt(g);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function nt(ct,g,b){var $=et(ct,b);return b-1>=g&&($|=et(ct,b-1)<<4),$}h.prototype._parseHex=function(g,b,$){this.length=Math.ceil((g.length-b)/6),this.words=new Array(this.length);for(var _e=0;_e=b;_e-=2)lt=nt(g,b,_e)<=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8;else{var tt=g.length-b;for(_e=tt%2===0?b+1:b;_e=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8}this.strip()};function st(ct,g,b,$){for(var _e=0,rt=Math.min(ct.length,b),at=g;at=49?_e+=lt-49+10:lt>=17?_e+=lt-17+10:_e+=lt}return _e}h.prototype._parseBase=function(g,b,$){this.words=[0],this.length=1;for(var _e=0,rt=1;rt<=67108863;rt*=b)_e++;_e--,rt=rt/b|0;for(var at=g.length-$,lt=at%_e,tt=Math.min(at,at-lt)+$,_=0,it=$;it1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var ot=["","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"],ht=[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],pt=[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];h.prototype.toString=function(g,b){g=g||10,b=b|0||1;var $;if(g===16||g==="hex"){$="";for(var _e=0,rt=0,at=0;at>>24-_e&16777215,_e+=2,_e>=26&&(_e-=26,at--),rt!==0||at!==this.length-1?$=ot[6-tt.length]+tt+$:$=tt+$}for(rt!==0&&($=rt.toString(16)+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}if(g===(g|0)&&g>=2&&g<=36){var _=ht[g],it=pt[g];$="";var yt=this.clone();for(yt.negative=0;!yt.isZero();){var vt=yt.modn(it).toString(g);yt=yt.idivn(it),yt.isZero()?$=vt+$:$=ot[_-vt.length]+vt+$}for(this.isZero()&&($="0"+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}c(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(g,b){return c(typeof j<"u"),this.toArrayLike(j,g,b)},h.prototype.toArray=function(g,b){return this.toArrayLike(Array,g,b)},h.prototype.toArrayLike=function(g,b,$){var _e=this.byteLength(),rt=$||Math.max(1,_e);c(_e<=rt,"byte array longer than desired length"),c(rt>0,"Requested array length <= 0"),this.strip();var at=b==="le",lt=new g(rt),tt,_,it=this.clone();if(at){for(_=0;!it.isZero();_++)tt=it.andln(255),it.iushrn(8),lt[_]=tt;for(;_=4096&&($+=13,b>>>=13),b>=64&&($+=7,b>>>=7),b>=8&&($+=4,b>>>=4),b>=2&&($+=2,b>>>=2),$+b},h.prototype._zeroBits=function(g){if(g===0)return 26;var b=g,$=0;return b&8191||($+=13,b>>>=13),b&127||($+=7,b>>>=7),b&15||($+=4,b>>>=4),b&3||($+=2,b>>>=2),b&1||$++,$},h.prototype.bitLength=function(){var g=this.words[this.length-1],b=this._countBits(g);return(this.length-1)*26+b};function dt(ct){for(var g=new Array(ct.bitLength()),b=0;b>>_e}return g}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,b=0;bg.length?this.clone().ior(g):g.clone().ior(this)},h.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},h.prototype.iuand=function(g){var b;this.length>g.length?b=g:b=this;for(var $=0;$g.length?this.clone().iand(g):g.clone().iand(this)},h.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},h.prototype.iuxor=function(g){var b,$;this.length>g.length?(b=this,$=g):(b=g,$=this);for(var _e=0;_e<$.length;_e++)this.words[_e]=b.words[_e]^$.words[_e];if(this!==b)for(;_eg.length?this.clone().ixor(g):g.clone().ixor(this)},h.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},h.prototype.inotn=function(g){c(typeof g=="number"&&g>=0);var b=Math.ceil(g/26)|0,$=g%26;this._expand(b),$>0&&b--;for(var _e=0;_e0&&(this.words[_e]=~this.words[_e]&67108863>>26-$),this.strip()},h.prototype.notn=function(g){return this.clone().inotn(g)},h.prototype.setn=function(g,b){c(typeof g=="number"&&g>=0);var $=g/26|0,_e=g%26;return this._expand($+1),b?this.words[$]=this.words[$]|1<<_e:this.words[$]=this.words[$]&~(1<<_e),this.strip()},h.prototype.iadd=function(g){var b;if(this.negative!==0&&g.negative===0)return this.negative=0,b=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,b=this.isub(g),g.negative=1,b._normSign();var $,_e;this.length>g.length?($=this,_e=g):($=g,_e=this);for(var rt=0,at=0;at<_e.length;at++)b=($.words[at]|0)+(_e.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;for(;rt!==0&&at<$.length;at++)b=($.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;if(this.length=$.length,rt!==0)this.words[this.length]=rt,this.length++;else if($!==this)for(;at<$.length;at++)this.words[at]=$.words[at];return this},h.prototype.add=function(g){var b;return g.negative!==0&&this.negative===0?(g.negative=0,b=this.sub(g),g.negative^=1,b):g.negative===0&&this.negative!==0?(this.negative=0,b=g.sub(this),this.negative=1,b):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},h.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var b=this.iadd(g);return g.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var $=this.cmp(g);if($===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _e,rt;$>0?(_e=this,rt=g):(_e=g,rt=this);for(var at=0,lt=0;lt>26,this.words[lt]=b&67108863;for(;at!==0&<<_e.length;lt++)b=(_e.words[lt]|0)+at,at=b>>26,this.words[lt]=b&67108863;if(at===0&<<_e.length&&_e!==this)for(;lt<_e.length;lt++)this.words[lt]=_e.words[lt];return this.length=Math.max(this.length,lt),_e!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(g){return this.clone().isub(g)};function gt(ct,g,b){b.negative=g.negative^ct.negative;var $=ct.length+g.length|0;b.length=$,$=$-1|0;var _e=ct.words[0]|0,rt=g.words[0]|0,at=_e*rt,lt=at&67108863,tt=at/67108864|0;b.words[0]=lt;for(var _=1;_<$;_++){for(var it=tt>>>26,yt=tt&67108863,vt=Math.min(_,g.length-1),Rt=Math.max(0,_-ct.length+1);Rt<=vt;Rt++){var Tt=_-Rt|0;_e=ct.words[Tt]|0,rt=g.words[Rt]|0,at=_e*rt+yt,it+=at/67108864|0,yt=at&67108863}b.words[_]=yt|0,tt=it|0}return tt!==0?b.words[_]=tt|0:b.length--,b.strip()}var wt=function(g,b,$){var _e=g.words,rt=b.words,at=$.words,lt=0,tt,_,it,yt=_e[0]|0,vt=yt&8191,Rt=yt>>>13,Tt=_e[1]|0,Mt=Tt&8191,At=Tt>>>13,Ot=_e[2]|0,Ct=Ot&8191,Ut=Ot>>>13,Lt=_e[3]|0,Nt=Lt&8191,Kt=Lt>>>13,yr=_e[4]|0,Xt=yr&8191,Jt=yr>>>13,Ar=_e[5]|0,er=Ar&8191,Vt=Ar>>>13,Ir=_e[6]|0,nr=Ir&8191,or=Ir>>>13,xr=_e[7]|0,Ft=xr&8191,jt=xr>>>13,Rr=_e[8]|0,Yt=Rr&8191,Zt=Rr>>>13,$r=_e[9]|0,It=$r&8191,Et=$r>>>13,xt=rt[0]|0,kt=xt&8191,zt=xt>>>13,Qt=rt[1]|0,Wt=Qt&8191,rr=Qt>>>13,Mr=rt[2]|0,tr=Mr&8191,ir=Mr>>>13,Tr=rt[3]|0,ar=Tr&8191,gr=Tr>>>13,Cr=rt[4]|0,ur=Cr&8191,vr=Cr>>>13,Br=rt[5]|0,lr=Br&8191,_r=Br>>>13,kr=rt[6]|0,fr=kr&8191,br=kr>>>13,Lr=rt[7]|0,cr=Lr&8191,wr=Lr>>>13,Pr=rt[8]|0,dr=Pr&8191,Er=Pr>>>13,Dr=rt[9]|0,pr=Dr&8191,Sr=Dr>>>13;$.negative=g.negative^b.negative,$.length=19,tt=Math.imul(vt,kt),_=Math.imul(vt,zt),_=_+Math.imul(Rt,kt)|0,it=Math.imul(Rt,zt);var Or=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Or>>>26)|0,Or&=67108863,tt=Math.imul(Mt,kt),_=Math.imul(Mt,zt),_=_+Math.imul(At,kt)|0,it=Math.imul(At,zt),tt=tt+Math.imul(vt,Wt)|0,_=_+Math.imul(vt,rr)|0,_=_+Math.imul(Rt,Wt)|0,it=it+Math.imul(Rt,rr)|0;var Nr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,tt=Math.imul(Ct,kt),_=Math.imul(Ct,zt),_=_+Math.imul(Ut,kt)|0,it=Math.imul(Ut,zt),tt=tt+Math.imul(Mt,Wt)|0,_=_+Math.imul(Mt,rr)|0,_=_+Math.imul(At,Wt)|0,it=it+Math.imul(At,rr)|0,tt=tt+Math.imul(vt,tr)|0,_=_+Math.imul(vt,ir)|0,_=_+Math.imul(Rt,tr)|0,it=it+Math.imul(Rt,ir)|0;var Ur=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,tt=Math.imul(Nt,kt),_=Math.imul(Nt,zt),_=_+Math.imul(Kt,kt)|0,it=Math.imul(Kt,zt),tt=tt+Math.imul(Ct,Wt)|0,_=_+Math.imul(Ct,rr)|0,_=_+Math.imul(Ut,Wt)|0,it=it+Math.imul(Ut,rr)|0,tt=tt+Math.imul(Mt,tr)|0,_=_+Math.imul(Mt,ir)|0,_=_+Math.imul(At,tr)|0,it=it+Math.imul(At,ir)|0,tt=tt+Math.imul(vt,ar)|0,_=_+Math.imul(vt,gr)|0,_=_+Math.imul(Rt,ar)|0,it=it+Math.imul(Rt,gr)|0;var Hr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,tt=Math.imul(Xt,kt),_=Math.imul(Xt,zt),_=_+Math.imul(Jt,kt)|0,it=Math.imul(Jt,zt),tt=tt+Math.imul(Nt,Wt)|0,_=_+Math.imul(Nt,rr)|0,_=_+Math.imul(Kt,Wt)|0,it=it+Math.imul(Kt,rr)|0,tt=tt+Math.imul(Ct,tr)|0,_=_+Math.imul(Ct,ir)|0,_=_+Math.imul(Ut,tr)|0,it=it+Math.imul(Ut,ir)|0,tt=tt+Math.imul(Mt,ar)|0,_=_+Math.imul(Mt,gr)|0,_=_+Math.imul(At,ar)|0,it=it+Math.imul(At,gr)|0,tt=tt+Math.imul(vt,ur)|0,_=_+Math.imul(vt,vr)|0,_=_+Math.imul(Rt,ur)|0,it=it+Math.imul(Rt,vr)|0;var Fr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,tt=Math.imul(er,kt),_=Math.imul(er,zt),_=_+Math.imul(Vt,kt)|0,it=Math.imul(Vt,zt),tt=tt+Math.imul(Xt,Wt)|0,_=_+Math.imul(Xt,rr)|0,_=_+Math.imul(Jt,Wt)|0,it=it+Math.imul(Jt,rr)|0,tt=tt+Math.imul(Nt,tr)|0,_=_+Math.imul(Nt,ir)|0,_=_+Math.imul(Kt,tr)|0,it=it+Math.imul(Kt,ir)|0,tt=tt+Math.imul(Ct,ar)|0,_=_+Math.imul(Ct,gr)|0,_=_+Math.imul(Ut,ar)|0,it=it+Math.imul(Ut,gr)|0,tt=tt+Math.imul(Mt,ur)|0,_=_+Math.imul(Mt,vr)|0,_=_+Math.imul(At,ur)|0,it=it+Math.imul(At,vr)|0,tt=tt+Math.imul(vt,lr)|0,_=_+Math.imul(vt,_r)|0,_=_+Math.imul(Rt,lr)|0,it=it+Math.imul(Rt,_r)|0;var qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(qr>>>26)|0,qr&=67108863,tt=Math.imul(nr,kt),_=Math.imul(nr,zt),_=_+Math.imul(or,kt)|0,it=Math.imul(or,zt),tt=tt+Math.imul(er,Wt)|0,_=_+Math.imul(er,rr)|0,_=_+Math.imul(Vt,Wt)|0,it=it+Math.imul(Vt,rr)|0,tt=tt+Math.imul(Xt,tr)|0,_=_+Math.imul(Xt,ir)|0,_=_+Math.imul(Jt,tr)|0,it=it+Math.imul(Jt,ir)|0,tt=tt+Math.imul(Nt,ar)|0,_=_+Math.imul(Nt,gr)|0,_=_+Math.imul(Kt,ar)|0,it=it+Math.imul(Kt,gr)|0,tt=tt+Math.imul(Ct,ur)|0,_=_+Math.imul(Ct,vr)|0,_=_+Math.imul(Ut,ur)|0,it=it+Math.imul(Ut,vr)|0,tt=tt+Math.imul(Mt,lr)|0,_=_+Math.imul(Mt,_r)|0,_=_+Math.imul(At,lr)|0,it=it+Math.imul(At,_r)|0,tt=tt+Math.imul(vt,fr)|0,_=_+Math.imul(vt,br)|0,_=_+Math.imul(Rt,fr)|0,it=it+Math.imul(Rt,br)|0;var Kr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,tt=Math.imul(Ft,kt),_=Math.imul(Ft,zt),_=_+Math.imul(jt,kt)|0,it=Math.imul(jt,zt),tt=tt+Math.imul(nr,Wt)|0,_=_+Math.imul(nr,rr)|0,_=_+Math.imul(or,Wt)|0,it=it+Math.imul(or,rr)|0,tt=tt+Math.imul(er,tr)|0,_=_+Math.imul(er,ir)|0,_=_+Math.imul(Vt,tr)|0,it=it+Math.imul(Vt,ir)|0,tt=tt+Math.imul(Xt,ar)|0,_=_+Math.imul(Xt,gr)|0,_=_+Math.imul(Jt,ar)|0,it=it+Math.imul(Jt,gr)|0,tt=tt+Math.imul(Nt,ur)|0,_=_+Math.imul(Nt,vr)|0,_=_+Math.imul(Kt,ur)|0,it=it+Math.imul(Kt,vr)|0,tt=tt+Math.imul(Ct,lr)|0,_=_+Math.imul(Ct,_r)|0,_=_+Math.imul(Ut,lr)|0,it=it+Math.imul(Ut,_r)|0,tt=tt+Math.imul(Mt,fr)|0,_=_+Math.imul(Mt,br)|0,_=_+Math.imul(At,fr)|0,it=it+Math.imul(At,br)|0,tt=tt+Math.imul(vt,cr)|0,_=_+Math.imul(vt,wr)|0,_=_+Math.imul(Rt,cr)|0,it=it+Math.imul(Rt,wr)|0;var jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(jr>>>26)|0,jr&=67108863,tt=Math.imul(Yt,kt),_=Math.imul(Yt,zt),_=_+Math.imul(Zt,kt)|0,it=Math.imul(Zt,zt),tt=tt+Math.imul(Ft,Wt)|0,_=_+Math.imul(Ft,rr)|0,_=_+Math.imul(jt,Wt)|0,it=it+Math.imul(jt,rr)|0,tt=tt+Math.imul(nr,tr)|0,_=_+Math.imul(nr,ir)|0,_=_+Math.imul(or,tr)|0,it=it+Math.imul(or,ir)|0,tt=tt+Math.imul(er,ar)|0,_=_+Math.imul(er,gr)|0,_=_+Math.imul(Vt,ar)|0,it=it+Math.imul(Vt,gr)|0,tt=tt+Math.imul(Xt,ur)|0,_=_+Math.imul(Xt,vr)|0,_=_+Math.imul(Jt,ur)|0,it=it+Math.imul(Jt,vr)|0,tt=tt+Math.imul(Nt,lr)|0,_=_+Math.imul(Nt,_r)|0,_=_+Math.imul(Kt,lr)|0,it=it+Math.imul(Kt,_r)|0,tt=tt+Math.imul(Ct,fr)|0,_=_+Math.imul(Ct,br)|0,_=_+Math.imul(Ut,fr)|0,it=it+Math.imul(Ut,br)|0,tt=tt+Math.imul(Mt,cr)|0,_=_+Math.imul(Mt,wr)|0,_=_+Math.imul(At,cr)|0,it=it+Math.imul(At,wr)|0,tt=tt+Math.imul(vt,dr)|0,_=_+Math.imul(vt,Er)|0,_=_+Math.imul(Rt,dr)|0,it=it+Math.imul(Rt,Er)|0;var Wr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,tt=Math.imul(It,kt),_=Math.imul(It,zt),_=_+Math.imul(Et,kt)|0,it=Math.imul(Et,zt),tt=tt+Math.imul(Yt,Wt)|0,_=_+Math.imul(Yt,rr)|0,_=_+Math.imul(Zt,Wt)|0,it=it+Math.imul(Zt,rr)|0,tt=tt+Math.imul(Ft,tr)|0,_=_+Math.imul(Ft,ir)|0,_=_+Math.imul(jt,tr)|0,it=it+Math.imul(jt,ir)|0,tt=tt+Math.imul(nr,ar)|0,_=_+Math.imul(nr,gr)|0,_=_+Math.imul(or,ar)|0,it=it+Math.imul(or,gr)|0,tt=tt+Math.imul(er,ur)|0,_=_+Math.imul(er,vr)|0,_=_+Math.imul(Vt,ur)|0,it=it+Math.imul(Vt,vr)|0,tt=tt+Math.imul(Xt,lr)|0,_=_+Math.imul(Xt,_r)|0,_=_+Math.imul(Jt,lr)|0,it=it+Math.imul(Jt,_r)|0,tt=tt+Math.imul(Nt,fr)|0,_=_+Math.imul(Nt,br)|0,_=_+Math.imul(Kt,fr)|0,it=it+Math.imul(Kt,br)|0,tt=tt+Math.imul(Ct,cr)|0,_=_+Math.imul(Ct,wr)|0,_=_+Math.imul(Ut,cr)|0,it=it+Math.imul(Ut,wr)|0,tt=tt+Math.imul(Mt,dr)|0,_=_+Math.imul(Mt,Er)|0,_=_+Math.imul(At,dr)|0,it=it+Math.imul(At,Er)|0,tt=tt+Math.imul(vt,pr)|0,_=_+Math.imul(vt,Sr)|0,_=_+Math.imul(Rt,pr)|0,it=it+Math.imul(Rt,Sr)|0;var Vr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,tt=Math.imul(It,Wt),_=Math.imul(It,rr),_=_+Math.imul(Et,Wt)|0,it=Math.imul(Et,rr),tt=tt+Math.imul(Yt,tr)|0,_=_+Math.imul(Yt,ir)|0,_=_+Math.imul(Zt,tr)|0,it=it+Math.imul(Zt,ir)|0,tt=tt+Math.imul(Ft,ar)|0,_=_+Math.imul(Ft,gr)|0,_=_+Math.imul(jt,ar)|0,it=it+Math.imul(jt,gr)|0,tt=tt+Math.imul(nr,ur)|0,_=_+Math.imul(nr,vr)|0,_=_+Math.imul(or,ur)|0,it=it+Math.imul(or,vr)|0,tt=tt+Math.imul(er,lr)|0,_=_+Math.imul(er,_r)|0,_=_+Math.imul(Vt,lr)|0,it=it+Math.imul(Vt,_r)|0,tt=tt+Math.imul(Xt,fr)|0,_=_+Math.imul(Xt,br)|0,_=_+Math.imul(Jt,fr)|0,it=it+Math.imul(Jt,br)|0,tt=tt+Math.imul(Nt,cr)|0,_=_+Math.imul(Nt,wr)|0,_=_+Math.imul(Kt,cr)|0,it=it+Math.imul(Kt,wr)|0,tt=tt+Math.imul(Ct,dr)|0,_=_+Math.imul(Ct,Er)|0,_=_+Math.imul(Ut,dr)|0,it=it+Math.imul(Ut,Er)|0,tt=tt+Math.imul(Mt,pr)|0,_=_+Math.imul(Mt,Sr)|0,_=_+Math.imul(At,pr)|0,it=it+Math.imul(At,Sr)|0;var Gr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,tt=Math.imul(It,tr),_=Math.imul(It,ir),_=_+Math.imul(Et,tr)|0,it=Math.imul(Et,ir),tt=tt+Math.imul(Yt,ar)|0,_=_+Math.imul(Yt,gr)|0,_=_+Math.imul(Zt,ar)|0,it=it+Math.imul(Zt,gr)|0,tt=tt+Math.imul(Ft,ur)|0,_=_+Math.imul(Ft,vr)|0,_=_+Math.imul(jt,ur)|0,it=it+Math.imul(jt,vr)|0,tt=tt+Math.imul(nr,lr)|0,_=_+Math.imul(nr,_r)|0,_=_+Math.imul(or,lr)|0,it=it+Math.imul(or,_r)|0,tt=tt+Math.imul(er,fr)|0,_=_+Math.imul(er,br)|0,_=_+Math.imul(Vt,fr)|0,it=it+Math.imul(Vt,br)|0,tt=tt+Math.imul(Xt,cr)|0,_=_+Math.imul(Xt,wr)|0,_=_+Math.imul(Jt,cr)|0,it=it+Math.imul(Jt,wr)|0,tt=tt+Math.imul(Nt,dr)|0,_=_+Math.imul(Nt,Er)|0,_=_+Math.imul(Kt,dr)|0,it=it+Math.imul(Kt,Er)|0,tt=tt+Math.imul(Ct,pr)|0,_=_+Math.imul(Ct,Sr)|0,_=_+Math.imul(Ut,pr)|0,it=it+Math.imul(Ut,Sr)|0;var Yr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,tt=Math.imul(It,ar),_=Math.imul(It,gr),_=_+Math.imul(Et,ar)|0,it=Math.imul(Et,gr),tt=tt+Math.imul(Yt,ur)|0,_=_+Math.imul(Yt,vr)|0,_=_+Math.imul(Zt,ur)|0,it=it+Math.imul(Zt,vr)|0,tt=tt+Math.imul(Ft,lr)|0,_=_+Math.imul(Ft,_r)|0,_=_+Math.imul(jt,lr)|0,it=it+Math.imul(jt,_r)|0,tt=tt+Math.imul(nr,fr)|0,_=_+Math.imul(nr,br)|0,_=_+Math.imul(or,fr)|0,it=it+Math.imul(or,br)|0,tt=tt+Math.imul(er,cr)|0,_=_+Math.imul(er,wr)|0,_=_+Math.imul(Vt,cr)|0,it=it+Math.imul(Vt,wr)|0,tt=tt+Math.imul(Xt,dr)|0,_=_+Math.imul(Xt,Er)|0,_=_+Math.imul(Jt,dr)|0,it=it+Math.imul(Jt,Er)|0,tt=tt+Math.imul(Nt,pr)|0,_=_+Math.imul(Nt,Sr)|0,_=_+Math.imul(Kt,pr)|0,it=it+Math.imul(Kt,Sr)|0;var Zr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,tt=Math.imul(It,ur),_=Math.imul(It,vr),_=_+Math.imul(Et,ur)|0,it=Math.imul(Et,vr),tt=tt+Math.imul(Yt,lr)|0,_=_+Math.imul(Yt,_r)|0,_=_+Math.imul(Zt,lr)|0,it=it+Math.imul(Zt,_r)|0,tt=tt+Math.imul(Ft,fr)|0,_=_+Math.imul(Ft,br)|0,_=_+Math.imul(jt,fr)|0,it=it+Math.imul(jt,br)|0,tt=tt+Math.imul(nr,cr)|0,_=_+Math.imul(nr,wr)|0,_=_+Math.imul(or,cr)|0,it=it+Math.imul(or,wr)|0,tt=tt+Math.imul(er,dr)|0,_=_+Math.imul(er,Er)|0,_=_+Math.imul(Vt,dr)|0,it=it+Math.imul(Vt,Er)|0,tt=tt+Math.imul(Xt,pr)|0,_=_+Math.imul(Xt,Sr)|0,_=_+Math.imul(Jt,pr)|0,it=it+Math.imul(Jt,Sr)|0;var Xr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,tt=Math.imul(It,lr),_=Math.imul(It,_r),_=_+Math.imul(Et,lr)|0,it=Math.imul(Et,_r),tt=tt+Math.imul(Yt,fr)|0,_=_+Math.imul(Yt,br)|0,_=_+Math.imul(Zt,fr)|0,it=it+Math.imul(Zt,br)|0,tt=tt+Math.imul(Ft,cr)|0,_=_+Math.imul(Ft,wr)|0,_=_+Math.imul(jt,cr)|0,it=it+Math.imul(jt,wr)|0,tt=tt+Math.imul(nr,dr)|0,_=_+Math.imul(nr,Er)|0,_=_+Math.imul(or,dr)|0,it=it+Math.imul(or,Er)|0,tt=tt+Math.imul(er,pr)|0,_=_+Math.imul(er,Sr)|0,_=_+Math.imul(Vt,pr)|0,it=it+Math.imul(Vt,Sr)|0;var Jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,tt=Math.imul(It,fr),_=Math.imul(It,br),_=_+Math.imul(Et,fr)|0,it=Math.imul(Et,br),tt=tt+Math.imul(Yt,cr)|0,_=_+Math.imul(Yt,wr)|0,_=_+Math.imul(Zt,cr)|0,it=it+Math.imul(Zt,wr)|0,tt=tt+Math.imul(Ft,dr)|0,_=_+Math.imul(Ft,Er)|0,_=_+Math.imul(jt,dr)|0,it=it+Math.imul(jt,Er)|0,tt=tt+Math.imul(nr,pr)|0,_=_+Math.imul(nr,Sr)|0,_=_+Math.imul(or,pr)|0,it=it+Math.imul(or,Sr)|0;var Qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,tt=Math.imul(It,cr),_=Math.imul(It,wr),_=_+Math.imul(Et,cr)|0,it=Math.imul(Et,wr),tt=tt+Math.imul(Yt,dr)|0,_=_+Math.imul(Yt,Er)|0,_=_+Math.imul(Zt,dr)|0,it=it+Math.imul(Zt,Er)|0,tt=tt+Math.imul(Ft,pr)|0,_=_+Math.imul(Ft,Sr)|0,_=_+Math.imul(jt,pr)|0,it=it+Math.imul(jt,Sr)|0;var en=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(en>>>26)|0,en&=67108863,tt=Math.imul(It,dr),_=Math.imul(It,Er),_=_+Math.imul(Et,dr)|0,it=Math.imul(Et,Er),tt=tt+Math.imul(Yt,pr)|0,_=_+Math.imul(Yt,Sr)|0,_=_+Math.imul(Zt,pr)|0,it=it+Math.imul(Zt,Sr)|0;var tn=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(tn>>>26)|0,tn&=67108863,tt=Math.imul(It,pr),_=Math.imul(It,Sr),_=_+Math.imul(Et,pr)|0,it=Math.imul(Et,Sr);var rn=(lt+tt|0)+((_&8191)<<13)|0;return lt=(it+(_>>>13)|0)+(rn>>>26)|0,rn&=67108863,at[0]=Or,at[1]=Nr,at[2]=Ur,at[3]=Hr,at[4]=Fr,at[5]=qr,at[6]=Kr,at[7]=jr,at[8]=Wr,at[9]=Vr,at[10]=Gr,at[11]=Yr,at[12]=Zr,at[13]=Xr,at[14]=Jr,at[15]=Qr,at[16]=en,at[17]=tn,at[18]=rn,lt!==0&&(at[19]=lt,$.length++),$};Math.imul||(wt=gt);function St(ct,g,b){b.negative=g.negative^ct.negative,b.length=ct.length+g.length;for(var $=0,_e=0,rt=0;rt>>26)|0,_e+=at>>>26,at&=67108863}b.words[rt]=lt,$=at,at=_e}return $!==0?b.words[rt]=$:b.length--,b.strip()}function _t(ct,g,b){var $=new mt;return $.mulp(ct,g,b)}h.prototype.mulTo=function(g,b){var $,_e=this.length+g.length;return this.length===10&&g.length===10?$=wt(this,g,b):_e<63?$=gt(this,g,b):_e<1024?$=St(this,g,b):$=_t(this,g,b),$};function mt(ct,g){this.x=ct,this.y=g}mt.prototype.makeRBT=function(g){for(var b=new Array(g),$=h.prototype._countBits(g)-1,_e=0;_e>=1;return _e},mt.prototype.permute=function(g,b,$,_e,rt,at){for(var lt=0;lt>>1)rt++;return 1<>>13,$[2*at+1]=rt&8191,rt=rt>>>13;for(at=2*b;at<_e;++at)$[at]=0;c(rt===0),c((rt&-8192)===0)},mt.prototype.stub=function(g){for(var b=new Array(g),$=0;$>=26,b+=_e/67108864|0,b+=rt>>>26,this.words[$]=rt&67108863}return b!==0&&(this.words[$]=b,this.length++),this},h.prototype.muln=function(g){return this.clone().imuln(g)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(g){var b=dt(g);if(b.length===0)return new h(1);for(var $=this,_e=0;_e=0);var b=g%26,$=(g-b)/26,_e=67108863>>>26-b<<26-b,rt;if(b!==0){var at=0;for(rt=0;rt>>26-b}at&&(this.words[rt]=at,this.length++)}if($!==0){for(rt=this.length-1;rt>=0;rt--)this.words[rt+$]=this.words[rt];for(rt=0;rt<$;rt++)this.words[rt]=0;this.length+=$}return this.strip()},h.prototype.ishln=function(g){return c(this.negative===0),this.iushln(g)},h.prototype.iushrn=function(g,b,$){c(typeof g=="number"&&g>=0);var _e;b?_e=(b-b%26)/26:_e=0;var rt=g%26,at=Math.min((g-rt)/26,this.length),lt=67108863^67108863>>>rt<at)for(this.length-=at,_=0;_=0&&(it!==0||_>=_e);_--){var yt=this.words[_]|0;this.words[_]=it<<26-rt|yt>>>rt,it=yt<}return tt&&it!==0&&(tt.words[tt.length++]=it),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(g,b,$){return c(this.negative===0),this.iushrn(g,b,$)},h.prototype.shln=function(g){return this.clone().ishln(g)},h.prototype.ushln=function(g){return this.clone().iushln(g)},h.prototype.shrn=function(g){return this.clone().ishrn(g)},h.prototype.ushrn=function(g){return this.clone().iushrn(g)},h.prototype.testn=function(g){c(typeof g=="number"&&g>=0);var b=g%26,$=(g-b)/26,_e=1<=0);var b=g%26,$=(g-b)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=$)return this;if(b!==0&&$++,this.length=Math.min($,this.length),b!==0){var _e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},h.prototype.isubn=function(g){if(c(typeof g=="number"),c(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(tt/67108864|0),this.words[rt+$]=at&67108863}for(;rt>26,this.words[rt+$]=at&67108863;if(lt===0)return this.strip();for(c(lt===-1),lt=0,rt=0;rt>26,this.words[rt]=at&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(g,b){var $=this.length-g.length,_e=this.clone(),rt=g,at=rt.words[rt.length-1]|0,lt=this._countBits(at);$=26-lt,$!==0&&(rt=rt.ushln($),_e.iushln($),at=rt.words[rt.length-1]|0);var tt=_e.length-rt.length,_;if(b!=="mod"){_=new h(null),_.length=tt+1,_.words=new Array(_.length);for(var it=0;it<_.length;it++)_.words[it]=0}var yt=_e.clone()._ishlnsubmul(rt,1,tt);yt.negative===0&&(_e=yt,_&&(_.words[tt]=1));for(var vt=tt-1;vt>=0;vt--){var Rt=(_e.words[rt.length+vt]|0)*67108864+(_e.words[rt.length+vt-1]|0);for(Rt=Math.min(Rt/at|0,67108863),_e._ishlnsubmul(rt,Rt,vt);_e.negative!==0;)Rt--,_e.negative=0,_e._ishlnsubmul(rt,1,vt),_e.isZero()||(_e.negative^=1);_&&(_.words[vt]=Rt)}return _&&_.strip(),_e.strip(),b!=="div"&&$!==0&&_e.iushrn($),{div:_||null,mod:_e}},h.prototype.divmod=function(g,b,$){if(c(!g.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var _e,rt,at;return this.negative!==0&&g.negative===0?(at=this.neg().divmod(g,b),b!=="mod"&&(_e=at.div.neg()),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.iadd(g)),{div:_e,mod:rt}):this.negative===0&&g.negative!==0?(at=this.divmod(g.neg(),b),b!=="mod"&&(_e=at.div.neg()),{div:_e,mod:at.mod}):this.negative&g.negative?(at=this.neg().divmod(g.neg(),b),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.isub(g)),{div:at.div,mod:rt}):g.length>this.length||this.cmp(g)<0?{div:new h(0),mod:this}:g.length===1?b==="div"?{div:this.divn(g.words[0]),mod:null}:b==="mod"?{div:null,mod:new h(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new h(this.modn(g.words[0]))}:this._wordDiv(g,b)},h.prototype.div=function(g){return this.divmod(g,"div",!1).div},h.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},h.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},h.prototype.divRound=function(g){var b=this.divmod(g);if(b.mod.isZero())return b.div;var $=b.div.negative!==0?b.mod.isub(g):b.mod,_e=g.ushrn(1),rt=g.andln(1),at=$.cmp(_e);return at<0||rt===1&&at===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},h.prototype.modn=function(g){c(g<=67108863);for(var b=(1<<26)%g,$=0,_e=this.length-1;_e>=0;_e--)$=(b*$+(this.words[_e]|0))%g;return $},h.prototype.idivn=function(g){c(g<=67108863);for(var b=0,$=this.length-1;$>=0;$--){var _e=(this.words[$]|0)+b*67108864;this.words[$]=_e/g|0,b=_e%g}return this.strip()},h.prototype.divn=function(g){return this.clone().idivn(g)},h.prototype.egcd=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=new h(0),lt=new h(1),tt=0;b.isEven()&&$.isEven();)b.iushrn(1),$.iushrn(1),++tt;for(var _=$.clone(),it=b.clone();!b.isZero();){for(var yt=0,vt=1;!(b.words[0]&vt)&&yt<26;++yt,vt<<=1);if(yt>0)for(b.iushrn(yt);yt-- >0;)(_e.isOdd()||rt.isOdd())&&(_e.iadd(_),rt.isub(it)),_e.iushrn(1),rt.iushrn(1);for(var Rt=0,Tt=1;!($.words[0]&Tt)&&Rt<26;++Rt,Tt<<=1);if(Rt>0)for($.iushrn(Rt);Rt-- >0;)(at.isOdd()||lt.isOdd())&&(at.iadd(_),lt.isub(it)),at.iushrn(1),lt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(at),rt.isub(lt)):($.isub(b),at.isub(_e),lt.isub(rt))}return{a:at,b:lt,gcd:$.iushln(tt)}},h.prototype._invmp=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=$.clone();b.cmpn(1)>0&&$.cmpn(1)>0;){for(var lt=0,tt=1;!(b.words[0]&tt)&<<26;++lt,tt<<=1);if(lt>0)for(b.iushrn(lt);lt-- >0;)_e.isOdd()&&_e.iadd(at),_e.iushrn(1);for(var _=0,it=1;!($.words[0]&it)&&_<26;++_,it<<=1);if(_>0)for($.iushrn(_);_-- >0;)rt.isOdd()&&rt.iadd(at),rt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(rt)):($.isub(b),rt.isub(_e))}var yt;return b.cmpn(1)===0?yt=_e:yt=rt,yt.cmpn(0)<0&&yt.iadd(g),yt},h.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var b=this.clone(),$=g.clone();b.negative=0,$.negative=0;for(var _e=0;b.isEven()&&$.isEven();_e++)b.iushrn(1),$.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;$.isEven();)$.iushrn(1);var rt=b.cmp($);if(rt<0){var at=b;b=$,$=at}else if(rt===0||$.cmpn(1)===0)break;b.isub($)}while(!0);return $.iushln(_e)},h.prototype.invm=function(g){return this.egcd(g).a.umod(g)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(g){return this.words[0]&g},h.prototype.bincn=function(g){c(typeof g=="number");var b=g%26,$=(g-b)/26,_e=1<>>26,lt&=67108863,this.words[at]=lt}return rt!==0&&(this.words[at]=rt,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(g){var b=g<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this.strip();var $;if(this.length>1)$=1;else{b&&(g=-g),c(g<=67108863,"Number is too big");var _e=this.words[0]|0;$=_e===g?0:_eg.length)return 1;if(this.length=0;$--){var _e=this.words[$]|0,rt=g.words[$]|0;if(_e!==rt){_ert&&(b=1);break}}return b},h.prototype.gtn=function(g){return this.cmpn(g)===1},h.prototype.gt=function(g){return this.cmp(g)===1},h.prototype.gten=function(g){return this.cmpn(g)>=0},h.prototype.gte=function(g){return this.cmp(g)>=0},h.prototype.ltn=function(g){return this.cmpn(g)===-1},h.prototype.lt=function(g){return this.cmp(g)===-1},h.prototype.lten=function(g){return this.cmpn(g)<=0},h.prototype.lte=function(g){return this.cmp(g)<=0},h.prototype.eqn=function(g){return this.cmpn(g)===0},h.prototype.eq=function(g){return this.cmp(g)===0},h.red=function(g){return new Pt(g)},h.prototype.toRed=function(g){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},h.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(g){return this.red=g,this},h.prototype.forceRed=function(g){return c(!this.red,"Already a number in reduction context"),this._forceRed(g)},h.prototype.redAdd=function(g){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},h.prototype.redIAdd=function(g){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},h.prototype.redSub=function(g){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},h.prototype.redISub=function(g){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},h.prototype.redShl=function(g){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},h.prototype.redMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},h.prototype.redIMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},h.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(g){return c(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var bt={k256:null,p224:null,p192:null,p25519:null};function $t(ct,g){this.name=ct,this.p=new h(g,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$t.prototype._tmp=function(){var g=new h(null);return g.words=new Array(Math.ceil(this.n/13)),g},$t.prototype.ireduce=function(g){var b=g,$;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),$=b.bitLength();while($>this.n);var _e=$0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},$t.prototype.split=function(g,b){g.iushrn(this.n,0,b)},$t.prototype.imulK=function(g){return g.imul(this.k)};function Bt(){$t.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Bt,$t),Bt.prototype.split=function(g,b){for(var $=4194303,_e=Math.min(g.length,9),rt=0;rt<_e;rt++)b.words[rt]=g.words[rt];if(b.length=_e,g.length<=9){g.words[0]=0,g.length=1;return}var at=g.words[9];for(b.words[b.length++]=at&$,rt=10;rt>>22,at=lt}at>>>=22,g.words[rt-10]=at,at===0&&g.length>10?g.length-=10:g.length-=9},Bt.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var b=0,$=0;$>>=26,g.words[$]=rt,b=_e}return b!==0&&(g.words[g.length++]=b),g},h._prime=function(g){if(bt[g])return bt[g];var b;if(g==="k256")b=new Bt;else if(g==="p224")b=new Dt;else if(g==="p192")b=new Ht;else if(g==="p25519")b=new qt;else throw new Error("Unknown prime "+g);return bt[g]=b,b};function Pt(ct){if(typeof ct=="string"){var g=h._prime(ct);this.m=g.p,this.prime=g}else c(ct.gtn(1),"modulus must be greater than 1"),this.m=ct,this.prime=null}Pt.prototype._verify1=function(g){c(g.negative===0,"red works only with positives"),c(g.red,"red works only with red numbers")},Pt.prototype._verify2=function(g,b){c((g.negative|b.negative)===0,"red works only with positives"),c(g.red&&g.red===b.red,"red works only with red numbers")},Pt.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},Pt.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},Pt.prototype.add=function(g,b){this._verify2(g,b);var $=g.add(b);return $.cmp(this.m)>=0&&$.isub(this.m),$._forceRed(this)},Pt.prototype.iadd=function(g,b){this._verify2(g,b);var $=g.iadd(b);return $.cmp(this.m)>=0&&$.isub(this.m),$},Pt.prototype.sub=function(g,b){this._verify2(g,b);var $=g.sub(b);return $.cmpn(0)<0&&$.iadd(this.m),$._forceRed(this)},Pt.prototype.isub=function(g,b){this._verify2(g,b);var $=g.isub(b);return $.cmpn(0)<0&&$.iadd(this.m),$},Pt.prototype.shl=function(g,b){return this._verify1(g),this.imod(g.ushln(b))},Pt.prototype.imul=function(g,b){return this._verify2(g,b),this.imod(g.imul(b))},Pt.prototype.mul=function(g,b){return this._verify2(g,b),this.imod(g.mul(b))},Pt.prototype.isqr=function(g){return this.imul(g,g.clone())},Pt.prototype.sqr=function(g){return this.mul(g,g)},Pt.prototype.sqrt=function(g){if(g.isZero())return g.clone();var b=this.m.andln(3);if(c(b%2===1),b===3){var $=this.m.add(new h(1)).iushrn(2);return this.pow(g,$)}for(var _e=this.m.subn(1),rt=0;!_e.isZero()&&_e.andln(1)===0;)rt++,_e.iushrn(1);c(!_e.isZero());var at=new h(1).toRed(this),lt=at.redNeg(),tt=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new h(2*_*_).toRed(this);this.pow(_,tt).cmp(lt)!==0;)_.redIAdd(lt);for(var it=this.pow(_,_e),yt=this.pow(g,_e.addn(1).iushrn(1)),vt=this.pow(g,_e),Rt=rt;vt.cmp(at)!==0;){for(var Tt=vt,Mt=0;Tt.cmp(at)!==0;Mt++)Tt=Tt.redSqr();c(Mt=0;rt--){for(var it=b.words[rt],yt=_-1;yt>=0;yt--){var vt=it>>yt&1;if(at!==_e[0]&&(at=this.sqr(at)),vt===0&<===0){tt=0;continue}lt<<=1,lt|=vt,tt++,!(tt!==$&&(rt!==0||yt!==0))&&(at=this.mul(at,_e[lt]),tt=0,lt=0)}_=26}return at},Pt.prototype.convertTo=function(g){var b=g.umod(this.m);return b===g?b.clone():b},Pt.prototype.convertFrom=function(g){var b=g.clone();return b.red=null,b},h.mont=function(g){return new Gt(g)};function Gt(ct){Pt.call(this,ct),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}d(Gt,Pt),Gt.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},Gt.prototype.convertFrom=function(g){var b=this.imod(g.mul(this.rinv));return b.red=null,b},Gt.prototype.imul=function(g,b){if(g.isZero()||b.isZero())return g.words[0]=0,g.length=1,g;var $=g.imul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.mul=function(g,b){if(g.isZero()||b.isZero())return new h(0)._forceRed(this);var $=g.mul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.invm=function(g){var b=this.imod(g._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(o,commonjsGlobal$2)})(bn$4);var bnExports$4=bn$4.exports,brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var o;brorand.exports=function(d){return o||(o=new e(null)),o.generate(d)};function e(c){this.rand=c}if(brorand.exports.Rand=e,e.prototype.generate=function(d){return this._rand(d)},e.prototype._rand=function(d){if(this.rand.getBytes)return this.rand.getBytes(d);for(var h=new Uint8Array(d),j=0;j=0);return et},a.prototype._randrange=function(d,h){var j=h.sub(d);return d.add(this._randbelow(j))},a.prototype.test=function(d,h,j){var et=d.bitLength(),nt=o.mont(d),st=new o(1).toRed(nt);h||(h=Math.max(1,et/48|0));for(var ot=d.subn(1),ht=0;!ot.testn(ht);ht++);for(var pt=d.shrn(ht),dt=ot.toRed(nt),gt=!0;h>0;h--){var wt=this._randrange(new o(2),ot);j&&j(wt);var St=wt.toRed(nt).redPow(pt);if(!(St.cmp(st)===0||St.cmp(dt)===0)){for(var _t=1;_t0;h--){var dt=this._randrange(new o(2),st),gt=d.gcd(dt);if(gt.cmpn(1)!==0)return gt;var wt=dt.toRed(et).redPow(ht);if(!(wt.cmp(nt)===0||wt.cmp(pt)===0)){for(var St=1;St_t;)bt.ishrn(1);if(bt.isEven()&&bt.iadd(h),bt.testn(1)||bt.iadd(j),mt.cmp(j)){if(!mt.cmp(et))for(;bt.mod(nt).cmp(st);)bt.iadd(ht)}else for(;bt.mod(a).cmp(ot);)bt.iadd(ht);if($t=bt.shrn(1),gt($t)&>(bt)&&wt($t)&&wt(bt)&&d.test($t)&&d.test(bt))return bt}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$1={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var o=bnExports$5,e=requireMr(),a=new e,c=new o(24),d=new o(11),h=new o(10),j=new o(3),et=new o(7),nt=requireGeneratePrime(),st=browserExports;dh=gt;function ot(St,_t){return _t=_t||"utf8",Buffer$1$1.isBuffer(St)||(St=new Buffer$1$1(St,_t)),this._pub=new o(St),this}function ht(St,_t){return _t=_t||"utf8",Buffer$1$1.isBuffer(St)||(St=new Buffer$1$1(St,_t)),this._priv=new o(St),this}var pt={};function dt(St,_t){var mt=_t.toString("hex"),bt=[mt,St.toString(16)].join("_");if(bt in pt)return pt[bt];var $t=0;if(St.isEven()||!nt.simpleSieve||!nt.fermatTest(St)||!a.test(St))return $t+=1,mt==="02"||mt==="05"?$t+=8:$t+=4,pt[bt]=$t,$t;a.test(St.shrn(1))||($t+=2);var Bt;switch(mt){case"02":St.mod(c).cmp(d)&&($t+=8);break;case"05":Bt=St.mod(h),Bt.cmp(j)&&Bt.cmp(et)&&($t+=8);break;default:$t+=4}return pt[bt]=$t,$t}function gt(St,_t,mt){this.setGenerator(_t),this.__prime=new o(St),this._prime=o.mont(this.__prime),this._primeLen=St.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,mt?(this.setPublicKey=ot,this.setPrivateKey=ht):this._primeCode=8}Object.defineProperty(gt.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=dt(this.__prime,this.__gen)),this._primeCode}}),gt.prototype.generateKeys=function(){return this._priv||(this._priv=new o(st(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},gt.prototype.computeSecret=function(St){St=new o(St),St=St.toRed(this._prime);var _t=St.redPow(this._priv).fromRed(),mt=new Buffer$1$1(_t.toArray()),bt=this.getPrime();if(mt.length"u"||!process$1.version||process$1.version.indexOf("v0.")===0||process$1.version.indexOf("v1.")===0&&process$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick}:processNextickArgs.exports=process$1;function nextTick(o,e,a,c){if(typeof o!="function")throw new TypeError('"callback" argument must be a function');var d=arguments.length,h,j;switch(d){case 0:case 1:return process$1.nextTick(o);case 2:return process$1.nextTick(function(){o.call(null,e)});case 3:return process$1.nextTick(function(){o.call(null,e,a)});case 4:return process$1.nextTick(function(){o.call(null,e,a,c)});default:for(h=new Array(d-1),j=0;j"u"}util$2.isPrimitive=isPrimitive;util$2.isBuffer=require$$0$1.Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(o){function e(h,j){if(!(h instanceof j))throw new TypeError("Cannot call a class as a function")}var a=safeBufferExports.Buffer,c=requireUtil();function d(h,j,et){h.copy(j,et)}o.exports=function(){function h(){e(this,h),this.head=null,this.tail=null,this.length=0}return h.prototype.push=function(et){var nt={data:et,next:null};this.length>0?this.tail.next=nt:this.head=nt,this.tail=nt,++this.length},h.prototype.unshift=function(et){var nt={data:et,next:this.head};this.length===0&&(this.tail=nt),this.head=nt,++this.length},h.prototype.shift=function(){if(this.length!==0){var et=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,et}},h.prototype.clear=function(){this.head=this.tail=null,this.length=0},h.prototype.join=function(et){if(this.length===0)return"";for(var nt=this.head,st=""+nt.data;nt=nt.next;)st+=et+nt.data;return st},h.prototype.concat=function(et){if(this.length===0)return a.alloc(0);for(var nt=a.allocUnsafe(et>>>0),st=this.head,ot=0;st;)d(st.data,nt,ot),ot+=st.data.length,st=st.next;return nt},h}(),c&&c.inspect&&c.inspect.custom&&(o.exports.prototype[c.inspect.custom]=function(){var h=c.inspect({length:this.length});return this.constructor.name+" "+h})}(BufferList)),BufferList.exports}var pna=processNextickArgsExports;function destroy(o,e){var a=this,c=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return c||d?(e?e(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,this,o)):pna.nextTick(emitErrorNT,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||null,function(h){!e&&h?a._writableState?a._writableState.errorEmitted||(a._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,a,h)):pna.nextTick(emitErrorNT,a,h):e&&e(h)}),this)}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(o,e){o.emit("error",e)}var destroy_1={destroy,undestroy},_stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var o=processNextickArgsExports;_stream_writable=wt;function e(at){var lt=this;this.next=null,this.entry=null,this.finish=function(){rt(lt,at)}}var a=!process$1.browser&&["v0.10","v0.9."].indexOf(process$1.version.slice(0,5))>-1?setImmediate:o.nextTick,c;wt.WritableState=dt;var d=Object.create(util$2);d.inherits=inherits_browserExports;var h={deprecate:requireBrowser$3()},j=streamBrowser,et=safeBufferExports.Buffer,nt=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function st(at){return et.from(at)}function ot(at){return et.isBuffer(at)||at instanceof nt}var ht=destroy_1;d.inherits(wt,j);function pt(){}function dt(at,lt){c=c||require_stream_duplex(),at=at||{};var tt=lt instanceof c;this.objectMode=!!at.objectMode,tt&&(this.objectMode=this.objectMode||!!at.writableObjectMode);var _=at.highWaterMark,it=at.writableHighWaterMark,yt=this.objectMode?16:16*1024;_||_===0?this.highWaterMark=_:tt&&(it||it===0)?this.highWaterMark=it:this.highWaterMark=yt,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var vt=at.decodeStrings===!1;this.decodeStrings=!vt,this.defaultEncoding=at.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Rt){Ht(lt,Rt)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}dt.prototype.getBuffer=function(){for(var lt=this.bufferedRequest,tt=[];lt;)tt.push(lt),lt=lt.next;return tt},function(){try{Object.defineProperty(dt.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var gt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(gt=Function.prototype[Symbol.hasInstance],Object.defineProperty(wt,Symbol.hasInstance,{value:function(at){return gt.call(this,at)?!0:this!==wt?!1:at&&at._writableState instanceof dt}})):gt=function(at){return at instanceof this};function wt(at){if(c=c||require_stream_duplex(),!gt.call(wt,this)&&!(this instanceof c))return new wt(at);this._writableState=new dt(at,this),this.writable=!0,at&&(typeof at.write=="function"&&(this._write=at.write),typeof at.writev=="function"&&(this._writev=at.writev),typeof at.destroy=="function"&&(this._destroy=at.destroy),typeof at.final=="function"&&(this._final=at.final)),j.call(this)}wt.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function St(at,lt){var tt=new Error("write after end");at.emit("error",tt),o.nextTick(lt,tt)}function _t(at,lt,tt,_){var it=!0,yt=!1;return tt===null?yt=new TypeError("May not write null values to stream"):typeof tt!="string"&&tt!==void 0&&!lt.objectMode&&(yt=new TypeError("Invalid non-string/buffer chunk")),yt&&(at.emit("error",yt),o.nextTick(_,yt),it=!1),it}wt.prototype.write=function(at,lt,tt){var _=this._writableState,it=!1,yt=!_.objectMode&&ot(at);return yt&&!et.isBuffer(at)&&(at=st(at)),typeof lt=="function"&&(tt=lt,lt=null),yt?lt="buffer":lt||(lt=_.defaultEncoding),typeof tt!="function"&&(tt=pt),_.ended?St(this,tt):(yt||_t(this,_,at,tt))&&(_.pendingcb++,it=bt(this,_,yt,at,lt,tt)),it},wt.prototype.cork=function(){var at=this._writableState;at.corked++},wt.prototype.uncork=function(){var at=this._writableState;at.corked&&(at.corked--,!at.writing&&!at.corked&&!at.bufferProcessing&&at.bufferedRequest&&Gt(this,at))},wt.prototype.setDefaultEncoding=function(lt){if(typeof lt=="string"&&(lt=lt.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((lt+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+lt);return this._writableState.defaultEncoding=lt,this};function mt(at,lt,tt){return!at.objectMode&&at.decodeStrings!==!1&&typeof lt=="string"&&(lt=et.from(lt,tt)),lt}Object.defineProperty(wt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function bt(at,lt,tt,_,it,yt){if(!tt){var vt=mt(lt,_,it);_!==vt&&(tt=!0,it="buffer",_=vt)}var Rt=lt.objectMode?1:_.length;lt.length+=Rt;var Tt=lt.length0?(typeof Ot!="string"&&!Nt.objectMode&&Object.getPrototypeOf(Ot)!==h.prototype&&(Ot=et(Ot)),Ut?Nt.endEmitted?At.emit("error",new Error("stream.unshift() after end event")):$t(At,Nt,Ot,!0):Nt.ended?At.emit("error",new Error("stream.push() after EOF")):(Nt.reading=!1,Nt.decoder&&!Ct?(Ot=Nt.decoder.write(Ot),Nt.objectMode||Ot.length!==0?$t(At,Nt,Ot,!1):b(At,Nt)):$t(At,Nt,Ot,!1))):Ut||(Nt.reading=!1)}return Dt(Nt)}function $t(At,Ot,Ct,Ut){Ot.flowing&&Ot.length===0&&!Ot.sync?(At.emit("data",Ct),At.read(0)):(Ot.length+=Ot.objectMode?1:Ct.length,Ut?Ot.buffer.unshift(Ct):Ot.buffer.push(Ct),Ot.needReadable&&ct(At)),b(At,Ot)}function Bt(At,Ot){var Ct;return!nt(Ot)&&typeof Ot!="string"&&Ot!==void 0&&!At.objectMode&&(Ct=new TypeError("Invalid non-string/buffer chunk")),Ct}function Dt(At){return!At.ended&&(At.needReadable||At.length=Ht?At=Ht:(At--,At|=At>>>1,At|=At>>>2,At|=At>>>4,At|=At>>>8,At|=At>>>16,At++),At}function Pt(At,Ot){return At<=0||Ot.length===0&&Ot.ended?0:Ot.objectMode?1:At!==At?Ot.flowing&&Ot.length?Ot.buffer.head.data.length:Ot.length:(At>Ot.highWaterMark&&(Ot.highWaterMark=qt(At)),At<=Ot.length?At:Ot.ended?Ot.length:(Ot.needReadable=!0,0))}mt.prototype.read=function(At){ht("read",At),At=parseInt(At,10);var Ot=this._readableState,Ct=At;if(At!==0&&(Ot.emittedReadable=!1),At===0&&Ot.needReadable&&(Ot.length>=Ot.highWaterMark||Ot.ended))return ht("read: emitReadable",Ot.length,Ot.ended),Ot.length===0&&Ot.ended?Rt(this):ct(this),null;if(At=Pt(At,Ot),At===0&&Ot.ended)return Ot.length===0&&Rt(this),null;var Ut=Ot.needReadable;ht("need readable",Ut),(Ot.length===0||Ot.length-At0?Lt=_(At,Ot):Lt=null,Lt===null?(Ot.needReadable=!0,At=0):Ot.length-=At,Ot.length===0&&(Ot.ended||(Ot.needReadable=!0),Ct!==At&&Ot.ended&&Rt(this)),Lt!==null&&this.emit("data",Lt),Lt};function Gt(At,Ot){if(!Ot.ended){if(Ot.decoder){var Ct=Ot.decoder.end();Ct&&Ct.length&&(Ot.buffer.push(Ct),Ot.length+=Ot.objectMode?1:Ct.length)}Ot.ended=!0,ct(At)}}function ct(At){var Ot=At._readableState;Ot.needReadable=!1,Ot.emittedReadable||(ht("emitReadable",Ot.flowing),Ot.emittedReadable=!0,Ot.sync?o.nextTick(g,At):g(At))}function g(At){ht("emit readable"),At.emit("readable"),tt(At)}function b(At,Ot){Ot.readingMore||(Ot.readingMore=!0,o.nextTick($,At,Ot))}function $(At,Ot){for(var Ct=Ot.length;!Ot.reading&&!Ot.flowing&&!Ot.ended&&Ot.length1&&Mt(Ut.pipes,At)!==-1)&&!Jt&&(ht("false write response, pause",Ut.awaitDrain),Ut.awaitDrain++,er=!0),Ct.pause())}function Ir(Ft){ht("onerror",Ft),xr(),At.removeListener("error",Ir),c(At,"error")===0&&At.emit("error",Ft)}St(At,"error",Ir);function nr(){At.removeListener("finish",or),xr()}At.once("close",nr);function or(){ht("onfinish"),At.removeListener("close",nr),xr()}At.once("finish",or);function xr(){ht("unpipe"),Ct.unpipe(At)}return At.emit("pipe",Ct),Ut.flowing||(ht("pipe resume"),Ct.resume()),At};function _e(At){return function(){var Ot=At._readableState;ht("pipeOnDrain",Ot.awaitDrain),Ot.awaitDrain&&Ot.awaitDrain--,Ot.awaitDrain===0&&c(At,"data")&&(Ot.flowing=!0,tt(At))}}mt.prototype.unpipe=function(At){var Ot=this._readableState,Ct={hasUnpiped:!1};if(Ot.pipesCount===0)return this;if(Ot.pipesCount===1)return At&&At!==Ot.pipes?this:(At||(At=Ot.pipes),Ot.pipes=null,Ot.pipesCount=0,Ot.flowing=!1,At&&At.emit("unpipe",this,Ct),this);if(!At){var Ut=Ot.pipes,Lt=Ot.pipesCount;Ot.pipes=null,Ot.pipesCount=0,Ot.flowing=!1;for(var Nt=0;Nt=Ot.length?(Ot.decoder?Ct=Ot.buffer.join(""):Ot.buffer.length===1?Ct=Ot.buffer.head.data:Ct=Ot.buffer.concat(Ot.length),Ot.buffer.clear()):Ct=it(At,Ot.buffer,Ot.decoder),Ct}function it(At,Ot,Ct){var Ut;return AtNt.length?Nt.length:At;if(Kt===Nt.length?Lt+=Nt:Lt+=Nt.slice(0,At),At-=Kt,At===0){Kt===Nt.length?(++Ut,Ct.next?Ot.head=Ct.next:Ot.head=Ot.tail=null):(Ot.head=Ct,Ct.data=Nt.slice(Kt));break}++Ut}return Ot.length-=Ut,Lt}function vt(At,Ot){var Ct=h.allocUnsafe(At),Ut=Ot.head,Lt=1;for(Ut.data.copy(Ct),At-=Ut.data.length;Ut=Ut.next;){var Nt=Ut.data,Kt=At>Nt.length?Nt.length:At;if(Nt.copy(Ct,Ct.length-At,0,Kt),At-=Kt,At===0){Kt===Nt.length?(++Lt,Ut.next?Ot.head=Ut.next:Ot.head=Ot.tail=null):(Ot.head=Ut,Ut.data=Nt.slice(Kt));break}++Lt}return Ot.length-=Lt,Ct}function Rt(At){var Ot=At._readableState;if(Ot.length>0)throw new Error('"endReadable()" called on non-empty stream');Ot.endEmitted||(Ot.ended=!0,o.nextTick(Tt,Ot,At))}function Tt(At,Ot){!At.endEmitted&&At.length===0&&(At.endEmitted=!0,Ot.readable=!1,Ot.emit("end"))}function Mt(At,Ot){for(var Ct=0,Ut=At.length;Ct=0||!a.umod(o.prime1)||!a.umod(o.prime2));return a}function blind(o){var e=getr(o),a=e.toRed(BN$a.mont(o.modulus)).redPow(new BN$a(o.publicExponent)).fromRed();return{blinder:a,unblinder:e.invm(o.modulus)}}function crt$2(o,e){var a=blind(e),c=e.modulus.byteLength(),d=new BN$a(o).mul(a.blinder).umod(e.modulus),h=d.toRed(BN$a.mont(e.prime1)),j=d.toRed(BN$a.mont(e.prime2)),et=e.coefficient,nt=e.prime1,st=e.prime2,ot=h.redPow(e.exponent1).fromRed(),ht=j.redPow(e.exponent2).fromRed(),pt=ot.isub(ht).imul(et).umod(nt).imul(st);return ht.iadd(pt).imul(a.unblinder).umod(e.modulus).toArrayLike(Buffer$7,"be",c)}crt$2.getr=getr;var browserifyRsa=crt$2,elliptic={};const 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"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$l={},bn$3={exports:{}};bn$3.exports;(function(o){(function(e,a){function c(ct,g){if(!ct)throw new Error(g||"Assertion failed")}function d(ct,g){ct.super_=g;var b=function(){};b.prototype=g.prototype,ct.prototype=new b,ct.prototype.constructor=ct}function h(ct,g,b){if(h.isBN(ct))return ct;this.negative=0,this.words=null,this.length=0,this.red=null,ct!==null&&((g==="le"||g==="be")&&(b=g,g=10),this._init(ct||0,g||10,b||"be"))}typeof e=="object"?e.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var j;try{typeof window<"u"&&typeof window.Buffer<"u"?j=window.Buffer:j=require$$0$1.Buffer}catch{}h.isBN=function(g){return g instanceof h?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===h.wordSize&&Array.isArray(g.words)},h.max=function(g,b){return g.cmp(b)>0?g:b},h.min=function(g,b){return g.cmp(b)<0?g:b},h.prototype._init=function(g,b,$){if(typeof g=="number")return this._initNumber(g,b,$);if(typeof g=="object")return this._initArray(g,b,$);b==="hex"&&(b=16),c(b===(b|0)&&b>=2&&b<=36),g=g.toString().replace(/\s+/g,"");var _e=0;g[0]==="-"&&(_e++,this.negative=1),_e=0;_e-=3)at=g[_e]|g[_e-1]<<8|g[_e-2]<<16,this.words[rt]|=at<>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);else if($==="le")for(_e=0,rt=0;_e>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);return this.strip()};function et(ct,g){var b=ct.charCodeAt(g);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function nt(ct,g,b){var $=et(ct,b);return b-1>=g&&($|=et(ct,b-1)<<4),$}h.prototype._parseHex=function(g,b,$){this.length=Math.ceil((g.length-b)/6),this.words=new Array(this.length);for(var _e=0;_e=b;_e-=2)lt=nt(g,b,_e)<=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8;else{var tt=g.length-b;for(_e=tt%2===0?b+1:b;_e=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8}this.strip()};function st(ct,g,b,$){for(var _e=0,rt=Math.min(ct.length,b),at=g;at=49?_e+=lt-49+10:lt>=17?_e+=lt-17+10:_e+=lt}return _e}h.prototype._parseBase=function(g,b,$){this.words=[0],this.length=1;for(var _e=0,rt=1;rt<=67108863;rt*=b)_e++;_e--,rt=rt/b|0;for(var at=g.length-$,lt=at%_e,tt=Math.min(at,at-lt)+$,_=0,it=$;it1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var ot=["","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"],ht=[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],pt=[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];h.prototype.toString=function(g,b){g=g||10,b=b|0||1;var $;if(g===16||g==="hex"){$="";for(var _e=0,rt=0,at=0;at>>24-_e&16777215,_e+=2,_e>=26&&(_e-=26,at--),rt!==0||at!==this.length-1?$=ot[6-tt.length]+tt+$:$=tt+$}for(rt!==0&&($=rt.toString(16)+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}if(g===(g|0)&&g>=2&&g<=36){var _=ht[g],it=pt[g];$="";var yt=this.clone();for(yt.negative=0;!yt.isZero();){var vt=yt.modn(it).toString(g);yt=yt.idivn(it),yt.isZero()?$=vt+$:$=ot[_-vt.length]+vt+$}for(this.isZero()&&($="0"+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}c(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(g,b){return c(typeof j<"u"),this.toArrayLike(j,g,b)},h.prototype.toArray=function(g,b){return this.toArrayLike(Array,g,b)},h.prototype.toArrayLike=function(g,b,$){var _e=this.byteLength(),rt=$||Math.max(1,_e);c(_e<=rt,"byte array longer than desired length"),c(rt>0,"Requested array length <= 0"),this.strip();var at=b==="le",lt=new g(rt),tt,_,it=this.clone();if(at){for(_=0;!it.isZero();_++)tt=it.andln(255),it.iushrn(8),lt[_]=tt;for(;_=4096&&($+=13,b>>>=13),b>=64&&($+=7,b>>>=7),b>=8&&($+=4,b>>>=4),b>=2&&($+=2,b>>>=2),$+b},h.prototype._zeroBits=function(g){if(g===0)return 26;var b=g,$=0;return b&8191||($+=13,b>>>=13),b&127||($+=7,b>>>=7),b&15||($+=4,b>>>=4),b&3||($+=2,b>>>=2),b&1||$++,$},h.prototype.bitLength=function(){var g=this.words[this.length-1],b=this._countBits(g);return(this.length-1)*26+b};function dt(ct){for(var g=new Array(ct.bitLength()),b=0;b>>_e}return g}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,b=0;bg.length?this.clone().ior(g):g.clone().ior(this)},h.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},h.prototype.iuand=function(g){var b;this.length>g.length?b=g:b=this;for(var $=0;$g.length?this.clone().iand(g):g.clone().iand(this)},h.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},h.prototype.iuxor=function(g){var b,$;this.length>g.length?(b=this,$=g):(b=g,$=this);for(var _e=0;_e<$.length;_e++)this.words[_e]=b.words[_e]^$.words[_e];if(this!==b)for(;_eg.length?this.clone().ixor(g):g.clone().ixor(this)},h.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},h.prototype.inotn=function(g){c(typeof g=="number"&&g>=0);var b=Math.ceil(g/26)|0,$=g%26;this._expand(b),$>0&&b--;for(var _e=0;_e0&&(this.words[_e]=~this.words[_e]&67108863>>26-$),this.strip()},h.prototype.notn=function(g){return this.clone().inotn(g)},h.prototype.setn=function(g,b){c(typeof g=="number"&&g>=0);var $=g/26|0,_e=g%26;return this._expand($+1),b?this.words[$]=this.words[$]|1<<_e:this.words[$]=this.words[$]&~(1<<_e),this.strip()},h.prototype.iadd=function(g){var b;if(this.negative!==0&&g.negative===0)return this.negative=0,b=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,b=this.isub(g),g.negative=1,b._normSign();var $,_e;this.length>g.length?($=this,_e=g):($=g,_e=this);for(var rt=0,at=0;at<_e.length;at++)b=($.words[at]|0)+(_e.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;for(;rt!==0&&at<$.length;at++)b=($.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;if(this.length=$.length,rt!==0)this.words[this.length]=rt,this.length++;else if($!==this)for(;at<$.length;at++)this.words[at]=$.words[at];return this},h.prototype.add=function(g){var b;return g.negative!==0&&this.negative===0?(g.negative=0,b=this.sub(g),g.negative^=1,b):g.negative===0&&this.negative!==0?(this.negative=0,b=g.sub(this),this.negative=1,b):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},h.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var b=this.iadd(g);return g.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var $=this.cmp(g);if($===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _e,rt;$>0?(_e=this,rt=g):(_e=g,rt=this);for(var at=0,lt=0;lt>26,this.words[lt]=b&67108863;for(;at!==0&<<_e.length;lt++)b=(_e.words[lt]|0)+at,at=b>>26,this.words[lt]=b&67108863;if(at===0&<<_e.length&&_e!==this)for(;lt<_e.length;lt++)this.words[lt]=_e.words[lt];return this.length=Math.max(this.length,lt),_e!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(g){return this.clone().isub(g)};function gt(ct,g,b){b.negative=g.negative^ct.negative;var $=ct.length+g.length|0;b.length=$,$=$-1|0;var _e=ct.words[0]|0,rt=g.words[0]|0,at=_e*rt,lt=at&67108863,tt=at/67108864|0;b.words[0]=lt;for(var _=1;_<$;_++){for(var it=tt>>>26,yt=tt&67108863,vt=Math.min(_,g.length-1),Rt=Math.max(0,_-ct.length+1);Rt<=vt;Rt++){var Tt=_-Rt|0;_e=ct.words[Tt]|0,rt=g.words[Rt]|0,at=_e*rt+yt,it+=at/67108864|0,yt=at&67108863}b.words[_]=yt|0,tt=it|0}return tt!==0?b.words[_]=tt|0:b.length--,b.strip()}var wt=function(g,b,$){var _e=g.words,rt=b.words,at=$.words,lt=0,tt,_,it,yt=_e[0]|0,vt=yt&8191,Rt=yt>>>13,Tt=_e[1]|0,Mt=Tt&8191,At=Tt>>>13,Ot=_e[2]|0,Ct=Ot&8191,Ut=Ot>>>13,Lt=_e[3]|0,Nt=Lt&8191,Kt=Lt>>>13,yr=_e[4]|0,Xt=yr&8191,Jt=yr>>>13,Ar=_e[5]|0,er=Ar&8191,Vt=Ar>>>13,Ir=_e[6]|0,nr=Ir&8191,or=Ir>>>13,xr=_e[7]|0,Ft=xr&8191,jt=xr>>>13,Rr=_e[8]|0,Yt=Rr&8191,Zt=Rr>>>13,$r=_e[9]|0,It=$r&8191,Et=$r>>>13,xt=rt[0]|0,kt=xt&8191,zt=xt>>>13,Qt=rt[1]|0,Wt=Qt&8191,rr=Qt>>>13,Mr=rt[2]|0,tr=Mr&8191,ir=Mr>>>13,Tr=rt[3]|0,ar=Tr&8191,gr=Tr>>>13,Cr=rt[4]|0,ur=Cr&8191,vr=Cr>>>13,Br=rt[5]|0,lr=Br&8191,_r=Br>>>13,kr=rt[6]|0,fr=kr&8191,br=kr>>>13,Lr=rt[7]|0,cr=Lr&8191,wr=Lr>>>13,Pr=rt[8]|0,dr=Pr&8191,Er=Pr>>>13,Dr=rt[9]|0,pr=Dr&8191,Sr=Dr>>>13;$.negative=g.negative^b.negative,$.length=19,tt=Math.imul(vt,kt),_=Math.imul(vt,zt),_=_+Math.imul(Rt,kt)|0,it=Math.imul(Rt,zt);var Or=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Or>>>26)|0,Or&=67108863,tt=Math.imul(Mt,kt),_=Math.imul(Mt,zt),_=_+Math.imul(At,kt)|0,it=Math.imul(At,zt),tt=tt+Math.imul(vt,Wt)|0,_=_+Math.imul(vt,rr)|0,_=_+Math.imul(Rt,Wt)|0,it=it+Math.imul(Rt,rr)|0;var Nr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,tt=Math.imul(Ct,kt),_=Math.imul(Ct,zt),_=_+Math.imul(Ut,kt)|0,it=Math.imul(Ut,zt),tt=tt+Math.imul(Mt,Wt)|0,_=_+Math.imul(Mt,rr)|0,_=_+Math.imul(At,Wt)|0,it=it+Math.imul(At,rr)|0,tt=tt+Math.imul(vt,tr)|0,_=_+Math.imul(vt,ir)|0,_=_+Math.imul(Rt,tr)|0,it=it+Math.imul(Rt,ir)|0;var Ur=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,tt=Math.imul(Nt,kt),_=Math.imul(Nt,zt),_=_+Math.imul(Kt,kt)|0,it=Math.imul(Kt,zt),tt=tt+Math.imul(Ct,Wt)|0,_=_+Math.imul(Ct,rr)|0,_=_+Math.imul(Ut,Wt)|0,it=it+Math.imul(Ut,rr)|0,tt=tt+Math.imul(Mt,tr)|0,_=_+Math.imul(Mt,ir)|0,_=_+Math.imul(At,tr)|0,it=it+Math.imul(At,ir)|0,tt=tt+Math.imul(vt,ar)|0,_=_+Math.imul(vt,gr)|0,_=_+Math.imul(Rt,ar)|0,it=it+Math.imul(Rt,gr)|0;var Hr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,tt=Math.imul(Xt,kt),_=Math.imul(Xt,zt),_=_+Math.imul(Jt,kt)|0,it=Math.imul(Jt,zt),tt=tt+Math.imul(Nt,Wt)|0,_=_+Math.imul(Nt,rr)|0,_=_+Math.imul(Kt,Wt)|0,it=it+Math.imul(Kt,rr)|0,tt=tt+Math.imul(Ct,tr)|0,_=_+Math.imul(Ct,ir)|0,_=_+Math.imul(Ut,tr)|0,it=it+Math.imul(Ut,ir)|0,tt=tt+Math.imul(Mt,ar)|0,_=_+Math.imul(Mt,gr)|0,_=_+Math.imul(At,ar)|0,it=it+Math.imul(At,gr)|0,tt=tt+Math.imul(vt,ur)|0,_=_+Math.imul(vt,vr)|0,_=_+Math.imul(Rt,ur)|0,it=it+Math.imul(Rt,vr)|0;var Fr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,tt=Math.imul(er,kt),_=Math.imul(er,zt),_=_+Math.imul(Vt,kt)|0,it=Math.imul(Vt,zt),tt=tt+Math.imul(Xt,Wt)|0,_=_+Math.imul(Xt,rr)|0,_=_+Math.imul(Jt,Wt)|0,it=it+Math.imul(Jt,rr)|0,tt=tt+Math.imul(Nt,tr)|0,_=_+Math.imul(Nt,ir)|0,_=_+Math.imul(Kt,tr)|0,it=it+Math.imul(Kt,ir)|0,tt=tt+Math.imul(Ct,ar)|0,_=_+Math.imul(Ct,gr)|0,_=_+Math.imul(Ut,ar)|0,it=it+Math.imul(Ut,gr)|0,tt=tt+Math.imul(Mt,ur)|0,_=_+Math.imul(Mt,vr)|0,_=_+Math.imul(At,ur)|0,it=it+Math.imul(At,vr)|0,tt=tt+Math.imul(vt,lr)|0,_=_+Math.imul(vt,_r)|0,_=_+Math.imul(Rt,lr)|0,it=it+Math.imul(Rt,_r)|0;var qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(qr>>>26)|0,qr&=67108863,tt=Math.imul(nr,kt),_=Math.imul(nr,zt),_=_+Math.imul(or,kt)|0,it=Math.imul(or,zt),tt=tt+Math.imul(er,Wt)|0,_=_+Math.imul(er,rr)|0,_=_+Math.imul(Vt,Wt)|0,it=it+Math.imul(Vt,rr)|0,tt=tt+Math.imul(Xt,tr)|0,_=_+Math.imul(Xt,ir)|0,_=_+Math.imul(Jt,tr)|0,it=it+Math.imul(Jt,ir)|0,tt=tt+Math.imul(Nt,ar)|0,_=_+Math.imul(Nt,gr)|0,_=_+Math.imul(Kt,ar)|0,it=it+Math.imul(Kt,gr)|0,tt=tt+Math.imul(Ct,ur)|0,_=_+Math.imul(Ct,vr)|0,_=_+Math.imul(Ut,ur)|0,it=it+Math.imul(Ut,vr)|0,tt=tt+Math.imul(Mt,lr)|0,_=_+Math.imul(Mt,_r)|0,_=_+Math.imul(At,lr)|0,it=it+Math.imul(At,_r)|0,tt=tt+Math.imul(vt,fr)|0,_=_+Math.imul(vt,br)|0,_=_+Math.imul(Rt,fr)|0,it=it+Math.imul(Rt,br)|0;var Kr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,tt=Math.imul(Ft,kt),_=Math.imul(Ft,zt),_=_+Math.imul(jt,kt)|0,it=Math.imul(jt,zt),tt=tt+Math.imul(nr,Wt)|0,_=_+Math.imul(nr,rr)|0,_=_+Math.imul(or,Wt)|0,it=it+Math.imul(or,rr)|0,tt=tt+Math.imul(er,tr)|0,_=_+Math.imul(er,ir)|0,_=_+Math.imul(Vt,tr)|0,it=it+Math.imul(Vt,ir)|0,tt=tt+Math.imul(Xt,ar)|0,_=_+Math.imul(Xt,gr)|0,_=_+Math.imul(Jt,ar)|0,it=it+Math.imul(Jt,gr)|0,tt=tt+Math.imul(Nt,ur)|0,_=_+Math.imul(Nt,vr)|0,_=_+Math.imul(Kt,ur)|0,it=it+Math.imul(Kt,vr)|0,tt=tt+Math.imul(Ct,lr)|0,_=_+Math.imul(Ct,_r)|0,_=_+Math.imul(Ut,lr)|0,it=it+Math.imul(Ut,_r)|0,tt=tt+Math.imul(Mt,fr)|0,_=_+Math.imul(Mt,br)|0,_=_+Math.imul(At,fr)|0,it=it+Math.imul(At,br)|0,tt=tt+Math.imul(vt,cr)|0,_=_+Math.imul(vt,wr)|0,_=_+Math.imul(Rt,cr)|0,it=it+Math.imul(Rt,wr)|0;var jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(jr>>>26)|0,jr&=67108863,tt=Math.imul(Yt,kt),_=Math.imul(Yt,zt),_=_+Math.imul(Zt,kt)|0,it=Math.imul(Zt,zt),tt=tt+Math.imul(Ft,Wt)|0,_=_+Math.imul(Ft,rr)|0,_=_+Math.imul(jt,Wt)|0,it=it+Math.imul(jt,rr)|0,tt=tt+Math.imul(nr,tr)|0,_=_+Math.imul(nr,ir)|0,_=_+Math.imul(or,tr)|0,it=it+Math.imul(or,ir)|0,tt=tt+Math.imul(er,ar)|0,_=_+Math.imul(er,gr)|0,_=_+Math.imul(Vt,ar)|0,it=it+Math.imul(Vt,gr)|0,tt=tt+Math.imul(Xt,ur)|0,_=_+Math.imul(Xt,vr)|0,_=_+Math.imul(Jt,ur)|0,it=it+Math.imul(Jt,vr)|0,tt=tt+Math.imul(Nt,lr)|0,_=_+Math.imul(Nt,_r)|0,_=_+Math.imul(Kt,lr)|0,it=it+Math.imul(Kt,_r)|0,tt=tt+Math.imul(Ct,fr)|0,_=_+Math.imul(Ct,br)|0,_=_+Math.imul(Ut,fr)|0,it=it+Math.imul(Ut,br)|0,tt=tt+Math.imul(Mt,cr)|0,_=_+Math.imul(Mt,wr)|0,_=_+Math.imul(At,cr)|0,it=it+Math.imul(At,wr)|0,tt=tt+Math.imul(vt,dr)|0,_=_+Math.imul(vt,Er)|0,_=_+Math.imul(Rt,dr)|0,it=it+Math.imul(Rt,Er)|0;var Wr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,tt=Math.imul(It,kt),_=Math.imul(It,zt),_=_+Math.imul(Et,kt)|0,it=Math.imul(Et,zt),tt=tt+Math.imul(Yt,Wt)|0,_=_+Math.imul(Yt,rr)|0,_=_+Math.imul(Zt,Wt)|0,it=it+Math.imul(Zt,rr)|0,tt=tt+Math.imul(Ft,tr)|0,_=_+Math.imul(Ft,ir)|0,_=_+Math.imul(jt,tr)|0,it=it+Math.imul(jt,ir)|0,tt=tt+Math.imul(nr,ar)|0,_=_+Math.imul(nr,gr)|0,_=_+Math.imul(or,ar)|0,it=it+Math.imul(or,gr)|0,tt=tt+Math.imul(er,ur)|0,_=_+Math.imul(er,vr)|0,_=_+Math.imul(Vt,ur)|0,it=it+Math.imul(Vt,vr)|0,tt=tt+Math.imul(Xt,lr)|0,_=_+Math.imul(Xt,_r)|0,_=_+Math.imul(Jt,lr)|0,it=it+Math.imul(Jt,_r)|0,tt=tt+Math.imul(Nt,fr)|0,_=_+Math.imul(Nt,br)|0,_=_+Math.imul(Kt,fr)|0,it=it+Math.imul(Kt,br)|0,tt=tt+Math.imul(Ct,cr)|0,_=_+Math.imul(Ct,wr)|0,_=_+Math.imul(Ut,cr)|0,it=it+Math.imul(Ut,wr)|0,tt=tt+Math.imul(Mt,dr)|0,_=_+Math.imul(Mt,Er)|0,_=_+Math.imul(At,dr)|0,it=it+Math.imul(At,Er)|0,tt=tt+Math.imul(vt,pr)|0,_=_+Math.imul(vt,Sr)|0,_=_+Math.imul(Rt,pr)|0,it=it+Math.imul(Rt,Sr)|0;var Vr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,tt=Math.imul(It,Wt),_=Math.imul(It,rr),_=_+Math.imul(Et,Wt)|0,it=Math.imul(Et,rr),tt=tt+Math.imul(Yt,tr)|0,_=_+Math.imul(Yt,ir)|0,_=_+Math.imul(Zt,tr)|0,it=it+Math.imul(Zt,ir)|0,tt=tt+Math.imul(Ft,ar)|0,_=_+Math.imul(Ft,gr)|0,_=_+Math.imul(jt,ar)|0,it=it+Math.imul(jt,gr)|0,tt=tt+Math.imul(nr,ur)|0,_=_+Math.imul(nr,vr)|0,_=_+Math.imul(or,ur)|0,it=it+Math.imul(or,vr)|0,tt=tt+Math.imul(er,lr)|0,_=_+Math.imul(er,_r)|0,_=_+Math.imul(Vt,lr)|0,it=it+Math.imul(Vt,_r)|0,tt=tt+Math.imul(Xt,fr)|0,_=_+Math.imul(Xt,br)|0,_=_+Math.imul(Jt,fr)|0,it=it+Math.imul(Jt,br)|0,tt=tt+Math.imul(Nt,cr)|0,_=_+Math.imul(Nt,wr)|0,_=_+Math.imul(Kt,cr)|0,it=it+Math.imul(Kt,wr)|0,tt=tt+Math.imul(Ct,dr)|0,_=_+Math.imul(Ct,Er)|0,_=_+Math.imul(Ut,dr)|0,it=it+Math.imul(Ut,Er)|0,tt=tt+Math.imul(Mt,pr)|0,_=_+Math.imul(Mt,Sr)|0,_=_+Math.imul(At,pr)|0,it=it+Math.imul(At,Sr)|0;var Gr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,tt=Math.imul(It,tr),_=Math.imul(It,ir),_=_+Math.imul(Et,tr)|0,it=Math.imul(Et,ir),tt=tt+Math.imul(Yt,ar)|0,_=_+Math.imul(Yt,gr)|0,_=_+Math.imul(Zt,ar)|0,it=it+Math.imul(Zt,gr)|0,tt=tt+Math.imul(Ft,ur)|0,_=_+Math.imul(Ft,vr)|0,_=_+Math.imul(jt,ur)|0,it=it+Math.imul(jt,vr)|0,tt=tt+Math.imul(nr,lr)|0,_=_+Math.imul(nr,_r)|0,_=_+Math.imul(or,lr)|0,it=it+Math.imul(or,_r)|0,tt=tt+Math.imul(er,fr)|0,_=_+Math.imul(er,br)|0,_=_+Math.imul(Vt,fr)|0,it=it+Math.imul(Vt,br)|0,tt=tt+Math.imul(Xt,cr)|0,_=_+Math.imul(Xt,wr)|0,_=_+Math.imul(Jt,cr)|0,it=it+Math.imul(Jt,wr)|0,tt=tt+Math.imul(Nt,dr)|0,_=_+Math.imul(Nt,Er)|0,_=_+Math.imul(Kt,dr)|0,it=it+Math.imul(Kt,Er)|0,tt=tt+Math.imul(Ct,pr)|0,_=_+Math.imul(Ct,Sr)|0,_=_+Math.imul(Ut,pr)|0,it=it+Math.imul(Ut,Sr)|0;var Yr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,tt=Math.imul(It,ar),_=Math.imul(It,gr),_=_+Math.imul(Et,ar)|0,it=Math.imul(Et,gr),tt=tt+Math.imul(Yt,ur)|0,_=_+Math.imul(Yt,vr)|0,_=_+Math.imul(Zt,ur)|0,it=it+Math.imul(Zt,vr)|0,tt=tt+Math.imul(Ft,lr)|0,_=_+Math.imul(Ft,_r)|0,_=_+Math.imul(jt,lr)|0,it=it+Math.imul(jt,_r)|0,tt=tt+Math.imul(nr,fr)|0,_=_+Math.imul(nr,br)|0,_=_+Math.imul(or,fr)|0,it=it+Math.imul(or,br)|0,tt=tt+Math.imul(er,cr)|0,_=_+Math.imul(er,wr)|0,_=_+Math.imul(Vt,cr)|0,it=it+Math.imul(Vt,wr)|0,tt=tt+Math.imul(Xt,dr)|0,_=_+Math.imul(Xt,Er)|0,_=_+Math.imul(Jt,dr)|0,it=it+Math.imul(Jt,Er)|0,tt=tt+Math.imul(Nt,pr)|0,_=_+Math.imul(Nt,Sr)|0,_=_+Math.imul(Kt,pr)|0,it=it+Math.imul(Kt,Sr)|0;var Zr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,tt=Math.imul(It,ur),_=Math.imul(It,vr),_=_+Math.imul(Et,ur)|0,it=Math.imul(Et,vr),tt=tt+Math.imul(Yt,lr)|0,_=_+Math.imul(Yt,_r)|0,_=_+Math.imul(Zt,lr)|0,it=it+Math.imul(Zt,_r)|0,tt=tt+Math.imul(Ft,fr)|0,_=_+Math.imul(Ft,br)|0,_=_+Math.imul(jt,fr)|0,it=it+Math.imul(jt,br)|0,tt=tt+Math.imul(nr,cr)|0,_=_+Math.imul(nr,wr)|0,_=_+Math.imul(or,cr)|0,it=it+Math.imul(or,wr)|0,tt=tt+Math.imul(er,dr)|0,_=_+Math.imul(er,Er)|0,_=_+Math.imul(Vt,dr)|0,it=it+Math.imul(Vt,Er)|0,tt=tt+Math.imul(Xt,pr)|0,_=_+Math.imul(Xt,Sr)|0,_=_+Math.imul(Jt,pr)|0,it=it+Math.imul(Jt,Sr)|0;var Xr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,tt=Math.imul(It,lr),_=Math.imul(It,_r),_=_+Math.imul(Et,lr)|0,it=Math.imul(Et,_r),tt=tt+Math.imul(Yt,fr)|0,_=_+Math.imul(Yt,br)|0,_=_+Math.imul(Zt,fr)|0,it=it+Math.imul(Zt,br)|0,tt=tt+Math.imul(Ft,cr)|0,_=_+Math.imul(Ft,wr)|0,_=_+Math.imul(jt,cr)|0,it=it+Math.imul(jt,wr)|0,tt=tt+Math.imul(nr,dr)|0,_=_+Math.imul(nr,Er)|0,_=_+Math.imul(or,dr)|0,it=it+Math.imul(or,Er)|0,tt=tt+Math.imul(er,pr)|0,_=_+Math.imul(er,Sr)|0,_=_+Math.imul(Vt,pr)|0,it=it+Math.imul(Vt,Sr)|0;var Jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,tt=Math.imul(It,fr),_=Math.imul(It,br),_=_+Math.imul(Et,fr)|0,it=Math.imul(Et,br),tt=tt+Math.imul(Yt,cr)|0,_=_+Math.imul(Yt,wr)|0,_=_+Math.imul(Zt,cr)|0,it=it+Math.imul(Zt,wr)|0,tt=tt+Math.imul(Ft,dr)|0,_=_+Math.imul(Ft,Er)|0,_=_+Math.imul(jt,dr)|0,it=it+Math.imul(jt,Er)|0,tt=tt+Math.imul(nr,pr)|0,_=_+Math.imul(nr,Sr)|0,_=_+Math.imul(or,pr)|0,it=it+Math.imul(or,Sr)|0;var Qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,tt=Math.imul(It,cr),_=Math.imul(It,wr),_=_+Math.imul(Et,cr)|0,it=Math.imul(Et,wr),tt=tt+Math.imul(Yt,dr)|0,_=_+Math.imul(Yt,Er)|0,_=_+Math.imul(Zt,dr)|0,it=it+Math.imul(Zt,Er)|0,tt=tt+Math.imul(Ft,pr)|0,_=_+Math.imul(Ft,Sr)|0,_=_+Math.imul(jt,pr)|0,it=it+Math.imul(jt,Sr)|0;var en=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(en>>>26)|0,en&=67108863,tt=Math.imul(It,dr),_=Math.imul(It,Er),_=_+Math.imul(Et,dr)|0,it=Math.imul(Et,Er),tt=tt+Math.imul(Yt,pr)|0,_=_+Math.imul(Yt,Sr)|0,_=_+Math.imul(Zt,pr)|0,it=it+Math.imul(Zt,Sr)|0;var tn=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(tn>>>26)|0,tn&=67108863,tt=Math.imul(It,pr),_=Math.imul(It,Sr),_=_+Math.imul(Et,pr)|0,it=Math.imul(Et,Sr);var rn=(lt+tt|0)+((_&8191)<<13)|0;return lt=(it+(_>>>13)|0)+(rn>>>26)|0,rn&=67108863,at[0]=Or,at[1]=Nr,at[2]=Ur,at[3]=Hr,at[4]=Fr,at[5]=qr,at[6]=Kr,at[7]=jr,at[8]=Wr,at[9]=Vr,at[10]=Gr,at[11]=Yr,at[12]=Zr,at[13]=Xr,at[14]=Jr,at[15]=Qr,at[16]=en,at[17]=tn,at[18]=rn,lt!==0&&(at[19]=lt,$.length++),$};Math.imul||(wt=gt);function St(ct,g,b){b.negative=g.negative^ct.negative,b.length=ct.length+g.length;for(var $=0,_e=0,rt=0;rt>>26)|0,_e+=at>>>26,at&=67108863}b.words[rt]=lt,$=at,at=_e}return $!==0?b.words[rt]=$:b.length--,b.strip()}function _t(ct,g,b){var $=new mt;return $.mulp(ct,g,b)}h.prototype.mulTo=function(g,b){var $,_e=this.length+g.length;return this.length===10&&g.length===10?$=wt(this,g,b):_e<63?$=gt(this,g,b):_e<1024?$=St(this,g,b):$=_t(this,g,b),$};function mt(ct,g){this.x=ct,this.y=g}mt.prototype.makeRBT=function(g){for(var b=new Array(g),$=h.prototype._countBits(g)-1,_e=0;_e>=1;return _e},mt.prototype.permute=function(g,b,$,_e,rt,at){for(var lt=0;lt>>1)rt++;return 1<>>13,$[2*at+1]=rt&8191,rt=rt>>>13;for(at=2*b;at<_e;++at)$[at]=0;c(rt===0),c((rt&-8192)===0)},mt.prototype.stub=function(g){for(var b=new Array(g),$=0;$>=26,b+=_e/67108864|0,b+=rt>>>26,this.words[$]=rt&67108863}return b!==0&&(this.words[$]=b,this.length++),this},h.prototype.muln=function(g){return this.clone().imuln(g)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(g){var b=dt(g);if(b.length===0)return new h(1);for(var $=this,_e=0;_e=0);var b=g%26,$=(g-b)/26,_e=67108863>>>26-b<<26-b,rt;if(b!==0){var at=0;for(rt=0;rt>>26-b}at&&(this.words[rt]=at,this.length++)}if($!==0){for(rt=this.length-1;rt>=0;rt--)this.words[rt+$]=this.words[rt];for(rt=0;rt<$;rt++)this.words[rt]=0;this.length+=$}return this.strip()},h.prototype.ishln=function(g){return c(this.negative===0),this.iushln(g)},h.prototype.iushrn=function(g,b,$){c(typeof g=="number"&&g>=0);var _e;b?_e=(b-b%26)/26:_e=0;var rt=g%26,at=Math.min((g-rt)/26,this.length),lt=67108863^67108863>>>rt<at)for(this.length-=at,_=0;_=0&&(it!==0||_>=_e);_--){var yt=this.words[_]|0;this.words[_]=it<<26-rt|yt>>>rt,it=yt<}return tt&&it!==0&&(tt.words[tt.length++]=it),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(g,b,$){return c(this.negative===0),this.iushrn(g,b,$)},h.prototype.shln=function(g){return this.clone().ishln(g)},h.prototype.ushln=function(g){return this.clone().iushln(g)},h.prototype.shrn=function(g){return this.clone().ishrn(g)},h.prototype.ushrn=function(g){return this.clone().iushrn(g)},h.prototype.testn=function(g){c(typeof g=="number"&&g>=0);var b=g%26,$=(g-b)/26,_e=1<=0);var b=g%26,$=(g-b)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=$)return this;if(b!==0&&$++,this.length=Math.min($,this.length),b!==0){var _e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},h.prototype.isubn=function(g){if(c(typeof g=="number"),c(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(tt/67108864|0),this.words[rt+$]=at&67108863}for(;rt>26,this.words[rt+$]=at&67108863;if(lt===0)return this.strip();for(c(lt===-1),lt=0,rt=0;rt>26,this.words[rt]=at&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(g,b){var $=this.length-g.length,_e=this.clone(),rt=g,at=rt.words[rt.length-1]|0,lt=this._countBits(at);$=26-lt,$!==0&&(rt=rt.ushln($),_e.iushln($),at=rt.words[rt.length-1]|0);var tt=_e.length-rt.length,_;if(b!=="mod"){_=new h(null),_.length=tt+1,_.words=new Array(_.length);for(var it=0;it<_.length;it++)_.words[it]=0}var yt=_e.clone()._ishlnsubmul(rt,1,tt);yt.negative===0&&(_e=yt,_&&(_.words[tt]=1));for(var vt=tt-1;vt>=0;vt--){var Rt=(_e.words[rt.length+vt]|0)*67108864+(_e.words[rt.length+vt-1]|0);for(Rt=Math.min(Rt/at|0,67108863),_e._ishlnsubmul(rt,Rt,vt);_e.negative!==0;)Rt--,_e.negative=0,_e._ishlnsubmul(rt,1,vt),_e.isZero()||(_e.negative^=1);_&&(_.words[vt]=Rt)}return _&&_.strip(),_e.strip(),b!=="div"&&$!==0&&_e.iushrn($),{div:_||null,mod:_e}},h.prototype.divmod=function(g,b,$){if(c(!g.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var _e,rt,at;return this.negative!==0&&g.negative===0?(at=this.neg().divmod(g,b),b!=="mod"&&(_e=at.div.neg()),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.iadd(g)),{div:_e,mod:rt}):this.negative===0&&g.negative!==0?(at=this.divmod(g.neg(),b),b!=="mod"&&(_e=at.div.neg()),{div:_e,mod:at.mod}):this.negative&g.negative?(at=this.neg().divmod(g.neg(),b),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.isub(g)),{div:at.div,mod:rt}):g.length>this.length||this.cmp(g)<0?{div:new h(0),mod:this}:g.length===1?b==="div"?{div:this.divn(g.words[0]),mod:null}:b==="mod"?{div:null,mod:new h(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new h(this.modn(g.words[0]))}:this._wordDiv(g,b)},h.prototype.div=function(g){return this.divmod(g,"div",!1).div},h.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},h.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},h.prototype.divRound=function(g){var b=this.divmod(g);if(b.mod.isZero())return b.div;var $=b.div.negative!==0?b.mod.isub(g):b.mod,_e=g.ushrn(1),rt=g.andln(1),at=$.cmp(_e);return at<0||rt===1&&at===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},h.prototype.modn=function(g){c(g<=67108863);for(var b=(1<<26)%g,$=0,_e=this.length-1;_e>=0;_e--)$=(b*$+(this.words[_e]|0))%g;return $},h.prototype.idivn=function(g){c(g<=67108863);for(var b=0,$=this.length-1;$>=0;$--){var _e=(this.words[$]|0)+b*67108864;this.words[$]=_e/g|0,b=_e%g}return this.strip()},h.prototype.divn=function(g){return this.clone().idivn(g)},h.prototype.egcd=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=new h(0),lt=new h(1),tt=0;b.isEven()&&$.isEven();)b.iushrn(1),$.iushrn(1),++tt;for(var _=$.clone(),it=b.clone();!b.isZero();){for(var yt=0,vt=1;!(b.words[0]&vt)&&yt<26;++yt,vt<<=1);if(yt>0)for(b.iushrn(yt);yt-- >0;)(_e.isOdd()||rt.isOdd())&&(_e.iadd(_),rt.isub(it)),_e.iushrn(1),rt.iushrn(1);for(var Rt=0,Tt=1;!($.words[0]&Tt)&&Rt<26;++Rt,Tt<<=1);if(Rt>0)for($.iushrn(Rt);Rt-- >0;)(at.isOdd()||lt.isOdd())&&(at.iadd(_),lt.isub(it)),at.iushrn(1),lt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(at),rt.isub(lt)):($.isub(b),at.isub(_e),lt.isub(rt))}return{a:at,b:lt,gcd:$.iushln(tt)}},h.prototype._invmp=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=$.clone();b.cmpn(1)>0&&$.cmpn(1)>0;){for(var lt=0,tt=1;!(b.words[0]&tt)&<<26;++lt,tt<<=1);if(lt>0)for(b.iushrn(lt);lt-- >0;)_e.isOdd()&&_e.iadd(at),_e.iushrn(1);for(var _=0,it=1;!($.words[0]&it)&&_<26;++_,it<<=1);if(_>0)for($.iushrn(_);_-- >0;)rt.isOdd()&&rt.iadd(at),rt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(rt)):($.isub(b),rt.isub(_e))}var yt;return b.cmpn(1)===0?yt=_e:yt=rt,yt.cmpn(0)<0&&yt.iadd(g),yt},h.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var b=this.clone(),$=g.clone();b.negative=0,$.negative=0;for(var _e=0;b.isEven()&&$.isEven();_e++)b.iushrn(1),$.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;$.isEven();)$.iushrn(1);var rt=b.cmp($);if(rt<0){var at=b;b=$,$=at}else if(rt===0||$.cmpn(1)===0)break;b.isub($)}while(!0);return $.iushln(_e)},h.prototype.invm=function(g){return this.egcd(g).a.umod(g)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(g){return this.words[0]&g},h.prototype.bincn=function(g){c(typeof g=="number");var b=g%26,$=(g-b)/26,_e=1<>>26,lt&=67108863,this.words[at]=lt}return rt!==0&&(this.words[at]=rt,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(g){var b=g<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this.strip();var $;if(this.length>1)$=1;else{b&&(g=-g),c(g<=67108863,"Number is too big");var _e=this.words[0]|0;$=_e===g?0:_eg.length)return 1;if(this.length=0;$--){var _e=this.words[$]|0,rt=g.words[$]|0;if(_e!==rt){_ert&&(b=1);break}}return b},h.prototype.gtn=function(g){return this.cmpn(g)===1},h.prototype.gt=function(g){return this.cmp(g)===1},h.prototype.gten=function(g){return this.cmpn(g)>=0},h.prototype.gte=function(g){return this.cmp(g)>=0},h.prototype.ltn=function(g){return this.cmpn(g)===-1},h.prototype.lt=function(g){return this.cmp(g)===-1},h.prototype.lten=function(g){return this.cmpn(g)<=0},h.prototype.lte=function(g){return this.cmp(g)<=0},h.prototype.eqn=function(g){return this.cmpn(g)===0},h.prototype.eq=function(g){return this.cmp(g)===0},h.red=function(g){return new Pt(g)},h.prototype.toRed=function(g){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},h.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(g){return this.red=g,this},h.prototype.forceRed=function(g){return c(!this.red,"Already a number in reduction context"),this._forceRed(g)},h.prototype.redAdd=function(g){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},h.prototype.redIAdd=function(g){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},h.prototype.redSub=function(g){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},h.prototype.redISub=function(g){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},h.prototype.redShl=function(g){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},h.prototype.redMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},h.prototype.redIMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},h.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(g){return c(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var bt={k256:null,p224:null,p192:null,p25519:null};function $t(ct,g){this.name=ct,this.p=new h(g,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$t.prototype._tmp=function(){var g=new h(null);return g.words=new Array(Math.ceil(this.n/13)),g},$t.prototype.ireduce=function(g){var b=g,$;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),$=b.bitLength();while($>this.n);var _e=$0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},$t.prototype.split=function(g,b){g.iushrn(this.n,0,b)},$t.prototype.imulK=function(g){return g.imul(this.k)};function Bt(){$t.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Bt,$t),Bt.prototype.split=function(g,b){for(var $=4194303,_e=Math.min(g.length,9),rt=0;rt<_e;rt++)b.words[rt]=g.words[rt];if(b.length=_e,g.length<=9){g.words[0]=0,g.length=1;return}var at=g.words[9];for(b.words[b.length++]=at&$,rt=10;rt>>22,at=lt}at>>>=22,g.words[rt-10]=at,at===0&&g.length>10?g.length-=10:g.length-=9},Bt.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var b=0,$=0;$>>=26,g.words[$]=rt,b=_e}return b!==0&&(g.words[g.length++]=b),g},h._prime=function(g){if(bt[g])return bt[g];var b;if(g==="k256")b=new Bt;else if(g==="p224")b=new Dt;else if(g==="p192")b=new Ht;else if(g==="p25519")b=new qt;else throw new Error("Unknown prime "+g);return bt[g]=b,b};function Pt(ct){if(typeof ct=="string"){var g=h._prime(ct);this.m=g.p,this.prime=g}else c(ct.gtn(1),"modulus must be greater than 1"),this.m=ct,this.prime=null}Pt.prototype._verify1=function(g){c(g.negative===0,"red works only with positives"),c(g.red,"red works only with red numbers")},Pt.prototype._verify2=function(g,b){c((g.negative|b.negative)===0,"red works only with positives"),c(g.red&&g.red===b.red,"red works only with red numbers")},Pt.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},Pt.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},Pt.prototype.add=function(g,b){this._verify2(g,b);var $=g.add(b);return $.cmp(this.m)>=0&&$.isub(this.m),$._forceRed(this)},Pt.prototype.iadd=function(g,b){this._verify2(g,b);var $=g.iadd(b);return $.cmp(this.m)>=0&&$.isub(this.m),$},Pt.prototype.sub=function(g,b){this._verify2(g,b);var $=g.sub(b);return $.cmpn(0)<0&&$.iadd(this.m),$._forceRed(this)},Pt.prototype.isub=function(g,b){this._verify2(g,b);var $=g.isub(b);return $.cmpn(0)<0&&$.iadd(this.m),$},Pt.prototype.shl=function(g,b){return this._verify1(g),this.imod(g.ushln(b))},Pt.prototype.imul=function(g,b){return this._verify2(g,b),this.imod(g.imul(b))},Pt.prototype.mul=function(g,b){return this._verify2(g,b),this.imod(g.mul(b))},Pt.prototype.isqr=function(g){return this.imul(g,g.clone())},Pt.prototype.sqr=function(g){return this.mul(g,g)},Pt.prototype.sqrt=function(g){if(g.isZero())return g.clone();var b=this.m.andln(3);if(c(b%2===1),b===3){var $=this.m.add(new h(1)).iushrn(2);return this.pow(g,$)}for(var _e=this.m.subn(1),rt=0;!_e.isZero()&&_e.andln(1)===0;)rt++,_e.iushrn(1);c(!_e.isZero());var at=new h(1).toRed(this),lt=at.redNeg(),tt=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new h(2*_*_).toRed(this);this.pow(_,tt).cmp(lt)!==0;)_.redIAdd(lt);for(var it=this.pow(_,_e),yt=this.pow(g,_e.addn(1).iushrn(1)),vt=this.pow(g,_e),Rt=rt;vt.cmp(at)!==0;){for(var Tt=vt,Mt=0;Tt.cmp(at)!==0;Mt++)Tt=Tt.redSqr();c(Mt=0;rt--){for(var it=b.words[rt],yt=_-1;yt>=0;yt--){var vt=it>>yt&1;if(at!==_e[0]&&(at=this.sqr(at)),vt===0&<===0){tt=0;continue}lt<<=1,lt|=vt,tt++,!(tt!==$&&(rt!==0||yt!==0))&&(at=this.mul(at,_e[lt]),tt=0,lt=0)}_=26}return at},Pt.prototype.convertTo=function(g){var b=g.umod(this.m);return b===g?b.clone():b},Pt.prototype.convertFrom=function(g){var b=g.clone();return b.red=null,b},h.mont=function(g){return new Gt(g)};function Gt(ct){Pt.call(this,ct),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}d(Gt,Pt),Gt.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},Gt.prototype.convertFrom=function(g){var b=this.imod(g.mul(this.rinv));return b.red=null,b},Gt.prototype.imul=function(g,b){if(g.isZero()||b.isZero())return g.words[0]=0,g.length=1,g;var $=g.imul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.mul=function(g,b){if(g.isZero()||b.isZero())return new h(0)._forceRed(this);var $=g.mul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.invm=function(g){var b=this.imod(g._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(o,commonjsGlobal$2)})(bn$3);var bnExports$3=bn$3.exports,utils$k={};(function(o){var e=o;function a(h,j){if(Array.isArray(h))return h.slice();if(!h)return[];var et=[];if(typeof h!="string"){for(var nt=0;nt>8,ht=st&255;ot?et.push(ot,ht):et.push(ht)}return et}e.toArray=a;function c(h){return h.length===1?"0"+h:h}e.zero2=c;function d(h){for(var j="",et=0;et(wt>>1)-1?_t=(wt>>1)-mt:_t=mt,St.isubn(_t)):_t=0,dt[gt]=_t,St.iushrn(1)}return dt}e.getNAF=h;function j(ot,ht){var pt=[[],[]];ot=ot.clone(),ht=ht.clone();for(var dt=0,gt=0,wt;ot.cmpn(-dt)>0||ht.cmpn(-gt)>0;){var St=ot.andln(3)+dt&3,_t=ht.andln(3)+gt&3;St===3&&(St=-1),_t===3&&(_t=-1);var mt;St&1?(wt=ot.andln(7)+dt&7,(wt===3||wt===5)&&_t===2?mt=-St:mt=St):mt=0,pt[0].push(mt);var bt;_t&1?(wt=ht.andln(7)+gt&7,(wt===3||wt===5)&&St===2?bt=-_t:bt=_t):bt=0,pt[1].push(bt),2*dt===mt+1&&(dt=1-dt),2*gt===bt+1&&(gt=1-gt),ot.iushrn(1),ht.iushrn(1)}return pt}e.getJSF=j;function et(ot,ht,pt){var dt="_"+ht;ot.prototype[ht]=function(){return this[dt]!==void 0?this[dt]:this[dt]=pt.call(this)}}e.cachedProperty=et;function nt(ot){return typeof ot=="string"?e.toArray(ot,"hex"):ot}e.parseBytes=nt;function st(ot){return new a(ot,"hex","le")}e.intFromLE=st})(utils$l);var curve={},BN$9=bnExports$3,utils$j=utils$l,getNAF=utils$j.getNAF,getJSF=utils$j.getJSF,assert$d=utils$j.assert;function BaseCurve(o,e){this.type=o,this.p=new BN$9(e.p,16),this.red=e.prime?BN$9.red(e.prime):BN$9.mont(this.p),this.zero=new BN$9(0).toRed(this.red),this.one=new BN$9(1).toRed(this.red),this.two=new BN$9(2).toRed(this.red),this.n=e.n&&new BN$9(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 a=this.n&&this.p.div(this.n);!a||a.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve;BaseCurve.prototype.point=function o(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function o(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function o(e,a){assert$d(e.precomputed);var c=e._getDoubles(),d=getNAF(a,1,this._bitLength),h=(1<=et;st--)nt=(nt<<1)+d[st];j.push(nt)}for(var ot=this.jpoint(null,null,null),ht=this.jpoint(null,null,null),pt=h;pt>0;pt--){for(et=0;et=0;nt--){for(var st=0;nt>=0&&j[nt]===0;nt--)st++;if(nt>=0&&st++,et=et.dblp(st),nt<0)break;var ot=j[nt];assert$d(ot!==0),e.type==="affine"?ot>0?et=et.mixedAdd(h[ot-1>>1]):et=et.mixedAdd(h[-ot-1>>1].neg()):ot>0?et=et.add(h[ot-1>>1]):et=et.add(h[-ot-1>>1].neg())}return e.type==="affine"?et.toP():et};BaseCurve.prototype._wnafMulAdd=function o(e,a,c,d,h){var j=this._wnafT1,et=this._wnafT2,nt=this._wnafT3,st=0,ot,ht,pt;for(ot=0;ot=1;ot-=2){var gt=ot-1,wt=ot;if(j[gt]!==1||j[wt]!==1){nt[gt]=getNAF(c[gt],j[gt],this._bitLength),nt[wt]=getNAF(c[wt],j[wt],this._bitLength),st=Math.max(nt[gt].length,st),st=Math.max(nt[wt].length,st);continue}var St=[a[gt],null,null,a[wt]];a[gt].y.cmp(a[wt].y)===0?(St[1]=a[gt].add(a[wt]),St[2]=a[gt].toJ().mixedAdd(a[wt].neg())):a[gt].y.cmp(a[wt].y.redNeg())===0?(St[1]=a[gt].toJ().mixedAdd(a[wt]),St[2]=a[gt].add(a[wt].neg())):(St[1]=a[gt].toJ().mixedAdd(a[wt]),St[2]=a[gt].toJ().mixedAdd(a[wt].neg()));var _t=[-3,-1,-5,-7,0,7,5,1,3],mt=getJSF(c[gt],c[wt]);for(st=Math.max(mt[0].length,st),nt[gt]=new Array(st),nt[wt]=new Array(st),ht=0;ht=0;ot--){for(var Ht=0;ot>=0;){var qt=!0;for(ht=0;ht=0&&Ht++,Bt=Bt.dblp(Ht),ot<0)break;for(ht=0;ht0?pt=et[ht][Pt-1>>1]:Pt<0&&(pt=et[ht][-Pt-1>>1].neg()),pt.type==="affine"?Bt=Bt.mixedAdd(pt):Bt=Bt.add(pt))}}for(ot=0;ot=Math.ceil((e.bitLength()+1)/a.step):!1};BasePoint.prototype._getDoubles=function o(e,a){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],d=this,h=0;h=0&&(dt=st,gt=ot),ht.negative&&(ht=ht.neg(),pt=pt.neg()),dt.negative&&(dt=dt.neg(),gt=gt.neg()),[{a:ht,b:pt},{a:dt,b:gt}]};ShortCurve.prototype._endoSplit=function o(e){var a=this.endo.basis,c=a[0],d=a[1],h=d.b.mul(e).divRound(this.n),j=c.b.neg().mul(e).divRound(this.n),et=h.mul(c.a),nt=j.mul(d.a),st=h.mul(c.b),ot=j.mul(d.b),ht=e.sub(et).sub(nt),pt=st.add(ot).neg();return{k1:ht,k2:pt}};ShortCurve.prototype.pointFromX=function o(e,a){e=new BN$8(e,16),e.red||(e=e.toRed(this.red));var c=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),d=c.redSqrt();if(d.redSqr().redSub(c).cmp(this.zero)!==0)throw new Error("invalid point");var h=d.fromRed().isOdd();return(a&&!h||!a&&h)&&(d=d.redNeg()),this.point(e,d)};ShortCurve.prototype.validate=function o(e){if(e.inf)return!0;var a=e.x,c=e.y,d=this.a.redMul(a),h=a.redSqr().redMul(a).redIAdd(d).redIAdd(this.b);return c.redSqr().redISub(h).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function o(e,a,c){for(var d=this._endoWnafT1,h=this._endoWnafT2,j=0;j":""};Point$2.prototype.isInfinity=function o(){return this.inf};Point$2.prototype.add=function o(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 a=this.y.redSub(e.y);a.cmpn(0)!==0&&(a=a.redMul(this.x.redSub(e.x).redInvm()));var c=a.redSqr().redISub(this.x).redISub(e.x),d=a.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,d)};Point$2.prototype.dbl=function o(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var a=this.curve.a,c=this.x.redSqr(),d=e.redInvm(),h=c.redAdd(c).redIAdd(c).redIAdd(a).redMul(d),j=h.redSqr().redISub(this.x.redAdd(this.x)),et=h.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,et)};Point$2.prototype.getX=function o(){return this.x.fromRed()};Point$2.prototype.getY=function o(){return this.y.fromRed()};Point$2.prototype.mul=function o(e){return e=new BN$8(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)};Point$2.prototype.mulAdd=function o(e,a,c){var d=[this,a],h=[e,c];return this.curve.endo?this.curve._endoWnafMulAdd(d,h):this.curve._wnafMulAdd(1,d,h,2)};Point$2.prototype.jmulAdd=function o(e,a,c){var d=[this,a],h=[e,c];return this.curve.endo?this.curve._endoWnafMulAdd(d,h,!0):this.curve._wnafMulAdd(1,d,h,2,!0)};Point$2.prototype.eq=function o(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Point$2.prototype.neg=function o(e){if(this.inf)return this;var a=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var c=this.precomputed,d=function(h){return h.neg()};a.precomputed={naf:c.naf&&{wnd:c.naf.wnd,points:c.naf.points.map(d)},doubles:c.doubles&&{step:c.doubles.step,points:c.doubles.points.map(d)}}}return a};Point$2.prototype.toJ=function o(){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 JPoint(o,e,a,c){Base$2.BasePoint.call(this,o,"jacobian"),e===null&&a===null&&c===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$8(0)):(this.x=new BN$8(e,16),this.y=new BN$8(a,16),this.z=new BN$8(c,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}inherits$4(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function o(e,a,c){return new JPoint(this,e,a,c)};JPoint.prototype.toP=function o(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),a=e.redSqr(),c=this.x.redMul(a),d=this.y.redMul(a).redMul(e);return this.curve.point(c,d)};JPoint.prototype.neg=function o(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function o(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var a=e.z.redSqr(),c=this.z.redSqr(),d=this.x.redMul(a),h=e.x.redMul(c),j=this.y.redMul(a.redMul(e.z)),et=e.y.redMul(c.redMul(this.z)),nt=d.redSub(h),st=j.redSub(et);if(nt.cmpn(0)===0)return st.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ot=nt.redSqr(),ht=ot.redMul(nt),pt=d.redMul(ot),dt=st.redSqr().redIAdd(ht).redISub(pt).redISub(pt),gt=st.redMul(pt.redISub(dt)).redISub(j.redMul(ht)),wt=this.z.redMul(e.z).redMul(nt);return this.curve.jpoint(dt,gt,wt)};JPoint.prototype.mixedAdd=function o(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var a=this.z.redSqr(),c=this.x,d=e.x.redMul(a),h=this.y,j=e.y.redMul(a).redMul(this.z),et=c.redSub(d),nt=h.redSub(j);if(et.cmpn(0)===0)return nt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var st=et.redSqr(),ot=st.redMul(et),ht=c.redMul(st),pt=nt.redSqr().redIAdd(ot).redISub(ht).redISub(ht),dt=nt.redMul(ht.redISub(pt)).redISub(h.redMul(ot)),gt=this.z.redMul(et);return this.curve.jpoint(pt,dt,gt)};JPoint.prototype.dblp=function o(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var a;if(this.curve.zeroA||this.curve.threeA){var c=this;for(a=0;a=0)return!1;if(c.redIAdd(h),this.x.cmp(c)===0)return!0}};JPoint.prototype.inspect=function o(){return this.isInfinity()?"":""};JPoint.prototype.isInfinity=function o(){return this.z.cmpn(0)===0};var BN$7=bnExports$3,inherits$3=inherits_browserExports,Base$1=base$1,utils$h=utils$l;function MontCurve(o){Base$1.call(this,"mont",o),this.a=new BN$7(o.a,16).toRed(this.red),this.b=new BN$7(o.b,16).toRed(this.red),this.i4=new BN$7(4).toRed(this.red).redInvm(),this.two=new BN$7(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$3(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function o(e){var a=e.normalize().x,c=a.redSqr(),d=c.redMul(a).redAdd(c.redMul(this.a)).redAdd(a),h=d.redSqrt();return h.redSqr().cmp(d)===0};function Point$1(o,e,a){Base$1.BasePoint.call(this,o,"projective"),e===null&&a===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$7(e,16),this.z=new BN$7(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$3(Point$1,Base$1.BasePoint);MontCurve.prototype.decodePoint=function o(e,a){return this.point(utils$h.toArray(e,a),1)};MontCurve.prototype.point=function o(e,a){return new Point$1(this,e,a)};MontCurve.prototype.pointFromJSON=function o(e){return Point$1.fromJSON(this,e)};Point$1.prototype.precompute=function o(){};Point$1.prototype._encode=function o(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function o(e,a){return new Point$1(e,a[0],a[1]||e.one)};Point$1.prototype.inspect=function o(){return this.isInfinity()?"":""};Point$1.prototype.isInfinity=function o(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function o(){var e=this.x.redAdd(this.z),a=e.redSqr(),c=this.x.redSub(this.z),d=c.redSqr(),h=a.redSub(d),j=a.redMul(d),et=h.redMul(d.redAdd(this.curve.a24.redMul(h)));return this.curve.point(j,et)};Point$1.prototype.add=function o(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.diffAdd=function o(e,a){var c=this.x.redAdd(this.z),d=this.x.redSub(this.z),h=e.x.redAdd(e.z),j=e.x.redSub(e.z),et=j.redMul(c),nt=h.redMul(d),st=a.z.redMul(et.redAdd(nt).redSqr()),ot=a.x.redMul(et.redISub(nt).redSqr());return this.curve.point(st,ot)};Point$1.prototype.mul=function o(e){for(var a=e.clone(),c=this,d=this.curve.point(null,null),h=this,j=[];a.cmpn(0)!==0;a.iushrn(1))j.push(a.andln(1));for(var et=j.length-1;et>=0;et--)j[et]===0?(c=c.diffAdd(d,h),d=d.dbl()):(d=c.diffAdd(d,h),c=c.dbl());return d};Point$1.prototype.mulAdd=function o(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function o(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function o(e){return this.getX().cmp(e.getX())===0};Point$1.prototype.normalize=function o(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function o(){return this.normalize(),this.x.fromRed()};var utils$g=utils$l,BN$6=bnExports$3,inherits$2=inherits_browserExports,Base=base$1,assert$b=utils$g.assert;function EdwardsCurve(o){this.twisted=(o.a|0)!==1,this.mOneA=this.twisted&&(o.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",o),this.a=new BN$6(o.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$6(o.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$6(o.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$b(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(o.c|0)===1}inherits$2(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function o(e){return this.mOneA?e.redNeg():this.a.redMul(e)};EdwardsCurve.prototype._mulC=function o(e){return this.oneC?e:this.c.redMul(e)};EdwardsCurve.prototype.jpoint=function o(e,a,c,d){return this.point(e,a,c,d)};EdwardsCurve.prototype.pointFromX=function o(e,a){e=new BN$6(e,16),e.red||(e=e.toRed(this.red));var c=e.redSqr(),d=this.c2.redSub(this.a.redMul(c)),h=this.one.redSub(this.c2.redMul(this.d).redMul(c)),j=d.redMul(h.redInvm()),et=j.redSqrt();if(et.redSqr().redSub(j).cmp(this.zero)!==0)throw new Error("invalid point");var nt=et.fromRed().isOdd();return(a&&!nt||!a&&nt)&&(et=et.redNeg()),this.point(e,et)};EdwardsCurve.prototype.pointFromY=function o(e,a){e=new BN$6(e,16),e.red||(e=e.toRed(this.red));var c=e.redSqr(),d=c.redSub(this.c2),h=c.redMul(this.d).redMul(this.c2).redSub(this.a),j=d.redMul(h.redInvm());if(j.cmp(this.zero)===0){if(a)throw new Error("invalid point");return this.point(this.zero,e)}var et=j.redSqrt();if(et.redSqr().redSub(j).cmp(this.zero)!==0)throw new Error("invalid point");return et.fromRed().isOdd()!==a&&(et=et.redNeg()),this.point(et,e)};EdwardsCurve.prototype.validate=function o(e){if(e.isInfinity())return!0;e.normalize();var a=e.x.redSqr(),c=e.y.redSqr(),d=a.redMul(this.a).redAdd(c),h=this.c2.redMul(this.one.redAdd(this.d.redMul(a).redMul(c)));return d.cmp(h)===0};function Point(o,e,a,c,d){Base.BasePoint.call(this,o,"projective"),e===null&&a===null&&c===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 BN$6(e,16),this.y=new BN$6(a,16),this.z=c?new BN$6(c,16):this.curve.one,this.t=d&&new BN$6(d,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()))))}inherits$2(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function o(e){return Point.fromJSON(this,e)};EdwardsCurve.prototype.point=function o(e,a,c,d){return new Point(this,e,a,c,d)};Point.fromJSON=function o(e,a){return new Point(e,a[0],a[1],a[2])};Point.prototype.inspect=function o(){return this.isInfinity()?"":""};Point.prototype.isInfinity=function o(){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 o(){var e=this.x.redSqr(),a=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(e),h=this.x.redAdd(this.y).redSqr().redISub(e).redISub(a),j=d.redAdd(a),et=j.redSub(c),nt=d.redSub(a),st=h.redMul(et),ot=j.redMul(nt),ht=h.redMul(nt),pt=et.redMul(j);return this.curve.point(st,ot,pt,ht)};Point.prototype._projDbl=function o(){var e=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr(),d,h,j,et,nt,st;if(this.curve.twisted){et=this.curve._mulA(a);var ot=et.redAdd(c);this.zOne?(d=e.redSub(a).redSub(c).redMul(ot.redSub(this.curve.two)),h=ot.redMul(et.redSub(c)),j=ot.redSqr().redSub(ot).redSub(ot)):(nt=this.z.redSqr(),st=ot.redSub(nt).redISub(nt),d=e.redSub(a).redISub(c).redMul(st),h=ot.redMul(et.redSub(c)),j=ot.redMul(st))}else et=a.redAdd(c),nt=this.curve._mulC(this.z).redSqr(),st=et.redSub(nt).redSub(nt),d=this.curve._mulC(e.redISub(et)).redMul(st),h=this.curve._mulC(et).redMul(a.redISub(c)),j=et.redMul(st);return this.curve.point(d,h,j)};Point.prototype.dbl=function o(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function o(e){var a=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),c=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),d=this.t.redMul(this.curve.dd).redMul(e.t),h=this.z.redMul(e.z.redAdd(e.z)),j=c.redSub(a),et=h.redSub(d),nt=h.redAdd(d),st=c.redAdd(a),ot=j.redMul(et),ht=nt.redMul(st),pt=j.redMul(st),dt=et.redMul(nt);return this.curve.point(ot,ht,dt,pt)};Point.prototype._projAdd=function o(e){var a=this.z.redMul(e.z),c=a.redSqr(),d=this.x.redMul(e.x),h=this.y.redMul(e.y),j=this.curve.d.redMul(d).redMul(h),et=c.redSub(j),nt=c.redAdd(j),st=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(d).redISub(h),ot=a.redMul(et).redMul(st),ht,pt;return this.curve.twisted?(ht=a.redMul(nt).redMul(h.redSub(this.curve._mulA(d))),pt=et.redMul(nt)):(ht=a.redMul(nt).redMul(h.redSub(d)),pt=this.curve._mulC(et).redMul(nt)),this.curve.point(ot,ht,pt)};Point.prototype.add=function o(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Point.prototype.mul=function o(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Point.prototype.mulAdd=function o(e,a,c){return this.curve._wnafMulAdd(1,[this,a],[e,c],2,!1)};Point.prototype.jmulAdd=function o(e,a,c){return this.curve._wnafMulAdd(1,[this,a],[e,c],2,!0)};Point.prototype.normalize=function o(){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};Point.prototype.neg=function o(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function o(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function o(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function o(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Point.prototype.eqXToP=function o(e){var a=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(a)===0)return!0;for(var c=e.clone(),d=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(a.redIAdd(d),this.x.cmp(a)===0)return!0}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;(function(o){var e=o;e.base=base$1,e.short=short,e.mont=mont,e.edwards=edwards})(curve);var curves$1={},hash$2={},utils$f={},assert$a=minimalisticAssert,inherits$1=inherits_browserExports;utils$f.inherits=inherits$1;function isSurrogatePair(o,e){return(o.charCodeAt(e)&64512)!==55296||e<0||e+1>=o.length?!1:(o.charCodeAt(e+1)&64512)===56320}function toArray(o,e){if(Array.isArray(o))return o.slice();if(!o)return[];var a=[];if(typeof o=="string")if(e){if(e==="hex")for(o=o.replace(/[^a-z0-9]+/ig,""),o.length%2!==0&&(o="0"+o),d=0;d>6|192,a[c++]=h&63|128):isSurrogatePair(o,d)?(h=65536+((h&1023)<<10)+(o.charCodeAt(++d)&1023),a[c++]=h>>18|240,a[c++]=h>>12&63|128,a[c++]=h>>6&63|128,a[c++]=h&63|128):(a[c++]=h>>12|224,a[c++]=h>>6&63|128,a[c++]=h&63|128)}else for(d=0;d>>24|o>>>8&65280|o<<8&16711680|(o&255)<<24;return e>>>0}utils$f.htonl=htonl;function toHex32(o,e){for(var a="",c=0;c>>0}return h}utils$f.join32=join32;function split32(o,e){for(var a=new Array(o.length*4),c=0,d=0;c>>24,a[d+1]=h>>>16&255,a[d+2]=h>>>8&255,a[d+3]=h&255):(a[d+3]=h>>>24,a[d+2]=h>>>16&255,a[d+1]=h>>>8&255,a[d]=h&255)}return a}utils$f.split32=split32;function rotr32$1(o,e){return o>>>e|o<<32-e}utils$f.rotr32=rotr32$1;function rotl32$2(o,e){return o<>>32-e}utils$f.rotl32=rotl32$2;function sum32$3(o,e){return o+e>>>0}utils$f.sum32=sum32$3;function sum32_3$1(o,e,a){return o+e+a>>>0}utils$f.sum32_3=sum32_3$1;function sum32_4$2(o,e,a,c){return o+e+a+c>>>0}utils$f.sum32_4=sum32_4$2;function sum32_5$2(o,e,a,c,d){return o+e+a+c+d>>>0}utils$f.sum32_5=sum32_5$2;function sum64$1(o,e,a,c){var d=o[e],h=o[e+1],j=c+h>>>0,et=(j>>0,o[e+1]=j}utils$f.sum64=sum64$1;function sum64_hi$1(o,e,a,c){var d=e+c>>>0,h=(d>>0}utils$f.sum64_hi=sum64_hi$1;function sum64_lo$1(o,e,a,c){var d=e+c;return d>>>0}utils$f.sum64_lo=sum64_lo$1;function sum64_4_hi$1(o,e,a,c,d,h,j,et){var nt=0,st=e;st=st+c>>>0,nt+=st>>0,nt+=st>>0,nt+=st>>0}utils$f.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(o,e,a,c,d,h,j,et){var nt=e+c+h+et;return nt>>>0}utils$f.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(o,e,a,c,d,h,j,et,nt,st){var ot=0,ht=e;ht=ht+c>>>0,ot+=ht>>0,ot+=ht>>0,ot+=ht>>0,ot+=ht>>0}utils$f.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(o,e,a,c,d,h,j,et,nt,st){var ot=e+c+h+et+st;return ot>>>0}utils$f.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(o,e,a){var c=e<<32-a|o>>>a;return c>>>0}utils$f.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(o,e,a){var c=o<<32-a|e>>>a;return c>>>0}utils$f.rotr64_lo=rotr64_lo$1;function shr64_hi$1(o,e,a){return o>>>a}utils$f.shr64_hi=shr64_hi$1;function shr64_lo$1(o,e,a){var c=o<<32-a|e>>>a;return c>>>0}utils$f.shr64_lo=shr64_lo$1;var common$5={},utils$e=utils$f,assert$9=minimalisticAssert;function BlockHash$4(){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}common$5.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function o(e,a){if(e=utils$e.toArray(e,a),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var c=e.length%this._delta8;this.pending=e.slice(e.length-c,e.length),this.pending.length===0&&(this.pending=null),e=utils$e.join32(e,0,e.length-c,this.endian);for(var d=0;d>>24&255,d[h++]=e>>>16&255,d[h++]=e>>>8&255,d[h++]=e&255}else for(d[h++]=e&255,d[h++]=e>>>8&255,d[h++]=e>>>16&255,d[h++]=e>>>24&255,d[h++]=0,d[h++]=0,d[h++]=0,d[h++]=0,j=8;j>>3}common$4.g0_256=g0_256$1;function g1_256$1(o){return rotr32(o,17)^rotr32(o,19)^o>>>10}common$4.g1_256=g1_256$1;var utils$c=utils$f,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$c.rotl32,sum32$2=utils$c.sum32,sum32_5$1=utils$c.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$c.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function o(e,a){for(var c=this.W,d=0;d<16;d++)c[d]=e[a+d];for(;dthis.blockSize&&(e=new this.Hash().update(e).digest()),assert$6(e.length<=this.blockSize);for(var a=e.length;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,a,c)}var hmacDrbg=HmacDRBG;HmacDRBG.prototype._init=function o(e,a,c){var d=e.concat(a).concat(c);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(c||[])),this._reseed=1};HmacDRBG.prototype.generate=function o(e,a,c,d){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof a!="string"&&(d=c,c=a,a=null),c&&(c=utils$5.toArray(c,d||"hex"),this._update(c));for(var h=[];h.length"};var BN$4=bnExports$3,utils$3=utils$l,assert$3=utils$3.assert;function Signature$2(o,e){if(o instanceof Signature$2)return o;this._importDER(o,e)||(assert$3(o.r&&o.s,"Signature without r or s"),this.r=new BN$4(o.r,16),this.s=new BN$4(o.s,16),o.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=o.recoveryParam)}var signature$1=Signature$2;function Position(){this.place=0}function getLength(o,e){var a=o[e.place++];if(!(a&128))return a;var c=a&15;if(c===0||c>4||o[e.place]===0)return!1;for(var d=0,h=0,j=e.place;h>>=0;return d<=127?!1:(e.place=j,d)}function rmPadding(o){for(var e=0,a=o.length-1;!o[e]&&!(o[e+1]&128)&&e>>3);for(o.push(a|128);--a;)o.push(e>>>(a<<3)&255);o.push(e)}Signature$2.prototype.toDER=function o(e){var a=this.r.toArray(),c=this.s.toArray();for(a[0]&128&&(a=[0].concat(a)),c[0]&128&&(c=[0].concat(c)),a=rmPadding(a),c=rmPadding(c);!c[0]&&!(c[1]&128);)c=c.slice(1);var d=[2];constructLength(d,a.length),d=d.concat(a),d.push(2),constructLength(d,c.length);var h=d.concat(c),j=[48];return constructLength(j,h.length),j=j.concat(h),utils$3.encode(j,e)};var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var o=bnExports$3,e=hmacDrbg,a=utils$l,c=curves$1,d=requireBrorand(),h=a.assert,j=key$1,et=signature$1;function nt(st){if(!(this instanceof nt))return new nt(st);typeof st=="string"&&(h(Object.prototype.hasOwnProperty.call(c,st),"Unknown curve "+st),st=c[st]),st instanceof c.PresetCurve&&(st={curve:st}),this.curve=st.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=st.curve.g,this.g.precompute(st.curve.n.bitLength()+1),this.hash=st.hash||st.curve.hash}return ec=nt,nt.prototype.keyPair=function(ot){return new j(this,ot)},nt.prototype.keyFromPrivate=function(ot,ht){return j.fromPrivate(this,ot,ht)},nt.prototype.keyFromPublic=function(ot,ht){return j.fromPublic(this,ot,ht)},nt.prototype.genKeyPair=function(ot){ot||(ot={});for(var ht=new e({hash:this.hash,pers:ot.pers,persEnc:ot.persEnc||"utf8",entropy:ot.entropy||d(this.hash.hmacStrength),entropyEnc:ot.entropy&&ot.entropyEnc||"utf8",nonce:this.n.toArray()}),pt=this.n.byteLength(),dt=this.n.sub(new o(2));;){var gt=new o(ht.generate(pt));if(!(gt.cmp(dt)>0))return gt.iaddn(1),this.keyFromPrivate(gt)}},nt.prototype._truncateToN=function(ot,ht,pt){var dt;if(o.isBN(ot)||typeof ot=="number")ot=new o(ot,16),dt=ot.byteLength();else if(typeof ot=="object")dt=ot.length,ot=new o(ot,16);else{var gt=ot.toString();dt=gt.length+1>>>1,ot=new o(gt,16)}typeof pt!="number"&&(pt=dt*8);var wt=pt-this.n.bitLength();return wt>0&&(ot=ot.ushrn(wt)),!ht&&ot.cmp(this.n)>=0?ot.sub(this.n):ot},nt.prototype.sign=function(ot,ht,pt,dt){if(typeof pt=="object"&&(dt=pt,pt=null),dt||(dt={}),typeof ot!="string"&&typeof ot!="number"&&!o.isBN(ot)){h(typeof ot=="object"&&ot&&typeof ot.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),h(ot.length>>>0===ot.length);for(var gt=0;gt=0)){var Dt=this.g.mul(Bt);if(!Dt.isInfinity()){var Ht=Dt.getX(),qt=Ht.umod(this.n);if(qt.cmpn(0)!==0){var Pt=Bt.invm(this.n).mul(qt.mul(ht.getPrivate()).iadd(ot));if(Pt=Pt.umod(this.n),Pt.cmpn(0)!==0){var Gt=(Dt.getY().isOdd()?1:0)|(Ht.cmp(qt)!==0?2:0);return dt.canonical&&Pt.cmp(this.nh)>0&&(Pt=this.n.sub(Pt),Gt^=1),new et({r:qt,s:Pt,recoveryParam:Gt})}}}}}},nt.prototype.verify=function(ot,ht,pt,dt,gt){gt||(gt={}),ot=this._truncateToN(ot,!1,gt.msgBitLength),pt=this.keyFromPublic(pt,dt),ht=new et(ht,"hex");var wt=ht.r,St=ht.s;if(wt.cmpn(1)<0||wt.cmp(this.n)>=0||St.cmpn(1)<0||St.cmp(this.n)>=0)return!1;var _t=St.invm(this.n),mt=_t.mul(ot).umod(this.n),bt=_t.mul(wt).umod(this.n),$t;return this.curve._maxwellTrick?($t=this.g.jmulAdd(mt,pt.getPublic(),bt),$t.isInfinity()?!1:$t.eqXToP(wt)):($t=this.g.mulAdd(mt,pt.getPublic(),bt),$t.isInfinity()?!1:$t.getX().umod(this.n).cmp(wt)===0)},nt.prototype.recoverPubKey=function(st,ot,ht,pt){h((3&ht)===ht,"The recovery param is more than two bits"),ot=new et(ot,pt);var dt=this.n,gt=new o(st),wt=ot.r,St=ot.s,_t=ht&1,mt=ht>>1;if(wt.cmp(this.curve.p.umod(this.curve.n))>=0&&mt)throw new Error("Unable to find sencond key candinate");mt?wt=this.curve.pointFromX(wt.add(this.curve.n),_t):wt=this.curve.pointFromX(wt,_t);var bt=ot.r.invm(dt),$t=dt.sub(gt).mul(bt).umod(dt),Bt=St.mul(bt).umod(dt);return this.g.mulAdd($t,wt,Bt)},nt.prototype.getKeyRecoveryParam=function(st,ot,ht,pt){if(ot=new et(ot,pt),ot.recoveryParam!==null)return ot.recoveryParam;for(var dt=0;dt<4;dt++){var gt;try{gt=this.recoverPubKey(st,ot,dt)}catch{continue}if(gt.eq(ht))return dt}throw new Error("Unable to find valid recovery factor")},ec}var utils$2=utils$l,assert$2=utils$2.assert,parseBytes$2=utils$2.parseBytes,cachedProperty$1=utils$2.cachedProperty;function KeyPair$1(o,e){this.eddsa=o,this._secret=parseBytes$2(e.secret),o.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=parseBytes$2(e.pub)}KeyPair$1.fromPublic=function o(e,a){return a instanceof KeyPair$1?a:new KeyPair$1(e,{pub:a})};KeyPair$1.fromSecret=function o(e,a){return a instanceof KeyPair$1?a:new KeyPair$1(e,{secret:a})};KeyPair$1.prototype.secret=function o(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function o(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function o(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function o(){var e=this.eddsa,a=this.hash(),c=e.encodingLength-1,d=a.slice(0,e.encodingLength);return d[0]&=248,d[c]&=127,d[c]|=64,d});cachedProperty$1(KeyPair$1,"priv",function o(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function o(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function o(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function o(e){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};KeyPair$1.prototype.verify=function o(e,a){return this.eddsa.verify(e,a,this)};KeyPair$1.prototype.getSecret=function o(e){return assert$2(this._secret,"KeyPair is public only"),utils$2.encode(this.secret(),e)};KeyPair$1.prototype.getPublic=function o(e){return utils$2.encode(this.pubBytes(),e)};var key=KeyPair$1,BN$3=bnExports$3,utils$1=utils$l,assert$1=utils$1.assert,cachedProperty=utils$1.cachedProperty,parseBytes$1=utils$1.parseBytes;function Signature$1(o,e){this.eddsa=o,typeof e!="object"&&(e=parseBytes$1(e)),Array.isArray(e)&&(assert$1(e.length===o.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,o.encodingLength),S:e.slice(o.encodingLength)}),assert$1(e.R&&e.S,"Signature without R or S"),o.isPoint(e.R)&&(this._R=e.R),e.S instanceof BN$3&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}cachedProperty(Signature$1,"S",function o(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function o(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function o(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function o(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function o(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function o(){return utils$1.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash=hash$2,curves=curves$1,utils=utils$l,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=key,Signature=signature;function EDDSA(o){if(assert(o==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(o);o=curves[o].curve,this.curve=o,this.g=o.g,this.g.precompute(o.n.bitLength()+1),this.pointClass=o.point().constructor,this.encodingLength=Math.ceil(o.n.bitLength()/8),this.hash=hash.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function o(e,a){e=parseBytes(e);var c=this.keyFromSecret(a),d=this.hashInt(c.messagePrefix(),e),h=this.g.mul(d),j=this.encodePoint(h),et=this.hashInt(j,c.pubBytes(),e).mul(c.priv()),nt=d.add(et).umod(this.curve.n);return this.makeSignature({R:h,S:nt,Rencoded:j})};EDDSA.prototype.verify=function o(e,a,c){if(e=parseBytes(e),a=this.makeSignature(a),a.S().gte(a.eddsa.curve.n)||a.S().isNeg())return!1;var d=this.keyFromPublic(c),h=this.hashInt(a.Rencoded(),d.pubBytes(),e),j=this.g.mul(a.S()),et=a.R().add(d.pub().mul(h));return et.eq(j)};EDDSA.prototype.hashInt=function o(){for(var e=this.hash(),a=0;a0?g:b},h.min=function(g,b){return g.cmp(b)<0?g:b},h.prototype._init=function(g,b,$){if(typeof g=="number")return this._initNumber(g,b,$);if(typeof g=="object")return this._initArray(g,b,$);b==="hex"&&(b=16),c(b===(b|0)&&b>=2&&b<=36),g=g.toString().replace(/\s+/g,"");var _e=0;g[0]==="-"&&(_e++,this.negative=1),_e=0;_e-=3)at=g[_e]|g[_e-1]<<8|g[_e-2]<<16,this.words[rt]|=at<>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);else if($==="le")for(_e=0,rt=0;_e>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);return this.strip()};function et(ct,g){var b=ct.charCodeAt(g);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function nt(ct,g,b){var $=et(ct,b);return b-1>=g&&($|=et(ct,b-1)<<4),$}h.prototype._parseHex=function(g,b,$){this.length=Math.ceil((g.length-b)/6),this.words=new Array(this.length);for(var _e=0;_e=b;_e-=2)lt=nt(g,b,_e)<=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8;else{var tt=g.length-b;for(_e=tt%2===0?b+1:b;_e=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8}this.strip()};function st(ct,g,b,$){for(var _e=0,rt=Math.min(ct.length,b),at=g;at=49?_e+=lt-49+10:lt>=17?_e+=lt-17+10:_e+=lt}return _e}h.prototype._parseBase=function(g,b,$){this.words=[0],this.length=1;for(var _e=0,rt=1;rt<=67108863;rt*=b)_e++;_e--,rt=rt/b|0;for(var at=g.length-$,lt=at%_e,tt=Math.min(at,at-lt)+$,_=0,it=$;it1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var ot=["","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"],ht=[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],pt=[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];h.prototype.toString=function(g,b){g=g||10,b=b|0||1;var $;if(g===16||g==="hex"){$="";for(var _e=0,rt=0,at=0;at>>24-_e&16777215,_e+=2,_e>=26&&(_e-=26,at--),rt!==0||at!==this.length-1?$=ot[6-tt.length]+tt+$:$=tt+$}for(rt!==0&&($=rt.toString(16)+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}if(g===(g|0)&&g>=2&&g<=36){var _=ht[g],it=pt[g];$="";var yt=this.clone();for(yt.negative=0;!yt.isZero();){var vt=yt.modn(it).toString(g);yt=yt.idivn(it),yt.isZero()?$=vt+$:$=ot[_-vt.length]+vt+$}for(this.isZero()&&($="0"+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}c(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(g,b){return c(typeof j<"u"),this.toArrayLike(j,g,b)},h.prototype.toArray=function(g,b){return this.toArrayLike(Array,g,b)},h.prototype.toArrayLike=function(g,b,$){var _e=this.byteLength(),rt=$||Math.max(1,_e);c(_e<=rt,"byte array longer than desired length"),c(rt>0,"Requested array length <= 0"),this.strip();var at=b==="le",lt=new g(rt),tt,_,it=this.clone();if(at){for(_=0;!it.isZero();_++)tt=it.andln(255),it.iushrn(8),lt[_]=tt;for(;_=4096&&($+=13,b>>>=13),b>=64&&($+=7,b>>>=7),b>=8&&($+=4,b>>>=4),b>=2&&($+=2,b>>>=2),$+b},h.prototype._zeroBits=function(g){if(g===0)return 26;var b=g,$=0;return b&8191||($+=13,b>>>=13),b&127||($+=7,b>>>=7),b&15||($+=4,b>>>=4),b&3||($+=2,b>>>=2),b&1||$++,$},h.prototype.bitLength=function(){var g=this.words[this.length-1],b=this._countBits(g);return(this.length-1)*26+b};function dt(ct){for(var g=new Array(ct.bitLength()),b=0;b>>_e}return g}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,b=0;bg.length?this.clone().ior(g):g.clone().ior(this)},h.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},h.prototype.iuand=function(g){var b;this.length>g.length?b=g:b=this;for(var $=0;$g.length?this.clone().iand(g):g.clone().iand(this)},h.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},h.prototype.iuxor=function(g){var b,$;this.length>g.length?(b=this,$=g):(b=g,$=this);for(var _e=0;_e<$.length;_e++)this.words[_e]=b.words[_e]^$.words[_e];if(this!==b)for(;_eg.length?this.clone().ixor(g):g.clone().ixor(this)},h.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},h.prototype.inotn=function(g){c(typeof g=="number"&&g>=0);var b=Math.ceil(g/26)|0,$=g%26;this._expand(b),$>0&&b--;for(var _e=0;_e0&&(this.words[_e]=~this.words[_e]&67108863>>26-$),this.strip()},h.prototype.notn=function(g){return this.clone().inotn(g)},h.prototype.setn=function(g,b){c(typeof g=="number"&&g>=0);var $=g/26|0,_e=g%26;return this._expand($+1),b?this.words[$]=this.words[$]|1<<_e:this.words[$]=this.words[$]&~(1<<_e),this.strip()},h.prototype.iadd=function(g){var b;if(this.negative!==0&&g.negative===0)return this.negative=0,b=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,b=this.isub(g),g.negative=1,b._normSign();var $,_e;this.length>g.length?($=this,_e=g):($=g,_e=this);for(var rt=0,at=0;at<_e.length;at++)b=($.words[at]|0)+(_e.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;for(;rt!==0&&at<$.length;at++)b=($.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;if(this.length=$.length,rt!==0)this.words[this.length]=rt,this.length++;else if($!==this)for(;at<$.length;at++)this.words[at]=$.words[at];return this},h.prototype.add=function(g){var b;return g.negative!==0&&this.negative===0?(g.negative=0,b=this.sub(g),g.negative^=1,b):g.negative===0&&this.negative!==0?(this.negative=0,b=g.sub(this),this.negative=1,b):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},h.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var b=this.iadd(g);return g.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var $=this.cmp(g);if($===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _e,rt;$>0?(_e=this,rt=g):(_e=g,rt=this);for(var at=0,lt=0;lt>26,this.words[lt]=b&67108863;for(;at!==0&<<_e.length;lt++)b=(_e.words[lt]|0)+at,at=b>>26,this.words[lt]=b&67108863;if(at===0&<<_e.length&&_e!==this)for(;lt<_e.length;lt++)this.words[lt]=_e.words[lt];return this.length=Math.max(this.length,lt),_e!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(g){return this.clone().isub(g)};function gt(ct,g,b){b.negative=g.negative^ct.negative;var $=ct.length+g.length|0;b.length=$,$=$-1|0;var _e=ct.words[0]|0,rt=g.words[0]|0,at=_e*rt,lt=at&67108863,tt=at/67108864|0;b.words[0]=lt;for(var _=1;_<$;_++){for(var it=tt>>>26,yt=tt&67108863,vt=Math.min(_,g.length-1),Rt=Math.max(0,_-ct.length+1);Rt<=vt;Rt++){var Tt=_-Rt|0;_e=ct.words[Tt]|0,rt=g.words[Rt]|0,at=_e*rt+yt,it+=at/67108864|0,yt=at&67108863}b.words[_]=yt|0,tt=it|0}return tt!==0?b.words[_]=tt|0:b.length--,b.strip()}var wt=function(g,b,$){var _e=g.words,rt=b.words,at=$.words,lt=0,tt,_,it,yt=_e[0]|0,vt=yt&8191,Rt=yt>>>13,Tt=_e[1]|0,Mt=Tt&8191,At=Tt>>>13,Ot=_e[2]|0,Ct=Ot&8191,Ut=Ot>>>13,Lt=_e[3]|0,Nt=Lt&8191,Kt=Lt>>>13,yr=_e[4]|0,Xt=yr&8191,Jt=yr>>>13,Ar=_e[5]|0,er=Ar&8191,Vt=Ar>>>13,Ir=_e[6]|0,nr=Ir&8191,or=Ir>>>13,xr=_e[7]|0,Ft=xr&8191,jt=xr>>>13,Rr=_e[8]|0,Yt=Rr&8191,Zt=Rr>>>13,$r=_e[9]|0,It=$r&8191,Et=$r>>>13,xt=rt[0]|0,kt=xt&8191,zt=xt>>>13,Qt=rt[1]|0,Wt=Qt&8191,rr=Qt>>>13,Mr=rt[2]|0,tr=Mr&8191,ir=Mr>>>13,Tr=rt[3]|0,ar=Tr&8191,gr=Tr>>>13,Cr=rt[4]|0,ur=Cr&8191,vr=Cr>>>13,Br=rt[5]|0,lr=Br&8191,_r=Br>>>13,kr=rt[6]|0,fr=kr&8191,br=kr>>>13,Lr=rt[7]|0,cr=Lr&8191,wr=Lr>>>13,Pr=rt[8]|0,dr=Pr&8191,Er=Pr>>>13,Dr=rt[9]|0,pr=Dr&8191,Sr=Dr>>>13;$.negative=g.negative^b.negative,$.length=19,tt=Math.imul(vt,kt),_=Math.imul(vt,zt),_=_+Math.imul(Rt,kt)|0,it=Math.imul(Rt,zt);var Or=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Or>>>26)|0,Or&=67108863,tt=Math.imul(Mt,kt),_=Math.imul(Mt,zt),_=_+Math.imul(At,kt)|0,it=Math.imul(At,zt),tt=tt+Math.imul(vt,Wt)|0,_=_+Math.imul(vt,rr)|0,_=_+Math.imul(Rt,Wt)|0,it=it+Math.imul(Rt,rr)|0;var Nr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,tt=Math.imul(Ct,kt),_=Math.imul(Ct,zt),_=_+Math.imul(Ut,kt)|0,it=Math.imul(Ut,zt),tt=tt+Math.imul(Mt,Wt)|0,_=_+Math.imul(Mt,rr)|0,_=_+Math.imul(At,Wt)|0,it=it+Math.imul(At,rr)|0,tt=tt+Math.imul(vt,tr)|0,_=_+Math.imul(vt,ir)|0,_=_+Math.imul(Rt,tr)|0,it=it+Math.imul(Rt,ir)|0;var Ur=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,tt=Math.imul(Nt,kt),_=Math.imul(Nt,zt),_=_+Math.imul(Kt,kt)|0,it=Math.imul(Kt,zt),tt=tt+Math.imul(Ct,Wt)|0,_=_+Math.imul(Ct,rr)|0,_=_+Math.imul(Ut,Wt)|0,it=it+Math.imul(Ut,rr)|0,tt=tt+Math.imul(Mt,tr)|0,_=_+Math.imul(Mt,ir)|0,_=_+Math.imul(At,tr)|0,it=it+Math.imul(At,ir)|0,tt=tt+Math.imul(vt,ar)|0,_=_+Math.imul(vt,gr)|0,_=_+Math.imul(Rt,ar)|0,it=it+Math.imul(Rt,gr)|0;var Hr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,tt=Math.imul(Xt,kt),_=Math.imul(Xt,zt),_=_+Math.imul(Jt,kt)|0,it=Math.imul(Jt,zt),tt=tt+Math.imul(Nt,Wt)|0,_=_+Math.imul(Nt,rr)|0,_=_+Math.imul(Kt,Wt)|0,it=it+Math.imul(Kt,rr)|0,tt=tt+Math.imul(Ct,tr)|0,_=_+Math.imul(Ct,ir)|0,_=_+Math.imul(Ut,tr)|0,it=it+Math.imul(Ut,ir)|0,tt=tt+Math.imul(Mt,ar)|0,_=_+Math.imul(Mt,gr)|0,_=_+Math.imul(At,ar)|0,it=it+Math.imul(At,gr)|0,tt=tt+Math.imul(vt,ur)|0,_=_+Math.imul(vt,vr)|0,_=_+Math.imul(Rt,ur)|0,it=it+Math.imul(Rt,vr)|0;var Fr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,tt=Math.imul(er,kt),_=Math.imul(er,zt),_=_+Math.imul(Vt,kt)|0,it=Math.imul(Vt,zt),tt=tt+Math.imul(Xt,Wt)|0,_=_+Math.imul(Xt,rr)|0,_=_+Math.imul(Jt,Wt)|0,it=it+Math.imul(Jt,rr)|0,tt=tt+Math.imul(Nt,tr)|0,_=_+Math.imul(Nt,ir)|0,_=_+Math.imul(Kt,tr)|0,it=it+Math.imul(Kt,ir)|0,tt=tt+Math.imul(Ct,ar)|0,_=_+Math.imul(Ct,gr)|0,_=_+Math.imul(Ut,ar)|0,it=it+Math.imul(Ut,gr)|0,tt=tt+Math.imul(Mt,ur)|0,_=_+Math.imul(Mt,vr)|0,_=_+Math.imul(At,ur)|0,it=it+Math.imul(At,vr)|0,tt=tt+Math.imul(vt,lr)|0,_=_+Math.imul(vt,_r)|0,_=_+Math.imul(Rt,lr)|0,it=it+Math.imul(Rt,_r)|0;var qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(qr>>>26)|0,qr&=67108863,tt=Math.imul(nr,kt),_=Math.imul(nr,zt),_=_+Math.imul(or,kt)|0,it=Math.imul(or,zt),tt=tt+Math.imul(er,Wt)|0,_=_+Math.imul(er,rr)|0,_=_+Math.imul(Vt,Wt)|0,it=it+Math.imul(Vt,rr)|0,tt=tt+Math.imul(Xt,tr)|0,_=_+Math.imul(Xt,ir)|0,_=_+Math.imul(Jt,tr)|0,it=it+Math.imul(Jt,ir)|0,tt=tt+Math.imul(Nt,ar)|0,_=_+Math.imul(Nt,gr)|0,_=_+Math.imul(Kt,ar)|0,it=it+Math.imul(Kt,gr)|0,tt=tt+Math.imul(Ct,ur)|0,_=_+Math.imul(Ct,vr)|0,_=_+Math.imul(Ut,ur)|0,it=it+Math.imul(Ut,vr)|0,tt=tt+Math.imul(Mt,lr)|0,_=_+Math.imul(Mt,_r)|0,_=_+Math.imul(At,lr)|0,it=it+Math.imul(At,_r)|0,tt=tt+Math.imul(vt,fr)|0,_=_+Math.imul(vt,br)|0,_=_+Math.imul(Rt,fr)|0,it=it+Math.imul(Rt,br)|0;var Kr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,tt=Math.imul(Ft,kt),_=Math.imul(Ft,zt),_=_+Math.imul(jt,kt)|0,it=Math.imul(jt,zt),tt=tt+Math.imul(nr,Wt)|0,_=_+Math.imul(nr,rr)|0,_=_+Math.imul(or,Wt)|0,it=it+Math.imul(or,rr)|0,tt=tt+Math.imul(er,tr)|0,_=_+Math.imul(er,ir)|0,_=_+Math.imul(Vt,tr)|0,it=it+Math.imul(Vt,ir)|0,tt=tt+Math.imul(Xt,ar)|0,_=_+Math.imul(Xt,gr)|0,_=_+Math.imul(Jt,ar)|0,it=it+Math.imul(Jt,gr)|0,tt=tt+Math.imul(Nt,ur)|0,_=_+Math.imul(Nt,vr)|0,_=_+Math.imul(Kt,ur)|0,it=it+Math.imul(Kt,vr)|0,tt=tt+Math.imul(Ct,lr)|0,_=_+Math.imul(Ct,_r)|0,_=_+Math.imul(Ut,lr)|0,it=it+Math.imul(Ut,_r)|0,tt=tt+Math.imul(Mt,fr)|0,_=_+Math.imul(Mt,br)|0,_=_+Math.imul(At,fr)|0,it=it+Math.imul(At,br)|0,tt=tt+Math.imul(vt,cr)|0,_=_+Math.imul(vt,wr)|0,_=_+Math.imul(Rt,cr)|0,it=it+Math.imul(Rt,wr)|0;var jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(jr>>>26)|0,jr&=67108863,tt=Math.imul(Yt,kt),_=Math.imul(Yt,zt),_=_+Math.imul(Zt,kt)|0,it=Math.imul(Zt,zt),tt=tt+Math.imul(Ft,Wt)|0,_=_+Math.imul(Ft,rr)|0,_=_+Math.imul(jt,Wt)|0,it=it+Math.imul(jt,rr)|0,tt=tt+Math.imul(nr,tr)|0,_=_+Math.imul(nr,ir)|0,_=_+Math.imul(or,tr)|0,it=it+Math.imul(or,ir)|0,tt=tt+Math.imul(er,ar)|0,_=_+Math.imul(er,gr)|0,_=_+Math.imul(Vt,ar)|0,it=it+Math.imul(Vt,gr)|0,tt=tt+Math.imul(Xt,ur)|0,_=_+Math.imul(Xt,vr)|0,_=_+Math.imul(Jt,ur)|0,it=it+Math.imul(Jt,vr)|0,tt=tt+Math.imul(Nt,lr)|0,_=_+Math.imul(Nt,_r)|0,_=_+Math.imul(Kt,lr)|0,it=it+Math.imul(Kt,_r)|0,tt=tt+Math.imul(Ct,fr)|0,_=_+Math.imul(Ct,br)|0,_=_+Math.imul(Ut,fr)|0,it=it+Math.imul(Ut,br)|0,tt=tt+Math.imul(Mt,cr)|0,_=_+Math.imul(Mt,wr)|0,_=_+Math.imul(At,cr)|0,it=it+Math.imul(At,wr)|0,tt=tt+Math.imul(vt,dr)|0,_=_+Math.imul(vt,Er)|0,_=_+Math.imul(Rt,dr)|0,it=it+Math.imul(Rt,Er)|0;var Wr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,tt=Math.imul(It,kt),_=Math.imul(It,zt),_=_+Math.imul(Et,kt)|0,it=Math.imul(Et,zt),tt=tt+Math.imul(Yt,Wt)|0,_=_+Math.imul(Yt,rr)|0,_=_+Math.imul(Zt,Wt)|0,it=it+Math.imul(Zt,rr)|0,tt=tt+Math.imul(Ft,tr)|0,_=_+Math.imul(Ft,ir)|0,_=_+Math.imul(jt,tr)|0,it=it+Math.imul(jt,ir)|0,tt=tt+Math.imul(nr,ar)|0,_=_+Math.imul(nr,gr)|0,_=_+Math.imul(or,ar)|0,it=it+Math.imul(or,gr)|0,tt=tt+Math.imul(er,ur)|0,_=_+Math.imul(er,vr)|0,_=_+Math.imul(Vt,ur)|0,it=it+Math.imul(Vt,vr)|0,tt=tt+Math.imul(Xt,lr)|0,_=_+Math.imul(Xt,_r)|0,_=_+Math.imul(Jt,lr)|0,it=it+Math.imul(Jt,_r)|0,tt=tt+Math.imul(Nt,fr)|0,_=_+Math.imul(Nt,br)|0,_=_+Math.imul(Kt,fr)|0,it=it+Math.imul(Kt,br)|0,tt=tt+Math.imul(Ct,cr)|0,_=_+Math.imul(Ct,wr)|0,_=_+Math.imul(Ut,cr)|0,it=it+Math.imul(Ut,wr)|0,tt=tt+Math.imul(Mt,dr)|0,_=_+Math.imul(Mt,Er)|0,_=_+Math.imul(At,dr)|0,it=it+Math.imul(At,Er)|0,tt=tt+Math.imul(vt,pr)|0,_=_+Math.imul(vt,Sr)|0,_=_+Math.imul(Rt,pr)|0,it=it+Math.imul(Rt,Sr)|0;var Vr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,tt=Math.imul(It,Wt),_=Math.imul(It,rr),_=_+Math.imul(Et,Wt)|0,it=Math.imul(Et,rr),tt=tt+Math.imul(Yt,tr)|0,_=_+Math.imul(Yt,ir)|0,_=_+Math.imul(Zt,tr)|0,it=it+Math.imul(Zt,ir)|0,tt=tt+Math.imul(Ft,ar)|0,_=_+Math.imul(Ft,gr)|0,_=_+Math.imul(jt,ar)|0,it=it+Math.imul(jt,gr)|0,tt=tt+Math.imul(nr,ur)|0,_=_+Math.imul(nr,vr)|0,_=_+Math.imul(or,ur)|0,it=it+Math.imul(or,vr)|0,tt=tt+Math.imul(er,lr)|0,_=_+Math.imul(er,_r)|0,_=_+Math.imul(Vt,lr)|0,it=it+Math.imul(Vt,_r)|0,tt=tt+Math.imul(Xt,fr)|0,_=_+Math.imul(Xt,br)|0,_=_+Math.imul(Jt,fr)|0,it=it+Math.imul(Jt,br)|0,tt=tt+Math.imul(Nt,cr)|0,_=_+Math.imul(Nt,wr)|0,_=_+Math.imul(Kt,cr)|0,it=it+Math.imul(Kt,wr)|0,tt=tt+Math.imul(Ct,dr)|0,_=_+Math.imul(Ct,Er)|0,_=_+Math.imul(Ut,dr)|0,it=it+Math.imul(Ut,Er)|0,tt=tt+Math.imul(Mt,pr)|0,_=_+Math.imul(Mt,Sr)|0,_=_+Math.imul(At,pr)|0,it=it+Math.imul(At,Sr)|0;var Gr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,tt=Math.imul(It,tr),_=Math.imul(It,ir),_=_+Math.imul(Et,tr)|0,it=Math.imul(Et,ir),tt=tt+Math.imul(Yt,ar)|0,_=_+Math.imul(Yt,gr)|0,_=_+Math.imul(Zt,ar)|0,it=it+Math.imul(Zt,gr)|0,tt=tt+Math.imul(Ft,ur)|0,_=_+Math.imul(Ft,vr)|0,_=_+Math.imul(jt,ur)|0,it=it+Math.imul(jt,vr)|0,tt=tt+Math.imul(nr,lr)|0,_=_+Math.imul(nr,_r)|0,_=_+Math.imul(or,lr)|0,it=it+Math.imul(or,_r)|0,tt=tt+Math.imul(er,fr)|0,_=_+Math.imul(er,br)|0,_=_+Math.imul(Vt,fr)|0,it=it+Math.imul(Vt,br)|0,tt=tt+Math.imul(Xt,cr)|0,_=_+Math.imul(Xt,wr)|0,_=_+Math.imul(Jt,cr)|0,it=it+Math.imul(Jt,wr)|0,tt=tt+Math.imul(Nt,dr)|0,_=_+Math.imul(Nt,Er)|0,_=_+Math.imul(Kt,dr)|0,it=it+Math.imul(Kt,Er)|0,tt=tt+Math.imul(Ct,pr)|0,_=_+Math.imul(Ct,Sr)|0,_=_+Math.imul(Ut,pr)|0,it=it+Math.imul(Ut,Sr)|0;var Yr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,tt=Math.imul(It,ar),_=Math.imul(It,gr),_=_+Math.imul(Et,ar)|0,it=Math.imul(Et,gr),tt=tt+Math.imul(Yt,ur)|0,_=_+Math.imul(Yt,vr)|0,_=_+Math.imul(Zt,ur)|0,it=it+Math.imul(Zt,vr)|0,tt=tt+Math.imul(Ft,lr)|0,_=_+Math.imul(Ft,_r)|0,_=_+Math.imul(jt,lr)|0,it=it+Math.imul(jt,_r)|0,tt=tt+Math.imul(nr,fr)|0,_=_+Math.imul(nr,br)|0,_=_+Math.imul(or,fr)|0,it=it+Math.imul(or,br)|0,tt=tt+Math.imul(er,cr)|0,_=_+Math.imul(er,wr)|0,_=_+Math.imul(Vt,cr)|0,it=it+Math.imul(Vt,wr)|0,tt=tt+Math.imul(Xt,dr)|0,_=_+Math.imul(Xt,Er)|0,_=_+Math.imul(Jt,dr)|0,it=it+Math.imul(Jt,Er)|0,tt=tt+Math.imul(Nt,pr)|0,_=_+Math.imul(Nt,Sr)|0,_=_+Math.imul(Kt,pr)|0,it=it+Math.imul(Kt,Sr)|0;var Zr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,tt=Math.imul(It,ur),_=Math.imul(It,vr),_=_+Math.imul(Et,ur)|0,it=Math.imul(Et,vr),tt=tt+Math.imul(Yt,lr)|0,_=_+Math.imul(Yt,_r)|0,_=_+Math.imul(Zt,lr)|0,it=it+Math.imul(Zt,_r)|0,tt=tt+Math.imul(Ft,fr)|0,_=_+Math.imul(Ft,br)|0,_=_+Math.imul(jt,fr)|0,it=it+Math.imul(jt,br)|0,tt=tt+Math.imul(nr,cr)|0,_=_+Math.imul(nr,wr)|0,_=_+Math.imul(or,cr)|0,it=it+Math.imul(or,wr)|0,tt=tt+Math.imul(er,dr)|0,_=_+Math.imul(er,Er)|0,_=_+Math.imul(Vt,dr)|0,it=it+Math.imul(Vt,Er)|0,tt=tt+Math.imul(Xt,pr)|0,_=_+Math.imul(Xt,Sr)|0,_=_+Math.imul(Jt,pr)|0,it=it+Math.imul(Jt,Sr)|0;var Xr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,tt=Math.imul(It,lr),_=Math.imul(It,_r),_=_+Math.imul(Et,lr)|0,it=Math.imul(Et,_r),tt=tt+Math.imul(Yt,fr)|0,_=_+Math.imul(Yt,br)|0,_=_+Math.imul(Zt,fr)|0,it=it+Math.imul(Zt,br)|0,tt=tt+Math.imul(Ft,cr)|0,_=_+Math.imul(Ft,wr)|0,_=_+Math.imul(jt,cr)|0,it=it+Math.imul(jt,wr)|0,tt=tt+Math.imul(nr,dr)|0,_=_+Math.imul(nr,Er)|0,_=_+Math.imul(or,dr)|0,it=it+Math.imul(or,Er)|0,tt=tt+Math.imul(er,pr)|0,_=_+Math.imul(er,Sr)|0,_=_+Math.imul(Vt,pr)|0,it=it+Math.imul(Vt,Sr)|0;var Jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,tt=Math.imul(It,fr),_=Math.imul(It,br),_=_+Math.imul(Et,fr)|0,it=Math.imul(Et,br),tt=tt+Math.imul(Yt,cr)|0,_=_+Math.imul(Yt,wr)|0,_=_+Math.imul(Zt,cr)|0,it=it+Math.imul(Zt,wr)|0,tt=tt+Math.imul(Ft,dr)|0,_=_+Math.imul(Ft,Er)|0,_=_+Math.imul(jt,dr)|0,it=it+Math.imul(jt,Er)|0,tt=tt+Math.imul(nr,pr)|0,_=_+Math.imul(nr,Sr)|0,_=_+Math.imul(or,pr)|0,it=it+Math.imul(or,Sr)|0;var Qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,tt=Math.imul(It,cr),_=Math.imul(It,wr),_=_+Math.imul(Et,cr)|0,it=Math.imul(Et,wr),tt=tt+Math.imul(Yt,dr)|0,_=_+Math.imul(Yt,Er)|0,_=_+Math.imul(Zt,dr)|0,it=it+Math.imul(Zt,Er)|0,tt=tt+Math.imul(Ft,pr)|0,_=_+Math.imul(Ft,Sr)|0,_=_+Math.imul(jt,pr)|0,it=it+Math.imul(jt,Sr)|0;var en=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(en>>>26)|0,en&=67108863,tt=Math.imul(It,dr),_=Math.imul(It,Er),_=_+Math.imul(Et,dr)|0,it=Math.imul(Et,Er),tt=tt+Math.imul(Yt,pr)|0,_=_+Math.imul(Yt,Sr)|0,_=_+Math.imul(Zt,pr)|0,it=it+Math.imul(Zt,Sr)|0;var tn=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(tn>>>26)|0,tn&=67108863,tt=Math.imul(It,pr),_=Math.imul(It,Sr),_=_+Math.imul(Et,pr)|0,it=Math.imul(Et,Sr);var rn=(lt+tt|0)+((_&8191)<<13)|0;return lt=(it+(_>>>13)|0)+(rn>>>26)|0,rn&=67108863,at[0]=Or,at[1]=Nr,at[2]=Ur,at[3]=Hr,at[4]=Fr,at[5]=qr,at[6]=Kr,at[7]=jr,at[8]=Wr,at[9]=Vr,at[10]=Gr,at[11]=Yr,at[12]=Zr,at[13]=Xr,at[14]=Jr,at[15]=Qr,at[16]=en,at[17]=tn,at[18]=rn,lt!==0&&(at[19]=lt,$.length++),$};Math.imul||(wt=gt);function St(ct,g,b){b.negative=g.negative^ct.negative,b.length=ct.length+g.length;for(var $=0,_e=0,rt=0;rt>>26)|0,_e+=at>>>26,at&=67108863}b.words[rt]=lt,$=at,at=_e}return $!==0?b.words[rt]=$:b.length--,b.strip()}function _t(ct,g,b){var $=new mt;return $.mulp(ct,g,b)}h.prototype.mulTo=function(g,b){var $,_e=this.length+g.length;return this.length===10&&g.length===10?$=wt(this,g,b):_e<63?$=gt(this,g,b):_e<1024?$=St(this,g,b):$=_t(this,g,b),$};function mt(ct,g){this.x=ct,this.y=g}mt.prototype.makeRBT=function(g){for(var b=new Array(g),$=h.prototype._countBits(g)-1,_e=0;_e>=1;return _e},mt.prototype.permute=function(g,b,$,_e,rt,at){for(var lt=0;lt>>1)rt++;return 1<>>13,$[2*at+1]=rt&8191,rt=rt>>>13;for(at=2*b;at<_e;++at)$[at]=0;c(rt===0),c((rt&-8192)===0)},mt.prototype.stub=function(g){for(var b=new Array(g),$=0;$>=26,b+=_e/67108864|0,b+=rt>>>26,this.words[$]=rt&67108863}return b!==0&&(this.words[$]=b,this.length++),this},h.prototype.muln=function(g){return this.clone().imuln(g)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(g){var b=dt(g);if(b.length===0)return new h(1);for(var $=this,_e=0;_e=0);var b=g%26,$=(g-b)/26,_e=67108863>>>26-b<<26-b,rt;if(b!==0){var at=0;for(rt=0;rt>>26-b}at&&(this.words[rt]=at,this.length++)}if($!==0){for(rt=this.length-1;rt>=0;rt--)this.words[rt+$]=this.words[rt];for(rt=0;rt<$;rt++)this.words[rt]=0;this.length+=$}return this.strip()},h.prototype.ishln=function(g){return c(this.negative===0),this.iushln(g)},h.prototype.iushrn=function(g,b,$){c(typeof g=="number"&&g>=0);var _e;b?_e=(b-b%26)/26:_e=0;var rt=g%26,at=Math.min((g-rt)/26,this.length),lt=67108863^67108863>>>rt<at)for(this.length-=at,_=0;_=0&&(it!==0||_>=_e);_--){var yt=this.words[_]|0;this.words[_]=it<<26-rt|yt>>>rt,it=yt<}return tt&&it!==0&&(tt.words[tt.length++]=it),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(g,b,$){return c(this.negative===0),this.iushrn(g,b,$)},h.prototype.shln=function(g){return this.clone().ishln(g)},h.prototype.ushln=function(g){return this.clone().iushln(g)},h.prototype.shrn=function(g){return this.clone().ishrn(g)},h.prototype.ushrn=function(g){return this.clone().iushrn(g)},h.prototype.testn=function(g){c(typeof g=="number"&&g>=0);var b=g%26,$=(g-b)/26,_e=1<=0);var b=g%26,$=(g-b)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=$)return this;if(b!==0&&$++,this.length=Math.min($,this.length),b!==0){var _e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},h.prototype.isubn=function(g){if(c(typeof g=="number"),c(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(tt/67108864|0),this.words[rt+$]=at&67108863}for(;rt>26,this.words[rt+$]=at&67108863;if(lt===0)return this.strip();for(c(lt===-1),lt=0,rt=0;rt>26,this.words[rt]=at&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(g,b){var $=this.length-g.length,_e=this.clone(),rt=g,at=rt.words[rt.length-1]|0,lt=this._countBits(at);$=26-lt,$!==0&&(rt=rt.ushln($),_e.iushln($),at=rt.words[rt.length-1]|0);var tt=_e.length-rt.length,_;if(b!=="mod"){_=new h(null),_.length=tt+1,_.words=new Array(_.length);for(var it=0;it<_.length;it++)_.words[it]=0}var yt=_e.clone()._ishlnsubmul(rt,1,tt);yt.negative===0&&(_e=yt,_&&(_.words[tt]=1));for(var vt=tt-1;vt>=0;vt--){var Rt=(_e.words[rt.length+vt]|0)*67108864+(_e.words[rt.length+vt-1]|0);for(Rt=Math.min(Rt/at|0,67108863),_e._ishlnsubmul(rt,Rt,vt);_e.negative!==0;)Rt--,_e.negative=0,_e._ishlnsubmul(rt,1,vt),_e.isZero()||(_e.negative^=1);_&&(_.words[vt]=Rt)}return _&&_.strip(),_e.strip(),b!=="div"&&$!==0&&_e.iushrn($),{div:_||null,mod:_e}},h.prototype.divmod=function(g,b,$){if(c(!g.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var _e,rt,at;return this.negative!==0&&g.negative===0?(at=this.neg().divmod(g,b),b!=="mod"&&(_e=at.div.neg()),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.iadd(g)),{div:_e,mod:rt}):this.negative===0&&g.negative!==0?(at=this.divmod(g.neg(),b),b!=="mod"&&(_e=at.div.neg()),{div:_e,mod:at.mod}):this.negative&g.negative?(at=this.neg().divmod(g.neg(),b),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.isub(g)),{div:at.div,mod:rt}):g.length>this.length||this.cmp(g)<0?{div:new h(0),mod:this}:g.length===1?b==="div"?{div:this.divn(g.words[0]),mod:null}:b==="mod"?{div:null,mod:new h(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new h(this.modn(g.words[0]))}:this._wordDiv(g,b)},h.prototype.div=function(g){return this.divmod(g,"div",!1).div},h.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},h.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},h.prototype.divRound=function(g){var b=this.divmod(g);if(b.mod.isZero())return b.div;var $=b.div.negative!==0?b.mod.isub(g):b.mod,_e=g.ushrn(1),rt=g.andln(1),at=$.cmp(_e);return at<0||rt===1&&at===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},h.prototype.modn=function(g){c(g<=67108863);for(var b=(1<<26)%g,$=0,_e=this.length-1;_e>=0;_e--)$=(b*$+(this.words[_e]|0))%g;return $},h.prototype.idivn=function(g){c(g<=67108863);for(var b=0,$=this.length-1;$>=0;$--){var _e=(this.words[$]|0)+b*67108864;this.words[$]=_e/g|0,b=_e%g}return this.strip()},h.prototype.divn=function(g){return this.clone().idivn(g)},h.prototype.egcd=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=new h(0),lt=new h(1),tt=0;b.isEven()&&$.isEven();)b.iushrn(1),$.iushrn(1),++tt;for(var _=$.clone(),it=b.clone();!b.isZero();){for(var yt=0,vt=1;!(b.words[0]&vt)&&yt<26;++yt,vt<<=1);if(yt>0)for(b.iushrn(yt);yt-- >0;)(_e.isOdd()||rt.isOdd())&&(_e.iadd(_),rt.isub(it)),_e.iushrn(1),rt.iushrn(1);for(var Rt=0,Tt=1;!($.words[0]&Tt)&&Rt<26;++Rt,Tt<<=1);if(Rt>0)for($.iushrn(Rt);Rt-- >0;)(at.isOdd()||lt.isOdd())&&(at.iadd(_),lt.isub(it)),at.iushrn(1),lt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(at),rt.isub(lt)):($.isub(b),at.isub(_e),lt.isub(rt))}return{a:at,b:lt,gcd:$.iushln(tt)}},h.prototype._invmp=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=$.clone();b.cmpn(1)>0&&$.cmpn(1)>0;){for(var lt=0,tt=1;!(b.words[0]&tt)&<<26;++lt,tt<<=1);if(lt>0)for(b.iushrn(lt);lt-- >0;)_e.isOdd()&&_e.iadd(at),_e.iushrn(1);for(var _=0,it=1;!($.words[0]&it)&&_<26;++_,it<<=1);if(_>0)for($.iushrn(_);_-- >0;)rt.isOdd()&&rt.iadd(at),rt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(rt)):($.isub(b),rt.isub(_e))}var yt;return b.cmpn(1)===0?yt=_e:yt=rt,yt.cmpn(0)<0&&yt.iadd(g),yt},h.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var b=this.clone(),$=g.clone();b.negative=0,$.negative=0;for(var _e=0;b.isEven()&&$.isEven();_e++)b.iushrn(1),$.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;$.isEven();)$.iushrn(1);var rt=b.cmp($);if(rt<0){var at=b;b=$,$=at}else if(rt===0||$.cmpn(1)===0)break;b.isub($)}while(!0);return $.iushln(_e)},h.prototype.invm=function(g){return this.egcd(g).a.umod(g)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(g){return this.words[0]&g},h.prototype.bincn=function(g){c(typeof g=="number");var b=g%26,$=(g-b)/26,_e=1<>>26,lt&=67108863,this.words[at]=lt}return rt!==0&&(this.words[at]=rt,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(g){var b=g<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this.strip();var $;if(this.length>1)$=1;else{b&&(g=-g),c(g<=67108863,"Number is too big");var _e=this.words[0]|0;$=_e===g?0:_eg.length)return 1;if(this.length=0;$--){var _e=this.words[$]|0,rt=g.words[$]|0;if(_e!==rt){_ert&&(b=1);break}}return b},h.prototype.gtn=function(g){return this.cmpn(g)===1},h.prototype.gt=function(g){return this.cmp(g)===1},h.prototype.gten=function(g){return this.cmpn(g)>=0},h.prototype.gte=function(g){return this.cmp(g)>=0},h.prototype.ltn=function(g){return this.cmpn(g)===-1},h.prototype.lt=function(g){return this.cmp(g)===-1},h.prototype.lten=function(g){return this.cmpn(g)<=0},h.prototype.lte=function(g){return this.cmp(g)<=0},h.prototype.eqn=function(g){return this.cmpn(g)===0},h.prototype.eq=function(g){return this.cmp(g)===0},h.red=function(g){return new Pt(g)},h.prototype.toRed=function(g){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},h.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(g){return this.red=g,this},h.prototype.forceRed=function(g){return c(!this.red,"Already a number in reduction context"),this._forceRed(g)},h.prototype.redAdd=function(g){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},h.prototype.redIAdd=function(g){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},h.prototype.redSub=function(g){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},h.prototype.redISub=function(g){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},h.prototype.redShl=function(g){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},h.prototype.redMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},h.prototype.redIMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},h.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(g){return c(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var bt={k256:null,p224:null,p192:null,p25519:null};function $t(ct,g){this.name=ct,this.p=new h(g,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$t.prototype._tmp=function(){var g=new h(null);return g.words=new Array(Math.ceil(this.n/13)),g},$t.prototype.ireduce=function(g){var b=g,$;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),$=b.bitLength();while($>this.n);var _e=$0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},$t.prototype.split=function(g,b){g.iushrn(this.n,0,b)},$t.prototype.imulK=function(g){return g.imul(this.k)};function Bt(){$t.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Bt,$t),Bt.prototype.split=function(g,b){for(var $=4194303,_e=Math.min(g.length,9),rt=0;rt<_e;rt++)b.words[rt]=g.words[rt];if(b.length=_e,g.length<=9){g.words[0]=0,g.length=1;return}var at=g.words[9];for(b.words[b.length++]=at&$,rt=10;rt>>22,at=lt}at>>>=22,g.words[rt-10]=at,at===0&&g.length>10?g.length-=10:g.length-=9},Bt.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var b=0,$=0;$>>=26,g.words[$]=rt,b=_e}return b!==0&&(g.words[g.length++]=b),g},h._prime=function(g){if(bt[g])return bt[g];var b;if(g==="k256")b=new Bt;else if(g==="p224")b=new Dt;else if(g==="p192")b=new Ht;else if(g==="p25519")b=new qt;else throw new Error("Unknown prime "+g);return bt[g]=b,b};function Pt(ct){if(typeof ct=="string"){var g=h._prime(ct);this.m=g.p,this.prime=g}else c(ct.gtn(1),"modulus must be greater than 1"),this.m=ct,this.prime=null}Pt.prototype._verify1=function(g){c(g.negative===0,"red works only with positives"),c(g.red,"red works only with red numbers")},Pt.prototype._verify2=function(g,b){c((g.negative|b.negative)===0,"red works only with positives"),c(g.red&&g.red===b.red,"red works only with red numbers")},Pt.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},Pt.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},Pt.prototype.add=function(g,b){this._verify2(g,b);var $=g.add(b);return $.cmp(this.m)>=0&&$.isub(this.m),$._forceRed(this)},Pt.prototype.iadd=function(g,b){this._verify2(g,b);var $=g.iadd(b);return $.cmp(this.m)>=0&&$.isub(this.m),$},Pt.prototype.sub=function(g,b){this._verify2(g,b);var $=g.sub(b);return $.cmpn(0)<0&&$.iadd(this.m),$._forceRed(this)},Pt.prototype.isub=function(g,b){this._verify2(g,b);var $=g.isub(b);return $.cmpn(0)<0&&$.iadd(this.m),$},Pt.prototype.shl=function(g,b){return this._verify1(g),this.imod(g.ushln(b))},Pt.prototype.imul=function(g,b){return this._verify2(g,b),this.imod(g.imul(b))},Pt.prototype.mul=function(g,b){return this._verify2(g,b),this.imod(g.mul(b))},Pt.prototype.isqr=function(g){return this.imul(g,g.clone())},Pt.prototype.sqr=function(g){return this.mul(g,g)},Pt.prototype.sqrt=function(g){if(g.isZero())return g.clone();var b=this.m.andln(3);if(c(b%2===1),b===3){var $=this.m.add(new h(1)).iushrn(2);return this.pow(g,$)}for(var _e=this.m.subn(1),rt=0;!_e.isZero()&&_e.andln(1)===0;)rt++,_e.iushrn(1);c(!_e.isZero());var at=new h(1).toRed(this),lt=at.redNeg(),tt=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new h(2*_*_).toRed(this);this.pow(_,tt).cmp(lt)!==0;)_.redIAdd(lt);for(var it=this.pow(_,_e),yt=this.pow(g,_e.addn(1).iushrn(1)),vt=this.pow(g,_e),Rt=rt;vt.cmp(at)!==0;){for(var Tt=vt,Mt=0;Tt.cmp(at)!==0;Mt++)Tt=Tt.redSqr();c(Mt=0;rt--){for(var it=b.words[rt],yt=_-1;yt>=0;yt--){var vt=it>>yt&1;if(at!==_e[0]&&(at=this.sqr(at)),vt===0&<===0){tt=0;continue}lt<<=1,lt|=vt,tt++,!(tt!==$&&(rt!==0||yt!==0))&&(at=this.mul(at,_e[lt]),tt=0,lt=0)}_=26}return at},Pt.prototype.convertTo=function(g){var b=g.umod(this.m);return b===g?b.clone():b},Pt.prototype.convertFrom=function(g){var b=g.clone();return b.red=null,b},h.mont=function(g){return new Gt(g)};function Gt(ct){Pt.call(this,ct),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}d(Gt,Pt),Gt.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},Gt.prototype.convertFrom=function(g){var b=this.imod(g.mul(this.rinv));return b.red=null,b},Gt.prototype.imul=function(g,b){if(g.isZero()||b.isZero())return g.words[0]=0,g.length=1,g;var $=g.imul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.mul=function(g,b){if(g.isZero()||b.isZero())return new h(0)._forceRed(this);var $=g.mul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.invm=function(g){var b=this.imod(g._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(o,commonjsGlobal$2)})(bn$2);var bnExports$2=bn$2.exports,api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(o,e){if(o.indexOf)return o.indexOf(e);for(var a=0;a>6],dt=(ht&32)===0;if((ht&31)===31){var gt=ht;for(ht=0;(gt&128)===128;){if(gt=st.readUInt8(ot),st.isError(gt))return gt;ht<<=7,ht|=gt&127}}else ht&=31;var wt=d.tag[ht];return{cls:pt,primitive:dt,tag:ht,tagStr:wt}}function nt(st,ot,ht){var pt=st.readUInt8(ht);if(st.isError(pt))return pt;if(!ot&&pt===128)return null;if(!(pt&128))return pt;var dt=pt&127;if(dt>4)return st.error("length octect is too long");pt=0;for(var gt=0;gt=256;St>>=8)wt++;var _t=new e(2+wt);_t[0]=gt,_t[1]=128|wt;for(var St=1+wt,mt=dt.length;mt>0;St--,mt>>=8)_t[St]=mt&255;return this._createEncoderBuffer([_t,dt])},j.prototype._encodeStr=function(ot,ht){if(ht==="bitstr")return this._createEncoderBuffer([ot.unused|0,ot.data]);if(ht==="bmpstr"){for(var pt=new e(ot.length*2),dt=0;dt=40)return this.reporter.error("Second objid identifier OOB");ot.splice(0,2,ot[0]*40+ot[1])}for(var gt=0,dt=0;dt=128;wt>>=7)gt++}for(var St=new e(gt),_t=St.length-1,dt=ot.length-1;dt>=0;dt--){var wt=ot[dt];for(St[_t--]=wt&127;(wt>>=7)>0;)St[_t--]=128|wt&127}return this._createEncoderBuffer(St)};function et(st){return st<10?"0"+st:st}j.prototype._encodeTime=function(ot,ht){var pt,dt=new Date(ot);return ht==="gentime"?pt=[et(dt.getFullYear()),et(dt.getUTCMonth()+1),et(dt.getUTCDate()),et(dt.getUTCHours()),et(dt.getUTCMinutes()),et(dt.getUTCSeconds()),"Z"].join(""):ht==="utctime"?pt=[et(dt.getFullYear()%100),et(dt.getUTCMonth()+1),et(dt.getUTCDate()),et(dt.getUTCHours()),et(dt.getUTCMinutes()),et(dt.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+ht+" time is not supported yet"),this._encodeStr(pt,"octstr")},j.prototype._encodeNull=function(){return this._createEncoderBuffer("")},j.prototype._encodeInt=function(ot,ht){if(typeof ot=="string"){if(!ht)return this.reporter.error("String int or enum given, but no values map");if(!ht.hasOwnProperty(ot))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(ot));ot=ht[ot]}if(typeof ot!="number"&&!e.isBuffer(ot)){var pt=ot.toArray();!ot.sign&&pt[0]&128&&pt.unshift(0),ot=new e(pt)}if(e.isBuffer(ot)){var dt=ot.length;ot.length===0&&dt++;var wt=new e(dt);return ot.copy(wt),ot.length===0&&(wt[0]=0),this._createEncoderBuffer(wt)}if(ot<128)return this._createEncoderBuffer(ot);if(ot<256)return this._createEncoderBuffer([0,ot]);for(var dt=1,gt=ot;gt>=256;gt>>=8)dt++;for(var wt=new Array(dt),gt=wt.length-1;gt>=0;gt--)wt[gt]=ot&255,ot>>=8;return wt[0]&128&&wt.unshift(0),this._createEncoderBuffer(new e(wt))},j.prototype._encodeBool=function(ot){return this._createEncoderBuffer(ot?255:0)},j.prototype._use=function(ot,ht){return typeof ot=="function"&&(ot=ot(ht)),ot._getEncoder("der").tree},j.prototype._skipDefault=function(ot,ht,pt){var dt=this._baseState,gt;if(dt.default===null)return!1;var wt=ot.join();if(dt.defaultBuffer===void 0&&(dt.defaultBuffer=this._encodeValue(dt.default,ht,pt).join()),wt.length!==dt.defaultBuffer.length)return!1;for(gt=0;gt=31?pt.error("Multi-octet tag encoding unsupported"):(ot||(dt|=32),dt|=d.tagClassByName[ht||"universal"]<<6,dt)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var o=inherits_browserExports,e=requireDer();function a(c){e.call(this,c),this.enc="pem"}return o(a,e),pem=a,a.prototype.encode=function(d,h){for(var j=e.prototype.encode.call(this,d),et=j.toString("base64"),nt=["-----BEGIN "+h.label+"-----"],st=0;st0&&bt.ishrn($t),bt}function gt(_t,mt){_t=dt(_t,mt),_t=_t.mod(mt);var bt=o.from(_t.toArray());if(bt.length=0)throw new Error("invalid sig")}return verify_1=h,verify_1}var browser$3,hasRequiredBrowser$1;function requireBrowser$1(){if(hasRequiredBrowser$1)return browser$3;hasRequiredBrowser$1=1;var o=safeBufferExports$1.Buffer,e=browser$9,a=readableBrowserExports,c=inherits_browserExports,d=requireSign(),h=requireVerify(),j=require$$6;Object.keys(j).forEach(function(ht){j[ht].id=o.from(j[ht].id,"hex"),j[ht.toLowerCase()]=j[ht]});function et(ht){a.Writable.call(this);var pt=j[ht];if(!pt)throw new Error("Unknown message digest");this._hashType=pt.hash,this._hash=e(pt.hash),this._tag=pt.id,this._signType=pt.sign}c(et,a.Writable),et.prototype._write=function(pt,dt,gt){this._hash.update(pt),gt()},et.prototype.update=function(pt,dt){return this._hash.update(typeof pt=="string"?o.from(pt,dt):pt),this},et.prototype.sign=function(pt,dt){this.end();var gt=this._hash.digest(),wt=d(gt,pt,this._hashType,this._signType,this._tag);return dt?wt.toString(dt):wt};function nt(ht){a.Writable.call(this);var pt=j[ht];if(!pt)throw new Error("Unknown message digest");this._hash=e(pt.hash),this._tag=pt.id,this._signType=pt.sign}c(nt,a.Writable),nt.prototype._write=function(pt,dt,gt){this._hash.update(pt),gt()},nt.prototype.update=function(pt,dt){return this._hash.update(typeof pt=="string"?o.from(pt,dt):pt),this},nt.prototype.verify=function(pt,dt,gt){var wt=typeof dt=="string"?o.from(dt,gt):dt;this.end();var St=this._hash.digest();return h(wt,St,pt,this._signType,this._tag)};function st(ht){return new et(ht)}function ot(ht){return new nt(ht)}return browser$3={Sign:st,Verify:ot,createSign:st,createVerify:ot},browser$3}var bn$1={exports:{}};bn$1.exports;(function(o){(function(e,a){function c(ct,g){if(!ct)throw new Error(g||"Assertion failed")}function d(ct,g){ct.super_=g;var b=function(){};b.prototype=g.prototype,ct.prototype=new b,ct.prototype.constructor=ct}function h(ct,g,b){if(h.isBN(ct))return ct;this.negative=0,this.words=null,this.length=0,this.red=null,ct!==null&&((g==="le"||g==="be")&&(b=g,g=10),this._init(ct||0,g||10,b||"be"))}typeof e=="object"?e.exports=h:a.BN=h,h.BN=h,h.wordSize=26;var j;try{typeof window<"u"&&typeof window.Buffer<"u"?j=window.Buffer:j=require$$0$1.Buffer}catch{}h.isBN=function(g){return g instanceof h?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===h.wordSize&&Array.isArray(g.words)},h.max=function(g,b){return g.cmp(b)>0?g:b},h.min=function(g,b){return g.cmp(b)<0?g:b},h.prototype._init=function(g,b,$){if(typeof g=="number")return this._initNumber(g,b,$);if(typeof g=="object")return this._initArray(g,b,$);b==="hex"&&(b=16),c(b===(b|0)&&b>=2&&b<=36),g=g.toString().replace(/\s+/g,"");var _e=0;g[0]==="-"&&(_e++,this.negative=1),_e=0;_e-=3)at=g[_e]|g[_e-1]<<8|g[_e-2]<<16,this.words[rt]|=at<>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);else if($==="le")for(_e=0,rt=0;_e>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);return this.strip()};function et(ct,g){var b=ct.charCodeAt(g);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function nt(ct,g,b){var $=et(ct,b);return b-1>=g&&($|=et(ct,b-1)<<4),$}h.prototype._parseHex=function(g,b,$){this.length=Math.ceil((g.length-b)/6),this.words=new Array(this.length);for(var _e=0;_e=b;_e-=2)lt=nt(g,b,_e)<=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8;else{var tt=g.length-b;for(_e=tt%2===0?b+1:b;_e=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8}this.strip()};function st(ct,g,b,$){for(var _e=0,rt=Math.min(ct.length,b),at=g;at=49?_e+=lt-49+10:lt>=17?_e+=lt-17+10:_e+=lt}return _e}h.prototype._parseBase=function(g,b,$){this.words=[0],this.length=1;for(var _e=0,rt=1;rt<=67108863;rt*=b)_e++;_e--,rt=rt/b|0;for(var at=g.length-$,lt=at%_e,tt=Math.min(at,at-lt)+$,_=0,it=$;it1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var ot=["","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"],ht=[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],pt=[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];h.prototype.toString=function(g,b){g=g||10,b=b|0||1;var $;if(g===16||g==="hex"){$="";for(var _e=0,rt=0,at=0;at>>24-_e&16777215,_e+=2,_e>=26&&(_e-=26,at--),rt!==0||at!==this.length-1?$=ot[6-tt.length]+tt+$:$=tt+$}for(rt!==0&&($=rt.toString(16)+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}if(g===(g|0)&&g>=2&&g<=36){var _=ht[g],it=pt[g];$="";var yt=this.clone();for(yt.negative=0;!yt.isZero();){var vt=yt.modn(it).toString(g);yt=yt.idivn(it),yt.isZero()?$=vt+$:$=ot[_-vt.length]+vt+$}for(this.isZero()&&($="0"+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}c(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(g,b){return c(typeof j<"u"),this.toArrayLike(j,g,b)},h.prototype.toArray=function(g,b){return this.toArrayLike(Array,g,b)},h.prototype.toArrayLike=function(g,b,$){var _e=this.byteLength(),rt=$||Math.max(1,_e);c(_e<=rt,"byte array longer than desired length"),c(rt>0,"Requested array length <= 0"),this.strip();var at=b==="le",lt=new g(rt),tt,_,it=this.clone();if(at){for(_=0;!it.isZero();_++)tt=it.andln(255),it.iushrn(8),lt[_]=tt;for(;_=4096&&($+=13,b>>>=13),b>=64&&($+=7,b>>>=7),b>=8&&($+=4,b>>>=4),b>=2&&($+=2,b>>>=2),$+b},h.prototype._zeroBits=function(g){if(g===0)return 26;var b=g,$=0;return b&8191||($+=13,b>>>=13),b&127||($+=7,b>>>=7),b&15||($+=4,b>>>=4),b&3||($+=2,b>>>=2),b&1||$++,$},h.prototype.bitLength=function(){var g=this.words[this.length-1],b=this._countBits(g);return(this.length-1)*26+b};function dt(ct){for(var g=new Array(ct.bitLength()),b=0;b>>_e}return g}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,b=0;bg.length?this.clone().ior(g):g.clone().ior(this)},h.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},h.prototype.iuand=function(g){var b;this.length>g.length?b=g:b=this;for(var $=0;$g.length?this.clone().iand(g):g.clone().iand(this)},h.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},h.prototype.iuxor=function(g){var b,$;this.length>g.length?(b=this,$=g):(b=g,$=this);for(var _e=0;_e<$.length;_e++)this.words[_e]=b.words[_e]^$.words[_e];if(this!==b)for(;_eg.length?this.clone().ixor(g):g.clone().ixor(this)},h.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},h.prototype.inotn=function(g){c(typeof g=="number"&&g>=0);var b=Math.ceil(g/26)|0,$=g%26;this._expand(b),$>0&&b--;for(var _e=0;_e0&&(this.words[_e]=~this.words[_e]&67108863>>26-$),this.strip()},h.prototype.notn=function(g){return this.clone().inotn(g)},h.prototype.setn=function(g,b){c(typeof g=="number"&&g>=0);var $=g/26|0,_e=g%26;return this._expand($+1),b?this.words[$]=this.words[$]|1<<_e:this.words[$]=this.words[$]&~(1<<_e),this.strip()},h.prototype.iadd=function(g){var b;if(this.negative!==0&&g.negative===0)return this.negative=0,b=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,b=this.isub(g),g.negative=1,b._normSign();var $,_e;this.length>g.length?($=this,_e=g):($=g,_e=this);for(var rt=0,at=0;at<_e.length;at++)b=($.words[at]|0)+(_e.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;for(;rt!==0&&at<$.length;at++)b=($.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;if(this.length=$.length,rt!==0)this.words[this.length]=rt,this.length++;else if($!==this)for(;at<$.length;at++)this.words[at]=$.words[at];return this},h.prototype.add=function(g){var b;return g.negative!==0&&this.negative===0?(g.negative=0,b=this.sub(g),g.negative^=1,b):g.negative===0&&this.negative!==0?(this.negative=0,b=g.sub(this),this.negative=1,b):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},h.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var b=this.iadd(g);return g.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var $=this.cmp(g);if($===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _e,rt;$>0?(_e=this,rt=g):(_e=g,rt=this);for(var at=0,lt=0;lt>26,this.words[lt]=b&67108863;for(;at!==0&<<_e.length;lt++)b=(_e.words[lt]|0)+at,at=b>>26,this.words[lt]=b&67108863;if(at===0&<<_e.length&&_e!==this)for(;lt<_e.length;lt++)this.words[lt]=_e.words[lt];return this.length=Math.max(this.length,lt),_e!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(g){return this.clone().isub(g)};function gt(ct,g,b){b.negative=g.negative^ct.negative;var $=ct.length+g.length|0;b.length=$,$=$-1|0;var _e=ct.words[0]|0,rt=g.words[0]|0,at=_e*rt,lt=at&67108863,tt=at/67108864|0;b.words[0]=lt;for(var _=1;_<$;_++){for(var it=tt>>>26,yt=tt&67108863,vt=Math.min(_,g.length-1),Rt=Math.max(0,_-ct.length+1);Rt<=vt;Rt++){var Tt=_-Rt|0;_e=ct.words[Tt]|0,rt=g.words[Rt]|0,at=_e*rt+yt,it+=at/67108864|0,yt=at&67108863}b.words[_]=yt|0,tt=it|0}return tt!==0?b.words[_]=tt|0:b.length--,b.strip()}var wt=function(g,b,$){var _e=g.words,rt=b.words,at=$.words,lt=0,tt,_,it,yt=_e[0]|0,vt=yt&8191,Rt=yt>>>13,Tt=_e[1]|0,Mt=Tt&8191,At=Tt>>>13,Ot=_e[2]|0,Ct=Ot&8191,Ut=Ot>>>13,Lt=_e[3]|0,Nt=Lt&8191,Kt=Lt>>>13,yr=_e[4]|0,Xt=yr&8191,Jt=yr>>>13,Ar=_e[5]|0,er=Ar&8191,Vt=Ar>>>13,Ir=_e[6]|0,nr=Ir&8191,or=Ir>>>13,xr=_e[7]|0,Ft=xr&8191,jt=xr>>>13,Rr=_e[8]|0,Yt=Rr&8191,Zt=Rr>>>13,$r=_e[9]|0,It=$r&8191,Et=$r>>>13,xt=rt[0]|0,kt=xt&8191,zt=xt>>>13,Qt=rt[1]|0,Wt=Qt&8191,rr=Qt>>>13,Mr=rt[2]|0,tr=Mr&8191,ir=Mr>>>13,Tr=rt[3]|0,ar=Tr&8191,gr=Tr>>>13,Cr=rt[4]|0,ur=Cr&8191,vr=Cr>>>13,Br=rt[5]|0,lr=Br&8191,_r=Br>>>13,kr=rt[6]|0,fr=kr&8191,br=kr>>>13,Lr=rt[7]|0,cr=Lr&8191,wr=Lr>>>13,Pr=rt[8]|0,dr=Pr&8191,Er=Pr>>>13,Dr=rt[9]|0,pr=Dr&8191,Sr=Dr>>>13;$.negative=g.negative^b.negative,$.length=19,tt=Math.imul(vt,kt),_=Math.imul(vt,zt),_=_+Math.imul(Rt,kt)|0,it=Math.imul(Rt,zt);var Or=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Or>>>26)|0,Or&=67108863,tt=Math.imul(Mt,kt),_=Math.imul(Mt,zt),_=_+Math.imul(At,kt)|0,it=Math.imul(At,zt),tt=tt+Math.imul(vt,Wt)|0,_=_+Math.imul(vt,rr)|0,_=_+Math.imul(Rt,Wt)|0,it=it+Math.imul(Rt,rr)|0;var Nr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,tt=Math.imul(Ct,kt),_=Math.imul(Ct,zt),_=_+Math.imul(Ut,kt)|0,it=Math.imul(Ut,zt),tt=tt+Math.imul(Mt,Wt)|0,_=_+Math.imul(Mt,rr)|0,_=_+Math.imul(At,Wt)|0,it=it+Math.imul(At,rr)|0,tt=tt+Math.imul(vt,tr)|0,_=_+Math.imul(vt,ir)|0,_=_+Math.imul(Rt,tr)|0,it=it+Math.imul(Rt,ir)|0;var Ur=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,tt=Math.imul(Nt,kt),_=Math.imul(Nt,zt),_=_+Math.imul(Kt,kt)|0,it=Math.imul(Kt,zt),tt=tt+Math.imul(Ct,Wt)|0,_=_+Math.imul(Ct,rr)|0,_=_+Math.imul(Ut,Wt)|0,it=it+Math.imul(Ut,rr)|0,tt=tt+Math.imul(Mt,tr)|0,_=_+Math.imul(Mt,ir)|0,_=_+Math.imul(At,tr)|0,it=it+Math.imul(At,ir)|0,tt=tt+Math.imul(vt,ar)|0,_=_+Math.imul(vt,gr)|0,_=_+Math.imul(Rt,ar)|0,it=it+Math.imul(Rt,gr)|0;var Hr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,tt=Math.imul(Xt,kt),_=Math.imul(Xt,zt),_=_+Math.imul(Jt,kt)|0,it=Math.imul(Jt,zt),tt=tt+Math.imul(Nt,Wt)|0,_=_+Math.imul(Nt,rr)|0,_=_+Math.imul(Kt,Wt)|0,it=it+Math.imul(Kt,rr)|0,tt=tt+Math.imul(Ct,tr)|0,_=_+Math.imul(Ct,ir)|0,_=_+Math.imul(Ut,tr)|0,it=it+Math.imul(Ut,ir)|0,tt=tt+Math.imul(Mt,ar)|0,_=_+Math.imul(Mt,gr)|0,_=_+Math.imul(At,ar)|0,it=it+Math.imul(At,gr)|0,tt=tt+Math.imul(vt,ur)|0,_=_+Math.imul(vt,vr)|0,_=_+Math.imul(Rt,ur)|0,it=it+Math.imul(Rt,vr)|0;var Fr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,tt=Math.imul(er,kt),_=Math.imul(er,zt),_=_+Math.imul(Vt,kt)|0,it=Math.imul(Vt,zt),tt=tt+Math.imul(Xt,Wt)|0,_=_+Math.imul(Xt,rr)|0,_=_+Math.imul(Jt,Wt)|0,it=it+Math.imul(Jt,rr)|0,tt=tt+Math.imul(Nt,tr)|0,_=_+Math.imul(Nt,ir)|0,_=_+Math.imul(Kt,tr)|0,it=it+Math.imul(Kt,ir)|0,tt=tt+Math.imul(Ct,ar)|0,_=_+Math.imul(Ct,gr)|0,_=_+Math.imul(Ut,ar)|0,it=it+Math.imul(Ut,gr)|0,tt=tt+Math.imul(Mt,ur)|0,_=_+Math.imul(Mt,vr)|0,_=_+Math.imul(At,ur)|0,it=it+Math.imul(At,vr)|0,tt=tt+Math.imul(vt,lr)|0,_=_+Math.imul(vt,_r)|0,_=_+Math.imul(Rt,lr)|0,it=it+Math.imul(Rt,_r)|0;var qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(qr>>>26)|0,qr&=67108863,tt=Math.imul(nr,kt),_=Math.imul(nr,zt),_=_+Math.imul(or,kt)|0,it=Math.imul(or,zt),tt=tt+Math.imul(er,Wt)|0,_=_+Math.imul(er,rr)|0,_=_+Math.imul(Vt,Wt)|0,it=it+Math.imul(Vt,rr)|0,tt=tt+Math.imul(Xt,tr)|0,_=_+Math.imul(Xt,ir)|0,_=_+Math.imul(Jt,tr)|0,it=it+Math.imul(Jt,ir)|0,tt=tt+Math.imul(Nt,ar)|0,_=_+Math.imul(Nt,gr)|0,_=_+Math.imul(Kt,ar)|0,it=it+Math.imul(Kt,gr)|0,tt=tt+Math.imul(Ct,ur)|0,_=_+Math.imul(Ct,vr)|0,_=_+Math.imul(Ut,ur)|0,it=it+Math.imul(Ut,vr)|0,tt=tt+Math.imul(Mt,lr)|0,_=_+Math.imul(Mt,_r)|0,_=_+Math.imul(At,lr)|0,it=it+Math.imul(At,_r)|0,tt=tt+Math.imul(vt,fr)|0,_=_+Math.imul(vt,br)|0,_=_+Math.imul(Rt,fr)|0,it=it+Math.imul(Rt,br)|0;var Kr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,tt=Math.imul(Ft,kt),_=Math.imul(Ft,zt),_=_+Math.imul(jt,kt)|0,it=Math.imul(jt,zt),tt=tt+Math.imul(nr,Wt)|0,_=_+Math.imul(nr,rr)|0,_=_+Math.imul(or,Wt)|0,it=it+Math.imul(or,rr)|0,tt=tt+Math.imul(er,tr)|0,_=_+Math.imul(er,ir)|0,_=_+Math.imul(Vt,tr)|0,it=it+Math.imul(Vt,ir)|0,tt=tt+Math.imul(Xt,ar)|0,_=_+Math.imul(Xt,gr)|0,_=_+Math.imul(Jt,ar)|0,it=it+Math.imul(Jt,gr)|0,tt=tt+Math.imul(Nt,ur)|0,_=_+Math.imul(Nt,vr)|0,_=_+Math.imul(Kt,ur)|0,it=it+Math.imul(Kt,vr)|0,tt=tt+Math.imul(Ct,lr)|0,_=_+Math.imul(Ct,_r)|0,_=_+Math.imul(Ut,lr)|0,it=it+Math.imul(Ut,_r)|0,tt=tt+Math.imul(Mt,fr)|0,_=_+Math.imul(Mt,br)|0,_=_+Math.imul(At,fr)|0,it=it+Math.imul(At,br)|0,tt=tt+Math.imul(vt,cr)|0,_=_+Math.imul(vt,wr)|0,_=_+Math.imul(Rt,cr)|0,it=it+Math.imul(Rt,wr)|0;var jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(jr>>>26)|0,jr&=67108863,tt=Math.imul(Yt,kt),_=Math.imul(Yt,zt),_=_+Math.imul(Zt,kt)|0,it=Math.imul(Zt,zt),tt=tt+Math.imul(Ft,Wt)|0,_=_+Math.imul(Ft,rr)|0,_=_+Math.imul(jt,Wt)|0,it=it+Math.imul(jt,rr)|0,tt=tt+Math.imul(nr,tr)|0,_=_+Math.imul(nr,ir)|0,_=_+Math.imul(or,tr)|0,it=it+Math.imul(or,ir)|0,tt=tt+Math.imul(er,ar)|0,_=_+Math.imul(er,gr)|0,_=_+Math.imul(Vt,ar)|0,it=it+Math.imul(Vt,gr)|0,tt=tt+Math.imul(Xt,ur)|0,_=_+Math.imul(Xt,vr)|0,_=_+Math.imul(Jt,ur)|0,it=it+Math.imul(Jt,vr)|0,tt=tt+Math.imul(Nt,lr)|0,_=_+Math.imul(Nt,_r)|0,_=_+Math.imul(Kt,lr)|0,it=it+Math.imul(Kt,_r)|0,tt=tt+Math.imul(Ct,fr)|0,_=_+Math.imul(Ct,br)|0,_=_+Math.imul(Ut,fr)|0,it=it+Math.imul(Ut,br)|0,tt=tt+Math.imul(Mt,cr)|0,_=_+Math.imul(Mt,wr)|0,_=_+Math.imul(At,cr)|0,it=it+Math.imul(At,wr)|0,tt=tt+Math.imul(vt,dr)|0,_=_+Math.imul(vt,Er)|0,_=_+Math.imul(Rt,dr)|0,it=it+Math.imul(Rt,Er)|0;var Wr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,tt=Math.imul(It,kt),_=Math.imul(It,zt),_=_+Math.imul(Et,kt)|0,it=Math.imul(Et,zt),tt=tt+Math.imul(Yt,Wt)|0,_=_+Math.imul(Yt,rr)|0,_=_+Math.imul(Zt,Wt)|0,it=it+Math.imul(Zt,rr)|0,tt=tt+Math.imul(Ft,tr)|0,_=_+Math.imul(Ft,ir)|0,_=_+Math.imul(jt,tr)|0,it=it+Math.imul(jt,ir)|0,tt=tt+Math.imul(nr,ar)|0,_=_+Math.imul(nr,gr)|0,_=_+Math.imul(or,ar)|0,it=it+Math.imul(or,gr)|0,tt=tt+Math.imul(er,ur)|0,_=_+Math.imul(er,vr)|0,_=_+Math.imul(Vt,ur)|0,it=it+Math.imul(Vt,vr)|0,tt=tt+Math.imul(Xt,lr)|0,_=_+Math.imul(Xt,_r)|0,_=_+Math.imul(Jt,lr)|0,it=it+Math.imul(Jt,_r)|0,tt=tt+Math.imul(Nt,fr)|0,_=_+Math.imul(Nt,br)|0,_=_+Math.imul(Kt,fr)|0,it=it+Math.imul(Kt,br)|0,tt=tt+Math.imul(Ct,cr)|0,_=_+Math.imul(Ct,wr)|0,_=_+Math.imul(Ut,cr)|0,it=it+Math.imul(Ut,wr)|0,tt=tt+Math.imul(Mt,dr)|0,_=_+Math.imul(Mt,Er)|0,_=_+Math.imul(At,dr)|0,it=it+Math.imul(At,Er)|0,tt=tt+Math.imul(vt,pr)|0,_=_+Math.imul(vt,Sr)|0,_=_+Math.imul(Rt,pr)|0,it=it+Math.imul(Rt,Sr)|0;var Vr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,tt=Math.imul(It,Wt),_=Math.imul(It,rr),_=_+Math.imul(Et,Wt)|0,it=Math.imul(Et,rr),tt=tt+Math.imul(Yt,tr)|0,_=_+Math.imul(Yt,ir)|0,_=_+Math.imul(Zt,tr)|0,it=it+Math.imul(Zt,ir)|0,tt=tt+Math.imul(Ft,ar)|0,_=_+Math.imul(Ft,gr)|0,_=_+Math.imul(jt,ar)|0,it=it+Math.imul(jt,gr)|0,tt=tt+Math.imul(nr,ur)|0,_=_+Math.imul(nr,vr)|0,_=_+Math.imul(or,ur)|0,it=it+Math.imul(or,vr)|0,tt=tt+Math.imul(er,lr)|0,_=_+Math.imul(er,_r)|0,_=_+Math.imul(Vt,lr)|0,it=it+Math.imul(Vt,_r)|0,tt=tt+Math.imul(Xt,fr)|0,_=_+Math.imul(Xt,br)|0,_=_+Math.imul(Jt,fr)|0,it=it+Math.imul(Jt,br)|0,tt=tt+Math.imul(Nt,cr)|0,_=_+Math.imul(Nt,wr)|0,_=_+Math.imul(Kt,cr)|0,it=it+Math.imul(Kt,wr)|0,tt=tt+Math.imul(Ct,dr)|0,_=_+Math.imul(Ct,Er)|0,_=_+Math.imul(Ut,dr)|0,it=it+Math.imul(Ut,Er)|0,tt=tt+Math.imul(Mt,pr)|0,_=_+Math.imul(Mt,Sr)|0,_=_+Math.imul(At,pr)|0,it=it+Math.imul(At,Sr)|0;var Gr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,tt=Math.imul(It,tr),_=Math.imul(It,ir),_=_+Math.imul(Et,tr)|0,it=Math.imul(Et,ir),tt=tt+Math.imul(Yt,ar)|0,_=_+Math.imul(Yt,gr)|0,_=_+Math.imul(Zt,ar)|0,it=it+Math.imul(Zt,gr)|0,tt=tt+Math.imul(Ft,ur)|0,_=_+Math.imul(Ft,vr)|0,_=_+Math.imul(jt,ur)|0,it=it+Math.imul(jt,vr)|0,tt=tt+Math.imul(nr,lr)|0,_=_+Math.imul(nr,_r)|0,_=_+Math.imul(or,lr)|0,it=it+Math.imul(or,_r)|0,tt=tt+Math.imul(er,fr)|0,_=_+Math.imul(er,br)|0,_=_+Math.imul(Vt,fr)|0,it=it+Math.imul(Vt,br)|0,tt=tt+Math.imul(Xt,cr)|0,_=_+Math.imul(Xt,wr)|0,_=_+Math.imul(Jt,cr)|0,it=it+Math.imul(Jt,wr)|0,tt=tt+Math.imul(Nt,dr)|0,_=_+Math.imul(Nt,Er)|0,_=_+Math.imul(Kt,dr)|0,it=it+Math.imul(Kt,Er)|0,tt=tt+Math.imul(Ct,pr)|0,_=_+Math.imul(Ct,Sr)|0,_=_+Math.imul(Ut,pr)|0,it=it+Math.imul(Ut,Sr)|0;var Yr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,tt=Math.imul(It,ar),_=Math.imul(It,gr),_=_+Math.imul(Et,ar)|0,it=Math.imul(Et,gr),tt=tt+Math.imul(Yt,ur)|0,_=_+Math.imul(Yt,vr)|0,_=_+Math.imul(Zt,ur)|0,it=it+Math.imul(Zt,vr)|0,tt=tt+Math.imul(Ft,lr)|0,_=_+Math.imul(Ft,_r)|0,_=_+Math.imul(jt,lr)|0,it=it+Math.imul(jt,_r)|0,tt=tt+Math.imul(nr,fr)|0,_=_+Math.imul(nr,br)|0,_=_+Math.imul(or,fr)|0,it=it+Math.imul(or,br)|0,tt=tt+Math.imul(er,cr)|0,_=_+Math.imul(er,wr)|0,_=_+Math.imul(Vt,cr)|0,it=it+Math.imul(Vt,wr)|0,tt=tt+Math.imul(Xt,dr)|0,_=_+Math.imul(Xt,Er)|0,_=_+Math.imul(Jt,dr)|0,it=it+Math.imul(Jt,Er)|0,tt=tt+Math.imul(Nt,pr)|0,_=_+Math.imul(Nt,Sr)|0,_=_+Math.imul(Kt,pr)|0,it=it+Math.imul(Kt,Sr)|0;var Zr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,tt=Math.imul(It,ur),_=Math.imul(It,vr),_=_+Math.imul(Et,ur)|0,it=Math.imul(Et,vr),tt=tt+Math.imul(Yt,lr)|0,_=_+Math.imul(Yt,_r)|0,_=_+Math.imul(Zt,lr)|0,it=it+Math.imul(Zt,_r)|0,tt=tt+Math.imul(Ft,fr)|0,_=_+Math.imul(Ft,br)|0,_=_+Math.imul(jt,fr)|0,it=it+Math.imul(jt,br)|0,tt=tt+Math.imul(nr,cr)|0,_=_+Math.imul(nr,wr)|0,_=_+Math.imul(or,cr)|0,it=it+Math.imul(or,wr)|0,tt=tt+Math.imul(er,dr)|0,_=_+Math.imul(er,Er)|0,_=_+Math.imul(Vt,dr)|0,it=it+Math.imul(Vt,Er)|0,tt=tt+Math.imul(Xt,pr)|0,_=_+Math.imul(Xt,Sr)|0,_=_+Math.imul(Jt,pr)|0,it=it+Math.imul(Jt,Sr)|0;var Xr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,tt=Math.imul(It,lr),_=Math.imul(It,_r),_=_+Math.imul(Et,lr)|0,it=Math.imul(Et,_r),tt=tt+Math.imul(Yt,fr)|0,_=_+Math.imul(Yt,br)|0,_=_+Math.imul(Zt,fr)|0,it=it+Math.imul(Zt,br)|0,tt=tt+Math.imul(Ft,cr)|0,_=_+Math.imul(Ft,wr)|0,_=_+Math.imul(jt,cr)|0,it=it+Math.imul(jt,wr)|0,tt=tt+Math.imul(nr,dr)|0,_=_+Math.imul(nr,Er)|0,_=_+Math.imul(or,dr)|0,it=it+Math.imul(or,Er)|0,tt=tt+Math.imul(er,pr)|0,_=_+Math.imul(er,Sr)|0,_=_+Math.imul(Vt,pr)|0,it=it+Math.imul(Vt,Sr)|0;var Jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,tt=Math.imul(It,fr),_=Math.imul(It,br),_=_+Math.imul(Et,fr)|0,it=Math.imul(Et,br),tt=tt+Math.imul(Yt,cr)|0,_=_+Math.imul(Yt,wr)|0,_=_+Math.imul(Zt,cr)|0,it=it+Math.imul(Zt,wr)|0,tt=tt+Math.imul(Ft,dr)|0,_=_+Math.imul(Ft,Er)|0,_=_+Math.imul(jt,dr)|0,it=it+Math.imul(jt,Er)|0,tt=tt+Math.imul(nr,pr)|0,_=_+Math.imul(nr,Sr)|0,_=_+Math.imul(or,pr)|0,it=it+Math.imul(or,Sr)|0;var Qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,tt=Math.imul(It,cr),_=Math.imul(It,wr),_=_+Math.imul(Et,cr)|0,it=Math.imul(Et,wr),tt=tt+Math.imul(Yt,dr)|0,_=_+Math.imul(Yt,Er)|0,_=_+Math.imul(Zt,dr)|0,it=it+Math.imul(Zt,Er)|0,tt=tt+Math.imul(Ft,pr)|0,_=_+Math.imul(Ft,Sr)|0,_=_+Math.imul(jt,pr)|0,it=it+Math.imul(jt,Sr)|0;var en=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(en>>>26)|0,en&=67108863,tt=Math.imul(It,dr),_=Math.imul(It,Er),_=_+Math.imul(Et,dr)|0,it=Math.imul(Et,Er),tt=tt+Math.imul(Yt,pr)|0,_=_+Math.imul(Yt,Sr)|0,_=_+Math.imul(Zt,pr)|0,it=it+Math.imul(Zt,Sr)|0;var tn=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(tn>>>26)|0,tn&=67108863,tt=Math.imul(It,pr),_=Math.imul(It,Sr),_=_+Math.imul(Et,pr)|0,it=Math.imul(Et,Sr);var rn=(lt+tt|0)+((_&8191)<<13)|0;return lt=(it+(_>>>13)|0)+(rn>>>26)|0,rn&=67108863,at[0]=Or,at[1]=Nr,at[2]=Ur,at[3]=Hr,at[4]=Fr,at[5]=qr,at[6]=Kr,at[7]=jr,at[8]=Wr,at[9]=Vr,at[10]=Gr,at[11]=Yr,at[12]=Zr,at[13]=Xr,at[14]=Jr,at[15]=Qr,at[16]=en,at[17]=tn,at[18]=rn,lt!==0&&(at[19]=lt,$.length++),$};Math.imul||(wt=gt);function St(ct,g,b){b.negative=g.negative^ct.negative,b.length=ct.length+g.length;for(var $=0,_e=0,rt=0;rt>>26)|0,_e+=at>>>26,at&=67108863}b.words[rt]=lt,$=at,at=_e}return $!==0?b.words[rt]=$:b.length--,b.strip()}function _t(ct,g,b){var $=new mt;return $.mulp(ct,g,b)}h.prototype.mulTo=function(g,b){var $,_e=this.length+g.length;return this.length===10&&g.length===10?$=wt(this,g,b):_e<63?$=gt(this,g,b):_e<1024?$=St(this,g,b):$=_t(this,g,b),$};function mt(ct,g){this.x=ct,this.y=g}mt.prototype.makeRBT=function(g){for(var b=new Array(g),$=h.prototype._countBits(g)-1,_e=0;_e>=1;return _e},mt.prototype.permute=function(g,b,$,_e,rt,at){for(var lt=0;lt>>1)rt++;return 1<>>13,$[2*at+1]=rt&8191,rt=rt>>>13;for(at=2*b;at<_e;++at)$[at]=0;c(rt===0),c((rt&-8192)===0)},mt.prototype.stub=function(g){for(var b=new Array(g),$=0;$>=26,b+=_e/67108864|0,b+=rt>>>26,this.words[$]=rt&67108863}return b!==0&&(this.words[$]=b,this.length++),this},h.prototype.muln=function(g){return this.clone().imuln(g)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(g){var b=dt(g);if(b.length===0)return new h(1);for(var $=this,_e=0;_e=0);var b=g%26,$=(g-b)/26,_e=67108863>>>26-b<<26-b,rt;if(b!==0){var at=0;for(rt=0;rt>>26-b}at&&(this.words[rt]=at,this.length++)}if($!==0){for(rt=this.length-1;rt>=0;rt--)this.words[rt+$]=this.words[rt];for(rt=0;rt<$;rt++)this.words[rt]=0;this.length+=$}return this.strip()},h.prototype.ishln=function(g){return c(this.negative===0),this.iushln(g)},h.prototype.iushrn=function(g,b,$){c(typeof g=="number"&&g>=0);var _e;b?_e=(b-b%26)/26:_e=0;var rt=g%26,at=Math.min((g-rt)/26,this.length),lt=67108863^67108863>>>rt<at)for(this.length-=at,_=0;_=0&&(it!==0||_>=_e);_--){var yt=this.words[_]|0;this.words[_]=it<<26-rt|yt>>>rt,it=yt<}return tt&&it!==0&&(tt.words[tt.length++]=it),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(g,b,$){return c(this.negative===0),this.iushrn(g,b,$)},h.prototype.shln=function(g){return this.clone().ishln(g)},h.prototype.ushln=function(g){return this.clone().iushln(g)},h.prototype.shrn=function(g){return this.clone().ishrn(g)},h.prototype.ushrn=function(g){return this.clone().iushrn(g)},h.prototype.testn=function(g){c(typeof g=="number"&&g>=0);var b=g%26,$=(g-b)/26,_e=1<=0);var b=g%26,$=(g-b)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=$)return this;if(b!==0&&$++,this.length=Math.min($,this.length),b!==0){var _e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},h.prototype.isubn=function(g){if(c(typeof g=="number"),c(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(tt/67108864|0),this.words[rt+$]=at&67108863}for(;rt>26,this.words[rt+$]=at&67108863;if(lt===0)return this.strip();for(c(lt===-1),lt=0,rt=0;rt>26,this.words[rt]=at&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(g,b){var $=this.length-g.length,_e=this.clone(),rt=g,at=rt.words[rt.length-1]|0,lt=this._countBits(at);$=26-lt,$!==0&&(rt=rt.ushln($),_e.iushln($),at=rt.words[rt.length-1]|0);var tt=_e.length-rt.length,_;if(b!=="mod"){_=new h(null),_.length=tt+1,_.words=new Array(_.length);for(var it=0;it<_.length;it++)_.words[it]=0}var yt=_e.clone()._ishlnsubmul(rt,1,tt);yt.negative===0&&(_e=yt,_&&(_.words[tt]=1));for(var vt=tt-1;vt>=0;vt--){var Rt=(_e.words[rt.length+vt]|0)*67108864+(_e.words[rt.length+vt-1]|0);for(Rt=Math.min(Rt/at|0,67108863),_e._ishlnsubmul(rt,Rt,vt);_e.negative!==0;)Rt--,_e.negative=0,_e._ishlnsubmul(rt,1,vt),_e.isZero()||(_e.negative^=1);_&&(_.words[vt]=Rt)}return _&&_.strip(),_e.strip(),b!=="div"&&$!==0&&_e.iushrn($),{div:_||null,mod:_e}},h.prototype.divmod=function(g,b,$){if(c(!g.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var _e,rt,at;return this.negative!==0&&g.negative===0?(at=this.neg().divmod(g,b),b!=="mod"&&(_e=at.div.neg()),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.iadd(g)),{div:_e,mod:rt}):this.negative===0&&g.negative!==0?(at=this.divmod(g.neg(),b),b!=="mod"&&(_e=at.div.neg()),{div:_e,mod:at.mod}):this.negative&g.negative?(at=this.neg().divmod(g.neg(),b),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.isub(g)),{div:at.div,mod:rt}):g.length>this.length||this.cmp(g)<0?{div:new h(0),mod:this}:g.length===1?b==="div"?{div:this.divn(g.words[0]),mod:null}:b==="mod"?{div:null,mod:new h(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new h(this.modn(g.words[0]))}:this._wordDiv(g,b)},h.prototype.div=function(g){return this.divmod(g,"div",!1).div},h.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},h.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},h.prototype.divRound=function(g){var b=this.divmod(g);if(b.mod.isZero())return b.div;var $=b.div.negative!==0?b.mod.isub(g):b.mod,_e=g.ushrn(1),rt=g.andln(1),at=$.cmp(_e);return at<0||rt===1&&at===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},h.prototype.modn=function(g){c(g<=67108863);for(var b=(1<<26)%g,$=0,_e=this.length-1;_e>=0;_e--)$=(b*$+(this.words[_e]|0))%g;return $},h.prototype.idivn=function(g){c(g<=67108863);for(var b=0,$=this.length-1;$>=0;$--){var _e=(this.words[$]|0)+b*67108864;this.words[$]=_e/g|0,b=_e%g}return this.strip()},h.prototype.divn=function(g){return this.clone().idivn(g)},h.prototype.egcd=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=new h(0),lt=new h(1),tt=0;b.isEven()&&$.isEven();)b.iushrn(1),$.iushrn(1),++tt;for(var _=$.clone(),it=b.clone();!b.isZero();){for(var yt=0,vt=1;!(b.words[0]&vt)&&yt<26;++yt,vt<<=1);if(yt>0)for(b.iushrn(yt);yt-- >0;)(_e.isOdd()||rt.isOdd())&&(_e.iadd(_),rt.isub(it)),_e.iushrn(1),rt.iushrn(1);for(var Rt=0,Tt=1;!($.words[0]&Tt)&&Rt<26;++Rt,Tt<<=1);if(Rt>0)for($.iushrn(Rt);Rt-- >0;)(at.isOdd()||lt.isOdd())&&(at.iadd(_),lt.isub(it)),at.iushrn(1),lt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(at),rt.isub(lt)):($.isub(b),at.isub(_e),lt.isub(rt))}return{a:at,b:lt,gcd:$.iushln(tt)}},h.prototype._invmp=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=$.clone();b.cmpn(1)>0&&$.cmpn(1)>0;){for(var lt=0,tt=1;!(b.words[0]&tt)&<<26;++lt,tt<<=1);if(lt>0)for(b.iushrn(lt);lt-- >0;)_e.isOdd()&&_e.iadd(at),_e.iushrn(1);for(var _=0,it=1;!($.words[0]&it)&&_<26;++_,it<<=1);if(_>0)for($.iushrn(_);_-- >0;)rt.isOdd()&&rt.iadd(at),rt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(rt)):($.isub(b),rt.isub(_e))}var yt;return b.cmpn(1)===0?yt=_e:yt=rt,yt.cmpn(0)<0&&yt.iadd(g),yt},h.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var b=this.clone(),$=g.clone();b.negative=0,$.negative=0;for(var _e=0;b.isEven()&&$.isEven();_e++)b.iushrn(1),$.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;$.isEven();)$.iushrn(1);var rt=b.cmp($);if(rt<0){var at=b;b=$,$=at}else if(rt===0||$.cmpn(1)===0)break;b.isub($)}while(!0);return $.iushln(_e)},h.prototype.invm=function(g){return this.egcd(g).a.umod(g)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(g){return this.words[0]&g},h.prototype.bincn=function(g){c(typeof g=="number");var b=g%26,$=(g-b)/26,_e=1<>>26,lt&=67108863,this.words[at]=lt}return rt!==0&&(this.words[at]=rt,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(g){var b=g<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this.strip();var $;if(this.length>1)$=1;else{b&&(g=-g),c(g<=67108863,"Number is too big");var _e=this.words[0]|0;$=_e===g?0:_eg.length)return 1;if(this.length=0;$--){var _e=this.words[$]|0,rt=g.words[$]|0;if(_e!==rt){_ert&&(b=1);break}}return b},h.prototype.gtn=function(g){return this.cmpn(g)===1},h.prototype.gt=function(g){return this.cmp(g)===1},h.prototype.gten=function(g){return this.cmpn(g)>=0},h.prototype.gte=function(g){return this.cmp(g)>=0},h.prototype.ltn=function(g){return this.cmpn(g)===-1},h.prototype.lt=function(g){return this.cmp(g)===-1},h.prototype.lten=function(g){return this.cmpn(g)<=0},h.prototype.lte=function(g){return this.cmp(g)<=0},h.prototype.eqn=function(g){return this.cmpn(g)===0},h.prototype.eq=function(g){return this.cmp(g)===0},h.red=function(g){return new Pt(g)},h.prototype.toRed=function(g){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},h.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(g){return this.red=g,this},h.prototype.forceRed=function(g){return c(!this.red,"Already a number in reduction context"),this._forceRed(g)},h.prototype.redAdd=function(g){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},h.prototype.redIAdd=function(g){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},h.prototype.redSub=function(g){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},h.prototype.redISub=function(g){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},h.prototype.redShl=function(g){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},h.prototype.redMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},h.prototype.redIMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},h.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(g){return c(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var bt={k256:null,p224:null,p192:null,p25519:null};function $t(ct,g){this.name=ct,this.p=new h(g,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$t.prototype._tmp=function(){var g=new h(null);return g.words=new Array(Math.ceil(this.n/13)),g},$t.prototype.ireduce=function(g){var b=g,$;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),$=b.bitLength();while($>this.n);var _e=$0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},$t.prototype.split=function(g,b){g.iushrn(this.n,0,b)},$t.prototype.imulK=function(g){return g.imul(this.k)};function Bt(){$t.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Bt,$t),Bt.prototype.split=function(g,b){for(var $=4194303,_e=Math.min(g.length,9),rt=0;rt<_e;rt++)b.words[rt]=g.words[rt];if(b.length=_e,g.length<=9){g.words[0]=0,g.length=1;return}var at=g.words[9];for(b.words[b.length++]=at&$,rt=10;rt>>22,at=lt}at>>>=22,g.words[rt-10]=at,at===0&&g.length>10?g.length-=10:g.length-=9},Bt.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var b=0,$=0;$>>=26,g.words[$]=rt,b=_e}return b!==0&&(g.words[g.length++]=b),g},h._prime=function(g){if(bt[g])return bt[g];var b;if(g==="k256")b=new Bt;else if(g==="p224")b=new Dt;else if(g==="p192")b=new Ht;else if(g==="p25519")b=new qt;else throw new Error("Unknown prime "+g);return bt[g]=b,b};function Pt(ct){if(typeof ct=="string"){var g=h._prime(ct);this.m=g.p,this.prime=g}else c(ct.gtn(1),"modulus must be greater than 1"),this.m=ct,this.prime=null}Pt.prototype._verify1=function(g){c(g.negative===0,"red works only with positives"),c(g.red,"red works only with red numbers")},Pt.prototype._verify2=function(g,b){c((g.negative|b.negative)===0,"red works only with positives"),c(g.red&&g.red===b.red,"red works only with red numbers")},Pt.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},Pt.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},Pt.prototype.add=function(g,b){this._verify2(g,b);var $=g.add(b);return $.cmp(this.m)>=0&&$.isub(this.m),$._forceRed(this)},Pt.prototype.iadd=function(g,b){this._verify2(g,b);var $=g.iadd(b);return $.cmp(this.m)>=0&&$.isub(this.m),$},Pt.prototype.sub=function(g,b){this._verify2(g,b);var $=g.sub(b);return $.cmpn(0)<0&&$.iadd(this.m),$._forceRed(this)},Pt.prototype.isub=function(g,b){this._verify2(g,b);var $=g.isub(b);return $.cmpn(0)<0&&$.iadd(this.m),$},Pt.prototype.shl=function(g,b){return this._verify1(g),this.imod(g.ushln(b))},Pt.prototype.imul=function(g,b){return this._verify2(g,b),this.imod(g.imul(b))},Pt.prototype.mul=function(g,b){return this._verify2(g,b),this.imod(g.mul(b))},Pt.prototype.isqr=function(g){return this.imul(g,g.clone())},Pt.prototype.sqr=function(g){return this.mul(g,g)},Pt.prototype.sqrt=function(g){if(g.isZero())return g.clone();var b=this.m.andln(3);if(c(b%2===1),b===3){var $=this.m.add(new h(1)).iushrn(2);return this.pow(g,$)}for(var _e=this.m.subn(1),rt=0;!_e.isZero()&&_e.andln(1)===0;)rt++,_e.iushrn(1);c(!_e.isZero());var at=new h(1).toRed(this),lt=at.redNeg(),tt=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new h(2*_*_).toRed(this);this.pow(_,tt).cmp(lt)!==0;)_.redIAdd(lt);for(var it=this.pow(_,_e),yt=this.pow(g,_e.addn(1).iushrn(1)),vt=this.pow(g,_e),Rt=rt;vt.cmp(at)!==0;){for(var Tt=vt,Mt=0;Tt.cmp(at)!==0;Mt++)Tt=Tt.redSqr();c(Mt=0;rt--){for(var it=b.words[rt],yt=_-1;yt>=0;yt--){var vt=it>>yt&1;if(at!==_e[0]&&(at=this.sqr(at)),vt===0&<===0){tt=0;continue}lt<<=1,lt|=vt,tt++,!(tt!==$&&(rt!==0||yt!==0))&&(at=this.mul(at,_e[lt]),tt=0,lt=0)}_=26}return at},Pt.prototype.convertTo=function(g){var b=g.umod(this.m);return b===g?b.clone():b},Pt.prototype.convertFrom=function(g){var b=g.clone();return b.red=null,b},h.mont=function(g){return new Gt(g)};function Gt(ct){Pt.call(this,ct),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}d(Gt,Pt),Gt.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},Gt.prototype.convertFrom=function(g){var b=this.imod(g.mul(this.rinv));return b.red=null,b},Gt.prototype.imul=function(g,b){if(g.isZero()||b.isZero())return g.words[0]=0,g.length=1,g;var $=g.imul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.mul=function(g,b){if(g.isZero()||b.isZero())return new h(0)._forceRed(this);var $=g.mul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.invm=function(g){var b=this.imod(g._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(o,commonjsGlobal$2)})(bn$1);var bnExports$1=bn$1.exports,browser$2,hasRequiredBrowser;function requireBrowser(){if(hasRequiredBrowser)return browser$2;hasRequiredBrowser=1;var o=requireElliptic(),e=bnExports$1;browser$2=function(j){return new c(j)};var a={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};a.p224=a.secp224r1,a.p256=a.secp256r1=a.prime256v1,a.p192=a.secp192r1=a.prime192v1,a.p384=a.secp384r1,a.p521=a.secp521r1;function c(h){this.curveType=a[h],this.curveType||(this.curveType={name:h}),this.curve=new o.ec(this.curveType.name),this.keys=void 0}c.prototype.generateKeys=function(h,j){return this.keys=this.curve.genKeyPair(),this.getPublicKey(h,j)},c.prototype.computeSecret=function(h,j,et){j=j||"utf8",Buffer$1$1.isBuffer(h)||(h=new Buffer$1$1(h,j));var nt=this.curve.keyFromPublic(h).getPublic(),st=nt.mul(this.keys.getPrivate()).getX();return d(st,et,this.curveType.byteLength)},c.prototype.getPublicKey=function(h,j){var et=this.keys.getPublic(j==="compressed",!0);return j==="hybrid"&&(et[et.length-1]%2?et[0]=7:et[0]=6),d(et,h)},c.prototype.getPrivateKey=function(h){return d(this.keys.getPrivate(),h)},c.prototype.setPublicKey=function(h,j){return j=j||"utf8",Buffer$1$1.isBuffer(h)||(h=new Buffer$1$1(h,j)),this.keys._importPublic(h),this},c.prototype.setPrivateKey=function(h,j){j=j||"utf8",Buffer$1$1.isBuffer(h)||(h=new Buffer$1$1(h,j));var et=new e(h);return et=et.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(et),this};function d(h,j,et){Array.isArray(h)||(h=h.toArray());var nt=new Buffer$1$1(h);if(et&&nt.length0?g:b},h.min=function(g,b){return g.cmp(b)<0?g:b},h.prototype._init=function(g,b,$){if(typeof g=="number")return this._initNumber(g,b,$);if(typeof g=="object")return this._initArray(g,b,$);b==="hex"&&(b=16),c(b===(b|0)&&b>=2&&b<=36),g=g.toString().replace(/\s+/g,"");var _e=0;g[0]==="-"&&(_e++,this.negative=1),_e=0;_e-=3)at=g[_e]|g[_e-1]<<8|g[_e-2]<<16,this.words[rt]|=at<>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);else if($==="le")for(_e=0,rt=0;_e>>26-lt&67108863,lt+=24,lt>=26&&(lt-=26,rt++);return this.strip()};function et(ct,g){var b=ct.charCodeAt(g);return b>=65&&b<=70?b-55:b>=97&&b<=102?b-87:b-48&15}function nt(ct,g,b){var $=et(ct,b);return b-1>=g&&($|=et(ct,b-1)<<4),$}h.prototype._parseHex=function(g,b,$){this.length=Math.ceil((g.length-b)/6),this.words=new Array(this.length);for(var _e=0;_e=b;_e-=2)lt=nt(g,b,_e)<=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8;else{var tt=g.length-b;for(_e=tt%2===0?b+1:b;_e=18?(rt-=18,at+=1,this.words[at]|=lt>>>26):rt+=8}this.strip()};function st(ct,g,b,$){for(var _e=0,rt=Math.min(ct.length,b),at=g;at=49?_e+=lt-49+10:lt>=17?_e+=lt-17+10:_e+=lt}return _e}h.prototype._parseBase=function(g,b,$){this.words=[0],this.length=1;for(var _e=0,rt=1;rt<=67108863;rt*=b)_e++;_e--,rt=rt/b|0;for(var at=g.length-$,lt=at%_e,tt=Math.min(at,at-lt)+$,_=0,it=$;it1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},h.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?""};var ot=["","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"],ht=[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],pt=[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];h.prototype.toString=function(g,b){g=g||10,b=b|0||1;var $;if(g===16||g==="hex"){$="";for(var _e=0,rt=0,at=0;at>>24-_e&16777215,_e+=2,_e>=26&&(_e-=26,at--),rt!==0||at!==this.length-1?$=ot[6-tt.length]+tt+$:$=tt+$}for(rt!==0&&($=rt.toString(16)+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}if(g===(g|0)&&g>=2&&g<=36){var _=ht[g],it=pt[g];$="";var yt=this.clone();for(yt.negative=0;!yt.isZero();){var vt=yt.modn(it).toString(g);yt=yt.idivn(it),yt.isZero()?$=vt+$:$=ot[_-vt.length]+vt+$}for(this.isZero()&&($="0"+$);$.length%b!==0;)$="0"+$;return this.negative!==0&&($="-"+$),$}c(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&c(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(g,b){return c(typeof j<"u"),this.toArrayLike(j,g,b)},h.prototype.toArray=function(g,b){return this.toArrayLike(Array,g,b)},h.prototype.toArrayLike=function(g,b,$){var _e=this.byteLength(),rt=$||Math.max(1,_e);c(_e<=rt,"byte array longer than desired length"),c(rt>0,"Requested array length <= 0"),this.strip();var at=b==="le",lt=new g(rt),tt,_,it=this.clone();if(at){for(_=0;!it.isZero();_++)tt=it.andln(255),it.iushrn(8),lt[_]=tt;for(;_=4096&&($+=13,b>>>=13),b>=64&&($+=7,b>>>=7),b>=8&&($+=4,b>>>=4),b>=2&&($+=2,b>>>=2),$+b},h.prototype._zeroBits=function(g){if(g===0)return 26;var b=g,$=0;return b&8191||($+=13,b>>>=13),b&127||($+=7,b>>>=7),b&15||($+=4,b>>>=4),b&3||($+=2,b>>>=2),b&1||$++,$},h.prototype.bitLength=function(){var g=this.words[this.length-1],b=this._countBits(g);return(this.length-1)*26+b};function dt(ct){for(var g=new Array(ct.bitLength()),b=0;b>>_e}return g}h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,b=0;bg.length?this.clone().ior(g):g.clone().ior(this)},h.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},h.prototype.iuand=function(g){var b;this.length>g.length?b=g:b=this;for(var $=0;$g.length?this.clone().iand(g):g.clone().iand(this)},h.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},h.prototype.iuxor=function(g){var b,$;this.length>g.length?(b=this,$=g):(b=g,$=this);for(var _e=0;_e<$.length;_e++)this.words[_e]=b.words[_e]^$.words[_e];if(this!==b)for(;_eg.length?this.clone().ixor(g):g.clone().ixor(this)},h.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},h.prototype.inotn=function(g){c(typeof g=="number"&&g>=0);var b=Math.ceil(g/26)|0,$=g%26;this._expand(b),$>0&&b--;for(var _e=0;_e0&&(this.words[_e]=~this.words[_e]&67108863>>26-$),this.strip()},h.prototype.notn=function(g){return this.clone().inotn(g)},h.prototype.setn=function(g,b){c(typeof g=="number"&&g>=0);var $=g/26|0,_e=g%26;return this._expand($+1),b?this.words[$]=this.words[$]|1<<_e:this.words[$]=this.words[$]&~(1<<_e),this.strip()},h.prototype.iadd=function(g){var b;if(this.negative!==0&&g.negative===0)return this.negative=0,b=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,b=this.isub(g),g.negative=1,b._normSign();var $,_e;this.length>g.length?($=this,_e=g):($=g,_e=this);for(var rt=0,at=0;at<_e.length;at++)b=($.words[at]|0)+(_e.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;for(;rt!==0&&at<$.length;at++)b=($.words[at]|0)+rt,this.words[at]=b&67108863,rt=b>>>26;if(this.length=$.length,rt!==0)this.words[this.length]=rt,this.length++;else if($!==this)for(;at<$.length;at++)this.words[at]=$.words[at];return this},h.prototype.add=function(g){var b;return g.negative!==0&&this.negative===0?(g.negative=0,b=this.sub(g),g.negative^=1,b):g.negative===0&&this.negative!==0?(this.negative=0,b=g.sub(this),this.negative=1,b):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},h.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var b=this.iadd(g);return g.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var $=this.cmp(g);if($===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _e,rt;$>0?(_e=this,rt=g):(_e=g,rt=this);for(var at=0,lt=0;lt>26,this.words[lt]=b&67108863;for(;at!==0&<<_e.length;lt++)b=(_e.words[lt]|0)+at,at=b>>26,this.words[lt]=b&67108863;if(at===0&<<_e.length&&_e!==this)for(;lt<_e.length;lt++)this.words[lt]=_e.words[lt];return this.length=Math.max(this.length,lt),_e!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(g){return this.clone().isub(g)};function gt(ct,g,b){b.negative=g.negative^ct.negative;var $=ct.length+g.length|0;b.length=$,$=$-1|0;var _e=ct.words[0]|0,rt=g.words[0]|0,at=_e*rt,lt=at&67108863,tt=at/67108864|0;b.words[0]=lt;for(var _=1;_<$;_++){for(var it=tt>>>26,yt=tt&67108863,vt=Math.min(_,g.length-1),Rt=Math.max(0,_-ct.length+1);Rt<=vt;Rt++){var Tt=_-Rt|0;_e=ct.words[Tt]|0,rt=g.words[Rt]|0,at=_e*rt+yt,it+=at/67108864|0,yt=at&67108863}b.words[_]=yt|0,tt=it|0}return tt!==0?b.words[_]=tt|0:b.length--,b.strip()}var wt=function(g,b,$){var _e=g.words,rt=b.words,at=$.words,lt=0,tt,_,it,yt=_e[0]|0,vt=yt&8191,Rt=yt>>>13,Tt=_e[1]|0,Mt=Tt&8191,At=Tt>>>13,Ot=_e[2]|0,Ct=Ot&8191,Ut=Ot>>>13,Lt=_e[3]|0,Nt=Lt&8191,Kt=Lt>>>13,yr=_e[4]|0,Xt=yr&8191,Jt=yr>>>13,Ar=_e[5]|0,er=Ar&8191,Vt=Ar>>>13,Ir=_e[6]|0,nr=Ir&8191,or=Ir>>>13,xr=_e[7]|0,Ft=xr&8191,jt=xr>>>13,Rr=_e[8]|0,Yt=Rr&8191,Zt=Rr>>>13,$r=_e[9]|0,It=$r&8191,Et=$r>>>13,xt=rt[0]|0,kt=xt&8191,zt=xt>>>13,Qt=rt[1]|0,Wt=Qt&8191,rr=Qt>>>13,Mr=rt[2]|0,tr=Mr&8191,ir=Mr>>>13,Tr=rt[3]|0,ar=Tr&8191,gr=Tr>>>13,Cr=rt[4]|0,ur=Cr&8191,vr=Cr>>>13,Br=rt[5]|0,lr=Br&8191,_r=Br>>>13,kr=rt[6]|0,fr=kr&8191,br=kr>>>13,Lr=rt[7]|0,cr=Lr&8191,wr=Lr>>>13,Pr=rt[8]|0,dr=Pr&8191,Er=Pr>>>13,Dr=rt[9]|0,pr=Dr&8191,Sr=Dr>>>13;$.negative=g.negative^b.negative,$.length=19,tt=Math.imul(vt,kt),_=Math.imul(vt,zt),_=_+Math.imul(Rt,kt)|0,it=Math.imul(Rt,zt);var Or=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Or>>>26)|0,Or&=67108863,tt=Math.imul(Mt,kt),_=Math.imul(Mt,zt),_=_+Math.imul(At,kt)|0,it=Math.imul(At,zt),tt=tt+Math.imul(vt,Wt)|0,_=_+Math.imul(vt,rr)|0,_=_+Math.imul(Rt,Wt)|0,it=it+Math.imul(Rt,rr)|0;var Nr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,tt=Math.imul(Ct,kt),_=Math.imul(Ct,zt),_=_+Math.imul(Ut,kt)|0,it=Math.imul(Ut,zt),tt=tt+Math.imul(Mt,Wt)|0,_=_+Math.imul(Mt,rr)|0,_=_+Math.imul(At,Wt)|0,it=it+Math.imul(At,rr)|0,tt=tt+Math.imul(vt,tr)|0,_=_+Math.imul(vt,ir)|0,_=_+Math.imul(Rt,tr)|0,it=it+Math.imul(Rt,ir)|0;var Ur=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,tt=Math.imul(Nt,kt),_=Math.imul(Nt,zt),_=_+Math.imul(Kt,kt)|0,it=Math.imul(Kt,zt),tt=tt+Math.imul(Ct,Wt)|0,_=_+Math.imul(Ct,rr)|0,_=_+Math.imul(Ut,Wt)|0,it=it+Math.imul(Ut,rr)|0,tt=tt+Math.imul(Mt,tr)|0,_=_+Math.imul(Mt,ir)|0,_=_+Math.imul(At,tr)|0,it=it+Math.imul(At,ir)|0,tt=tt+Math.imul(vt,ar)|0,_=_+Math.imul(vt,gr)|0,_=_+Math.imul(Rt,ar)|0,it=it+Math.imul(Rt,gr)|0;var Hr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,tt=Math.imul(Xt,kt),_=Math.imul(Xt,zt),_=_+Math.imul(Jt,kt)|0,it=Math.imul(Jt,zt),tt=tt+Math.imul(Nt,Wt)|0,_=_+Math.imul(Nt,rr)|0,_=_+Math.imul(Kt,Wt)|0,it=it+Math.imul(Kt,rr)|0,tt=tt+Math.imul(Ct,tr)|0,_=_+Math.imul(Ct,ir)|0,_=_+Math.imul(Ut,tr)|0,it=it+Math.imul(Ut,ir)|0,tt=tt+Math.imul(Mt,ar)|0,_=_+Math.imul(Mt,gr)|0,_=_+Math.imul(At,ar)|0,it=it+Math.imul(At,gr)|0,tt=tt+Math.imul(vt,ur)|0,_=_+Math.imul(vt,vr)|0,_=_+Math.imul(Rt,ur)|0,it=it+Math.imul(Rt,vr)|0;var Fr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,tt=Math.imul(er,kt),_=Math.imul(er,zt),_=_+Math.imul(Vt,kt)|0,it=Math.imul(Vt,zt),tt=tt+Math.imul(Xt,Wt)|0,_=_+Math.imul(Xt,rr)|0,_=_+Math.imul(Jt,Wt)|0,it=it+Math.imul(Jt,rr)|0,tt=tt+Math.imul(Nt,tr)|0,_=_+Math.imul(Nt,ir)|0,_=_+Math.imul(Kt,tr)|0,it=it+Math.imul(Kt,ir)|0,tt=tt+Math.imul(Ct,ar)|0,_=_+Math.imul(Ct,gr)|0,_=_+Math.imul(Ut,ar)|0,it=it+Math.imul(Ut,gr)|0,tt=tt+Math.imul(Mt,ur)|0,_=_+Math.imul(Mt,vr)|0,_=_+Math.imul(At,ur)|0,it=it+Math.imul(At,vr)|0,tt=tt+Math.imul(vt,lr)|0,_=_+Math.imul(vt,_r)|0,_=_+Math.imul(Rt,lr)|0,it=it+Math.imul(Rt,_r)|0;var qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(qr>>>26)|0,qr&=67108863,tt=Math.imul(nr,kt),_=Math.imul(nr,zt),_=_+Math.imul(or,kt)|0,it=Math.imul(or,zt),tt=tt+Math.imul(er,Wt)|0,_=_+Math.imul(er,rr)|0,_=_+Math.imul(Vt,Wt)|0,it=it+Math.imul(Vt,rr)|0,tt=tt+Math.imul(Xt,tr)|0,_=_+Math.imul(Xt,ir)|0,_=_+Math.imul(Jt,tr)|0,it=it+Math.imul(Jt,ir)|0,tt=tt+Math.imul(Nt,ar)|0,_=_+Math.imul(Nt,gr)|0,_=_+Math.imul(Kt,ar)|0,it=it+Math.imul(Kt,gr)|0,tt=tt+Math.imul(Ct,ur)|0,_=_+Math.imul(Ct,vr)|0,_=_+Math.imul(Ut,ur)|0,it=it+Math.imul(Ut,vr)|0,tt=tt+Math.imul(Mt,lr)|0,_=_+Math.imul(Mt,_r)|0,_=_+Math.imul(At,lr)|0,it=it+Math.imul(At,_r)|0,tt=tt+Math.imul(vt,fr)|0,_=_+Math.imul(vt,br)|0,_=_+Math.imul(Rt,fr)|0,it=it+Math.imul(Rt,br)|0;var Kr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,tt=Math.imul(Ft,kt),_=Math.imul(Ft,zt),_=_+Math.imul(jt,kt)|0,it=Math.imul(jt,zt),tt=tt+Math.imul(nr,Wt)|0,_=_+Math.imul(nr,rr)|0,_=_+Math.imul(or,Wt)|0,it=it+Math.imul(or,rr)|0,tt=tt+Math.imul(er,tr)|0,_=_+Math.imul(er,ir)|0,_=_+Math.imul(Vt,tr)|0,it=it+Math.imul(Vt,ir)|0,tt=tt+Math.imul(Xt,ar)|0,_=_+Math.imul(Xt,gr)|0,_=_+Math.imul(Jt,ar)|0,it=it+Math.imul(Jt,gr)|0,tt=tt+Math.imul(Nt,ur)|0,_=_+Math.imul(Nt,vr)|0,_=_+Math.imul(Kt,ur)|0,it=it+Math.imul(Kt,vr)|0,tt=tt+Math.imul(Ct,lr)|0,_=_+Math.imul(Ct,_r)|0,_=_+Math.imul(Ut,lr)|0,it=it+Math.imul(Ut,_r)|0,tt=tt+Math.imul(Mt,fr)|0,_=_+Math.imul(Mt,br)|0,_=_+Math.imul(At,fr)|0,it=it+Math.imul(At,br)|0,tt=tt+Math.imul(vt,cr)|0,_=_+Math.imul(vt,wr)|0,_=_+Math.imul(Rt,cr)|0,it=it+Math.imul(Rt,wr)|0;var jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(jr>>>26)|0,jr&=67108863,tt=Math.imul(Yt,kt),_=Math.imul(Yt,zt),_=_+Math.imul(Zt,kt)|0,it=Math.imul(Zt,zt),tt=tt+Math.imul(Ft,Wt)|0,_=_+Math.imul(Ft,rr)|0,_=_+Math.imul(jt,Wt)|0,it=it+Math.imul(jt,rr)|0,tt=tt+Math.imul(nr,tr)|0,_=_+Math.imul(nr,ir)|0,_=_+Math.imul(or,tr)|0,it=it+Math.imul(or,ir)|0,tt=tt+Math.imul(er,ar)|0,_=_+Math.imul(er,gr)|0,_=_+Math.imul(Vt,ar)|0,it=it+Math.imul(Vt,gr)|0,tt=tt+Math.imul(Xt,ur)|0,_=_+Math.imul(Xt,vr)|0,_=_+Math.imul(Jt,ur)|0,it=it+Math.imul(Jt,vr)|0,tt=tt+Math.imul(Nt,lr)|0,_=_+Math.imul(Nt,_r)|0,_=_+Math.imul(Kt,lr)|0,it=it+Math.imul(Kt,_r)|0,tt=tt+Math.imul(Ct,fr)|0,_=_+Math.imul(Ct,br)|0,_=_+Math.imul(Ut,fr)|0,it=it+Math.imul(Ut,br)|0,tt=tt+Math.imul(Mt,cr)|0,_=_+Math.imul(Mt,wr)|0,_=_+Math.imul(At,cr)|0,it=it+Math.imul(At,wr)|0,tt=tt+Math.imul(vt,dr)|0,_=_+Math.imul(vt,Er)|0,_=_+Math.imul(Rt,dr)|0,it=it+Math.imul(Rt,Er)|0;var Wr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,tt=Math.imul(It,kt),_=Math.imul(It,zt),_=_+Math.imul(Et,kt)|0,it=Math.imul(Et,zt),tt=tt+Math.imul(Yt,Wt)|0,_=_+Math.imul(Yt,rr)|0,_=_+Math.imul(Zt,Wt)|0,it=it+Math.imul(Zt,rr)|0,tt=tt+Math.imul(Ft,tr)|0,_=_+Math.imul(Ft,ir)|0,_=_+Math.imul(jt,tr)|0,it=it+Math.imul(jt,ir)|0,tt=tt+Math.imul(nr,ar)|0,_=_+Math.imul(nr,gr)|0,_=_+Math.imul(or,ar)|0,it=it+Math.imul(or,gr)|0,tt=tt+Math.imul(er,ur)|0,_=_+Math.imul(er,vr)|0,_=_+Math.imul(Vt,ur)|0,it=it+Math.imul(Vt,vr)|0,tt=tt+Math.imul(Xt,lr)|0,_=_+Math.imul(Xt,_r)|0,_=_+Math.imul(Jt,lr)|0,it=it+Math.imul(Jt,_r)|0,tt=tt+Math.imul(Nt,fr)|0,_=_+Math.imul(Nt,br)|0,_=_+Math.imul(Kt,fr)|0,it=it+Math.imul(Kt,br)|0,tt=tt+Math.imul(Ct,cr)|0,_=_+Math.imul(Ct,wr)|0,_=_+Math.imul(Ut,cr)|0,it=it+Math.imul(Ut,wr)|0,tt=tt+Math.imul(Mt,dr)|0,_=_+Math.imul(Mt,Er)|0,_=_+Math.imul(At,dr)|0,it=it+Math.imul(At,Er)|0,tt=tt+Math.imul(vt,pr)|0,_=_+Math.imul(vt,Sr)|0,_=_+Math.imul(Rt,pr)|0,it=it+Math.imul(Rt,Sr)|0;var Vr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,tt=Math.imul(It,Wt),_=Math.imul(It,rr),_=_+Math.imul(Et,Wt)|0,it=Math.imul(Et,rr),tt=tt+Math.imul(Yt,tr)|0,_=_+Math.imul(Yt,ir)|0,_=_+Math.imul(Zt,tr)|0,it=it+Math.imul(Zt,ir)|0,tt=tt+Math.imul(Ft,ar)|0,_=_+Math.imul(Ft,gr)|0,_=_+Math.imul(jt,ar)|0,it=it+Math.imul(jt,gr)|0,tt=tt+Math.imul(nr,ur)|0,_=_+Math.imul(nr,vr)|0,_=_+Math.imul(or,ur)|0,it=it+Math.imul(or,vr)|0,tt=tt+Math.imul(er,lr)|0,_=_+Math.imul(er,_r)|0,_=_+Math.imul(Vt,lr)|0,it=it+Math.imul(Vt,_r)|0,tt=tt+Math.imul(Xt,fr)|0,_=_+Math.imul(Xt,br)|0,_=_+Math.imul(Jt,fr)|0,it=it+Math.imul(Jt,br)|0,tt=tt+Math.imul(Nt,cr)|0,_=_+Math.imul(Nt,wr)|0,_=_+Math.imul(Kt,cr)|0,it=it+Math.imul(Kt,wr)|0,tt=tt+Math.imul(Ct,dr)|0,_=_+Math.imul(Ct,Er)|0,_=_+Math.imul(Ut,dr)|0,it=it+Math.imul(Ut,Er)|0,tt=tt+Math.imul(Mt,pr)|0,_=_+Math.imul(Mt,Sr)|0,_=_+Math.imul(At,pr)|0,it=it+Math.imul(At,Sr)|0;var Gr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,tt=Math.imul(It,tr),_=Math.imul(It,ir),_=_+Math.imul(Et,tr)|0,it=Math.imul(Et,ir),tt=tt+Math.imul(Yt,ar)|0,_=_+Math.imul(Yt,gr)|0,_=_+Math.imul(Zt,ar)|0,it=it+Math.imul(Zt,gr)|0,tt=tt+Math.imul(Ft,ur)|0,_=_+Math.imul(Ft,vr)|0,_=_+Math.imul(jt,ur)|0,it=it+Math.imul(jt,vr)|0,tt=tt+Math.imul(nr,lr)|0,_=_+Math.imul(nr,_r)|0,_=_+Math.imul(or,lr)|0,it=it+Math.imul(or,_r)|0,tt=tt+Math.imul(er,fr)|0,_=_+Math.imul(er,br)|0,_=_+Math.imul(Vt,fr)|0,it=it+Math.imul(Vt,br)|0,tt=tt+Math.imul(Xt,cr)|0,_=_+Math.imul(Xt,wr)|0,_=_+Math.imul(Jt,cr)|0,it=it+Math.imul(Jt,wr)|0,tt=tt+Math.imul(Nt,dr)|0,_=_+Math.imul(Nt,Er)|0,_=_+Math.imul(Kt,dr)|0,it=it+Math.imul(Kt,Er)|0,tt=tt+Math.imul(Ct,pr)|0,_=_+Math.imul(Ct,Sr)|0,_=_+Math.imul(Ut,pr)|0,it=it+Math.imul(Ut,Sr)|0;var Yr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,tt=Math.imul(It,ar),_=Math.imul(It,gr),_=_+Math.imul(Et,ar)|0,it=Math.imul(Et,gr),tt=tt+Math.imul(Yt,ur)|0,_=_+Math.imul(Yt,vr)|0,_=_+Math.imul(Zt,ur)|0,it=it+Math.imul(Zt,vr)|0,tt=tt+Math.imul(Ft,lr)|0,_=_+Math.imul(Ft,_r)|0,_=_+Math.imul(jt,lr)|0,it=it+Math.imul(jt,_r)|0,tt=tt+Math.imul(nr,fr)|0,_=_+Math.imul(nr,br)|0,_=_+Math.imul(or,fr)|0,it=it+Math.imul(or,br)|0,tt=tt+Math.imul(er,cr)|0,_=_+Math.imul(er,wr)|0,_=_+Math.imul(Vt,cr)|0,it=it+Math.imul(Vt,wr)|0,tt=tt+Math.imul(Xt,dr)|0,_=_+Math.imul(Xt,Er)|0,_=_+Math.imul(Jt,dr)|0,it=it+Math.imul(Jt,Er)|0,tt=tt+Math.imul(Nt,pr)|0,_=_+Math.imul(Nt,Sr)|0,_=_+Math.imul(Kt,pr)|0,it=it+Math.imul(Kt,Sr)|0;var Zr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,tt=Math.imul(It,ur),_=Math.imul(It,vr),_=_+Math.imul(Et,ur)|0,it=Math.imul(Et,vr),tt=tt+Math.imul(Yt,lr)|0,_=_+Math.imul(Yt,_r)|0,_=_+Math.imul(Zt,lr)|0,it=it+Math.imul(Zt,_r)|0,tt=tt+Math.imul(Ft,fr)|0,_=_+Math.imul(Ft,br)|0,_=_+Math.imul(jt,fr)|0,it=it+Math.imul(jt,br)|0,tt=tt+Math.imul(nr,cr)|0,_=_+Math.imul(nr,wr)|0,_=_+Math.imul(or,cr)|0,it=it+Math.imul(or,wr)|0,tt=tt+Math.imul(er,dr)|0,_=_+Math.imul(er,Er)|0,_=_+Math.imul(Vt,dr)|0,it=it+Math.imul(Vt,Er)|0,tt=tt+Math.imul(Xt,pr)|0,_=_+Math.imul(Xt,Sr)|0,_=_+Math.imul(Jt,pr)|0,it=it+Math.imul(Jt,Sr)|0;var Xr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,tt=Math.imul(It,lr),_=Math.imul(It,_r),_=_+Math.imul(Et,lr)|0,it=Math.imul(Et,_r),tt=tt+Math.imul(Yt,fr)|0,_=_+Math.imul(Yt,br)|0,_=_+Math.imul(Zt,fr)|0,it=it+Math.imul(Zt,br)|0,tt=tt+Math.imul(Ft,cr)|0,_=_+Math.imul(Ft,wr)|0,_=_+Math.imul(jt,cr)|0,it=it+Math.imul(jt,wr)|0,tt=tt+Math.imul(nr,dr)|0,_=_+Math.imul(nr,Er)|0,_=_+Math.imul(or,dr)|0,it=it+Math.imul(or,Er)|0,tt=tt+Math.imul(er,pr)|0,_=_+Math.imul(er,Sr)|0,_=_+Math.imul(Vt,pr)|0,it=it+Math.imul(Vt,Sr)|0;var Jr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,tt=Math.imul(It,fr),_=Math.imul(It,br),_=_+Math.imul(Et,fr)|0,it=Math.imul(Et,br),tt=tt+Math.imul(Yt,cr)|0,_=_+Math.imul(Yt,wr)|0,_=_+Math.imul(Zt,cr)|0,it=it+Math.imul(Zt,wr)|0,tt=tt+Math.imul(Ft,dr)|0,_=_+Math.imul(Ft,Er)|0,_=_+Math.imul(jt,dr)|0,it=it+Math.imul(jt,Er)|0,tt=tt+Math.imul(nr,pr)|0,_=_+Math.imul(nr,Sr)|0,_=_+Math.imul(or,pr)|0,it=it+Math.imul(or,Sr)|0;var Qr=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,tt=Math.imul(It,cr),_=Math.imul(It,wr),_=_+Math.imul(Et,cr)|0,it=Math.imul(Et,wr),tt=tt+Math.imul(Yt,dr)|0,_=_+Math.imul(Yt,Er)|0,_=_+Math.imul(Zt,dr)|0,it=it+Math.imul(Zt,Er)|0,tt=tt+Math.imul(Ft,pr)|0,_=_+Math.imul(Ft,Sr)|0,_=_+Math.imul(jt,pr)|0,it=it+Math.imul(jt,Sr)|0;var en=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(en>>>26)|0,en&=67108863,tt=Math.imul(It,dr),_=Math.imul(It,Er),_=_+Math.imul(Et,dr)|0,it=Math.imul(Et,Er),tt=tt+Math.imul(Yt,pr)|0,_=_+Math.imul(Yt,Sr)|0,_=_+Math.imul(Zt,pr)|0,it=it+Math.imul(Zt,Sr)|0;var tn=(lt+tt|0)+((_&8191)<<13)|0;lt=(it+(_>>>13)|0)+(tn>>>26)|0,tn&=67108863,tt=Math.imul(It,pr),_=Math.imul(It,Sr),_=_+Math.imul(Et,pr)|0,it=Math.imul(Et,Sr);var rn=(lt+tt|0)+((_&8191)<<13)|0;return lt=(it+(_>>>13)|0)+(rn>>>26)|0,rn&=67108863,at[0]=Or,at[1]=Nr,at[2]=Ur,at[3]=Hr,at[4]=Fr,at[5]=qr,at[6]=Kr,at[7]=jr,at[8]=Wr,at[9]=Vr,at[10]=Gr,at[11]=Yr,at[12]=Zr,at[13]=Xr,at[14]=Jr,at[15]=Qr,at[16]=en,at[17]=tn,at[18]=rn,lt!==0&&(at[19]=lt,$.length++),$};Math.imul||(wt=gt);function St(ct,g,b){b.negative=g.negative^ct.negative,b.length=ct.length+g.length;for(var $=0,_e=0,rt=0;rt>>26)|0,_e+=at>>>26,at&=67108863}b.words[rt]=lt,$=at,at=_e}return $!==0?b.words[rt]=$:b.length--,b.strip()}function _t(ct,g,b){var $=new mt;return $.mulp(ct,g,b)}h.prototype.mulTo=function(g,b){var $,_e=this.length+g.length;return this.length===10&&g.length===10?$=wt(this,g,b):_e<63?$=gt(this,g,b):_e<1024?$=St(this,g,b):$=_t(this,g,b),$};function mt(ct,g){this.x=ct,this.y=g}mt.prototype.makeRBT=function(g){for(var b=new Array(g),$=h.prototype._countBits(g)-1,_e=0;_e>=1;return _e},mt.prototype.permute=function(g,b,$,_e,rt,at){for(var lt=0;lt>>1)rt++;return 1<>>13,$[2*at+1]=rt&8191,rt=rt>>>13;for(at=2*b;at<_e;++at)$[at]=0;c(rt===0),c((rt&-8192)===0)},mt.prototype.stub=function(g){for(var b=new Array(g),$=0;$>=26,b+=_e/67108864|0,b+=rt>>>26,this.words[$]=rt&67108863}return b!==0&&(this.words[$]=b,this.length++),this},h.prototype.muln=function(g){return this.clone().imuln(g)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(g){var b=dt(g);if(b.length===0)return new h(1);for(var $=this,_e=0;_e=0);var b=g%26,$=(g-b)/26,_e=67108863>>>26-b<<26-b,rt;if(b!==0){var at=0;for(rt=0;rt>>26-b}at&&(this.words[rt]=at,this.length++)}if($!==0){for(rt=this.length-1;rt>=0;rt--)this.words[rt+$]=this.words[rt];for(rt=0;rt<$;rt++)this.words[rt]=0;this.length+=$}return this.strip()},h.prototype.ishln=function(g){return c(this.negative===0),this.iushln(g)},h.prototype.iushrn=function(g,b,$){c(typeof g=="number"&&g>=0);var _e;b?_e=(b-b%26)/26:_e=0;var rt=g%26,at=Math.min((g-rt)/26,this.length),lt=67108863^67108863>>>rt<at)for(this.length-=at,_=0;_=0&&(it!==0||_>=_e);_--){var yt=this.words[_]|0;this.words[_]=it<<26-rt|yt>>>rt,it=yt<}return tt&&it!==0&&(tt.words[tt.length++]=it),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(g,b,$){return c(this.negative===0),this.iushrn(g,b,$)},h.prototype.shln=function(g){return this.clone().ishln(g)},h.prototype.ushln=function(g){return this.clone().iushln(g)},h.prototype.shrn=function(g){return this.clone().ishrn(g)},h.prototype.ushrn=function(g){return this.clone().iushrn(g)},h.prototype.testn=function(g){c(typeof g=="number"&&g>=0);var b=g%26,$=(g-b)/26,_e=1<=0);var b=g%26,$=(g-b)/26;if(c(this.negative===0,"imaskn works only with positive numbers"),this.length<=$)return this;if(b!==0&&$++,this.length=Math.min($,this.length),b!==0){var _e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},h.prototype.isubn=function(g){if(c(typeof g=="number"),c(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(tt/67108864|0),this.words[rt+$]=at&67108863}for(;rt>26,this.words[rt+$]=at&67108863;if(lt===0)return this.strip();for(c(lt===-1),lt=0,rt=0;rt>26,this.words[rt]=at&67108863;return this.negative=1,this.strip()},h.prototype._wordDiv=function(g,b){var $=this.length-g.length,_e=this.clone(),rt=g,at=rt.words[rt.length-1]|0,lt=this._countBits(at);$=26-lt,$!==0&&(rt=rt.ushln($),_e.iushln($),at=rt.words[rt.length-1]|0);var tt=_e.length-rt.length,_;if(b!=="mod"){_=new h(null),_.length=tt+1,_.words=new Array(_.length);for(var it=0;it<_.length;it++)_.words[it]=0}var yt=_e.clone()._ishlnsubmul(rt,1,tt);yt.negative===0&&(_e=yt,_&&(_.words[tt]=1));for(var vt=tt-1;vt>=0;vt--){var Rt=(_e.words[rt.length+vt]|0)*67108864+(_e.words[rt.length+vt-1]|0);for(Rt=Math.min(Rt/at|0,67108863),_e._ishlnsubmul(rt,Rt,vt);_e.negative!==0;)Rt--,_e.negative=0,_e._ishlnsubmul(rt,1,vt),_e.isZero()||(_e.negative^=1);_&&(_.words[vt]=Rt)}return _&&_.strip(),_e.strip(),b!=="div"&&$!==0&&_e.iushrn($),{div:_||null,mod:_e}},h.prototype.divmod=function(g,b,$){if(c(!g.isZero()),this.isZero())return{div:new h(0),mod:new h(0)};var _e,rt,at;return this.negative!==0&&g.negative===0?(at=this.neg().divmod(g,b),b!=="mod"&&(_e=at.div.neg()),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.iadd(g)),{div:_e,mod:rt}):this.negative===0&&g.negative!==0?(at=this.divmod(g.neg(),b),b!=="mod"&&(_e=at.div.neg()),{div:_e,mod:at.mod}):this.negative&g.negative?(at=this.neg().divmod(g.neg(),b),b!=="div"&&(rt=at.mod.neg(),$&&rt.negative!==0&&rt.isub(g)),{div:at.div,mod:rt}):g.length>this.length||this.cmp(g)<0?{div:new h(0),mod:this}:g.length===1?b==="div"?{div:this.divn(g.words[0]),mod:null}:b==="mod"?{div:null,mod:new h(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new h(this.modn(g.words[0]))}:this._wordDiv(g,b)},h.prototype.div=function(g){return this.divmod(g,"div",!1).div},h.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},h.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},h.prototype.divRound=function(g){var b=this.divmod(g);if(b.mod.isZero())return b.div;var $=b.div.negative!==0?b.mod.isub(g):b.mod,_e=g.ushrn(1),rt=g.andln(1),at=$.cmp(_e);return at<0||rt===1&&at===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},h.prototype.modn=function(g){c(g<=67108863);for(var b=(1<<26)%g,$=0,_e=this.length-1;_e>=0;_e--)$=(b*$+(this.words[_e]|0))%g;return $},h.prototype.idivn=function(g){c(g<=67108863);for(var b=0,$=this.length-1;$>=0;$--){var _e=(this.words[$]|0)+b*67108864;this.words[$]=_e/g|0,b=_e%g}return this.strip()},h.prototype.divn=function(g){return this.clone().idivn(g)},h.prototype.egcd=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=new h(0),lt=new h(1),tt=0;b.isEven()&&$.isEven();)b.iushrn(1),$.iushrn(1),++tt;for(var _=$.clone(),it=b.clone();!b.isZero();){for(var yt=0,vt=1;!(b.words[0]&vt)&&yt<26;++yt,vt<<=1);if(yt>0)for(b.iushrn(yt);yt-- >0;)(_e.isOdd()||rt.isOdd())&&(_e.iadd(_),rt.isub(it)),_e.iushrn(1),rt.iushrn(1);for(var Rt=0,Tt=1;!($.words[0]&Tt)&&Rt<26;++Rt,Tt<<=1);if(Rt>0)for($.iushrn(Rt);Rt-- >0;)(at.isOdd()||lt.isOdd())&&(at.iadd(_),lt.isub(it)),at.iushrn(1),lt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(at),rt.isub(lt)):($.isub(b),at.isub(_e),lt.isub(rt))}return{a:at,b:lt,gcd:$.iushln(tt)}},h.prototype._invmp=function(g){c(g.negative===0),c(!g.isZero());var b=this,$=g.clone();b.negative!==0?b=b.umod(g):b=b.clone();for(var _e=new h(1),rt=new h(0),at=$.clone();b.cmpn(1)>0&&$.cmpn(1)>0;){for(var lt=0,tt=1;!(b.words[0]&tt)&<<26;++lt,tt<<=1);if(lt>0)for(b.iushrn(lt);lt-- >0;)_e.isOdd()&&_e.iadd(at),_e.iushrn(1);for(var _=0,it=1;!($.words[0]&it)&&_<26;++_,it<<=1);if(_>0)for($.iushrn(_);_-- >0;)rt.isOdd()&&rt.iadd(at),rt.iushrn(1);b.cmp($)>=0?(b.isub($),_e.isub(rt)):($.isub(b),rt.isub(_e))}var yt;return b.cmpn(1)===0?yt=_e:yt=rt,yt.cmpn(0)<0&&yt.iadd(g),yt},h.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var b=this.clone(),$=g.clone();b.negative=0,$.negative=0;for(var _e=0;b.isEven()&&$.isEven();_e++)b.iushrn(1),$.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;$.isEven();)$.iushrn(1);var rt=b.cmp($);if(rt<0){var at=b;b=$,$=at}else if(rt===0||$.cmpn(1)===0)break;b.isub($)}while(!0);return $.iushln(_e)},h.prototype.invm=function(g){return this.egcd(g).a.umod(g)},h.prototype.isEven=function(){return(this.words[0]&1)===0},h.prototype.isOdd=function(){return(this.words[0]&1)===1},h.prototype.andln=function(g){return this.words[0]&g},h.prototype.bincn=function(g){c(typeof g=="number");var b=g%26,$=(g-b)/26,_e=1<>>26,lt&=67108863,this.words[at]=lt}return rt!==0&&(this.words[at]=rt,this.length++),this},h.prototype.isZero=function(){return this.length===1&&this.words[0]===0},h.prototype.cmpn=function(g){var b=g<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this.strip();var $;if(this.length>1)$=1;else{b&&(g=-g),c(g<=67108863,"Number is too big");var _e=this.words[0]|0;$=_e===g?0:_eg.length)return 1;if(this.length=0;$--){var _e=this.words[$]|0,rt=g.words[$]|0;if(_e!==rt){_ert&&(b=1);break}}return b},h.prototype.gtn=function(g){return this.cmpn(g)===1},h.prototype.gt=function(g){return this.cmp(g)===1},h.prototype.gten=function(g){return this.cmpn(g)>=0},h.prototype.gte=function(g){return this.cmp(g)>=0},h.prototype.ltn=function(g){return this.cmpn(g)===-1},h.prototype.lt=function(g){return this.cmp(g)===-1},h.prototype.lten=function(g){return this.cmpn(g)<=0},h.prototype.lte=function(g){return this.cmp(g)<=0},h.prototype.eqn=function(g){return this.cmpn(g)===0},h.prototype.eq=function(g){return this.cmp(g)===0},h.red=function(g){return new Pt(g)},h.prototype.toRed=function(g){return c(!this.red,"Already a number in reduction context"),c(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},h.prototype.fromRed=function(){return c(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(g){return this.red=g,this},h.prototype.forceRed=function(g){return c(!this.red,"Already a number in reduction context"),this._forceRed(g)},h.prototype.redAdd=function(g){return c(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},h.prototype.redIAdd=function(g){return c(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},h.prototype.redSub=function(g){return c(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},h.prototype.redISub=function(g){return c(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},h.prototype.redShl=function(g){return c(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},h.prototype.redMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},h.prototype.redIMul=function(g){return c(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},h.prototype.redSqr=function(){return c(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return c(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return c(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return c(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return c(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(g){return c(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var bt={k256:null,p224:null,p192:null,p25519:null};function $t(ct,g){this.name=ct,this.p=new h(g,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$t.prototype._tmp=function(){var g=new h(null);return g.words=new Array(Math.ceil(this.n/13)),g},$t.prototype.ireduce=function(g){var b=g,$;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),$=b.bitLength();while($>this.n);var _e=$0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},$t.prototype.split=function(g,b){g.iushrn(this.n,0,b)},$t.prototype.imulK=function(g){return g.imul(this.k)};function Bt(){$t.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Bt,$t),Bt.prototype.split=function(g,b){for(var $=4194303,_e=Math.min(g.length,9),rt=0;rt<_e;rt++)b.words[rt]=g.words[rt];if(b.length=_e,g.length<=9){g.words[0]=0,g.length=1;return}var at=g.words[9];for(b.words[b.length++]=at&$,rt=10;rt>>22,at=lt}at>>>=22,g.words[rt-10]=at,at===0&&g.length>10?g.length-=10:g.length-=9},Bt.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var b=0,$=0;$>>=26,g.words[$]=rt,b=_e}return b!==0&&(g.words[g.length++]=b),g},h._prime=function(g){if(bt[g])return bt[g];var b;if(g==="k256")b=new Bt;else if(g==="p224")b=new Dt;else if(g==="p192")b=new Ht;else if(g==="p25519")b=new qt;else throw new Error("Unknown prime "+g);return bt[g]=b,b};function Pt(ct){if(typeof ct=="string"){var g=h._prime(ct);this.m=g.p,this.prime=g}else c(ct.gtn(1),"modulus must be greater than 1"),this.m=ct,this.prime=null}Pt.prototype._verify1=function(g){c(g.negative===0,"red works only with positives"),c(g.red,"red works only with red numbers")},Pt.prototype._verify2=function(g,b){c((g.negative|b.negative)===0,"red works only with positives"),c(g.red&&g.red===b.red,"red works only with red numbers")},Pt.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},Pt.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},Pt.prototype.add=function(g,b){this._verify2(g,b);var $=g.add(b);return $.cmp(this.m)>=0&&$.isub(this.m),$._forceRed(this)},Pt.prototype.iadd=function(g,b){this._verify2(g,b);var $=g.iadd(b);return $.cmp(this.m)>=0&&$.isub(this.m),$},Pt.prototype.sub=function(g,b){this._verify2(g,b);var $=g.sub(b);return $.cmpn(0)<0&&$.iadd(this.m),$._forceRed(this)},Pt.prototype.isub=function(g,b){this._verify2(g,b);var $=g.isub(b);return $.cmpn(0)<0&&$.iadd(this.m),$},Pt.prototype.shl=function(g,b){return this._verify1(g),this.imod(g.ushln(b))},Pt.prototype.imul=function(g,b){return this._verify2(g,b),this.imod(g.imul(b))},Pt.prototype.mul=function(g,b){return this._verify2(g,b),this.imod(g.mul(b))},Pt.prototype.isqr=function(g){return this.imul(g,g.clone())},Pt.prototype.sqr=function(g){return this.mul(g,g)},Pt.prototype.sqrt=function(g){if(g.isZero())return g.clone();var b=this.m.andln(3);if(c(b%2===1),b===3){var $=this.m.add(new h(1)).iushrn(2);return this.pow(g,$)}for(var _e=this.m.subn(1),rt=0;!_e.isZero()&&_e.andln(1)===0;)rt++,_e.iushrn(1);c(!_e.isZero());var at=new h(1).toRed(this),lt=at.redNeg(),tt=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new h(2*_*_).toRed(this);this.pow(_,tt).cmp(lt)!==0;)_.redIAdd(lt);for(var it=this.pow(_,_e),yt=this.pow(g,_e.addn(1).iushrn(1)),vt=this.pow(g,_e),Rt=rt;vt.cmp(at)!==0;){for(var Tt=vt,Mt=0;Tt.cmp(at)!==0;Mt++)Tt=Tt.redSqr();c(Mt=0;rt--){for(var it=b.words[rt],yt=_-1;yt>=0;yt--){var vt=it>>yt&1;if(at!==_e[0]&&(at=this.sqr(at)),vt===0&<===0){tt=0;continue}lt<<=1,lt|=vt,tt++,!(tt!==$&&(rt!==0||yt!==0))&&(at=this.mul(at,_e[lt]),tt=0,lt=0)}_=26}return at},Pt.prototype.convertTo=function(g){var b=g.umod(this.m);return b===g?b.clone():b},Pt.prototype.convertFrom=function(g){var b=g.clone();return b.red=null,b},h.mont=function(g){return new Gt(g)};function Gt(ct){Pt.call(this,ct),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new h(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)}d(Gt,Pt),Gt.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},Gt.prototype.convertFrom=function(g){var b=this.imod(g.mul(this.rinv));return b.red=null,b},Gt.prototype.imul=function(g,b){if(g.isZero()||b.isZero())return g.words[0]=0,g.length=1,g;var $=g.imul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.mul=function(g,b){if(g.isZero()||b.isZero())return new h(0)._forceRed(this);var $=g.mul(b),_e=$.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),rt=$.isub(_e).iushrn(this.shift),at=rt;return rt.cmp(this.m)>=0?at=rt.isub(this.m):rt.cmpn(0)<0&&(at=rt.iadd(this.m)),at._forceRed(this)},Gt.prototype.invm=function(g){var b=this.imod(g._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(o,commonjsGlobal$2)})(bn);var bnExports=bn.exports,BN$2=bnExports,Buffer$3=safeBufferExports$1.Buffer;function withPublic$2(o,e){return Buffer$3.from(o.toRed(BN$2.mont(e.modulus)).redPow(new BN$2(e.publicExponent)).fromRed().toArray())}var withPublic_1=withPublic$2,parseKeys$1=parseAsn1,randomBytes=browserExports,createHash$1=browser$9,mgf$1=mgf$2,xor$1=xor$2,BN$1=bnExports,withPublic$1=withPublic_1,crt$1=browserifyRsa,Buffer$2=safeBufferExports$1.Buffer,publicEncrypt=function o(e,a,c){var d;e.padding?d=e.padding:c?d=1:d=4;var h=parseKeys$1(e),j;if(d===4)j=oaep$1(h,a);else if(d===1)j=pkcs1$1(h,a,c);else if(d===3){if(j=new BN$1(a),j.cmp(h.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return c?crt$1(j,h):withPublic$1(j,h)};function oaep$1(o,e){var a=o.modulus.byteLength(),c=e.length,d=createHash$1("sha1").update(Buffer$2.alloc(0)).digest(),h=d.length,j=2*h;if(c>a-j-2)throw new Error("message too long");var et=Buffer$2.alloc(a-c-j-2),nt=a-h-1,st=randomBytes(h),ot=xor$1(Buffer$2.concat([d,et,Buffer$2.alloc(1,1),e],nt),mgf$1(st,nt)),ht=xor$1(st,mgf$1(ot,h));return new BN$1(Buffer$2.concat([Buffer$2.alloc(1),ht,ot],a))}function pkcs1$1(o,e,a){var c=e.length,d=o.modulus.byteLength();if(c>d-11)throw new Error("message too long");var h;return a?h=Buffer$2.alloc(d-c-3,255):h=nonZero(d-c-3),new BN$1(Buffer$2.concat([Buffer$2.from([0,a?1:2]),h,Buffer$2.alloc(1),e],d))}function nonZero(o){for(var e=Buffer$2.allocUnsafe(o),a=0,c=randomBytes(o*2),d=0,h;aj||new BN(a).cmp(h.modulus)>=0)throw new Error("decryption error");var et;c?et=withPublic(new BN(a),h):et=crt(a,h);var nt=Buffer$1.alloc(j-et.length);if(et=Buffer$1.concat([nt,et],j),d===4)return oaep(h,et);if(d===1)return pkcs1(h,et,c);if(d===3)return et;throw new Error("unknown padding")};function oaep(o,e){var a=o.modulus.byteLength(),c=createHash("sha1").update(Buffer$1.alloc(0)).digest(),d=c.length;if(e[0]!==0)throw new Error("decryption error");var h=e.slice(1,d+1),j=e.slice(d+1),et=xor(h,mgf(j,d)),nt=xor(j,mgf(et,a-d-1));if(compare(c,nt.slice(0,d)))throw new Error("decryption error");for(var st=d;nt[st]===0;)st++;if(nt[st++]!==1)throw new Error("decryption error");return nt.slice(st)}function pkcs1(o,e,a){for(var c=e.slice(0,2),d=2,h=0;e[d++]!==0;)if(d>=e.length){h++;break}var j=e.slice(2,d-1);if((c.toString("hex")!=="0002"&&!a||c.toString("hex")!=="0001"&&a)&&h++,j.length<8&&h++,h)throw new Error("decryption error");return e.slice(d)}function compare(o,e){o=Buffer$1.from(o),e=Buffer$1.from(e);var a=0,c=o.length;o.length!==e.length&&(a++,c=Math.min(o.length,e.length));for(var d=-1;++dkMaxUint32||o<0)throw new TypeError("offset must be a uint32");if(o>kBufferMaxLength||o>e)throw new RangeError("offset out of range")}function assertSize(o,e,a){if(typeof o!="number"||o!==o)throw new TypeError("size must be a number");if(o>kMaxUint32||o<0)throw new TypeError("size must be a uint32");if(o+e>a||o>kBufferMaxLength)throw new RangeError("buffer too small")}crypto$1&&crypto$1.getRandomValues||!process$1.browser?(browser.randomFill=randomFill,browser.randomFillSync=randomFillSync):(browser.randomFill=oldBrowser,browser.randomFillSync=oldBrowser);function randomFill(o,e,a,c){if(!Buffer.isBuffer(o)&&!(o instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof e=="function")c=e,e=0,a=o.length;else if(typeof a=="function")c=a,a=o.length-e;else if(typeof c!="function")throw new TypeError('"cb" argument must be a function');return assertOffset(e,o.length),assertSize(a,e,o.length),actualFill(o,e,a,c)}function actualFill(o,e,a,c){if(process$1.browser){var d=o.buffer,h=new Uint8Array(d,e,a);if(crypto$1.getRandomValues(h),c){process$1.nextTick(function(){c(null,o)});return}return o}if(c){randombytes(a,function(et,nt){if(et)return c(et);nt.copy(o,e),c(null,o)});return}var j=randombytes(a);return j.copy(o,e),o}function randomFillSync(o,e,a){if(typeof e>"u"&&(e=0),!Buffer.isBuffer(o)&&!(o instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return assertOffset(e,o.length),a===void 0&&(a=o.length-e),assertSize(a,e,o.length),actualFill(o,e,a)}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=browserExports,cryptoBrowserify.createHash=cryptoBrowserify.Hash=browser$9,cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=browser$8;var o=algos,e=Object.keys(o),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(e);cryptoBrowserify.getHashes=function(){return a};var c=browser$7;cryptoBrowserify.pbkdf2=c.pbkdf2,cryptoBrowserify.pbkdf2Sync=c.pbkdf2Sync;var d=browser$6;cryptoBrowserify.Cipher=d.Cipher,cryptoBrowserify.createCipher=d.createCipher,cryptoBrowserify.Cipheriv=d.Cipheriv,cryptoBrowserify.createCipheriv=d.createCipheriv,cryptoBrowserify.Decipher=d.Decipher,cryptoBrowserify.createDecipher=d.createDecipher,cryptoBrowserify.Decipheriv=d.Decipheriv,cryptoBrowserify.createDecipheriv=d.createDecipheriv,cryptoBrowserify.getCiphers=d.getCiphers,cryptoBrowserify.listCiphers=d.listCiphers;var h=requireBrowser$2();cryptoBrowserify.DiffieHellmanGroup=h.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=h.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=h.getDiffieHellman,cryptoBrowserify.createDiffieHellman=h.createDiffieHellman,cryptoBrowserify.DiffieHellman=h.DiffieHellman;var j=requireBrowser$1();cryptoBrowserify.createSign=j.createSign,cryptoBrowserify.Sign=j.Sign,cryptoBrowserify.createVerify=j.createVerify,cryptoBrowserify.Verify=j.Verify,cryptoBrowserify.createECDH=requireBrowser();var et=browser$1;cryptoBrowserify.publicEncrypt=et.publicEncrypt,cryptoBrowserify.privateEncrypt=et.privateEncrypt,cryptoBrowserify.publicDecrypt=et.publicDecrypt,cryptoBrowserify.privateDecrypt=et.privateDecrypt;var nt=browser;return cryptoBrowserify.randomFill=nt.randomFill,cryptoBrowserify.randomFillSync=nt.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet +we accept pull requests +https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}requireCryptoBrowserify();export{AnchorProvider as A,Buffer$1$1 as B,ComputeBudgetProgram as C,Program as P,React as R,SystemProgram as S,TOKEN_PROGRAM_ID as T,WalletProvider as W,PublicKey$1 as a,useConnection as b,ASSOCIATED_TOKEN_PROGRAM_ID as c,SYSVAR_RENT_PUBKEY as d,getAccount as e,getMint as f,getAssociatedTokenAddress as g,getAssociatedTokenAddressSync as h,index as i,jsxRuntimeExports as j,bnExports$6 as k,useWallet as l,BN$b as m,clusterApiUrl as n,PhantomWalletAdapter as o,ConnectionProvider as p,WalletModalProvider as q,reactExports as r,WalletMultiButton as s,client as t,useAnchorWallet as u}; diff --git a/assets/vendor-CuhqgDVu.css b/assets/vendor-CuhqgDVu.css new file mode 100644 index 0000000..96d8e46 --- /dev/null +++ b/assets/vendor-CuhqgDVu.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap";.wallet-adapter-button{background-color:transparent;border:none;color:#fff;cursor:pointer;display:flex;align-items:center;font-family:DM Sans,Roboto,Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px;font-weight:600;height:48px;line-height:48px;padding:0 24px;border-radius:4px}.wallet-adapter-button-trigger{background-color:#512da8}.wallet-adapter-button:not([disabled]):focus-visible{outline-color:#fff}.wallet-adapter-button:not([disabled]):hover{background-color:#1a1f2e}.wallet-adapter-button[disabled]{background:#404144;color:#999;cursor:not-allowed}.wallet-adapter-button-end-icon,.wallet-adapter-button-start-icon,.wallet-adapter-button-end-icon img,.wallet-adapter-button-start-icon img{display:flex;align-items:center;justify-content:center;width:24px;height:24px}.wallet-adapter-button-end-icon{margin-left:12px}.wallet-adapter-button-start-icon{margin-right:12px}.wallet-adapter-collapse{width:100%}.wallet-adapter-dropdown{position:relative;display:inline-block}.wallet-adapter-dropdown-list{position:absolute;z-index:99;display:grid;grid-template-rows:1fr;grid-row-gap:10px;padding:10px;top:100%;right:0;margin:0;list-style:none;background:#2c2d30;border-radius:10px;box-shadow:0 8px 20px #0009;opacity:0;visibility:hidden;transition:opacity .2s ease,transform .2s ease,visibility .2s;font-family:DM Sans,Roboto,Helvetica Neue,Helvetica,Arial,sans-serif}.wallet-adapter-dropdown-list-active{opacity:1;visibility:visible;transform:translateY(10px)}.wallet-adapter-dropdown-list-item{display:flex;flex-direction:row;justify-content:center;align-items:center;border:none;outline:none;cursor:pointer;white-space:nowrap;box-sizing:border-box;padding:0 20px;width:100%;border-radius:6px;font-size:14px;font-weight:600;height:37px;color:#fff}.wallet-adapter-dropdown-list-item:not([disabled]):hover{background-color:#1a1f2e}.wallet-adapter-modal-collapse-button svg{align-self:center;fill:#999}.wallet-adapter-modal-collapse-button.wallet-adapter-modal-collapse-button-active svg{transform:rotate(180deg);transition:transform ease-in .15s}.wallet-adapter-modal{position:fixed;top:0;left:0;right:0;bottom:0;opacity:0;transition:opacity linear .15s;background:#00000080;z-index:1040;overflow-y:auto}.wallet-adapter-modal.wallet-adapter-modal-fade-in{opacity:1}.wallet-adapter-modal-button-close{display:flex;align-items:center;justify-content:center;position:absolute;top:18px;right:18px;padding:12px;cursor:pointer;background:#1a1f2e;border:none;border-radius:50%}.wallet-adapter-modal-button-close:focus-visible{outline-color:#fff}.wallet-adapter-modal-button-close svg{fill:#777;transition:fill .2s ease 0s}.wallet-adapter-modal-button-close:hover svg{fill:#fff}.wallet-adapter-modal-overlay{background:#00000080;position:fixed;top:0;left:0;bottom:0;right:0}.wallet-adapter-modal-container{display:flex;margin:3rem;min-height:calc(100vh - 6rem);align-items:center;justify-content:center}@media (max-width: 480px){.wallet-adapter-modal-container{margin:1rem;min-height:calc(100vh - 2rem)}}.wallet-adapter-modal-wrapper{box-sizing:border-box;position:relative;display:flex;align-items:center;flex-direction:column;z-index:1050;max-width:400px;border-radius:10px;background:#10141f;box-shadow:0 8px 20px #0009;font-family:DM Sans,Roboto,Helvetica Neue,Helvetica,Arial,sans-serif;flex:1}.wallet-adapter-modal-wrapper .wallet-adapter-button{width:100%}.wallet-adapter-modal-title{font-weight:500;font-size:24px;line-height:36px;margin:0;padding:64px 48px 48px;text-align:center;color:#fff}@media (max-width: 374px){.wallet-adapter-modal-title{font-size:18px}}.wallet-adapter-modal-list{margin:0 0 12px;padding:0;width:100%;list-style:none}.wallet-adapter-modal-list .wallet-adapter-button{font-weight:400;border-radius:0;font-size:18px}.wallet-adapter-modal-list .wallet-adapter-button-end-icon,.wallet-adapter-modal-list .wallet-adapter-button-start-icon,.wallet-adapter-modal-list .wallet-adapter-button-end-icon img,.wallet-adapter-modal-list .wallet-adapter-button-start-icon img{width:28px;height:28px}.wallet-adapter-modal-list .wallet-adapter-button span{margin-left:auto;font-size:14px;opacity:.6}.wallet-adapter-modal-list-more{cursor:pointer;border:none;padding:12px 24px 24px 12px;align-self:flex-end;display:flex;align-items:center;background-color:transparent;color:#fff}.wallet-adapter-modal-list-more svg{transition:all .1s ease;fill:#fff;margin-left:.5rem}.wallet-adapter-modal-list-more-icon-rotate{transform:rotate(180deg)}.wallet-adapter-modal-middle{width:100%;display:flex;flex-direction:column;align-items:center;padding:0 24px 24px;box-sizing:border-box}.wallet-adapter-modal-middle-button{display:block;cursor:pointer;margin-top:48px;width:100%;background-color:#512da8;padding:12px;font-size:18px;border:none;border-radius:8px;color:#fff} diff --git a/index.html b/index.html new file mode 100644 index 0000000..ad62c85 --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + + Vite + React + TS + + + + + + +
+ +